Exemplo n.º 1
0
function heartbeat($engine)
{
    if (checkVariable("server")) {
        $server = $_REQUEST['server'];
        $engine->heartbeat($server);
        return "0</code><codedesc>success";
    } else {
        return "2</code><codedesc>Required parameter missing";
    }
}
Exemplo n.º 2
0
 function insert($parent_id)
 {
     if (isset($_POST['name']) === true && $_POST['name'] != NULL && (isset($_POST['parent_id']) === true && $_POST['parent_id'] != NULL)) {
         $parent_id = checkVariable($_POST['parent_id']);
         $name = checkVariable($_POST['name']);
         $out = $treeManager->insert_element($name, $parent_id);
     } else {
         $out = FAILED;
     }
 }
        if (isset($_POST['elementId']) && !empty($_POST['elementId']) && isset($_POST['ownerEl']) && $_POST['ownerEl'] != NULL) {
            $elementId = checkVariable($_POST['elementId']);
            $ownerEl = checkVariable($_POST['ownerEl']);
            $index = 0;
            $out = $treeManager->deleteElement($elementId, &$index, $ownerEl);
        } else {
            $out = FAILED;
        }
        break;
    case "changeOrder":
        /**
         * Change the order of an element
         */
        if (isset($_POST['elementId']) && $_POST['elementId'] != NULL && (isset($_POST['destOwnerEl']) && $_POST['destOwnerEl'] != NULL) && (isset($_POST['position']) && $_POST['position'] != NULL) && (isset($_POST['oldOwnerEl']) && $_POST['oldOwnerEl'] != NULL)) {
            $oldOwnerEl = checkVariable($_POST['oldOwnerEl']);
            $elementId = checkVariable($_POST['elementId']);
            $destOwnerEl = checkVariable($_POST['destOwnerEl']);
            $position = (int) checkVariable($_POST['position']);
            $out = $treeManager->changeOrder($elementId, $oldOwnerEl, $destOwnerEl, $position);
        } else {
            $out = FAILED;
        }
        break;
    default:
        /**
         * if an unsupported action is requested, reply it with FAILED
         */
        $out = FAILED;
        break;
}
echo $out;