Пример #1
0
$oR3DCQuery->GetPlayerStatusrRefByPlayerID($config, $b_player_id, $wins, $loss, $draws);
if ($oR3DCQuery->ELOIsActive()) {
    $points = $oR3DCQuery->ELOGetRating($b_player_id);
} else {
    $points = $oR3DCQuery->GetPointValue($wins, $loss, $draws);
}
$blackdiv = "\n\t<div class=\"avatar\">{$image}</div>\n\t<div class=\"userid\">{$userid}</div>\n\t<div class=\"points\">{$points}</div>\n\t";
$player = 'white';
$bdiv = $whitediv;
$tdiv = $blackdiv;
$imgc = 'w';
if ($gameid != "") {
    // Get the pgn text
    //Instantiate the CR3DCQuery Class
    $oR3DCQuery = new CR3DCQuery($config);
    $fen = $oR3DCQuery->FormatInputedFEN2($oR3DCQuery->GetInitialGameFEN($config, $gameid));
    //replaceLast($oR3DCQuery->GetHackedFEN($sid, $gameid), "0", "1");
    $oR3DCQuery->Close();
    unset($oR3DCQuery);
} else {
    $fen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
}
$fen = explode(" ", $fen);
$board = explode("/", $fen[0]);
$initiator = "";
$w_player_id = "";
$b_player_id = "";
$status = "";
$completion_status = "";
$start_time = "";
$next_move = "";
//Instantiate the CSkins Class
$oSkins = new CSkins($config);
$SkinName = $oSkins->getskinname();
$oSkins->Close();
unset($oSkins);
///////
require $Root_Path . "bin/CR3DCQuery.php";
$gameid = $_GET['gameid'];
$FEN = $_GET['fen'];
$PGN = $_GET['pgn'];
if ($FEN == "") {
    $FEN = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
} else {
    //Instantiate the CR3DCQuery Class
    $oR3DCQuery = new CR3DCQuery($config);
    $oR3DCQuery->FormatInputedFEN2($FEN);
    $oR3DCQuery->Close();
    unset($oR3DCQuery);
}
function replaceLast($string, $search, $replace)
{
    $pos = false;
    if (is_int(strpos($string, $search))) {
        $endPos = strlen($string);
        while ($endPos > 0) {
            $endPos = $endPos - 1;
            $pos = strpos($string, $search, $endPos);
            if (is_int($pos)) {
                break;
            }
        }