More changes for better structure and minimal json api in dev

This commit is contained in:
andryyy
2017-01-21 11:49:29 +01:00
parent 68d674197d
commit c34a7b69b8
16 changed files with 3132 additions and 3026 deletions

32
data/web/json_api.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
require_once 'inc/prerequisites.inc.php';
error_reporting(0);
if (isset($_SESSION['mailcow_cc_role'])) {
if ($_GET['action'] && $_GET['object']) {
$action = $_GET['action'];
$object = $_GET['object'];
switch ($action) {
case "get_mailbox_details":
$data = mailbox_get_mailbox_details($object);
if (!$data || empty($data)) {
echo '{}';
}
else {
echo json_encode(mailbox_get_mailbox_details($object), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
}
break;
case "get_domain_details":
$data = mailbox_get_domain_details($object);
if (!$data || empty($data)) {
echo '{}';
}
else {
echo json_encode(mailbox_get_domain_details($object), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
}
break;
default:
echo '{}';
break;
}
}
}