diff --git a/data/web/css/mailbox.css b/data/web/css/mailbox.css
index b5c69343..23f5ad84 100644
--- a/data/web/css/mailbox.css
+++ b/data/web/css/mailbox.css
@@ -1,19 +1,19 @@
-.panel-heading div {
- margin-top: -18px;
- font-size: 15px;
+table.footable>tbody>tr.footable-empty>td {
+ font-size:15px !important;
+ font-style:italic;
}
-.panel-heading div span {
- margin-left:5px;
+.pagination a {
+ text-decoration: none !important;
}
-.panel-body {
- display: none;
+.panel panel-default {
+ overflow: visible !important;
}
-.clickable {
- cursor: pointer;
+.table-responsive {
+ overflow: visible !important;
}
-.progress {
- margin-bottom: 0px;
-}
-.table>thead>tr>th {
- vertical-align: top !important;
+.footer-add-item {
+ text-align:center;
+ font-style: italic;
+ display:block;
+ padding: 10px;
}
\ No newline at end of file
diff --git a/data/web/css/tables.css b/data/web/css/tables.css
deleted file mode 100644
index 651e1665..00000000
--- a/data/web/css/tables.css
+++ /dev/null
@@ -1,79 +0,0 @@
-ul[id*="sortable"] { word-wrap: break-word; list-style-type: none; float: left; padding: 0 15px 0 0; width: 48%; cursor:move}
-ul[id$="sortable-active"] li {cursor:move; }
-ul[id$="sortable-inactive"] li {cursor:move }
-.list-heading { cursor:default !important}
-.ui-state-disabled { cursor:no-drop; color:#ccc; }
-.ui-state-highlight {background: #F5F5F5 !important; height: 41px !important; cursor:move }
-table[data-sortable] {
- border-collapse: collapse;
- border-spacing: 0;
-}
-table[data-sortable] th {
- vertical-align: bottom;
- font-weight: bold;
-}
-table[data-sortable] th, table[data-sortable] td {
- text-align: left;
- padding: 10px;
-}
-table[data-sortable] th:not([data-sortable="false"]) {
- -webkit-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- -o-user-select: none;
- user-select: none;
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
- -webkit-touch-callout: none;
- cursor: pointer;
-}
-table[data-sortable] th:after {
- content: "";
- visibility: hidden;
- display: inline-block;
- vertical-align: inherit;
- height: 0;
- width: 0;
- border-width: 5px;
- border-style: solid;
- border-color: transparent;
- margin-right: 1px;
- margin-left: 10px;
- float: right;
-}
-table[data-sortable] th[data-sortable="false"]:after {
- display: none;
-}
-table[data-sortable] th[data-sorted="true"]:after {
- visibility: visible;
-}
-table[data-sortable] th[data-sorted-direction="descending"]:after {
- border-top-color: inherit;
- margin-top: 8px;
-}
-table[data-sortable] th[data-sorted-direction="ascending"]:after {
- border-bottom-color: inherit;
- margin-top: 3px;
-}
-table[data-sortable].sortable-theme-bootstrap thead th {
- border-bottom: 2px solid #e0e0e0;
-}
-table[data-sortable].sortable-theme-bootstrap th[data-sorted="true"] {
- color: #3a87ad;
- background: #d9edf7;
- border-bottom-color: #bce8f1;
-}
-table[data-sortable].sortable-theme-bootstrap th[data-sorted="true"][data-sorted-direction="descending"]:after {
- border-top-color: #3a87ad;
-}
-table[data-sortable].sortable-theme-bootstrap th[data-sorted="true"][data-sorted-direction="ascending"]:after {
- border-bottom-color: #3a87ad;
-}
-table[data-sortable].sortable-theme-bootstrap.sortable-theme-bootstrap-striped tbody > tr:nth-child(odd) > td {
- background-color: #f9f9f9;
-}
-#data td, #no-data td {
- vertical-align: middle;
-}
-.sort-table:hover {
- border-bottom-color: #00B7DC !important;
-}
\ No newline at end of file
diff --git a/data/web/inc/footer.inc.php b/data/web/inc/footer.inc.php
index 5523ec58..580c457f 100644
--- a/data/web/inc/footer.inc.php
+++ b/data/web/inc/footer.inc.php
@@ -50,11 +50,7 @@ $(document).ready(function() {
type: "GET",
cache: false,
dataType: 'script',
- url: "json_api.php",
- data: {
- 'action':'get_u2f_auth_challenge',
- 'object':'=(isset($_SESSION['pending_mailcow_cc_username'])) ? $_SESSION['pending_mailcow_cc_username'] : null;?>',
- },
+ url: "/api/v1/u2f-authentication/=(isset($_SESSION['pending_mailcow_cc_username'])) ? $_SESSION['pending_mailcow_cc_username'] : null;?>",
success: function(data){
data;
}
@@ -87,11 +83,7 @@ $(document).ready(function() {
type: "GET",
cache: false,
dataType: 'script',
- url: "json_api.php",
- data: {
- 'action':'get_u2f_reg_challenge',
- 'object':'=(isset($_SESSION['mailcow_cc_username'])) ? $_SESSION['mailcow_cc_username'] : null;?>',
- },
+ url: "/api/v1/u2f-registration/=(isset($_SESSION['mailcow_cc_username'])) ? $_SESSION['mailcow_cc_username'] : null;?>",
success: function(data){
data;
}
diff --git a/data/web/inc/header.inc.php b/data/web/inc/header.inc.php
index a206a35d..a7ec1c52 100644
--- a/data/web/inc/header.inc.php
+++ b/data/web/inc/header.inc.php
@@ -16,10 +16,8 @@
-
-
=(preg_match("/mailbox.php/i", $_SERVER['REQUEST_URI'])) ? '' : null;?>
diff --git a/data/web/js/add.js b/data/web/js/add.js
index 1ebcdbb2..54a70500 100644
--- a/data/web/js/add.js
+++ b/data/web/js/add.js
@@ -2,7 +2,7 @@ $(document).ready(function() {
// add.php
// Get max. possible quota for a domain when domain field changes
$('#addSelectDomain').on('change', function() {
- $.get("json_api.php", { action:"get_domain_details", object:this.value }, function(data){
+ $.get("/api/v1/domain/" + this.value, function(data){
var result = jQuery.parseJSON( data );
max_new_mailbox_quota = ( result.max_new_mailbox_quota / 1048576);
if (max_new_mailbox_quota != '0') {
diff --git a/data/web/js/admin.js b/data/web/js/admin.js
index a235a422..feaf3907 100644
--- a/data/web/js/admin.js
+++ b/data/web/js/admin.js
@@ -1,31 +1,42 @@
$(document).ready(function() {
- // Postfix restrictions, drag and drop functions
- $( "[id*=srr-sortable]" ).sortable({
- items: "li:not(.list-heading)",
- cancel: ".ui-state-disabled",
- connectWith: "[id*=srr-sortable]",
- dropOnEmpty: true,
- placeholder: "ui-state-highlight"
- });
- $( "[id*=ssr-sortable]" ).sortable({
- items: "li:not(.list-heading)",
- cancel: ".ui-state-disabled",
- connectWith: "[id*=ssr-sortable]",
- dropOnEmpty: true,
- placeholder: "ui-state-highlight"
- });
- $('#srr_form').submit(function(){
- var srr_joined_vals = $("[id^=srr-sortable-active] li").map(function() {
- return $(this).data("value");
- }).get().join(', ');
- var input = $("").attr("type", "hidden").attr("name", "srr_value").val(srr_joined_vals);
- $('#srr_form').append($(input));
- });
- $('#ssr_form').submit(function(){
- var ssr_joined_vals = $("[id^=ssr-sortable-active] li").map(function() {
- return $(this).data("value");
- }).get().join(', ');
- var input = $("").attr("type", "hidden").attr("name", "ssr_value").val(ssr_joined_vals);
- $('#ssr_form').append($(input));
- });
+ $.ajax({
+ dataType: 'json',
+ url: '/api/v1/domain-admin/all',
+ jsonp: false,
+ error: function () {
+ alert('Cannot draw domain administrator table');
+ },
+ success: function (data) {
+ $.each(data, function (i, item) {
+ item.action = '
';
+ });
+ $('#domainadminstable').footable({
+ "columns": [
+ {"sorted": true,"name":"username","title":lang.username,"style":{"width":"250px"}},
+ {"name":"selected_domains","title":lang.admin_domains,"breakpoints":"xs sm"},
+ {"name":"tfa_active","title":"TFA", "filterable": false,"style":{"maxWidth":"80px","width":"80px"}},
+ {"name":"active","filterable": false,"style":{"maxWidth":"80px","width":"80px"},"title":lang.active},
+ {"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
+ },
+ "filtering": {
+ "enabled": true,
+ "position": "left",
+ "placeholder": lang.filter_table
+ },
+ "sorting": {
+ "enabled": true
+ }
+ });
+ }
+ });
});
\ No newline at end of file
diff --git a/data/web/js/mailbox.js b/data/web/js/mailbox.js
index 1ddf0c35..4e6b303d 100644
--- a/data/web/js/mailbox.js
+++ b/data/web/js/mailbox.js
@@ -15,7 +15,7 @@ $(document).ready(function() {
$.ajax({
dataType: 'json',
- url: '/json_api.php?action=domain_table_data',
+ url: '/api/v1/domain/all',
jsonp: false,
error: function () {
alert('Cannot draw domain table');
@@ -70,7 +70,7 @@ $(document).ready(function() {
$.ajax({
dataType: 'json',
- url: '/json_api.php?action=mailbox_table_data',
+ url: '/api/v1/mailbox/all',
jsonp: false,
error: function () {
alert('Cannot draw mailbox table');
@@ -102,12 +102,12 @@ $(document).ready(function() {
{"sorted": true,"name":"username","title":lang.username,"style":{"width":"250px"}},
{"name":"name","title":lang.fname,"breakpoints":"xs sm"},
{"name":"domain","title":lang.domain,"breakpoints":"xs sm"},
- {"name":"quota","title":lang.domain_quota},
- {"name":"spam_aliases","filterable": false,"title":lang.spam_aliases,"breakpoints":"xs sm"},
- {"name":"in_use","filterable": false,"type":"html","title":lang.in_use},
- {"name":"messages","filterable": false,"style":{"width":"90px"},"title":lang.msg_num,"breakpoints":"xs sm"},
- {"name":"active","filterable": false,"style":{"maxWidth":"80px","width":"80px"},"title":lang.active},
- {"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","width":"290px"},"type":"html","title":lang.action,"breakpoints":"xs sm"}
+ {"name":"quota","style":{"whiteSpace":"nowrap"},"title":lang.domain_quota},
+ {"name":"spam_aliases","filterable": false,"title":lang.spam_aliases,"breakpoints":"xs sm md"},
+ {"name":"in_use","filterable": false,"style":{"whiteSpace":"nowrap"},"type":"html","title":lang.in_use},
+ {"name":"messages","filterable": false,"style":{"whiteSpace":"nowrap"},"title":lang.msg_num,"breakpoints":"xs sm md"},
+ {"name":"active","filterable": false,"style":{"whiteSpace":"nowrap"},"title":lang.active},
+ {"name":"action","filterable": false,"sortable": false,"style":{"whiteSpace":"nowrap","text-align":"right","width":"290px"},"type":"html","title":lang.action,"breakpoints":"xs sm md"}
],
"empty": lang.empty,
"rows": data,
@@ -130,7 +130,7 @@ $(document).ready(function() {
$.ajax({
dataType: 'json',
- url: '/json_api.php?action=resource_table_data',
+ url: '/api/v1/resource/all',
jsonp: false,
error: function () {
alert('Cannot draw resource table');
@@ -172,7 +172,7 @@ $(document).ready(function() {
$.ajax({
dataType: 'json',
- url: '/json_api.php?action=domain_alias_table_data',
+ url: '/api/v1/alias-domain/all',
jsonp: false,
error: function () {
alert('Cannot draw alias domain table');
@@ -212,7 +212,7 @@ $(document).ready(function() {
$.ajax({
dataType: 'json',
- url: '/json_api.php?action=alias_table_data',
+ url: '/api/v1/alias/all',
jsonp: false,
error: function () {
alert('Cannot draw alias table');
diff --git a/data/web/js/sorttable.js b/data/web/js/sorttable.js
deleted file mode 100644
index cb3e293c..00000000
--- a/data/web/js/sorttable.js
+++ /dev/null
@@ -1,236 +0,0 @@
-(function() {
- var SELECTOR, addEventListener, clickEvents, numberRegExp, sortable, touchDevice, trimRegExp;
-
- SELECTOR = 'table[data-sortable]';
-
- numberRegExp = /^-?[£$¤]?[\d,.]+%?$/;
-
- trimRegExp = /^\s+|\s+$/g;
-
- clickEvents = ['click'];
-
- touchDevice = 'ontouchstart' in document.documentElement;
-
- if (touchDevice) {
- clickEvents.push('touchstart');
- }
-
- addEventListener = function(el, event, handler) {
- if (el.addEventListener != null) {
- return el.addEventListener(event, handler, false);
- } else {
- return el.attachEvent("on" + event, handler);
- }
- };
-
- sortable = {
- init: function(options) {
- var table, tables, _i, _len, _results;
- if (options == null) {
- options = {};
- }
- if (options.selector == null) {
- options.selector = SELECTOR;
- }
- tables = document.querySelectorAll(options.selector);
- _results = [];
- for (_i = 0, _len = tables.length; _i < _len; _i++) {
- table = tables[_i];
- _results.push(sortable.initTable(table));
- }
- return _results;
- },
- initTable: function(table) {
- var i, th, ths, _i, _len, _ref;
- if (((_ref = table.tHead) != null ? _ref.rows.length : void 0) !== 1) {
- return;
- }
- if (table.getAttribute('data-sortable-initialized') === 'true') {
- return;
- }
- table.setAttribute('data-sortable-initialized', 'true');
- ths = table.querySelectorAll('th');
- for (i = _i = 0, _len = ths.length; _i < _len; i = ++_i) {
- th = ths[i];
- if (th.getAttribute('data-sortable') !== 'false') {
- sortable.setupClickableTH(table, th, i);
- }
- }
- return table;
- },
- setupClickableTH: function(table, th, i) {
- var eventName, onClick, type, _i, _len, _results;
- type = sortable.getColumnType(table, i);
- onClick = function(e) {
- var compare, item, newSortedDirection, position, row, rowArray, sorted, sortedDirection, tBody, ths, value, _compare, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1;
- if (e.handled !== true) {
- e.handled = true;
- } else {
- return false;
- }
- sorted = this.getAttribute('data-sorted') === 'true';
- sortedDirection = this.getAttribute('data-sorted-direction');
- if (sorted) {
- newSortedDirection = sortedDirection === 'ascending' ? 'descending' : 'ascending';
- } else {
- newSortedDirection = type.defaultSortDirection;
- }
- ths = this.parentNode.querySelectorAll('th');
- for (_i = 0, _len = ths.length; _i < _len; _i++) {
- th = ths[_i];
- th.setAttribute('data-sorted', 'false');
- th.removeAttribute('data-sorted-direction');
- }
- this.setAttribute('data-sorted', 'true');
- this.setAttribute('data-sorted-direction', newSortedDirection);
- tBody = table.tBodies[0];
- rowArray = [];
- if (!sorted) {
- if (type.compare != null) {
- _compare = type.compare;
- } else {
- _compare = function(a, b) {
- return b - a;
- };
- }
- compare = function(a, b) {
- if (a[0] === b[0]) {
- return a[2] - b[2];
- }
- if (type.reverse) {
- return _compare(b[0], a[0]);
- } else {
- return _compare(a[0], b[0]);
- }
- };
- _ref = tBody.rows;
- for (position = _j = 0, _len1 = _ref.length; _j < _len1; position = ++_j) {
- row = _ref[position];
- value = sortable.getNodeValue(row.cells[i]);
- if (type.comparator != null) {
- value = type.comparator(value);
- }
- rowArray.push([value, row, position]);
- }
- rowArray.sort(compare);
- for (_k = 0, _len2 = rowArray.length; _k < _len2; _k++) {
- row = rowArray[_k];
- tBody.appendChild(row[1]);
- }
- } else {
- _ref1 = tBody.rows;
- for (_l = 0, _len3 = _ref1.length; _l < _len3; _l++) {
- item = _ref1[_l];
- rowArray.push(item);
- }
- rowArray.reverse();
- for (_m = 0, _len4 = rowArray.length; _m < _len4; _m++) {
- row = rowArray[_m];
- tBody.appendChild(row);
- }
- }
- if (typeof window['CustomEvent'] === 'function') {
- return typeof table.dispatchEvent === "function" ? table.dispatchEvent(new CustomEvent('Sortable.sorted', {
- bubbles: true
- })) : void 0;
- }
- };
- _results = [];
- for (_i = 0, _len = clickEvents.length; _i < _len; _i++) {
- eventName = clickEvents[_i];
- _results.push(addEventListener(th, eventName, onClick));
- }
- return _results;
- },
- getColumnType: function(table, i) {
- var row, specified, text, type, _i, _j, _len, _len1, _ref, _ref1, _ref2;
- specified = (_ref = table.querySelectorAll('th')[i]) != null ? _ref.getAttribute('data-sortable-type') : void 0;
- if (specified != null) {
- return sortable.typesObject[specified];
- }
- _ref1 = table.tBodies[0].rows;
- for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
- row = _ref1[_i];
- text = sortable.getNodeValue(row.cells[i]);
- _ref2 = sortable.types;
- for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
- type = _ref2[_j];
- if (type.match(text)) {
- return type;
- }
- }
- }
- return sortable.typesObject.alpha;
- },
- getNodeValue: function(node) {
- var dataValue;
- if (!node) {
- return '';
- }
- dataValue = node.getAttribute('data-value');
- if (dataValue !== null) {
- return dataValue;
- }
- if (typeof node.innerText !== 'undefined') {
- return node.innerText.replace(trimRegExp, '');
- }
- return node.textContent.replace(trimRegExp, '');
- },
- setupTypes: function(types) {
- var type, _i, _len, _results;
- sortable.types = types;
- sortable.typesObject = {};
- _results = [];
- for (_i = 0, _len = types.length; _i < _len; _i++) {
- type = types[_i];
- _results.push(sortable.typesObject[type.name] = type);
- }
- return _results;
- }
- };
-
- sortable.setupTypes([
- {
- name: 'numeric',
- defaultSortDirection: 'descending',
- match: function(a) {
- return a.match(numberRegExp);
- },
- comparator: function(a) {
- return parseFloat(a.replace(/[^0-9.-]/g, ''), 10) || 0;
- }
- }, {
- name: 'date',
- defaultSortDirection: 'ascending',
- reverse: true,
- match: function(a) {
- return !isNaN(Date.parse(a));
- },
- comparator: function(a) {
- return Date.parse(a) || 0;
- }
- }, {
- name: 'alpha',
- defaultSortDirection: 'ascending',
- match: function() {
- return true;
- },
- compare: function(a, b) {
- return a.localeCompare(b);
- }
- }
- ]);
-
- setTimeout(sortable.init, 0);
-
- if (typeof define === 'function' && define.amd) {
- define(function() {
- return sortable;
- });
- } else if (typeof exports !== 'undefined') {
- module.exports = sortable;
- } else {
- window.Sortable = sortable;
- }
-
-}).call(this);
diff --git a/data/web/json_api.php b/data/web/json_api.php
index f0715466..66b46cfb 100644
--- a/data/web/json_api.php
+++ b/data/web/json_api.php
@@ -2,168 +2,242 @@
require_once 'inc/prerequisites.inc.php';
error_reporting(E_ALL);
if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_username'])) {
- if (isset($_GET['action'])) {
- $action = $_GET['action'];
+ if (isset($_GET['action']) && isset($_GET['object'])) {
+ $action = filter_input(INPUT_GET, 'action', FILTER_SANITIZE_STRING);
+ $object = filter_input(INPUT_GET, 'object', FILTER_SANITIZE_STRING);
switch ($action) {
- case "domain_table_data":
- $domains = mailbox_get_domains();
- if (!empty($domains)) {
- foreach ($domains as $domain) {
- $data[] = mailbox_get_domain_details($domain);
- }
- if (!isset($data) || empty($data)) {
- echo '{}';
- }
- else {
- echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
- }
- }
- else {
- echo '{}';
- }
- break;
- case "mailbox_table_data":
- $domains = mailbox_get_domains();
- if (!empty($domains)) {
- foreach ($domains as $domain) {
- $mailboxes = mailbox_get_mailboxes($domain);
- if (!empty($mailboxes)) {
- foreach ($mailboxes as $mailbox) {
- $data[] = mailbox_get_mailbox_details($mailbox);
+ case "domain":
+ switch ($object) {
+ case "all":
+ $domains = mailbox_get_domains();
+ if (!empty($domains)) {
+ foreach ($domains as $domain) {
+ $data[] = mailbox_get_domain_details($domain);
+ }
+ if (!isset($data) || empty($data)) {
+ echo '{}';
+ }
+ else {
+ echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
}
}
- }
- if (!isset($data) || empty($data)) {
- echo '{}';
- }
- else {
- echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
- }
+ else {
+ echo '{}';
+ }
+ break;
+
+ default:
+ $data = mailbox_get_domain_details($object);
+ if (!isset($data) || empty($data)) {
+ echo '{}';
+ }
+ else {
+ echo json_encode(mailbox_get_domain_details($object), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
+ }
+ break;
}
- else {
- echo '{}';
- }
- break;
- case "resource_table_data":
- $domains = mailbox_get_domains();
- if (!empty($domains)) {
- foreach ($domains as $domain) {
- $resources = mailbox_get_resources($domain);
- if (!empty($resources)) {
- foreach ($resources as $resource) {
- $data[] = mailbox_get_resource_details($resource);
+ break;
+ case "mailbox":
+ switch ($object) {
+ case "all":
+ $domains = mailbox_get_domains();
+ if (!empty($domains)) {
+ foreach ($domains as $domain) {
+ $mailboxes = mailbox_get_mailboxes($domain);
+ if (!empty($mailboxes)) {
+ foreach ($mailboxes as $mailbox) {
+ $data[] = mailbox_get_mailbox_details($mailbox);
+ }
+ }
+ }
+ if (!isset($data) || empty($data)) {
+ echo '{}';
+ }
+ else {
+ echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
}
}
- }
- if (!isset($data) || empty($data)) {
- echo '{}';
- }
- else {
- echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
- }
+ else {
+ echo '{}';
+ }
+ break;
+
+ default:
+ $data = mailbox_get_mailbox_details($object);
+ if (!isset($data) || empty($data)) {
+ echo '{}';
+ }
+ else {
+ echo json_encode(mailbox_get_mailbox_details($object), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
+ }
+ break;
+
}
- else {
- echo '{}';
- }
- break;
- case "domain_alias_table_data":
- $domains = mailbox_get_domains();
- if (!empty($domains)) {
- foreach ($domains as $domain) {
- $alias_domains = mailbox_get_alias_domains($domain);
- if (!empty($alias_domains)) {
- foreach ($alias_domains as $alias_domain) {
- $data[] = mailbox_get_alias_domain_details($alias_domain);
+ break;
+ case "resource":
+ switch ($object) {
+ case "all":
+ $domains = mailbox_get_domains();
+ if (!empty($domains)) {
+ foreach ($domains as $domain) {
+ $resources = mailbox_get_resources($domain);
+ if (!empty($resources)) {
+ foreach ($resources as $resource) {
+ $data[] = mailbox_get_resource_details($resource);
+ }
+ }
+ }
+ if (!isset($data) || empty($data)) {
+ echo '{}';
+ }
+ else {
+ echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
}
}
- }
- if (!isset($data) || empty($data)) {
- echo '{}';
- }
- else {
- echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
- }
+ else {
+ echo '{}';
+ }
+ break;
+
+ default:
+ $data = mailbox_get_resource_details($object);
+ if (!isset($data) || empty($data)) {
+ echo '{}';
+ }
+ else {
+ echo json_encode(mailbox_get_resource_details($object), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
+ }
+ break;
+
}
- else {
- echo '{}';
- }
- break;
- case "alias_table_data":
- $domains = array_merge(mailbox_get_domains(), mailbox_get_alias_domains());
- if (!empty($domains)) {
- foreach ($domains as $domain) {
- $aliases = mailbox_get_aliases($domain);
- if (!empty($aliases)) {
- foreach ($aliases as $alias) {
- $data[] = mailbox_get_alias_details($alias);
+ break;
+ case "alias-domain":
+ switch ($object) {
+ case "all":
+ $domains = mailbox_get_domains();
+ if (!empty($domains)) {
+ foreach ($domains as $domain) {
+ $alias_domains = mailbox_get_alias_domains($domain);
+ if (!empty($alias_domains)) {
+ foreach ($alias_domains as $alias_domain) {
+ $data[] = mailbox_get_alias_domain_details($alias_domain);
+ }
+ }
+ }
+ if (!isset($data) || empty($data)) {
+ echo '{}';
+ }
+ else {
+ echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
}
}
- }
- if (!isset($data) || empty($data)) {
- echo '{}';
- }
- else {
- echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
- }
+ else {
+ echo '{}';
+ }
+ break;
+
+ default:
+ $data = mailbox_get_alias_domains($object);
+ if (!isset($data) || empty($data)) {
+ echo '{}';
+ }
+ else {
+ echo json_encode(mailbox_get_alias_domains($object), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
+ }
+ break;
}
- else {
- echo '{}';
+ break;
+ case "alias":
+ switch ($object) {
+ case "all":
+ $domains = array_merge(mailbox_get_domains(), mailbox_get_alias_domains());
+ if (!empty($domains)) {
+ foreach ($domains as $domain) {
+ $aliases = mailbox_get_aliases($domain);
+ if (!empty($aliases)) {
+ foreach ($aliases as $alias) {
+ $data[] = mailbox_get_alias_details($alias);
+ }
+ }
+ }
+ if (!isset($data) || empty($data)) {
+ echo '{}';
+ }
+ else {
+ echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
+ }
+ }
+ else {
+ echo '{}';
+ }
+ break;
+
+ default:
+ $data = mailbox_get_alias_details($object);
+ if (!isset($data) || empty($data)) {
+ echo '{}';
+ }
+ else {
+ echo json_encode(mailbox_get_alias_details($object), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
+ }
+ break;
}
- break;
- case "get_mailbox_details":
- if (!isset($_GET['object'])) { return false; }
- $object = $_GET['object'];
- $data = mailbox_get_mailbox_details($object);
- if (!isset($data) || empty($data)) {
- echo '{}';
+ break;
+ case "domain-admin":
+ switch ($object) {
+ case "all":
+ $domain_admins = get_domain_admins();
+ if (!empty($domain_admins)) {
+ foreach ($domain_admins as $domain_admin) {
+ $data[] = get_domain_admin_details($domain_admin);
+ }
+ if (!isset($data) || empty($data)) {
+ echo '{}';
+ }
+ else {
+ echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
+ }
+ }
+ else {
+ echo '{}';
+ }
+ break;
+
+ default:
+ $data = get_domain_admin_details($object);
+ if (!isset($data) || empty($data)) {
+ echo '{}';
+ }
+ else {
+ echo json_encode(get_domain_admin_details($object), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
+ }
+ break;
}
- else {
- echo json_encode(mailbox_get_mailbox_details($object), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
- }
- break;
- case "get_domain_details":
- if (!isset($_GET['object'])) { return false; }
- $object = $_GET['object'];
- $data = mailbox_get_domain_details($object);
- if (!isset($data) || empty($data)) {
- echo '{}';
- }
- else {
- echo json_encode(mailbox_get_domain_details($object), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
- }
- break;
- case "get_u2f_reg_challenge":
- if (!isset($_GET['object'])) { return false; }
- $object = $_GET['object'];
- if (
- ($_SESSION["mailcow_cc_role"] == "admin" || $_SESSION["mailcow_cc_role"] == "domainadmin")
- &&
- ($_SESSION["mailcow_cc_username"] == $object)
- ) {
+ break;
+ case "u2f-registration":
+ if (($_SESSION["mailcow_cc_role"] == "admin" || $_SESSION["mailcow_cc_role"] == "domainadmin") && $_SESSION["mailcow_cc_username"] == $object) {
$data = $u2f->getRegisterData(get_u2f_registrations($object));
list($req, $sigs) = $data;
$_SESSION['regReq'] = json_encode($req);
echo 'var req = ' . json_encode($req) . '; var sigs = ' . json_encode($sigs) . ';';
}
else {
- echo '{}';
+ return;
}
- break;
- case "get_u2f_auth_challenge":
- if (!isset($_GET['object'])) { return false; }
- $object = $_GET['object'];
+ break;
+ case "u2f-authentication":
if (isset($_SESSION['pending_mailcow_cc_username']) && $_SESSION['pending_mailcow_cc_username'] == $object) {
$reqs = json_encode($u2f->getAuthenticateData(get_u2f_registrations($object)));
$_SESSION['authReq'] = $reqs;
echo 'var req = ' . $reqs . ';';
}
else {
- echo '{}';
+ return;
}
- break;
+ break;
default:
echo '{}';
- break;
+ break;
}
}
}
\ No newline at end of file
diff --git a/data/web/lang/lang.de.php b/data/web/lang/lang.de.php
index 160a306e..cd1b34b3 100644
--- a/data/web/lang/lang.de.php
+++ b/data/web/lang/lang.de.php
@@ -36,6 +36,7 @@ $lang['danger']['object_exists'] = 'Objekt %s existiert bereits';
$lang['danger']['domain_exists'] = 'Domain %s existiert bereits';
$lang['danger']['alias_goto_identical'] = 'Alias- und Ziel-Adresse dürfen nicht identisch sein';
$lang['danger']['aliasd_targetd_identical'] = 'Alias-Domain darf nicht gleich Ziel-Domain sein';
+$lang['danger']['maxquota_empty'] = 'Max. Speicherplatz pro Mailbox darf nicht 0 sein.';
$lang['success']['alias_added'] = 'Alias-Adresse(n) wurden angelegt';
$lang['success']['alias_modified'] = 'Änderungen an Alias %s wurden gespeichert';
$lang['success']['aliasd_modified'] = 'Änderungen an Alias-Domain %s wurden gespeichert';
@@ -70,6 +71,7 @@ $lang['danger']['is_spam_alias'] = '%s lautet bereits eine Spam-Alias-Adresse';
$lang['danger']['quota_not_0_not_numeric'] = 'Speicherplatz muss numerisch und >= 0 sein';
$lang['danger']['domain_not_found'] = 'Domain "%s" nicht gefunden.';
$lang['danger']['max_mailbox_exceeded'] = 'Anzahl an Mailboxen überschritten (%d von %d)';
+$lang['danger']['max_alias_exceeded'] = 'Anzahl an Alias-Adressen überschritten';
$lang['danger']['mailbox_quota_exceeded'] = 'Speicherplatz überschreitet das Limit (max. %d MiB)';
$lang['danger']['mailbox_quota_left_exceeded'] = 'Nicht genügend Speicherplatz vorhanden (Speicherplatz anwendbar: %d MiB)';
$lang['success']['mailbox_added'] = 'Mailbox %s wurde angelegt';
@@ -246,6 +248,7 @@ $lang['mailbox']['add_domain_alias'] = 'Domain-Alias hinzufügen';
$lang['mailbox']['add_mailbox'] = 'Mailbox hinzufügen';
$lang['mailbox']['add_resource'] = 'Ressource hinzufügen';
$lang['mailbox']['add_alias'] = 'Alias hinzufügen';
+$lang['mailbox']['empty'] = 'Keine Einträge vorhanden';
$lang['info']['no_action'] = 'Keine Aktion anwendbar';
@@ -448,4 +451,6 @@ $lang['admin']['site_not_found'] = 'Kann mailcow Site-Konfiguration nicht finden
$lang['admin']['public_folder_empty'] = 'Public folder name must not be empty'; // NEEDS TRANSLATION
$lang['admin']['set_rr_failed'] = 'Kann Postfix Restriktionen nicht setzen';
$lang['admin']['no_record'] = 'Kein Eintrag';
+$lang['admin']['filter_table'] = 'Tabelle Filtern';
+$lang['admin']['empty'] = 'Keine Einträge vorhanden';
?>
diff --git a/data/web/lang/lang.en.php b/data/web/lang/lang.en.php
index 6b602faf..f46c9ac1 100644
--- a/data/web/lang/lang.en.php
+++ b/data/web/lang/lang.en.php
@@ -38,6 +38,7 @@ $lang['danger']['object_exists'] = "Object %s already exists";
$lang['danger']['domain_exists'] = "Domain %s already exists";
$lang['danger']['alias_goto_identical'] = "Alias and goto address must not be identical";
$lang['danger']['aliasd_targetd_identical'] = "Alias domain must not be equal to target domain";
+$lang['danger']['maxquota_empty'] = 'Max. quota per mailbox must not be 0.';
$lang['success']['alias_added'] = "Alias address/es has/have been added";
$lang['success']['alias_modified'] = "Changes to alias have been saved";
$lang['success']['aliasd_modified'] = "Changes to alias domain have been saved";
@@ -72,6 +73,7 @@ $lang['danger']['is_spam_alias'] = "%s is already known as a spam alias address"
$lang['danger']['quota_not_0_not_numeric'] = "Quota must be numeric and >= 0";
$lang['danger']['domain_not_found'] = "Domain not found.";
$lang['danger']['max_mailbox_exceeded'] = "Max. mailboxes exceeded (%d of %d)";
+$lang['danger']['max_alias_exceeded'] = 'Max. aliases exceeded';
$lang['danger']['mailbox_quota_exceeded'] = "Quota exceeds the domain limit (max. %d MiB)";
$lang['danger']['mailbox_quota_left_exceeded'] = "Not enough space left (space left: %d MiB)";
$lang['success']['mailbox_added'] = "Mailbox %s has been added";
@@ -249,6 +251,7 @@ $lang['mailbox']['add_mailbox'] = 'Add mailbox';
$lang['mailbox']['add_resource'] = 'Add resource';
$lang['mailbox']['add_alias'] = 'Add alias';
$lang['mailbox']['add_domain_record_first'] = 'Please add a domain first';
+$lang['mailbox']['empty'] = 'No results';
$lang['info']['no_action'] = 'No action applicable';
@@ -459,4 +462,6 @@ $lang['admin']['site_not_found'] = 'Cannot locate mailcow site configuration';
$lang['admin']['public_folder_empty'] = 'Public folder name must not be empty';
$lang['admin']['set_rr_failed'] = 'Cannot set Postfix restrictions';
$lang['admin']['no_record'] = 'No record';
+$lang['admin']['filter_table'] = 'Filter table';
+$lang['admin']['empty'] = 'No results';
?>
diff --git a/data/web/mailbox.php b/data/web/mailbox.php
index bc8ca6d2..fe2cd803 100644
--- a/data/web/mailbox.php
+++ b/data/web/mailbox.php
@@ -5,33 +5,11 @@ if (isset($_SESSION['mailcow_cc_role']) && ($_SESSION['mailcow_cc_role'] == "adm
require_once "inc/header.inc.php";
$_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
?>
-
-
=$lang['mailbox']['domains'];?>
tbody>tr.footable-empty>td {
endif;
?>
+
=$lang['mailbox']['domains'];?>
@@ -49,14 +28,15 @@ table.footable>tbody>tr.footable-empty>td {
+
-
=$lang['mailbox']['mailboxes'];?>
+
=$lang['mailbox']['mailboxes'];?>
@@ -65,14 +45,15 @@ table.footable>tbody>tr.footable-empty>td {
+
-
=$lang['mailbox']['resources'];?>
+
=$lang['mailbox']['resources'];?>
@@ -80,14 +61,15 @@ table.footable>tbody>tr.footable-empty>td {
+
-
=$lang['mailbox']['domain_aliases'];?>
+
=$lang['mailbox']['domain_aliases'];?>
@@ -100,10 +82,10 @@ table.footable>tbody>tr.footable-empty>td {
-
=$lang['mailbox']['aliases'];?>
+
=$lang['mailbox']['aliases'];?>
diff --git a/data/web/user.php b/data/web/user.php
index 94f2a762..03e1a22b 100644
--- a/data/web/user.php
+++ b/data/web/user.php
@@ -405,7 +405,7 @@ elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == '
-
+
Server:Port |
@@ -416,7 +416,7 @@ elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == '
=$lang['user']['last_run'];?> |
Log |
=$lang['user']['active'];?> |
- =$lang['user']['action'];?> |
+ =$lang['user']['action'];?> |