Example #1
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/ZeitiPortal/resources/required_scripts.php";
session_start();
if (isset($_SESSION['user'])) {
    require_once 'MUDBAccess.php';
    require_once 'Mail.php';
    $action = $_REQUEST['action'];
    $dbaccess = new \ZP\MUDBAccess();
    switch ($action) {
        case 'getEntities':
            print json_encode($dbaccess->getEntities());
            break;
        case 'getPermissions':
            print json_encode($dbaccess->getPermissions());
            break;
        case 'addGroup':
            $group = json_decode($_REQUEST['group']);
            print json_encode($dbaccess->addGroup($group));
            break;
        case 'getEntityDetails':
            $group = json_decode($_REQUEST['group']);
            //$group = new \ZP\Group($group);
            print json_encode($dbaccess->getEntities($group));
            break;
        case 'getGroups':
            $entityID = intval($_REQUEST['entityID']);
            $TPIN = intval($_REQUEST['TPIN']);
            if ($entityID <= 0 && $TPIN <= 0) {
                print json_encode(['success: false', 'message' => 'Internal error occurred. Could not fetch groups. Please refresh the page and try again.']);
            } else {
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/ZeitiPortal/resources/required_scripts.php";
session_start();
if (isset($_SESSION['user'])) {
    require_once 'MUDBAccess.php';
    $action = $_REQUEST['action'];
    $dbaccess = new \ZP\MUDBAccess();
    switch ($action) {
        case 'getEntities':
            print json_encode($dbaccess->getEntities());
            break;
        case 'getPermissions':
            print json_encode($dbaccess->getPermissions());
            break;
        default:
            print json_encode(["success" => false, 'exception' => 'Invalid action']);
    }
}