Beispiel #1
0
<?php

$SkipCompCode = true;
require_once dirname(__FILE__) . '/config.php';
$JsonResponse = array('compatible' => true, 'ianseoversion' => ProgramVersion, 'minappversion' => $AppMinVersion, 'maxappversion' => $AppMaxVersion);
if (empty($_REQUEST['version'])) {
    $JsonResponse['compatible'] = false;
} else {
    $AppMinVersion = explode('.', $AppMinVersion);
    $AppMinVersion = sprintf('%03s-%03s-%04s-', $AppMinVersion[0], $AppMinVersion[1], $AppMinVersion[2]);
    $AppMaxVersion = explode('.', $AppMaxVersion);
    $AppMaxVersion = sprintf('%03s-%03s-%04s-', $AppMaxVersion[0], $AppMaxVersion[1], $AppMaxVersion[2]);
    $AppVersion = explode('.', $_REQUEST['version']);
    while (count($AppVersion) < 3) {
        $AppVersion[] = 0;
    }
    $AppVersion = sprintf('%03s-%03s-%04s-', $AppVersion[0], $AppVersion[1], $AppVersion[2]);
    if ($AppVersion < $AppMinVersion or $AppVersion > $AppMaxVersion) {
        $JsonResponse['compatible'] = false;
    }
}
SendResult($JsonResponse);
Beispiel #2
0
    if ($r = safe_fetch($Rs)) {
        $tgtType = $r->EvFinalTargetType;
        $Error = 0;
    }
    $arrowIndex = $_REQUEST['arrowindex'] + 1;
    if (empty($_REQUEST['arrowsymbol'])) {
        $tmpLetter = ' ';
    } else {
        $tmpLetter = GetLetterFromPrint($_REQUEST['arrowsymbol'], 'T', $tgtType);
        if ($tmpLetter == ' ') {
            $Error = 1;
        }
    }
    if (!$Error) {
        UpdateArrowString($MatchNo, $Event, $EventType, $tmpLetter, $arrowIndex, $arrowIndex);
    }
    $JsonResult = array();
    $JsonResult['error'] = $Error;
    $JsonResult['matchid'] = $Event . "|" . ($EventType ? "T" : "I") . "|" . $MatchNo;
    $JsonResult['distnum'] = 1;
    $JsonResult['arrowindex'] = $arrowIndex - 1;
    $JsonResult['arrowsymbol'] = $_REQUEST['arrowsymbol'];
    $JsonResult['curscore'] = 0;
    $JsonResult['curgold'] = 0;
    $JsonResult['curxnine'] = 0;
    $JsonResult['score'] = 0;
    $JsonResult['gold'] = 0;
    $JsonResult['xnine'] = 0;
}
SendResult($JsonResult);
Beispiel #3
0
<?php

require_once dirname(__FILE__) . '/config.php';
require_once 'Common/GlobalsLanguage.inc.php';
require_once 'Common/Lib/CommonLib.php';
$json_array = array();
if (empty($_REQUEST['lang'])) {
    $ServerUrl = Get_Tournament_Option('ISK-Lite-ServerUrl', '', $CompId);
    foreach ($Lingue as $lang => $text) {
        if (!file_exists($CFG->LANGUAGE_PATH . $lang . '/ISK-Lite.php')) {
            continue;
        }
        $json_array[] = array('id' => $lang, 'name' => $text, 'md5' => md5_file($CFG->LANGUAGE_PATH . $lang . '/ISK-Lite.php'), 'urlFlag' => $ServerUrl . $CFG->ROOT_DIR . 'Common/Languages/' . $lang . '/' . $lang . '.png', 'urlFile' => $ServerUrl . $CFG->ROOT_DIR . 'Api/ISK-Lite/' . basename(__FILE__) . '?lang=' . $lang);
    }
} elseif (preg_match('/^[a-z_0-9-]+$/sim', $_REQUEST['lang'])) {
    $json_array = getArrayLang($CFG->LANGUAGE_PATH . $_REQUEST['lang'] . '/ISK-Lite.php');
    $json_array['MD5'] = md5_file($CFG->LANGUAGE_PATH . $_REQUEST['lang'] . '/ISK-Lite.php');
    $json_array['LanguageName'] = $Lingue[$_REQUEST['lang']];
}
// Return the json structure with the callback function that is needed by the app
SendResult($json_array);
function getArrayLang($file)
{
    $lang = array();
    include $file;
    return $lang;
}
Beispiel #4
0
<?php

$AppMinVersion = '0.8.5';
$AppMaxVersion = '1.9.9';
require_once dirname(dirname(__FILE__)) . '/config.php';
// if there is no callback no need to go further...
if (empty($_REQUEST["callback"])) {
    die;
}
$CompCode = empty($_REQUEST['compcode']) ? '' : $_REQUEST['compcode'];
$DeviceId = empty($_REQUEST['devid']) ? '' : $_REQUEST['devid'];
// should it be worth to send back an error to the device?
if (!$CompCode) {
    if (empty($SkipCompCode)) {
        SendResult(array('error' => get_text('ISK-Lite-NoCompCode', 'Api')));
    }
} else {
    $CompId = getIdFromCode($CompCode);
}
function SendResult($Result)
{
    header('Access-Control-Allow-Origin: *');
    header('Content-Type: application/json');
    echo $_REQUEST["callback"] . '(' . json_encode($Result) . ')';
    exit;
}
function getGroupedTargets($TargetNo, $Session = 0, $SesType = 'Q', $SesPhase = '')
{
    global $CompId;
    // get all targets associated/grouped together with the target requested
    $SubSelect = "select TgGroup, TgSession, TgSesType\n\t\tfrom TargetGroups\n\t\twhere TgTournament={$CompId}\n\t\tand TgTargetNo='{$TargetNo}'";