Example #1
0
    return is_null($value) ? null : (double) $value;
}
function safe_bool($value)
{
    return is_null($value) ? null : (bool) $value;
}
$api = new RestApi();
/**
 * API information
 */
function info()
{
    return array('api_version' => DOMJUDGE_API_VERSION, 'domjudge_version' => DOMJUDGE_VERSION);
}
$doc = "Get general API information.";
$api->provideFunction('GET', 'info', $doc);
/**
 * Contest information
 */
function contest()
{
    global $cids, $cdatas, $userdata;
    if (checkrole('jury')) {
        $cdatas = getCurContests(TRUE);
    } elseif (isset($userdata['teamid'])) {
        $cdatas = getCurContests(TRUE, $userdata['teamid']);
    }
    if (empty($cdatas)) {
        return null;
    }
    $cid = $cids[0];