Exemplo n.º 1
0
}
$api_m = trim($_REQUEST['api_m']);
// API Version
if (!$api_version) {
    $api_version = VB_API_VERSION;
}
if ($api_version < VB_API_VERSION_MIN) {
    print_apierror('api_version_too_low', 'This server accepts API version ' . VB_API_VERSION_MIN . ' at least. The requested API version is too low.');
} elseif ($api_version > VB_API_VERSION) {
    print_apierror('api_version_too_high', 'This server accepts API version ' . VB_API_VERSION . ' at most. The requested API version is too high.');
}
define('VB_API_VERSION_CURRENT', $api_version);
if ($api_version < VB5_API_VERSION_START || strstr("api_init", $api_m)) {
    $old_api_m = $api_m;
    define("VB4_MAPI_METHOD", $old_api_m);
    $api_m = vB_Api::map_vb4_input_to_vb5($api_m, $_REQUEST);
}
// $methodsegments[0] is the API class name
// $methodsegments[1] is the API function name
// $_REQUEST data as function named params
$methodsegments = explode(".", $api_m);
try {
    $apiobj = vB_Api::instanceInternal(strtolower($methodsegments[0]));
    $data = $apiobj->callNamed($methodsegments[1], array_merge($_REQUEST, $_FILES));
    if (!empty($data)) {
        if ($api_version < VB5_API_VERSION_START) {
            vB_Api::map_vb5_output_to_vb4($old_api_m, $data);
        }
        print_apioutput($data);
    }
} catch (Exception $e) {