More changes for better structure and minimal json api in dev
This commit is contained in:
32
data/web/json_api.php
Normal file
32
data/web/json_api.php
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user