2017-12-09 20:17:15 +08:00
|
|
|
<?php
|
2018-02-09 03:13:36 +08:00
|
|
|
function quarantine($_action, $_data = null) {
|
2017-12-09 20:17:15 +08:00
|
|
|
global $pdo;
|
|
|
|
global $redis;
|
|
|
|
global $lang;
|
2018-08-04 02:31:33 +08:00
|
|
|
$_data_log = $_data;
|
2017-12-09 20:17:15 +08:00
|
|
|
switch ($_action) {
|
|
|
|
case 'delete':
|
|
|
|
if (!is_array($_data['id'])) {
|
|
|
|
$ids = array();
|
|
|
|
$ids[] = $_data['id'];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$ids = $_data['id'];
|
|
|
|
}
|
2018-02-09 03:13:36 +08:00
|
|
|
if (!isset($_SESSION['acl']['quarantine']) || $_SESSION['acl']['quarantine'] != "1" ) {
|
2018-08-14 05:20:40 +08:00
|
|
|
$_SESSION['return'][] = array(
|
2017-12-09 20:17:15 +08:00
|
|
|
'type' => 'danger',
|
2018-08-04 02:31:33 +08:00
|
|
|
'log' => array(__FUNCTION__, $_action, $_data_log),
|
|
|
|
'msg' => 'access_denied'
|
2017-12-09 20:17:15 +08:00
|
|
|
);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
foreach ($ids as $id) {
|
|
|
|
if (!is_numeric($id)) {
|
2018-08-14 05:20:40 +08:00
|
|
|
$_SESSION['return'][] = array(
|
2017-12-09 20:17:15 +08:00
|
|
|
'type' => 'danger',
|
2018-08-04 02:31:33 +08:00
|
|
|
'log' => array(__FUNCTION__, $_action, $_data_log),
|
|
|
|
'msg' => 'access_denied'
|
2017-12-09 20:17:15 +08:00
|
|
|
);
|
2018-08-14 05:20:40 +08:00
|
|
|
continue;
|
2017-12-09 20:17:15 +08:00
|
|
|
}
|
2018-08-14 05:20:40 +08:00
|
|
|
$stmt = $pdo->prepare('SELECT `rcpt` FROM `quarantine` WHERE `id` = :id');
|
|
|
|
$stmt->execute(array(':id' => $id));
|
|
|
|
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
|
|
if (!hasMailboxObjectAccess($_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role'], $row['rcpt']) && $_SESSION['mailcow_cc_role'] != 'admin') {
|
|
|
|
$_SESSION['return'][] = array(
|
2017-12-09 20:17:15 +08:00
|
|
|
'type' => 'danger',
|
2018-08-04 02:31:33 +08:00
|
|
|
'log' => array(__FUNCTION__, $_action, $_data_log),
|
2018-08-14 05:20:40 +08:00
|
|
|
'msg' => 'access_denied'
|
2017-12-09 20:17:15 +08:00
|
|
|
);
|
2018-08-14 05:20:40 +08:00
|
|
|
continue;
|
2017-12-09 20:17:15 +08:00
|
|
|
}
|
2018-08-14 05:20:40 +08:00
|
|
|
else {
|
|
|
|
$stmt = $pdo->prepare("DELETE FROM `quarantine` WHERE `id` = :id");
|
|
|
|
$stmt->execute(array(
|
|
|
|
':id' => $id
|
|
|
|
));
|
|
|
|
}
|
|
|
|
$_SESSION['return'][] = array(
|
|
|
|
'type' => 'success',
|
|
|
|
'log' => array(__FUNCTION__, $_action, $_data_log),
|
|
|
|
'msg' => array('item_deleted', $id)
|
|
|
|
);
|
2017-12-09 20:17:15 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'edit':
|
2018-02-09 03:13:36 +08:00
|
|
|
if (!isset($_SESSION['acl']['quarantine']) || $_SESSION['acl']['quarantine'] != "1" ) {
|
2018-08-14 05:20:40 +08:00
|
|
|
$_SESSION['return'][] = array(
|
2017-12-09 20:17:15 +08:00
|
|
|
'type' => 'danger',
|
2018-08-04 02:31:33 +08:00
|
|
|
'log' => array(__FUNCTION__, $_action, $_data_log),
|
|
|
|
'msg' => 'access_denied'
|
2017-12-09 20:17:15 +08:00
|
|
|
);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
// Edit settings
|
|
|
|
if ($_data['action'] == 'settings') {
|
|
|
|
if ($_SESSION['mailcow_cc_role'] != "admin") {
|
2018-08-14 05:20:40 +08:00
|
|
|
$_SESSION['return'][] = array(
|
2017-12-09 20:17:15 +08:00
|
|
|
'type' => 'danger',
|
2018-08-04 02:31:33 +08:00
|
|
|
'log' => array(__FUNCTION__, $_action, $_data_log),
|
|
|
|
'msg' => 'access_denied'
|
2017-12-09 20:17:15 +08:00
|
|
|
);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
$retention_size = $_data['retention_size'];
|
|
|
|
$max_size = $_data['max_size'];
|
|
|
|
$exclude_domains = (array)$_data['exclude_domains'];
|
|
|
|
try {
|
|
|
|
$redis->Set('Q_RETENTION_SIZE', intval($retention_size));
|
|
|
|
$redis->Set('Q_MAX_SIZE', intval($max_size));
|
|
|
|
$redis->Set('Q_EXCLUDE_DOMAINS', json_encode($exclude_domains));
|
|
|
|
}
|
|
|
|
catch (RedisException $e) {
|
2018-08-14 05:20:40 +08:00
|
|
|
$_SESSION['return'][] = array(
|
2017-12-09 20:17:15 +08:00
|
|
|
'type' => 'danger',
|
2018-08-04 02:31:33 +08:00
|
|
|
'log' => array(__FUNCTION__, $_action, $_data_log),
|
|
|
|
'msg' => array('redis_error', $e)
|
2017-12-09 20:17:15 +08:00
|
|
|
);
|
|
|
|
return false;
|
|
|
|
}
|
2018-08-14 05:20:40 +08:00
|
|
|
$_SESSION['return'][] = array(
|
2017-12-09 20:17:15 +08:00
|
|
|
'type' => 'success',
|
2018-08-04 02:31:33 +08:00
|
|
|
'log' => array(__FUNCTION__, $_action, $_data_log),
|
|
|
|
'msg' => 'saved_settings'
|
2017-12-09 20:17:15 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
// Release item
|
|
|
|
elseif ($_data['action'] == 'release') {
|
|
|
|
if (!is_array($_data['id'])) {
|
|
|
|
$ids = array();
|
|
|
|
$ids[] = $_data['id'];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$ids = $_data['id'];
|
|
|
|
}
|
|
|
|
foreach ($ids as $id) {
|
|
|
|
if (!is_numeric($id)) {
|
2018-08-14 05:20:40 +08:00
|
|
|
$_SESSION['return'][] = array(
|
2017-12-09 20:17:15 +08:00
|
|
|
'type' => 'danger',
|
2018-08-04 02:31:33 +08:00
|
|
|
'log' => array(__FUNCTION__, $_action, $_data_log),
|
|
|
|
'msg' => 'access_denied'
|
2017-12-09 20:17:15 +08:00
|
|
|
);
|
2018-08-14 05:20:40 +08:00
|
|
|
continue;
|
2017-12-09 20:17:15 +08:00
|
|
|
}
|
2018-08-14 05:20:40 +08:00
|
|
|
$stmt = $pdo->prepare('SELECT `msg`, `qid`, `sender`, `rcpt` FROM `quarantine` WHERE `id` = :id');
|
|
|
|
$stmt->execute(array(':id' => $id));
|
|
|
|
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
|
|
if (!hasMailboxObjectAccess($_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role'], $row['rcpt'])) {
|
|
|
|
$_SESSION['return'][] = array(
|
2017-12-09 20:17:15 +08:00
|
|
|
'type' => 'danger',
|
2018-08-14 05:20:40 +08:00
|
|
|
'msg' => 'access_denied'
|
2017-12-09 20:17:15 +08:00
|
|
|
);
|
2018-08-14 05:20:40 +08:00
|
|
|
continue;
|
2017-12-09 20:17:15 +08:00
|
|
|
}
|
|
|
|
$sender = (isset($row['sender'])) ? $row['sender'] : 'sender-unknown@rspamd';
|
|
|
|
try {
|
|
|
|
$mail = new PHPMailer(true);
|
|
|
|
$mail->isSMTP();
|
|
|
|
$mail->SMTPDebug = 0;
|
|
|
|
$mail->SMTPOptions = array(
|
|
|
|
'ssl' => array(
|
|
|
|
'verify_peer' => false,
|
|
|
|
'verify_peer_name' => false,
|
|
|
|
'allow_self_signed' => true
|
|
|
|
)
|
|
|
|
);
|
|
|
|
if (!empty(gethostbynamel('postfix-mailcow'))) {
|
2017-12-11 16:55:22 +08:00
|
|
|
$postfix = 'postfix-mailcow';
|
2017-12-09 20:17:15 +08:00
|
|
|
}
|
|
|
|
if (!empty(gethostbynamel('postfix'))) {
|
|
|
|
$postfix = 'postfix';
|
|
|
|
}
|
|
|
|
else {
|
2018-08-14 05:20:40 +08:00
|
|
|
$_SESSION['return'][] = array(
|
2017-12-09 20:17:15 +08:00
|
|
|
'type' => 'warning',
|
2018-08-04 02:31:33 +08:00
|
|
|
'log' => array(__FUNCTION__, $_action, $_data_log),
|
|
|
|
'msg' => array('release_send_failed', 'Cannot determine Postfix host')
|
2017-12-09 20:17:15 +08:00
|
|
|
);
|
2018-08-14 05:20:40 +08:00
|
|
|
continue;
|
2017-12-09 20:17:15 +08:00
|
|
|
}
|
|
|
|
$mail->Host = $postfix;
|
|
|
|
$mail->Port = 590;
|
|
|
|
$mail->setFrom($sender);
|
|
|
|
$mail->CharSet = 'UTF-8';
|
2018-02-09 03:13:36 +08:00
|
|
|
$mail->Subject = sprintf($lang['quarantine']['release_subject'], $row['qid']);
|
2017-12-09 20:17:15 +08:00
|
|
|
$mail->addAddress($row['rcpt']);
|
|
|
|
$mail->IsHTML(false);
|
|
|
|
$msg_tmpf = tempnam("/tmp", $row['qid']);
|
|
|
|
file_put_contents($msg_tmpf, $row['msg']);
|
|
|
|
$mail->addAttachment($msg_tmpf, $row['qid'] . '.eml');
|
2018-02-09 03:13:36 +08:00
|
|
|
$mail->Body = sprintf($lang['quarantine']['release_body']);
|
2017-12-09 20:17:15 +08:00
|
|
|
$mail->send();
|
|
|
|
unlink($msg_tmpf);
|
|
|
|
}
|
|
|
|
catch (phpmailerException $e) {
|
|
|
|
unlink($msg_tmpf);
|
2018-08-14 05:20:40 +08:00
|
|
|
$_SESSION['return'][] = array(
|
2017-12-09 20:17:15 +08:00
|
|
|
'type' => 'warning',
|
2018-08-04 02:31:33 +08:00
|
|
|
'log' => array(__FUNCTION__, $_action, $_data_log),
|
|
|
|
'msg' => array('release_send_failed', $e->errorMessage())
|
2017-12-09 20:17:15 +08:00
|
|
|
);
|
2018-08-14 05:20:40 +08:00
|
|
|
continue;
|
2017-12-09 20:17:15 +08:00
|
|
|
}
|
|
|
|
try {
|
2018-02-09 03:13:36 +08:00
|
|
|
$stmt = $pdo->prepare("DELETE FROM `quarantine` WHERE `id` = :id");
|
2017-12-09 20:17:15 +08:00
|
|
|
$stmt->execute(array(
|
|
|
|
':id' => $id
|
|
|
|
));
|
|
|
|
}
|
|
|
|
catch (PDOException $e) {
|
2018-08-14 05:20:40 +08:00
|
|
|
$_SESSION['return'][] = array(
|
2017-12-09 20:17:15 +08:00
|
|
|
'type' => 'danger',
|
2018-08-04 02:31:33 +08:00
|
|
|
'log' => array(__FUNCTION__, $_action, $_data_log),
|
|
|
|
'msg' => array('mysql_error', $e)
|
2017-12-09 20:17:15 +08:00
|
|
|
);
|
2018-08-14 05:20:40 +08:00
|
|
|
continue;
|
2017-12-09 20:17:15 +08:00
|
|
|
}
|
2018-08-14 05:20:40 +08:00
|
|
|
$_SESSION['return'][] = array(
|
|
|
|
'type' => 'success',
|
|
|
|
'log' => array(__FUNCTION__, $_action, $_data_log),
|
|
|
|
'msg' => array('item_released', $id)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elseif ($_data['action'] == 'learnspam') {
|
|
|
|
if (!is_array($_data['id'])) {
|
|
|
|
$ids = array();
|
|
|
|
$ids[] = $_data['id'];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$ids = $_data['id'];
|
|
|
|
}
|
|
|
|
foreach ($ids as $id) {
|
|
|
|
if (!is_numeric($id)) {
|
|
|
|
$_SESSION['return'][] = array(
|
|
|
|
'type' => 'danger',
|
|
|
|
'log' => array(__FUNCTION__, $_action, $_data_log),
|
|
|
|
'msg' => 'access_denied'
|
|
|
|
);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$stmt = $pdo->prepare('SELECT `msg`, `rcpt` FROM `quarantine` WHERE `id` = :id');
|
|
|
|
$stmt->execute(array(':id' => $id));
|
|
|
|
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
|
|
if (!hasMailboxObjectAccess($_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role'], $row['rcpt']) && $_SESSION['mailcow_cc_role'] != 'admin') {
|
|
|
|
$_SESSION['return'][] = array(
|
|
|
|
'type' => 'danger',
|
|
|
|
'msg' => 'access_denied'
|
|
|
|
);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$curl = curl_init();
|
2018-09-30 15:53:25 +08:00
|
|
|
curl_setopt($curl, CURLOPT_UNIX_SOCKET_PATH, '/var/lib/rspamd/rspamd.sock');
|
2018-08-14 05:20:40 +08:00
|
|
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
|
|
|
curl_setopt($curl, CURLOPT_POST, 1);
|
|
|
|
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
|
2018-09-30 15:53:25 +08:00
|
|
|
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: text/plain'));
|
2018-08-14 05:20:40 +08:00
|
|
|
curl_setopt($curl, CURLOPT_URL,"http://rspamd/learnspam");
|
2018-09-30 15:53:25 +08:00
|
|
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $row['msg']);
|
2018-08-14 05:20:40 +08:00
|
|
|
$response = curl_exec($curl);
|
|
|
|
if (!curl_errno($curl)) {
|
|
|
|
$response = json_decode($response, true);
|
|
|
|
if (isset($response['error'])) {
|
|
|
|
if (stripos($response['error'], 'already learned') === false) {
|
|
|
|
$_SESSION['return'][] = array(
|
|
|
|
'type' => 'danger',
|
|
|
|
'log' => array(__FUNCTION__),
|
|
|
|
'msg' => array('spam_learn_error', $response['error'])
|
|
|
|
);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
curl_close($curl);
|
|
|
|
$curl = curl_init();
|
2018-09-30 15:53:25 +08:00
|
|
|
curl_setopt($curl, CURLOPT_UNIX_SOCKET_PATH, '/var/lib/rspamd/rspamd.sock');
|
2018-08-14 05:20:40 +08:00
|
|
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
|
|
|
curl_setopt($curl, CURLOPT_POST, 1);
|
|
|
|
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
|
2018-09-30 15:53:25 +08:00
|
|
|
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: text/plain', 'Flag: 11'));
|
2018-08-14 05:20:40 +08:00
|
|
|
curl_setopt($curl, CURLOPT_URL,"http://rspamd/fuzzyadd");
|
2018-09-30 15:53:25 +08:00
|
|
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $row['msg']);
|
2018-08-14 05:20:40 +08:00
|
|
|
$response = curl_exec($curl);
|
|
|
|
if (!curl_errno($curl)) {
|
|
|
|
$response = json_decode($response, true);
|
|
|
|
if (isset($response['error'])) {
|
|
|
|
$_SESSION['return'][] = array(
|
2018-09-30 15:53:25 +08:00
|
|
|
'type' => 'warning',
|
2018-08-14 05:20:40 +08:00
|
|
|
'log' => array(__FUNCTION__),
|
|
|
|
'msg' => array('fuzzy_learn_error', $response['error'])
|
|
|
|
);
|
|
|
|
}
|
|
|
|
curl_close($curl);
|
|
|
|
try {
|
|
|
|
$stmt = $pdo->prepare("DELETE FROM `quarantine` WHERE `id` = :id");
|
|
|
|
$stmt->execute(array(
|
|
|
|
':id' => $id
|
|
|
|
));
|
|
|
|
}
|
|
|
|
catch (PDOException $e) {
|
|
|
|
$_SESSION['return'][] = array(
|
|
|
|
'type' => 'danger',
|
|
|
|
'log' => array(__FUNCTION__, $_action, $_data_log),
|
|
|
|
'msg' => array('mysql_error', $e)
|
|
|
|
);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$_SESSION['return'][] = array(
|
|
|
|
'type' => 'success',
|
|
|
|
'log' => array(__FUNCTION__),
|
2018-09-30 15:53:25 +08:00
|
|
|
'msg' => array('qlearn_spam', $id)
|
2018-08-14 05:20:40 +08:00
|
|
|
);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
curl_close($curl);
|
|
|
|
$_SESSION['return'][] = array(
|
|
|
|
'type' => 'danger',
|
|
|
|
'log' => array(__FUNCTION__),
|
2018-09-30 15:53:25 +08:00
|
|
|
'msg' => array('spam_learn_error', 'Curl: ' . curl_strerror(curl_errno($curl)))
|
2018-08-14 05:20:40 +08:00
|
|
|
);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
curl_close($curl);
|
|
|
|
$_SESSION['return'][] = array(
|
|
|
|
'type' => 'danger',
|
|
|
|
'log' => array(__FUNCTION__),
|
|
|
|
'msg' => array('learn_spam_error', 'unknown')
|
|
|
|
);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$_SESSION['return'][] = array(
|
|
|
|
'type' => 'danger',
|
|
|
|
'log' => array(__FUNCTION__),
|
2018-09-30 15:53:25 +08:00
|
|
|
'msg' => array('spam_learn_error', 'Curl: ' . curl_strerror(curl_errno($curl)))
|
2018-08-14 05:20:40 +08:00
|
|
|
);
|
2018-09-30 15:53:25 +08:00
|
|
|
curl_close($curl);
|
2018-08-14 05:20:40 +08:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
curl_close($curl);
|
|
|
|
$_SESSION['return'][] = array(
|
|
|
|
'type' => 'danger',
|
|
|
|
'log' => array(__FUNCTION__),
|
|
|
|
'msg' => array('learn_spam_error', 'unknown')
|
|
|
|
);
|
|
|
|
continue;
|
2017-12-09 20:17:15 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
break;
|
|
|
|
case 'get':
|
2018-08-14 05:20:40 +08:00
|
|
|
if ($_SESSION['mailcow_cc_role'] == "user") {
|
|
|
|
$stmt = $pdo->prepare('SELECT `id`, `qid`, `rcpt`, `sender`, UNIX_TIMESTAMP(`created`) AS `created` FROM `quarantine` WHERE `rcpt` = :mbox');
|
|
|
|
$stmt->execute(array(':mbox' => $_SESSION['mailcow_cc_username']));
|
|
|
|
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
while($row = array_shift($rows)) {
|
|
|
|
$q_meta[] = $row;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elseif ($_SESSION['mailcow_cc_role'] == "admin") {
|
|
|
|
$stmt = $pdo->query('SELECT `id`, `qid`, `rcpt`, `sender`, UNIX_TIMESTAMP(`created`) AS `created` FROM `quarantine`');
|
|
|
|
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
while($row = array_shift($rows)) {
|
|
|
|
$q_meta[] = $row;
|
2017-12-09 20:17:15 +08:00
|
|
|
}
|
2018-08-14 05:20:40 +08:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$domains = array_merge(mailbox('get', 'domains'), mailbox('get', 'alias_domains'));
|
|
|
|
foreach ($domains as $domain) {
|
|
|
|
$stmt = $pdo->prepare('SELECT `id`, `qid`, `rcpt`, `sender`, UNIX_TIMESTAMP(`created`) AS `created` FROM `quarantine` WHERE `rcpt` REGEXP :domain');
|
|
|
|
$stmt->execute(array(':domain' => '@' . $domain . '$'));
|
2018-01-17 22:23:33 +08:00
|
|
|
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
while($row = array_shift($rows)) {
|
|
|
|
$q_meta[] = $row;
|
|
|
|
}
|
|
|
|
}
|
2017-12-09 20:17:15 +08:00
|
|
|
}
|
|
|
|
return $q_meta;
|
|
|
|
break;
|
|
|
|
case 'settings':
|
|
|
|
try {
|
2018-12-01 02:04:18 +08:00
|
|
|
if ($_SESSION['mailcow_cc_role'] == "admin") {
|
|
|
|
$settings['exclude_domains'] = json_decode($redis->Get('Q_EXCLUDE_DOMAINS'), true);
|
|
|
|
}
|
2017-12-09 20:17:15 +08:00
|
|
|
$settings['max_size'] = $redis->Get('Q_MAX_SIZE');
|
|
|
|
$settings['retention_size'] = $redis->Get('Q_RETENTION_SIZE');
|
|
|
|
}
|
|
|
|
catch (RedisException $e) {
|
2018-08-14 05:20:40 +08:00
|
|
|
$_SESSION['return'][] = array(
|
2017-12-09 20:17:15 +08:00
|
|
|
'type' => 'danger',
|
2018-08-04 02:31:33 +08:00
|
|
|
'log' => array(__FUNCTION__, $_action, $_data_log),
|
|
|
|
'msg' => array('redis_error', $e)
|
2017-12-09 20:17:15 +08:00
|
|
|
);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return $settings;
|
|
|
|
break;
|
|
|
|
case 'details':
|
|
|
|
if (!is_numeric($_data) || empty($_data)) {
|
|
|
|
return false;
|
|
|
|
}
|
2018-08-14 05:20:40 +08:00
|
|
|
$stmt = $pdo->prepare('SELECT `rcpt`, `symbols`, `msg`, `domain` FROM `quarantine` WHERE `id`= :id');
|
|
|
|
$stmt->execute(array(':id' => $_data));
|
|
|
|
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
|
|
if (hasMailboxObjectAccess($_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role'], $row['rcpt'])) {
|
|
|
|
return $row;
|
2017-12-09 20:17:15 +08:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
break;
|
|
|
|
}
|
2018-02-09 03:13:36 +08:00
|
|
|
}
|