Use API for forwarding hosts
parent
74359f6df4
commit
bbff045d04
|
@ -279,45 +279,14 @@ $tfa_data = get_tfa();
|
||||||
<div class="panel-heading"><?=$lang['admin']['forwarding_hosts'];?></div>
|
<div class="panel-heading"><?=$lang['admin']['forwarding_hosts'];?></div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<p style="margin-bottom:40px"><?=$lang['admin']['forwarding_hosts_hint'];?></p>
|
<p style="margin-bottom:40px"><?=$lang['admin']['forwarding_hosts_hint'];?></p>
|
||||||
<form method="post">
|
<form method="post" data-id="fwdhosts">
|
||||||
<div class="table-responsive">
|
<div class="btn-group btn-group-sm">
|
||||||
<table class="table table-striped" id="forwardinghoststable">
|
<button type="button" id="toggle_multi_select_all" data-form-id="fwdhosts" class="btn btn-default">Toggle all</button>
|
||||||
<thead>
|
<button type="button" id="delete_fwdhosts" name="delete_fwdhosts" class="btn btn-danger"><?=$lang['admin']['remove'];?></button>
|
||||||
<tr>
|
|
||||||
<th style="min-width: 100px;"><?=$lang['edit']['host'];?></th>
|
|
||||||
<th style="min-width: 100px;"><?=$lang['edit']['source'];?></th>
|
|
||||||
<th><?=$lang['user']['spamfilter'];?></th>
|
|
||||||
<th style="text-align: right; min-width: 200px;"><?=$lang['admin']['action'];?></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php
|
|
||||||
$fwd_hosts = get_forwarding_hosts();
|
|
||||||
if (!empty($fwd_hosts)) {
|
|
||||||
foreach ($fwd_hosts as $host => $attr) {
|
|
||||||
?>
|
|
||||||
<tr id="data">
|
|
||||||
<td><?=htmlspecialchars($host);?></td>
|
|
||||||
<td><?=htmlspecialchars($attr['source']);?></td>
|
|
||||||
<td><?=($attr['keep_spam'] == "no") ? $lang['admin']['yes'] : $lang['admin']['no'];?></td>
|
|
||||||
<td style="text-align: right;">
|
|
||||||
<div class="btn-group">
|
|
||||||
<a href="delete.php?forwardinghost=<?=htmlspecialchars($host);?>" class="btn btn-xs btn-danger"><span class="glyphicon glyphicon-trash"></span> <?=$lang['admin']['remove'];?></a>
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
<hr >
|
||||||
</td>
|
<div class="table-responsive">
|
||||||
</tr>
|
<table class="table table-striped" id="forwardinghoststable"></table>
|
||||||
<?php
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
?>
|
|
||||||
<tr id="no-data"><td colspan="4" style="text-align: center; font-style: italic;"><?=$lang['admin']['no_record'];?></td></tr>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<legend><?=$lang['admin']['add_forwarding_host'];?></legend>
|
<legend><?=$lang['admin']['add_forwarding_host'];?></legend>
|
||||||
|
|
|
@ -55,4 +55,12 @@ body.modal-open {
|
||||||
overflow: inherit;
|
overflow: inherit;
|
||||||
padding-right: inherit !important;
|
padding-right: inherit !important;
|
||||||
}
|
}
|
||||||
|
.mailcow-alert-box {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 8px;
|
||||||
|
right: 25px;
|
||||||
|
min-width: 300px;
|
||||||
|
max-width: 350px;
|
||||||
|
z-index: 2000;
|
||||||
|
display: none;
|
||||||
|
}
|
|
@ -19,6 +19,9 @@ if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == "admi
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<?php
|
||||||
|
endif;
|
||||||
|
?>
|
||||||
<div id="ConfirmDeleteModal" class="modal fade" role="dialog">
|
<div id="ConfirmDeleteModal" class="modal fade" role="dialog">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
|
@ -36,9 +39,6 @@ if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == "admi
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
|
||||||
endif;
|
|
||||||
?>
|
|
||||||
<div style="margin-bottom:100px"></div>
|
<div style="margin-bottom:100px"></div>
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js"></script>
|
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js"></script>
|
||||||
<script src="/js/bootstrap-switch.min.js"></script>
|
<script src="/js/bootstrap-switch.min.js"></script>
|
||||||
|
@ -53,6 +53,16 @@ function setLang(sel) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
function mailcow_alert_box(type, message) {
|
||||||
|
$('.mailcow-alert-box').show();
|
||||||
|
$('.mailcow-alert-box').addClass("alert-" + type);
|
||||||
|
$('#mailcow-alert-text').text(message);
|
||||||
|
}
|
||||||
|
// PHP error handler
|
||||||
|
<?php if (isset($_SESSION['return'])): ?>
|
||||||
|
mailcow_alert_box("<?=$_SESSION['return']['type'];?>", "<?=$_SESSION['return']['msg'];?>");
|
||||||
|
<?php endif; unset($_SESSION['return']); ?>
|
||||||
|
|
||||||
// Confirm TFA modal
|
// Confirm TFA modal
|
||||||
<?php if (isset($_SESSION['pending_tfa_method'])):?>
|
<?php if (isset($_SESSION['pending_tfa_method'])):?>
|
||||||
$('#ConfirmTFAModal').modal({
|
$('#ConfirmTFAModal').modal({
|
||||||
|
@ -220,21 +230,10 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<div class="mailcow-alert-box alert" role="alert">
|
||||||
if (isset($_SESSION['return'])):
|
|
||||||
?>
|
|
||||||
<div class="container">
|
|
||||||
<div style="position:fixed;bottom:8px;right:25px;min-width:300px;max-width:350px;z-index:2000">
|
|
||||||
<div <?=($_SESSION['return']['type'] == 'danger') ? null : 'id="alert-fade"'?> class="alert alert-<?=$_SESSION['return']['type'];?>" role="alert">
|
|
||||||
<a href="#" class="close" data-dismiss="alert"> ×</a>
|
<a href="#" class="close" data-dismiss="alert"> ×</a>
|
||||||
<?=htmlspecialchars($_SESSION['return']['msg']);?>
|
<span id="mailcow-alert-text"></span>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<?php
|
|
||||||
unset($_SESSION['return']);
|
|
||||||
endif;
|
|
||||||
?>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
<?php $stmt = null; $pdo = null; ?>
|
<?php $stmt = null; $pdo = null; ?>
|
||||||
|
|
|
@ -5103,11 +5103,10 @@ function get_forwarding_hosts() {
|
||||||
global $redis;
|
global $redis;
|
||||||
$data = array();
|
$data = array();
|
||||||
try {
|
try {
|
||||||
$wl_hosts = $redis->hGetAll('WHITELISTED_FWD_HOST');
|
$fwd_hosts = $redis->hGetAll('WHITELISTED_FWD_HOST');
|
||||||
if (!empty($wl_hosts)) {
|
if (!empty($fwd_hosts)) {
|
||||||
foreach ($wl_hosts as $host => $source) {
|
foreach ($fwd_hosts as $fwd_host => $source) {
|
||||||
$data[$host]['keep_spam'] = ($redis->hGet('KEEP_SPAM', $host)) ? "yes" : "no";
|
$data[] = $fwd_host;
|
||||||
$data[$host]['source'] = $source;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5120,6 +5119,31 @@ function get_forwarding_hosts() {
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
function get_forwarding_host_details($host) {
|
||||||
|
global $redis;
|
||||||
|
$data = array();
|
||||||
|
if (!isset($host) || empty($host)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (filter_var($host, FILTER_VALIDATE_IP)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if ($source = $redis->hGet('WHITELISTED_FWD_HOST', $host)) {
|
||||||
|
$data['host'] = $host;
|
||||||
|
$data['source'] = $source;
|
||||||
|
$data['keep_spam'] = ($redis->hGet('KEEP_SPAM', $host)) ? "yes" : "no";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (RedisException $e) {
|
||||||
|
$_SESSION['return'] = array(
|
||||||
|
'type' => 'danger',
|
||||||
|
'msg' => 'Redis: '.$e
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
function add_forwarding_host($postarray) {
|
function add_forwarding_host($postarray) {
|
||||||
require_once 'spf.inc.php';
|
require_once 'spf.inc.php';
|
||||||
global $redis;
|
global $redis;
|
||||||
|
@ -5140,13 +5164,16 @@ function add_forwarding_host($postarray) {
|
||||||
else {
|
else {
|
||||||
$filter_spam = 0;
|
$filter_spam = 0;
|
||||||
}
|
}
|
||||||
if (filter_var($host, FILTER_VALIDATE_IP)) {
|
if (preg_match('/^[0-9a-fA-F:\/]+$/', $host)) { // IPv6 address
|
||||||
|
$hosts = array($host);
|
||||||
|
}
|
||||||
|
elseif (preg_match('/^[0-9\.\/]+$/', $host)) { // IPv4 address
|
||||||
$hosts = array($host);
|
$hosts = array($host);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$hosts = get_outgoing_hosts_best_guess($host);
|
$hosts = get_outgoing_hosts_best_guess($host);
|
||||||
}
|
}
|
||||||
if (!$hosts) {
|
if (empty($hosts)) {
|
||||||
$_SESSION['return'] = array(
|
$_SESSION['return'] = array(
|
||||||
'type' => 'danger',
|
'type' => 'danger',
|
||||||
'msg' => 'Invalid host specified: '. htmlspecialchars($host)
|
'msg' => 'Invalid host specified: '. htmlspecialchars($host)
|
||||||
|
@ -5195,8 +5222,8 @@ function delete_forwarding_host($postarray) {
|
||||||
}
|
}
|
||||||
foreach ($hosts as $host) {
|
foreach ($hosts as $host) {
|
||||||
try {
|
try {
|
||||||
return $redis->hDel('WHITELISTED_FWD_HOST', $host);
|
$redis->hDel('WHITELISTED_FWD_HOST', $host);
|
||||||
return $redis->hDel('KEEP_SPAM', $host);
|
$redis->hDel('KEEP_SPAM', $host);
|
||||||
}
|
}
|
||||||
catch (RedisException $e) {
|
catch (RedisException $e) {
|
||||||
$_SESSION['return'] = array(
|
$_SESSION['return'] = array(
|
||||||
|
@ -5208,7 +5235,7 @@ function delete_forwarding_host($postarray) {
|
||||||
}
|
}
|
||||||
$_SESSION['return'] = array(
|
$_SESSION['return'] = array(
|
||||||
'type' => 'success',
|
'type' => 'success',
|
||||||
'msg' => sprintf($lang['success']['forwarding_host_removed'], htmlspecialchars($host))
|
'msg' => sprintf($lang['success']['forwarding_host_removed'], htmlspecialchars(implode(', ', $hosts)))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
function get_logs($container, $lines = 100) {
|
function get_logs($container, $lines = 100) {
|
||||||
|
|
|
@ -1,4 +1,37 @@
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
// Collect values of input fields with name multi_select to js array multi_data[data-id-of-checkbox]
|
||||||
|
var multi_data = [];
|
||||||
|
$(document).on('change', 'input[name=multi_select]:checkbox', function() {
|
||||||
|
if ($(this).is(':checked') && $(this).attr('data-form-id')) {
|
||||||
|
var id = $(this).data('form-id');
|
||||||
|
if (typeof multi_data[id] == "undefined") {
|
||||||
|
multi_data[id] = [];
|
||||||
|
}
|
||||||
|
multi_data[id].push($(this).val());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var id = $(this).data('form-id');
|
||||||
|
multi_data[id].splice($.inArray($(this).val(), multi_data[id]),1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Select by click on tr
|
||||||
|
$(document).on('click', 'tr', function(e) {
|
||||||
|
if (e.target.type == "checkbox") {
|
||||||
|
e.stopPropagation();
|
||||||
|
} else {
|
||||||
|
var checkbox = $(this).find(':checkbox');
|
||||||
|
checkbox.trigger('click');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Select or deselect all checkboxes with same data-form-id
|
||||||
|
$(document).on('click', '#toggle_multi_select_all', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var closests_checkboxes = $("input[data-form-id=" + $(this).attr("data-form-id") + "]");
|
||||||
|
closests_checkboxes.prop("checked", !closests_checkboxes.prop("checked")).change();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Draw domain admin table
|
||||||
$.ajax({
|
$.ajax({
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
url: '/api/v1/get/domain-admin/all',
|
url: '/api/v1/get/domain-admin/all',
|
||||||
|
@ -39,6 +72,84 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Draw fwd hosts table
|
||||||
|
$.ajax({
|
||||||
|
dataType: 'json',
|
||||||
|
url: '/api/v1/get/fwdhost/all',
|
||||||
|
jsonp: false,
|
||||||
|
error: function () {
|
||||||
|
console.log('Cannot draw forwarding hosts table');
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
$.each(data, function (i, item) {
|
||||||
|
item.action = '<div class="btn-group">' +
|
||||||
|
'<a href="/delete.php?forwardinghost=' + encodeURI(item.host) + '" class="btn btn-xs btn-danger"><span class="glyphicon glyphicon-trash"></span> ' + lang.remove + '</a>' +
|
||||||
|
'</div>';
|
||||||
|
if (item.keep_spam == "yes") {
|
||||||
|
item.keep_spam = lang.no;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
item.keep_spam = lang.yes;
|
||||||
|
}
|
||||||
|
item.chkbox = '<input type="checkbox" data-form-id="fwdhosts" name="multi_select" value="' + item.host + '" />';
|
||||||
|
});
|
||||||
|
$('#forwardinghoststable').footable({
|
||||||
|
"columns": [
|
||||||
|
{"name":"chkbox","title":"","style":{"maxWidth":"40px","width":"40px"},"filterable": false,"sortable": false,"type":"html"},
|
||||||
|
{"name":"host","type":"text","title":lang.host,"style":{"width":"250px"}},
|
||||||
|
{"name":"source","title":lang.source,"breakpoints":"xs sm"},
|
||||||
|
{"name":"keep_spam","title":lang.spamfilter, "type": "text","style":{"maxWidth":"80px","width":"80px"}},
|
||||||
|
{"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","maxWidth":"180px","width":"180px"},"type":"html","title":lang.action,"breakpoints":"xs sm"}
|
||||||
|
],
|
||||||
|
"rows": data,
|
||||||
|
"empty": lang.empty,
|
||||||
|
"paging": {
|
||||||
|
"enabled": true,
|
||||||
|
"limit": 5,
|
||||||
|
"size": pagination_size
|
||||||
|
},
|
||||||
|
"sorting": {
|
||||||
|
"enabled": true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '#delete_fwdhosts', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var id = $(this).closest("form").attr('data-id');
|
||||||
|
if (typeof multi_data[id] == "undefined") return;
|
||||||
|
data_array = multi_data[id];
|
||||||
|
if (Object.keys(data_array).length !== 0) {
|
||||||
|
$(document).on('show.bs.modal','#ConfirmDeleteModal', function () {
|
||||||
|
$("#ItemsToDelete").empty();
|
||||||
|
for (var i in data_array) {
|
||||||
|
$("#ItemsToDelete").append("<li>" + data_array[i] + "</li>");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
$('#ConfirmDeleteModal').modal({
|
||||||
|
backdrop: 'static',
|
||||||
|
keyboard: false
|
||||||
|
})
|
||||||
|
.one('click', '#IsConfirmed', function(e) {
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
dataType: "json",
|
||||||
|
data: { "forwardinghost": JSON.stringify(data_array) },
|
||||||
|
url: '/api/v1/delete/fwdhost',
|
||||||
|
jsonp: false,
|
||||||
|
complete: function (data) {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.one('click', '#isCanceled', function(e) {
|
||||||
|
$('#ConfirmDeleteModal').modal('hide');
|
||||||
|
});;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$("#refresh_dovecot_log").on('click', function(e) {
|
$("#refresh_dovecot_log").on('click', function(e) {
|
||||||
function unix_time_format(tm) {
|
function unix_time_format(tm) {
|
||||||
var date = new Date(tm ? tm * 1000 : 0);
|
var date = new Date(tm ? tm * 1000 : 0);
|
||||||
|
|
|
@ -301,7 +301,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
$(document).on('click', '#activate_selected_alias', function(e) {
|
$(document).on('click', '#activate_selected_alias', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (selected_aliases.length !== 0) {
|
if (Object.keys(selected_aliases).length !== 0) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
|
|
|
@ -33,7 +33,12 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
$domains = mailbox_get_domains();
|
$domains = mailbox_get_domains();
|
||||||
if (!empty($domains)) {
|
if (!empty($domains)) {
|
||||||
foreach ($domains as $domain) {
|
foreach ($domains as $domain) {
|
||||||
$data[] = mailbox_get_domain_details($domain);
|
if ($details = mailbox_get_domain_details($domain)) {
|
||||||
|
$data[] = $details;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!isset($data) || empty($data)) {
|
if (!isset($data) || empty($data)) {
|
||||||
echo '{}';
|
echo '{}';
|
||||||
|
@ -53,7 +58,7 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
echo '{}';
|
echo '{}';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo json_encode(mailbox_get_domain_details($object), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +107,12 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
$mailboxes = mailbox_get_mailboxes($domain);
|
$mailboxes = mailbox_get_mailboxes($domain);
|
||||||
if (!empty($mailboxes)) {
|
if (!empty($mailboxes)) {
|
||||||
foreach ($mailboxes as $mailbox) {
|
foreach ($mailboxes as $mailbox) {
|
||||||
$data[] = mailbox_get_mailbox_details($mailbox);
|
if ($details = mailbox_get_mailbox_details($mailbox)) {
|
||||||
|
$data[] = $details;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,7 +134,7 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
echo '{}';
|
echo '{}';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo json_encode(mailbox_get_mailbox_details($object), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -139,7 +149,12 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
$resources = mailbox_get_resources($domain);
|
$resources = mailbox_get_resources($domain);
|
||||||
if (!empty($resources)) {
|
if (!empty($resources)) {
|
||||||
foreach ($resources as $resource) {
|
foreach ($resources as $resource) {
|
||||||
$data[] = mailbox_get_resource_details($resource);
|
if ($details = mailbox_get_resource_details($resource)) {
|
||||||
|
$data[] = $details;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,7 +176,40 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
echo '{}';
|
echo '{}';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo json_encode(mailbox_get_resource_details($object), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "fwdhost":
|
||||||
|
switch ($object) {
|
||||||
|
case "all":
|
||||||
|
$fwdhosts = get_forwarding_hosts();
|
||||||
|
if (!empty($fwdhosts)) {
|
||||||
|
foreach ($fwdhosts as $fwdhost) {
|
||||||
|
if ($details = get_forwarding_host_details($fwdhost)) {
|
||||||
|
$data[] = $details;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isset($data) || empty($data)) {
|
||||||
|
echo '{}';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$data = get_forwarding_host_details($object);
|
||||||
|
if (!isset($data) || empty($data)) {
|
||||||
|
echo '{}';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -176,7 +224,12 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
$alias_domains = mailbox_get_alias_domains($domain);
|
$alias_domains = mailbox_get_alias_domains($domain);
|
||||||
if (!empty($alias_domains)) {
|
if (!empty($alias_domains)) {
|
||||||
foreach ($alias_domains as $alias_domain) {
|
foreach ($alias_domains as $alias_domain) {
|
||||||
$data[] = mailbox_get_alias_domain_details($alias_domain);
|
if ($details = mailbox_get_alias_domain_details($alias_domain)) {
|
||||||
|
$data[] = $details;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -198,7 +251,7 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
echo '{}';
|
echo '{}';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo json_encode(mailbox_get_alias_domains($object), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -212,7 +265,12 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
$aliases = mailbox_get_aliases($domain);
|
$aliases = mailbox_get_aliases($domain);
|
||||||
if (!empty($aliases)) {
|
if (!empty($aliases)) {
|
||||||
foreach ($aliases as $alias) {
|
foreach ($aliases as $alias) {
|
||||||
$data[] = mailbox_get_alias_details($alias);
|
if ($details = mailbox_get_alias_details($alias)) {
|
||||||
|
$data[] = $details;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,7 +292,7 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
echo '{}';
|
echo '{}';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo json_encode(mailbox_get_alias_details($object), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +303,12 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
$domain_admins = get_domain_admins();
|
$domain_admins = get_domain_admins();
|
||||||
if (!empty($domain_admins)) {
|
if (!empty($domain_admins)) {
|
||||||
foreach ($domain_admins as $domain_admin) {
|
foreach ($domain_admins as $domain_admin) {
|
||||||
$data[] = get_domain_admin_details($domain_admin);
|
if ($details = get_domain_admin_details($domain_admin)) {
|
||||||
|
$data[] = $details;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!isset($data) || empty($data)) {
|
if (!isset($data) || empty($data)) {
|
||||||
echo '{}';
|
echo '{}';
|
||||||
|
@ -265,7 +328,7 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
echo '{}';
|
echo '{}';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo json_encode(get_domain_admin_details($object), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -307,7 +370,7 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
if (mailbox_delete_alias(array('address' => $address)) === false) {
|
if (mailbox_delete_alias(array('address' => $address)) === false) {
|
||||||
echo json_encode(array(
|
echo json_encode(array(
|
||||||
'type' => 'error',
|
'type' => 'error',
|
||||||
'message' => 'Deletion of item failed'
|
'message' => 'Deletion of item/s failed'
|
||||||
));
|
));
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
@ -324,6 +387,30 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "fwdhost":
|
||||||
|
if (isset($_POST['forwardinghost'])) {
|
||||||
|
$forwardinghost = json_decode($_POST['forwardinghost'], true);
|
||||||
|
if (is_array($forwardinghost)) {
|
||||||
|
if (delete_forwarding_host(array('forwardinghost' => $forwardinghost)) === false) {
|
||||||
|
echo json_encode(array(
|
||||||
|
'type' => 'error',
|
||||||
|
'message' => 'Deletion of item/s failed'
|
||||||
|
));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
echo json_encode(array(
|
||||||
|
'type' => 'success',
|
||||||
|
'message' => 'Task completed'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo json_encode(array(
|
||||||
|
'type' => 'error',
|
||||||
|
'message' => 'Cannot find forwardinghost array in post data'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "edit":
|
case "edit":
|
||||||
|
|
|
@ -135,6 +135,7 @@ $lang['user']['day'] = 'Tag';
|
||||||
$lang['user']['week'] = 'Woche';
|
$lang['user']['week'] = 'Woche';
|
||||||
$lang['user']['weeks'] = 'Wochen';
|
$lang['user']['weeks'] = 'Wochen';
|
||||||
$lang['user']['spamfilter'] = 'Spamfilter';
|
$lang['user']['spamfilter'] = 'Spamfilter';
|
||||||
|
$lang['admin']['spamfilter'] = 'Spamfilter';
|
||||||
$lang['user']['spamfilter_wl'] = 'Whitelist';
|
$lang['user']['spamfilter_wl'] = 'Whitelist';
|
||||||
$lang['user']['spamfilter_wl_desc'] = 'Für E-Mail-Adressen, die vom Spamfilter <b>nicht</b> erfasst werden sollen. Die Verwendung von Wildcards ist gestattet.';
|
$lang['user']['spamfilter_wl_desc'] = 'Für E-Mail-Adressen, die vom Spamfilter <b>nicht</b> erfasst werden sollen. Die Verwendung von Wildcards ist gestattet.';
|
||||||
$lang['user']['spamfilter_bl'] = 'Blacklist';
|
$lang['user']['spamfilter_bl'] = 'Blacklist';
|
||||||
|
@ -480,8 +481,8 @@ $lang['admin']['message'] = 'Nachricht';
|
||||||
$lang['admin']['forwarding_hosts'] = 'Weiterleitungs-Hosts';
|
$lang['admin']['forwarding_hosts'] = 'Weiterleitungs-Hosts';
|
||||||
$lang['admin']['forwarding_hosts_hint'] = 'Eingehende Nachrichten werden von den hier gelisteten Hosts bedingungslos akzeptiert. Diese Hosts werden dann nicht mit DNSBLs abgeglichen oder Greylisting unterworfen. Von ihnen empfangener Spam wird nie abgelehnt, optional kann er aber in den Spam-Ordner einsortiert werden. Die übliche Verwendung für diese Funktion ist, um Mailserver anzugeben, auf denen eine Weiterleitung zu Ihrem Mailcow-Server eingerichtet wurde.';
|
$lang['admin']['forwarding_hosts_hint'] = 'Eingehende Nachrichten werden von den hier gelisteten Hosts bedingungslos akzeptiert. Diese Hosts werden dann nicht mit DNSBLs abgeglichen oder Greylisting unterworfen. Von ihnen empfangener Spam wird nie abgelehnt, optional kann er aber in den Spam-Ordner einsortiert werden. Die übliche Verwendung für diese Funktion ist, um Mailserver anzugeben, auf denen eine Weiterleitung zu Ihrem Mailcow-Server eingerichtet wurde.';
|
||||||
$lang['admin']['forwarding_hosts_add_hint'] = 'Sie können entweder IPv4/IPv6-Adressen, Netzwerke in CIDR-Notation, Hostnamen (die zu IP-Adressen aufgelöst werden), oder Domainnamen (die zu IP-Adressen aufgelöst werden, indem ihr SPF-Record abgefragt wird oder, in dessen Abwesenheit, ihre MX-Records) angeben.';
|
$lang['admin']['forwarding_hosts_add_hint'] = 'Sie können entweder IPv4/IPv6-Adressen, Netzwerke in CIDR-Notation, Hostnamen (die zu IP-Adressen aufgelöst werden), oder Domainnamen (die zu IP-Adressen aufgelöst werden, indem ihr SPF-Record abgefragt wird oder, in dessen Abwesenheit, ihre MX-Records) angeben.';
|
||||||
$lang['edit']['host'] = 'Host';
|
$lang['admin']['host'] = 'Host';
|
||||||
$lang['edit']['source'] = 'Quelle';
|
$lang['admin']['source'] = 'Quelle';
|
||||||
$lang['admin']['add_forwarding_host'] = 'Weiterleitungs-Host hinzufügen';
|
$lang['admin']['add_forwarding_host'] = 'Weiterleitungs-Host hinzufügen';
|
||||||
$lang['delete']['remove_forwardinghost_warning'] = '<b>Warnung:</b> Sie entfernen den Weiterleitungs-Host <b>%s</b>!';
|
$lang['delete']['remove_forwardinghost_warning'] = '<b>Warnung:</b> Sie entfernen den Weiterleitungs-Host <b>%s</b>!';
|
||||||
$lang['success']['forwarding_host_removed'] = "Weiterleitungs-Host %s wurde entfernt";
|
$lang['success']['forwarding_host_removed'] = "Weiterleitungs-Host %s wurde entfernt";
|
||||||
|
|
|
@ -137,6 +137,7 @@ $lang['user']['day'] = 'Day';
|
||||||
$lang['user']['week'] = 'Week';
|
$lang['user']['week'] = 'Week';
|
||||||
$lang['user']['weeks'] = 'Weeks';
|
$lang['user']['weeks'] = 'Weeks';
|
||||||
$lang['user']['spamfilter'] = 'Spam filter';
|
$lang['user']['spamfilter'] = 'Spam filter';
|
||||||
|
$lang['admin']['spamfilter'] = 'Spam filter';
|
||||||
$lang['user']['spamfilter_wl'] = 'Whitelist';
|
$lang['user']['spamfilter_wl'] = 'Whitelist';
|
||||||
$lang['user']['spamfilter_wl_desc'] = 'Whitelisted email addresses to <b>never</b> classify as spam. Wildcards maybe used.';
|
$lang['user']['spamfilter_wl_desc'] = 'Whitelisted email addresses to <b>never</b> classify as spam. Wildcards maybe used.';
|
||||||
$lang['user']['spamfilter_bl'] = 'Blacklist';
|
$lang['user']['spamfilter_bl'] = 'Blacklist';
|
||||||
|
@ -492,8 +493,8 @@ $lang['admin']['logs'] = 'Logs';
|
||||||
$lang['admin']['forwarding_hosts'] = 'Forwarding Hosts';
|
$lang['admin']['forwarding_hosts'] = 'Forwarding Hosts';
|
||||||
$lang['admin']['forwarding_hosts_hint'] = 'Incoming messages are unconditionally accepted from any hosts listed here. These hosts are then not checked against DNSBLs or subjected to greylisting. Spam received from them is never rejected, but optionally it can be filed into the Junk folder. The most common use for this is to specify mail servers on which you have set up a rule that forwards incoming emails to your Mailcow server.';
|
$lang['admin']['forwarding_hosts_hint'] = 'Incoming messages are unconditionally accepted from any hosts listed here. These hosts are then not checked against DNSBLs or subjected to greylisting. Spam received from them is never rejected, but optionally it can be filed into the Junk folder. The most common use for this is to specify mail servers on which you have set up a rule that forwards incoming emails to your Mailcow server.';
|
||||||
$lang['admin']['forwarding_hosts_add_hint'] = 'You can either specify IPv4/IPv6 addresses, networks in CIDR notation, host names (which will be resolved to IP addresses), or domain names (which will be resolved to IP addresses by querying SPF records or, in their absence, MX records).';
|
$lang['admin']['forwarding_hosts_add_hint'] = 'You can either specify IPv4/IPv6 addresses, networks in CIDR notation, host names (which will be resolved to IP addresses), or domain names (which will be resolved to IP addresses by querying SPF records or, in their absence, MX records).';
|
||||||
$lang['edit']['host'] = 'Host';
|
$lang['admin']['host'] = 'Host';
|
||||||
$lang['edit']['source'] = 'Source';
|
$lang['admin']['source'] = 'Source';
|
||||||
$lang['admin']['add_forwarding_host'] = 'Add Forwarding Host';
|
$lang['admin']['add_forwarding_host'] = 'Add Forwarding Host';
|
||||||
$lang['delete']['remove_forwardinghost_warning'] = '<b>Warning:</b> You are about to remove the forwarding host <b>%s</b>!';
|
$lang['delete']['remove_forwardinghost_warning'] = '<b>Warning:</b> You are about to remove the forwarding host <b>%s</b>!';
|
||||||
$lang['success']['forwarding_host_removed'] = "Forwarding host %s has been removed";
|
$lang['success']['forwarding_host_removed'] = "Forwarding host %s has been removed";
|
||||||
|
|
Loading…
Reference in New Issue