示例#1
0
    $pvtKey = isset($data->server->pvtKey) ? $data->server->pvtKey : '';
    $token = isset($data->server->token) ? $data->server->token : '';
}
include_once '../registry.php';
include_once '../sites/' . $site . '/conf.php';
include_once '../dataProvider/Modules.php';
include_once '../dataProvider/Applications.php';
include_once '../classes/Sessions.php';
include_once 'config.php';
$modules = new Modules();
$app = new Applications();
$appAccess = $app->hasAccess($pvtKey);
$API = array_merge($API, $modules->getEnabledModulesAPI());
if (isset($token)) {
    $s = new Sessions();
    $userAccess = $s->setSessionByToken($token);
}
function doRpc($cdata)
{
    global $API;
    global $appAccess;
    try {
        if (!$appAccess) {
            throw new Exception('Access Denied: Please make sure API Key is typed correctly in the settings tab');
        }
        if (!isset($API[$cdata->action])) {
            throw new Exception('Call to undefined action: ' . $cdata->action);
        }
        $action = $cdata->action;
        $a = $API[$action];
        doAroundCalls($a['before'], $cdata);