示例#1
0
function getPgnFile($pgnFile)
{
    if (!stristr($pgnFile, '.pgn')) {
        $eventDb = new LiveRelayDatabase();
        $pgnFile = $eventDb->getPgnByEventName($pgnFile, isset($_GET['getGameList']));
    }
    if (strstr($pgnFile, '/')) {
        $tokens = explode("/", $pgnFile);
        return $tokens[count($tokens) - 1];
    }
    return $pgnFile;
}
    echo '{ "success" : false, "message" : "Access denied" }';
    die;
}
#exit;
header('Content-Type: text/html; charset=ISO-8859-1');
include_once "ChessConfig.php";
include_once "PgnParser.class.php";
include_once "DGT-game-parser.class.php";
if (isset($_POST['getRemotePgn'])) {
    if (!preg_match("/\\.pgn/si", $_POST['remotePath'])) {
        $dgtParser = new DGTGameParser();
        $result = $dgtParser->createPgnFromDGTData($_POST['remote_url'], $_POST['local_pgn']);
    } else {
        $pgnObj = new PGNParser();
        $result = $pgnObj->createCopyOfRemotePgn($_POST['remote_url'], $_POST['local_pgn']);
    }
    if (!$result['success']) {
        #header('HTTP/1.1 400');
    }
    echo stripslashes(json_encode($result));
}
if (isset($_POST['getLastBuilds'])) {
    $result = array('success' => false, 'data' => array());
    $relayDb = new LiveRelayDatabase();
    $data = $relayDb->getLastBuildDates($_POST['ids']);
    if (count($data)) {
        $result['success'] = true;
        $result['data'] = $data;
    }
    echo stripslashes(json_encode($result));
}
        <?php 
if (!CHESS_USE_DATABASE) {
    ?>
        <td><input type="button" value="Stop" onclick="stopUpdates()"></td>
            <?php 
}
?>
        <td id="secondsToNextUpdate"></td>
    </tr>
</table>
<?php 
if (CHESS_USE_DATABASE) {
    ?>
    <input type="submit" value="Save events" name="save">
    <?php 
    $relayObj = new LiveRelayDatabase();
    $activeRelays = $relayObj->getActiveRelays();
    foreach ($activeRelays as $activeRelay) {
        ?>

        <fieldset>
            <legend>Active relay</legend>
            <input type="hidden" class="ids" name="id[]" value="<?php 
        echo $activeRelay->getId();
        ?>
">
            <table>
                <tr class="errorRow" style="display:none">
                    <td colspan="2" class="errors"></td>
                </tr>
                <tr>