header('Content-Type: text/html; charset=ISO-8859-1'); include_once "ChessConfig.php"; include_once "PgnParser.class.php"; include_once "live-relay-database.class.php"; 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; } if (isset($_GET['pgnFile']) && isset($_GET['getGameList'])) { /* Return game list */ $pgnObj = new PGNParser(PGN_FOLDER . getPgnFile($_GET['pgnFile'])); echo $pgnObj->getGameListAsJson(); } if (isset($_GET['pgnFile']) && isset($_GET['getGameDetails']) && isset($_GET['gameIndex'])) { /* Return game list */ $pgnObj = new PGNParser(PGN_FOLDER . getPgnFile($_GET['pgnFile'])); echo $pgnObj->getGameDetailsAsJson($_GET['gameIndex'], $_GET['timestamp'], $_GET['liveUpdateMode']); } if (isset($_GET['pgnFile']) && isset($_GET['getNumberOfGames'])) { $pgnObj = new PGNParser(PGN_FOLDER . getPgnFile($_GET['pgnFile'])); echo $pgnObj->getNumberOfGames(); }
include_once "live-relay-database.class.php"; if (strpos($_SERVER['HTTP_REFERER'], RECEIVE_LIVE_UPDATE_VALID_REFERER) !== 0) { 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; }
private function loadNewGameData() { $pgn = $this->getLocalPgnWithoutTags(); $pgnObj = new PGNParser(); $pgnObj->clearCacheFor($pgn); if (!preg_match("/\\.pgn/si", $this->remote_url)) { $dgtParser = new DGTGameParser(); $result = $dgtParser->createPgnFromDGTData($this->remote_url, $pgn, $this->id); } else { $pgnObj = new PGNParser(); $result = $pgnObj->createCopyOfRemotePgn($this->remote_url, $pgn, $this->id); } if ($result['success']) { if ($result['finished_round']) { $this->finishRound(); } else { $this->startRound(); } } }