Example #1
0
            header('HTTP/1.1: 400 Bad Request');
            exit;
        }
        // Here we implemented the children method to return indexes for performance, keeping the backward compatibility
        if (arg("int") === '1') {
            echo json_encode(model::children(arg('id')));
        } else {
            echo json_encode(model_json::multi(model::children(arg('id'))));
        }
        break;
    case "move":
        if (is_null(arg('id')) || is_null(arg('target'))) {
            header("HTTP/1.1: 400 Bad Request");
            echo "Bad command";
            exit;
        }
        if (!model::move(arg("id"), arg("target"))) {
            header("HTTP/1.1: 409 Conflict");
            echo "move Error, please change your values";
            exit;
        }
        break;
    default:
        header('HTTP/1.1: 400 Bad Request');
        exit;
}
// switch / case
$nolog = array('read', 'ancestors', 'children', 'links', 'stats', 'types', 'tags', 'search');
if (!in_array(arg('cmd'), $nolog)) {
    damas_service::log_event();
}