Example #1
0
function gamelistdisplayuf(tagtree &$tt, $ThePlayerID, $PlayerName, $PlayerPronoun, $DisplayNotification, $StartPoint, $MaxResults, $Pagenum)
{
    if ($DisplayNotification) {
        $MaxResults++;
    }
    $QueryResult = dbquery(DBQUERY_READ_RESULTSET, 'SELECT "PlayerGameRcd"."Colour" AS "UsersColour", "PlayerGameRcd"."Inherited", "PlayerGameRcd"."GameCounts", "PlayerGameRcd"."GameResult", "PlayerGameRcd"."NumLongTurns", "Game"."GameID", "Game"."Friendly", "Game"."GameName", "Game"."GTitleDeletedByAdmin", "Game"."LastMove", "Game"."GameCreator", "Game"."OriginalPlayers", "Game"."CurrentPlayers", "Game"."GameStatus", "GameVersion"."ShortVersionName", "GameVersionGroup"."VersionName", "GameVersion"."VersionNameSuffix", "GameVersion"."Creators", "User"."Name" AS "GameCreatorName", "GameInProgress"."PlayerToMove", "GameInProgress"."AbortVote", "GameInProgress"."KickVote", ROUND("PGRScore"."Score"/100, 2) AS "Score", "ParticipantRcd"."CurrentOccupant" FROM "PlayerGameRcd" JOIN "Game" ON "PlayerGameRcd"."Game" = "Game"."GameID" JOIN "GameVersion" ON "Game"."GVersion" = "GameVersion"."VersionID" JOIN "GameVersionGroup" ON "GameVersion"."VersionGroup" = "GameVersionGroup"."VersionGroupID" JOIN "User" ON "Game"."GameCreator" = "User"."UserID" LEFT JOIN "GameInProgress" ON "Game"."GameID" = "GameInProgress"."Game" LEFT JOIN "PGRScore" ON "PlayerGameRcd"."Game" = "PGRScore"."Game" AND "PlayerGameRcd"."User" = "PGRScore"."User" LEFT JOIN "PlayerGameRcd" AS "ParticipantRcd" ON "ParticipantRcd"."User" = :me: AND "Game"."GameID" = "ParticipantRcd"."Game" WHERE "PlayerGameRcd"."User" = :user: AND "PlayerGameRcd"."GameResult" NOT IN (\'Playing\', \'Hide\') ORDER BY "Game"."LastMove" DESC LIMIT :startpoint:, :maxresults:', 'user', $ThePlayerID, 'me', $_SESSION['MyUserID'], 'startpoint', $StartPoint, 'maxresults', $MaxResults);
    if ($DisplayNotification) {
        $MaxResults--;
        if ($QueryResult === 'NONE') {
            $tt->leaf('p', 'None');
            return;
        }
        $fb = fragment::blank();
        $PaginationBar = array($fb, $fb);
    } else {
        require_once HIDDEN_FILES_PATH . 'paginate.php';
        $CountQueryResult = dbquery(DBQUERY_READ_INTEGER, 'CALL "CountUsersGamesFinished"(:user:)', 'user', $ThePlayerID);
        if (!$CountQueryResult) {
            return false;
        }
        $PaginationBar = paginationbar('game', 'games', SITE_ADDRESS . 'oldgames.php', array('UserID' => $ThePlayerID), 100, $Pagenum, $CountQueryResult);
        if ($QueryResult === 'NONE') {
            $tt->append($PaginationBar[0]);
            return;
        }
    }
    $PlayerColours = array('FFC18A', 'FFFFAF', '9FFF9F', 'FFC6FF', 'C4C4C4');
    $ColourNames = array(transtext('_colourRed'), transtext('_colourYellow'), transtext('_colourGreen'), transtext('_colourPurple'), transtext('_colourGrey'));
    $TranslatedResults = array('Finished 1st' => transtext('_ugResult1st'), 'Finished 2nd' => transtext('_ugResult2nd'), 'Finished 3rd' => transtext('_ugResult3rd'), 'Finished 4th' => transtext('_ugResult4th'), 'Finished 5th' => transtext('_ugResult5th'), 'Game Aborted' => transtext('_ugResultAborted'), 'Quit' => transtext('_ugResultQuit'), 'Kicked by Admin' => transtext('_ugResultKickA'), 'Kicked by System' => transtext('_ugResultKickS'), 'Kicked by Vote' => transtext('_ugResultKickV'));
    $frag = fragment::blank();
    $OldGameID = 0;
    $i = 0;
    while ($row = db_fetch_assoc($QueryResult)) {
        if ($row['GameID'] != $OldGameID) {
            $i++;
            if ($i > $MaxResults) {
                // "This table shows only X's last 20 games" etc
                $tt->leaf('p', str_replace(array('\\username', '\\pronoun', '\\userid'), array($PlayerName, $PlayerPronoun, $ThePlayerID), transtext('_ugFinishedNote')));
                break;
            }
            $OldGameID = $row['GameID'];
            if ($row['GTitleDeletedByAdmin']) {
                $row['GameName'] = 'The title of this game has been cleared by an Administrator';
            }
            if (is_null($row['CurrentOccupant']) or $row['CurrentOccupant'] > 0 and !$row['GameIsFinished']) {
                $RowTagAttributes = null;
            } else {
                if ($row['GameStatus'] == 'In Progress' and $row['PlayerToMoveID'] == $_SESSION['MyUserID'] or $row['GameStatus'] == 'Recruiting Replacement' and !is_null($row['Colour'])) {
                    $RowTagAttributes = 'class="mymove"';
                } else {
                    if (($row['GameStatus'] == 'In Progress' or $row['GameStatus'] == 'Recruiting Replacement') and ($row['AbortVote'] != '00000' or $row['KickVote'] != '00000')) {
                        $RowTagAttributes = 'class="myattn"';
                    } else {
                        $RowTagAttributes = 'class="mygame"';
                    }
                }
            }
            $frag->opennode('tr', $RowTagAttributes);
            $version_name = vname($row['VersionName'], $row['VersionNameSuffix']);
            $frag->leaf('td', '<img src="gfx/icon-' . strtolower($row['ShortVersionName']) . '.png" alt="' . $version_name . '" title="' . $version_name . ' (' . $row['Creators'] . ')">', 'width=23 style="border-right: none;"');
            $frag->leaf('td', '<a href="board.php?GameID=' . $row['GameID'] . '">' . $row['GameName'] . '</a>', 'style="border-left: none; padding-left: 0px; text-align: left;"');
            $frag->leaf('td', '<a href="userdetails.php?UserID=' . $row['GameCreator'] . '">' . $row['GameCreatorName'] . '</a>');
            if ($row['Friendly']) {
                $frag->leaf('td', transtext('^Yes'), 'bgcolor="#9FFF9F"');
            } else {
                $frag->leaf('td', transtext('^No'), 'bgcolor="#FFC18A"');
            }
            $frag->leaf('td', $row['CurrentPlayers'] . ($row['CurrentPlayers'] == $row['OriginalPlayers'] ? '' : '&#8239;/&#8239;' . $row['OriginalPlayers']));
            $frag->leaf('td', $row['GameStatus']);
            $lmtime = strtotime($row['LastMove']);
            $frag->opennode('td');
            $frag->leaf('span', date('Y', $lmtime), 'style="font-size: 50%;"');
            $frag->text(date('M-d', $lmtime));
            $frag->closenode();
            $frag->leaf('td', $ColourNames[$row['UsersColour']], 'bgcolor="#' . $PlayerColours[$row['UsersColour']] . '"');
            $frag->leaf('td', $TranslatedResults[$row['GameResult']]);
            $frag->leaf('td', $row['NumLongTurns']);
            $frag->leaf('td', is_null($row['Score']) ? 'n/a' : $row['Score']);
            $frag->leaf('td', $row['GameCounts'] ? transtext('^Yes') : transtext('^No'));
            $frag->leaf('td', $row['Inherited'] ? transtext('^Yes') : transtext('^No'));
            $frag->closenode();
        }
    }
    $tt->append($PaginationBar[0]);
    $tt->opennode('table', 'class="table_extra_horizontal_padding"');
    $tt->opennode('thead');
    $tt->opennode('tr');
    $tt->leaf('th', 'Name', 'colspan=2 style="width: 175px;"');
    $tt->leaf('th', 'Creator');
    $tt->leaf('th', 'Frdly', 'title="Whether the game was a &quot;friendly&quot; game."');
    $tt->leaf('th', 'P', 'title="The number of players the game had when it finished (or currently has, if it hasn\'t finished) / the number of players it had when it started."');
    $tt->leaf('th', 'Status');
    $tt->leaf('th', 'Last Move', 'style="min-width: 75px;"');
    $tt->leaf('th', transtext('_ugColColour'), 'title="The colour ' . $PlayerName . ' played as in this game."');
    $tt->leaf('th', transtext('_ugColResult'), 'style="min-width: 90px;" title="The result ' . $PlayerName . ' achieved in this game. Usually this will be a rank achieved at the final scoring."');
    $tt->leaf('th', transtext('_ugColLT'), 'title="&quot;Long Turns&quot;: The number of times in this game ' . $PlayerName . ' took longer than Time Limit A to make a decision."');
    $tt->leaf('th', transtext('_ugColScore'), 'title="The score ' . $PlayerName . ' achieved in this game. The decimal part gives the player\'s position on the income track."');
    $tt->leaf('th', 'Counts', 'title="Whether the game counts towards ' . $PlayerName . '\'s statistics. Sometimes if you join a game in the middle, it does not contibute (either negatively or positively) toward your personal statistics."');
    $tt->leaf('th', 'Inhrtd', 'title="Whether ' . $PlayerName . ' inherited this game, that is, took over from another player who had left the game."');
    $tt->closenode(2);
    // tr, thead
    $tt->opennode('tbody');
    $tt->append($frag);
    $tt->closenode(2);
    // tbody, table
    $tt->append($PaginationBar[1]);
}
Example #2
0
function gamelistdisplayf(tagtree &$tt, $StartPoint, $Pagenum)
{
    if ($_SESSION['LoggedIn']) {
        $Query = 'SELECT "Game"."GameID", "Game"."Friendly", "Game"."GameName", "Game"."GTitleDeletedByAdmin", "Game"."LastMove", "Game"."GameCreator", "Game"."OriginalPlayers", "Game"."CurrentPlayers", "Game"."RailPhase", "Game"."Round", "Game"."NumRounds", "Game"."GameStatus", "GameVersion"."ShortVersionName", "GameVersionGroup"."VersionName", "GameVersion"."VersionNameSuffix", "GameVersion"."Creators", "User"."Name" AS "GameCreatorName", "PlayerGameRcd"."User" FROM "Game" JOIN "GameVersion" ON "Game"."GVersion" = "GameVersion"."VersionID" JOIN "GameVersionGroup" ON "GameVersion"."VersionGroup" = "GameVersionGroup"."VersionGroupID" JOIN "User" ON "Game"."GameCreator" = "User"."UserID" LEFT JOIN "PlayerGameRcd" ON "PlayerGameRcd"."User" = :me: AND "Game"."GameID" = "PlayerGameRcd"."Game" WHERE "Game"."GameIsFinished" = 1 ORDER BY "Game"."LastMove" DESC LIMIT :startpoint:, 100';
        $me = $_SESSION['MyUserID'];
    } else {
        $Query = 'SELECT "Game"."GameID", "Game"."Friendly", "Game"."GameName", "Game"."GTitleDeletedByAdmin", "Game"."LastMove", "Game"."GameCreator", "Game"."OriginalPlayers", "Game"."CurrentPlayers", "Game"."RailPhase", "Game"."Round", "Game"."NumRounds", "Game"."GameStatus", "GameVersion"."ShortVersionName", "GameVersionGroup"."VersionName", "GameVersion"."VersionNameSuffix", "GameVersion"."Creators", "User"."Name" AS "GameCreatorName" FROM "Game" JOIN "GameVersion" ON "Game"."GVersion" = "GameVersion"."VersionID" JOIN "GameVersionGroup" ON "GameVersion"."VersionGroup" = "GameVersionGroup"."VersionGroupID" JOIN "User" ON "Game"."GameCreator" = "User"."UserID" WHERE "Game"."GameIsFinished" = 1 ORDER BY "Game"."LastMove" DESC LIMIT :startpoint:, 100';
        $me = 0;
    }
    $QueryResult = dbquery(DBQUERY_READ_RESULTSET, $Query, 'me', $me, 'startpoint', $StartPoint);
    $CountQueryResult = dbquery(DBQUERY_READ_INTEGER_TOLERANT_ZERO, 'SELECT "MetadatumValue" FROM "Metadatum" WHERE "MetadatumName" = \'Games-Finished\'');
    if (!$CountQueryResult) {
        return false;
    }
    require_once HIDDEN_FILES_PATH . 'paginate.php';
    $PaginationBar = paginationbar('game', 'games', SITE_ADDRESS . 'oldgames.php', null, 100, $Pagenum, $CountQueryResult);
    $tt->append($PaginationBar[0]);
    if ($QueryResult === 'NONE') {
        return;
    }
    $tt->opennode('table', 'class="table_extra_horizontal_padding"');
    $tt->opennode('thead');
    $tt->opennode('tr');
    $tt->leaf('th', 'Name', 'colspan=2 style="width: 270px;"');
    $tt->leaf('th', 'Creator');
    $tt->leaf('th', 'Friendly?');
    $tt->leaf('th', 'Original', 'title="The number of players the game had when it started."');
    $tt->leaf('th', 'Final', 'title="The number of players the game had when it finished."');
    $tt->leaf('th', 'Status');
    $tt->leaf('th', 'Round');
    $tt->leaf('th', 'Last Move <span style="font-weight: normal;">(GMT)</span>');
    $tt->closenode(2);
    // tr, thead
    $tt->opennode('tbody');
    $RoundColumnStyles = array('gamelist_roundcol_c', 'gamelist_roundcol_r');
    while ($row = db_fetch_assoc($QueryResult)) {
        if ($row['GTitleDeletedByAdmin']) {
            $row['GameName'] = 'The title of this game has been cleared by an Administrator';
        }
        $RowTagAttributes = null;
        if ($_SESSION['LoggedIn']) {
            $GameCreatorColumn = '<a href="userdetails.php?UserID=' . $row['GameCreator'] . '">' . $row['GameCreatorName'] . '</a>';
            if (!is_null($row['User'])) {
                $RowTagAttributes = 'class="mygame"';
            }
        } else {
            $GameCreatorColumn = $row['GameCreatorName'];
        }
        $tt->opennode('tr', $RowTagAttributes);
        $version_name = vname($row['VersionName'], $row['VersionNameSuffix']);
        $tt->leaf('td', '<img src="gfx/icon-' . strtolower($row['ShortVersionName']) . '.png" alt="' . $version_name . '" title="' . $version_name . ' (' . $row['Creators'] . ')">', 'width=23 style="border-right: none;"');
        $tt->leaf('td', '<a href="board.php?GameID=' . $row['GameID'] . '">' . $row['GameName'] . '</a>', 'style="border-left: none; padding-left: 0px; text-align: left;"');
        $tt->leaf('td', $GameCreatorColumn);
        if ($row['Friendly']) {
            $tt->leaf('td', transtext('^Yes'), 'bgcolor="#9FFF9F"');
        } else {
            $tt->leaf('td', transtext('^No'), 'bgcolor="#FFC18A"');
        }
        $tt->leaf('td', $row['OriginalPlayers']);
        $tt->leaf('td', $row['CurrentPlayers']);
        $tt->leaf('td', $row['GameStatus']);
        $tt->leaf('td', ($row['Round'] >= 10 ? '' : '&nbsp;&nbsp;') . $row['Round'] . ' / ' . $row['NumRounds'], 'class="' . $RoundColumnStyles[$row['RailPhase']] . '"');
        $lmtime = strtotime($row['LastMove']);
        $tt->opennode('td');
        $tt->leaf('span', date('Y', $lmtime), 'style="font-size: 50%;"');
        $tt->text(date('M-d H:i:s', $lmtime));
        $tt->closenode(2);
        // td, tr
    }
    $tt->closenode(2);
    // tbody, table
    $tt->append($PaginationBar[1]);
}
Example #3
0
function gamelistdisplayx(tagtree &$tt)
{
    if ($_SESSION['LoggedIn']) {
        $Query = 'CALL "ListGamesNeedingReplacements_LoggedIn"(:me:)';
        $me = $_SESSION['MyUserID'];
    } else {
        $Query = 'CALL "ListGamesNeedingReplacements_LoggedOut"()';
        $me = 0;
    }
    $QueryResult = dbquery(DBQUERY_READ_RESULTSET, $Query, 'me', $me);
    if ($QueryResult === 'NONE') {
        $tt->leaf('p', 'None');
        return;
    }
    $tt->opennode('table', 'class="table_extra_horizontal_padding"');
    $tt->opennode('thead');
    $tt->opennode('tr');
    $tt->leaf('th', 'Name', 'colspan=2 style="width: 270px;"');
    $tt->leaf('th', 'Creator');
    $tt->leaf('th', 'Friendly?');
    $tt->leaf('th', 'Found?', 'title="Has at least one candidate replacement been found for the seat that is unfilled?"');
    $tt->leaf('th', 'Original', 'title="The number of players the game had when it started."');
    $tt->leaf('th', 'Current', 'title="The number of players (as in seats, whether filled or unfilled) the game has at present."');
    $tt->leaf('th', '<a href="http://orderofthehammer.com/credits.htm#acronyms">TLA</a>', 'style="min-width: 36px;" title="&quot;Time Limit A&quot; - click the link for more information."');
    $tt->leaf('th', '<a href="http://orderofthehammer.com/credits.htm#acronyms">TLB</a>', 'style="min-width: 36px;" title="&quot;Time Limit B&quot; - click the link for more information."');
    $tt->leaf('th', 'Round', 'style="width: 46px;"');
    $tt->leaf('th', 'Talk Rules', 'style="min-width: 100px;"');
    $tt->closenode(2);
    // tr, thead
    $tt->opennode('tbody');
    $RoundColumnStyles = array('gamelist_roundcol_c', 'gamelist_roundcol_r');
    $OldGameID = 0;
    while ($row = db_fetch_assoc($QueryResult)) {
        if ($row['GameID'] != $OldGameID) {
            $OldGameID = $row['GameID'];
            if ($row['GTitleDeletedByAdmin']) {
                $row['GameName'] = 'The title of this game has been cleared by an Administrator';
            }
            $RowTagAttributes = null;
            if ($_SESSION['LoggedIn']) {
                $GameCreatorColumn = '<a href="userdetails.php?UserID=' . $row['GameCreator'] . '">' . $row['GameCreatorName'] . '</a>';
                if (!is_null($row['User'])) {
                    if (!is_null($row['Colour'])) {
                        $RowTagAttributes = 'class="mymove"';
                    } else {
                        if ($row['AbortVote'] == '00000' and $row['KickVote'] == '00000') {
                            $RowTagAttributes = 'class="mygame"';
                        } else {
                            $RowTagAttributes = 'class="myattn"';
                        }
                    }
                }
            } else {
                $GameCreatorColumn = $row['GameCreatorName'];
            }
            if ($row['TimeLimitA'] <= 1080) {
                $TLACellAttributes = 'class="alert"';
            } else {
                if ($row['TimeLimitA'] <= 1800) {
                    $TLACellAttributes = 'style="font-weight: bold;"';
                } else {
                    $TLACellAttributes = null;
                }
            }
            if ($row['TimeLimitB'] <= 2160) {
                $TLBCellAttributes = 'class="alert"';
            } else {
                if ($row['TimeLimitB'] <= 3600) {
                    $TLBCellAttributes = 'style="font-weight: bold;"';
                } else {
                    $TLBCellAttributes = null;
                }
            }
            $tt->opennode('tr', $RowTagAttributes);
            $version_name = vname($row['VersionName'], $row['VersionNameSuffix']);
            $tt->leaf('td', '<img src="gfx/icon-' . strtolower($row['ShortVersionName']) . '.png" alt="' . $version_name . '" title="' . $version_name . ' (' . $row['Creators'] . ')">', 'width=23 style="border-right: none;"');
            $tt->leaf('td', '<a href="board.php?GameID=' . $row['GameID'] . '">' . $row['GameName'] . '</a>', 'style="border-left: none; padding-left: 0px; text-align: left;"');
            $tt->leaf('td', $GameCreatorColumn);
            if ($row['Friendly']) {
                $tt->leaf('td', transtext('^Yes'), 'bgcolor="#9FFF9F"');
            } else {
                $tt->leaf('td', transtext('^No'), 'bgcolor="#FFC18A"');
            }
            if (is_null($row['Colour'])) {
                $tt->leaf('td', transtext('^No'), 'bgcolor="#FFC18A"');
            } else {
                $tt->leaf('td', transtext('^Yes'), 'bgcolor="#9FFF9F"');
            }
            $tt->leaf('td', $row['OriginalPlayers']);
            $tt->leaf('td', $row['CurrentPlayers']);
            $tt->leaf('td', minutes_mhd($row['TimeLimitA']), $TLACellAttributes);
            $tt->leaf('td', minutes_mhd($row['TimeLimitB']), $TLBCellAttributes);
            $tt->leaf('td', ($row['Round'] >= 10 ? '' : '&nbsp;&nbsp;') . $row['Round'] . ' / ' . $row['NumRounds'], 'class="' . $RoundColumnStyles[$row['RailPhase']] . '"');
            $tt->leaf('td', $row['TalkRules']);
            $tt->closenode();
        }
    }
    $tt->closenode(2);
    // tbody, table
}
Example #4
0
function security_script_input($expression, $value, $mode = 0)
{
    // if the input matches the regex, all is good, otherwise set to "error".
    if (preg_match($expression, $value)) {
        $value = addslashes($value);
        return $value;
    } else {
        // failure to validate
        if ($mode) {
            $valuename = vname($valuename);
            $_SESSION["error"]["message"][] = "Invalid " . lang_trans($valuename) . " supplied, please correct.";
            $_SESSION["error"][$valuename] = 0;
            return $value;
        } else {
            return "error";
        }
    }
}
Example #5
0
 $RatingOptions->next();
 $RatingOptions->leaf('td', '');
 $RatingOptions->leaf('td', '(Your rating is ' . $Rating . '. You cannot create a private game with a minimum or maximum player rating - if creating a private game, leave these set to "0" and "none" respectively. Your game <b>must</b> be a Competitive game if you set a <b>minimum</b> player rating - the setting of the tickbox option above will be ignored. However, you <b>can</b> create a Friendly game and give it a <b>maximum</b> player rating.)', 'class="font_serif"');
 $RatingOptions->closenode();
 // tr
 if ($Administrator) {
     $QR = dbquery(DBQUERY_READ_RESULTSET, 'SELECT "GameVersion"."VersionID", "GameVersionGroup"."VersionName", "GameVersion"."VersionNameSuffix", "GameVersion"."Creators", "GameVersion"."MinimumPlayersAllowed", "GameVersion"."MaximumPlayersAllowed" FROM "GameVersion" JOIN "GameVersionGroup" ON "GameVersion"."VersionGroup" = "GameVersionGroup"."VersionGroupID"');
 } else {
     $QR = dbquery(DBQUERY_READ_RESULTSET, 'SELECT "GameVersion"."VersionID", "GameVersionGroup"."VersionName", "GameVersion"."VersionNameSuffix", "GameVersion"."Creators", "GameVersion"."MinimumPlayersAllowed", "GameVersion"."MaximumPlayersAllowed" FROM "GameVersion" LEFT JOIN "GameVersionAuth" JOIN "GameVersionGroup" ON "GameVersion"."VersionGroup" = "GameVersionGroup"."VersionGroupID" ON "GameVersion"."VersionID" = "GameVersionAuth"."Version" AND "GameVersionAuth"."User" = :user: WHERE "GameVersion"."GVAdminOnly" = 0 OR "GameVersionAuth"."User" IS NOT NULL', 'user', $_SESSION['MyUserID']);
 }
 if ($QR === 'NONE') {
     myerror($unexpectederrormessage, 'No game versions to display', MYERROR_NOT_IN_FUNCTION);
 }
 $VersionString = fragment::blank();
 while ($row = db_fetch_assoc($QR)) {
     $VersionString->leaf('option', vname($row['VersionName'], $row['VersionNameSuffix']) . ' (' . $row['Creators'] . ') (' . $row['MinimumPlayersAllowed'] . '-' . $row['MaximumPlayersAllowed'] . ')', 'value=' . $row['VersionID']);
 }
 if ($DefaultFriendly) {
     $FriendlyChecked = ' checked';
 } else {
     $FriendlyChecked = '';
 }
 if ($DefaultNoSC) {
     $ScotCanalChecked = ' checked';
 } else {
     $ScotCanalChecked = '';
 }
 if ($DefaultRVC) {
     $RVCChecked = ' checked';
 } else {
     $RVCChecked = '';
Example #6
0
function gamegetdata_lobby($GameID, $DoingWork)
{
    global $Administrator;
    $GAME = dbquery(DBQUERY_READ_SINGLEROW, 'CALL "GameGetData_Lobby_DisplayOrModify"(:gameid:)', 'gameid', $GameID);
    $QRP = dbquery(DBQUERY_READ_RESULTSET, 'CALL "GameGetData_User_Modify"(:gameid:)', 'gameid', $GameID);
    if ($GAME === 'NONE') {
        return false;
    }
    if ($GAME['GameStatus'] == 'Cancelled' and !$Administrator) {
        return false;
    }
    if ($GAME['GameStatus'] != 'Recruiting' and $GAME['GameStatus'] != 'Cancelled') {
        return 'WRONG PAGE';
    }
    $colournames = array(transtext('_colourRed'), transtext('_colourYellow'), transtext('_colourGreen'), transtext('_colourPurple'), transtext('_colourGrey'));
    $pronounmap_BasicUppercase = array('He' => transtext('^pronounHeCap'), 'She' => transtext('^pronounSheCap'), 'It' => transtext('^pronounItCap'));
    $pronounmap_BasicLowercase = array('He' => transtext('^pronounHe'), 'She' => transtext('^pronounShe'), 'It' => transtext('^pronounIt'));
    // $pronounmap_PossessiveUppercase = array( 'He'  => transtext('^pronounHisPoCap'),
    //                                          'She' => transtext('^pronounHerPoCap'),
    //                                          'It'  => transtext('^pronounItsPoCap')
    //                                          );
    // Not currently needed
    $pronounmap_PossessiveLowercase = array('He' => transtext('^pronounHisPo'), 'She' => transtext('^pronounHerPo'), 'It' => transtext('^pronounItsPo'));
    $pronounmap_IndirectObjectLowercase = array('He' => transtext('^pronounHimIO'), 'She' => transtext('^pronounHerIO'), 'It' => transtext('^pronounItIO'));
    $GAME['GameID'] = $GameID;
    $GAME['SpecialRules'] = (int) $GAME['SpecialRules'];
    for ($i = 0; $i < MAX_PLAYERS; $i++) {
        $GAME['PlayerName'][$i] = '';
        $GAME['PlayerFullName'][$i] = '';
    }
    $GAME['MyColour'] = 50;
    while ($row = db_fetch_assoc($QRP)) {
        $GAME['PlayerUserID'][$row['Colour']] = $row['UserID'];
        $GAME['PlayerName'][$row['Colour']] = $row['Name'];
        $GAME['PlayerFullName'][$row['Colour']] = $colournames[$row['Colour']] . ' (' . $row['Name'] . ')';
        $GAME['Pronoun_Eng'][$row['Colour']] = $row['Pronoun'];
        $GAME['PlayerRating'][$row['Colour']] = $row['Rating'];
        $GAME['Pronoun'][$row['Colour']] = $pronounmap_BasicUppercase[$row['Pronoun']];
        $GAME['PronounLC'][$row['Colour']] = $pronounmap_BasicLowercase[$row['Pronoun']];
        $GAME['PossessivePronounLC'][$row['Colour']] = $pronounmap_PossessiveLowercase[$row['Pronoun']];
        $GAME['OtherPronounLC'][$row['Colour']] = $pronounmap_IndirectObjectLowercase[$row['Pronoun']];
        $GAME['Email'][$row['Colour']] = $row['Email'];
        $GAME['EmailPrompt'][$row['Colour']] = $row['EmailPrompt'];
        $GAME['EmailPromptAgain'][$row['Colour']] = $row['EmailPromptAgain'];
        $GAME['HasBeenEmailed'][$row['Colour']] = $row['HasBeenEmailed'];
        if ($_SESSION['LoggedIn'] and $_SESSION['MyUserID'] == $row['UserID']) {
            $GAME['MyColour'] = $row['Colour'];
        }
    }
    $GAME['TimeLimitA_Minutes'] = $GAME['TimeLimitA'];
    $GAME['TimeLimitB_Minutes'] = $GAME['TimeLimitB'];
    if ($DoingWork) {
        if (is_null($GAME['CardsToRemove'])) {
            $GAME['CardsToRemove'] = array();
        } else {
            $GAME['CardsToRemove'] = explode('|', $GAME['CardsToRemove']);
        }
        $GAME['SpaceAlwaysExists'] = explode('|', $GAME['SpaceAlwaysExists']);
        $GAME['CanalAlwaysExists'] = explode('|', $GAME['CanalAlwaysExists']);
        $GAME['carddetailarrayb'] = explode('|', $GAME['CardDetailArrayB']);
        $GAME['ExternalLocations'] = explode('|', $GAME['ExternalLocations']);
        $GAME['NumTowns'] = count($GAME['ExternalLocations']);
        $GAME['NumIndustrySpaces'] = count($GAME['SpaceAlwaysExists']);
        $GAME['NumCanalLinks'] = count($GAME['CanalAlwaysExists']);
        dbquery(DBQUERY_START_TRANSACTION);
    } else {
        $GAME['VersionName'] = vname($GAME['VersionName'], $GAME['VersionNameSuffix']);
        if ($GAME['GTitleDeletedByAdmin']) {
            $GAME['GameName_Title'] = transtext('_GameTitleHidden');
            if ($Administrator) {
                $GAME['GameName_Page'] = '<b>' . $GAME['GameName'] . '</b> (Title hidden to non-Administrators)';
            } else {
                $GAME['GameName_Page'] = '<b>' . transtext('_GameTitleHidden') . '</b>';
            }
        } else {
            $GAME['GameName_Title'] = $GAME['GameName'];
            $GAME['GameName_Page'] = '<b>' . $GAME['GameName'] . '</b>';
        }
        if ($GAME['TimeLimitA'] % 1440 == 0) {
            $GAME['TimeLimitA'] /= 1440;
            if ($GAME['TimeLimitA'] == 1) {
                $GAME['TimeLimitAunit'] = transtext('_timeDay');
            } else {
                $GAME['TimeLimitAunit'] = transtext('_timeDayPl');
            }
        } else {
            if ($GAME['TimeLimitA'] % 60 == 0) {
                $GAME['TimeLimitA'] /= 60;
                if ($GAME['TimeLimitA'] == 1) {
                    $GAME['TimeLimitAunit'] = transtext('_timeHour');
                } else {
                    $GAME['TimeLimitAunit'] = transtext('_timeHourPl');
                }
            } else {
                $GAME['TimeLimitAunit'] = transtext('_timeMinutePl');
            }
        }
        if ($GAME['TimeLimitB'] % 1440 == 0) {
            $GAME['TimeLimitB'] /= 1440;
            if ($GAME['TimeLimitB'] == 1) {
                $GAME['TimeLimitBunit'] = transtext('_timeDay');
            } else {
                $GAME['TimeLimitBunit'] = transtext('_timeDayPl');
            }
        } else {
            if ($GAME['TimeLimitB'] % 60 == 0) {
                $GAME['TimeLimitB'] /= 60;
                if ($GAME['TimeLimitB'] == 1) {
                    $GAME['TimeLimitBunit'] = transtext('_timeHour');
                } else {
                    $GAME['TimeLimitBunit'] = transtext('_timeHourPl');
                }
            } else {
                $GAME['TimeLimitBunit'] = transtext('_timeMinutePl');
            }
        }
    }
    return $GAME;
}
Example #7
0
function gamegetdata_board_see($GameID)
{
    $GAME = dbquery(DBQUERY_READ_SINGLEROW, 'CALL "GameGetData_Game_Display"(:gameid:)', 'gameid', $GameID);
    $QRP = dbquery(DBQUERY_READ_RESULTSET, 'CALL "GameGetData_User_Display"(:gameid:)', 'gameid', $GameID);
    if ($GAME === 'NONE') {
        return false;
    }
    if ($GAME['GameStatus'] == 'Cancelled' and !$Administrator) {
        return false;
    }
    if ($GAME['GameStatus'] == 'Recruiting' or $GAME['GameStatus'] == 'Cancelled') {
        return 'WRONG PAGE';
    }
    $colournames = array(transtext('_colourRed'), transtext('_colourYellow'), transtext('_colourGreen'), transtext('_colourPurple'), transtext('_colourGrey'));
    $pronounmap_BasicUppercase = array('He' => transtext('^pronounHeCap'), 'She' => transtext('^pronounSheCap'), 'It' => transtext('^pronounItCap'));
    $pronounmap_BasicLowercase = array('He' => transtext('^pronounHe'), 'She' => transtext('^pronounShe'), 'It' => transtext('^pronounIt'));
    // $pronounmap_PossessiveUppercase = array( 'He'  => transtext('^pronounHisPoCap'),
    //                                          'She' => transtext('^pronounHerPoCap'),
    //                                          'It'  => transtext('^pronounItsPoCap')
    //                                          );
    // Not currently needed
    $pronounmap_PossessiveLowercase = array('He' => transtext('^pronounHisPo'), 'She' => transtext('^pronounHerPo'), 'It' => transtext('^pronounItsPo'));
    $pronounmap_IndirectObjectLowercase = array('He' => transtext('^pronounHimIO'), 'She' => transtext('^pronounHerIO'), 'It' => transtext('^pronounItIO'));
    $GAME['VersionName'] = vname($GAME['VersionName'], $GAME['VersionNameSuffix']);
    if ($GAME['GTitleDeletedByAdmin']) {
        $GAME['GameName_Title'] = transtext('_GameTitleHidden');
        if ($Administrator) {
            $GAME['GameName_Page'] = '<b>' . $GAME['GameName'] . '</b> (Title hidden to non-Administrators)';
        } else {
            $GAME['GameName_Page'] = '<b>' . transtext('_GameTitleHidden') . '</b>';
        }
    } else {
        $GAME['GameName_Title'] = $GAME['GameName'];
        $GAME['GameName_Page'] = '<b>' . $GAME['GameName'] . '</b>';
    }
    $GAME['locationnames'] = explode('|', $GAME['LocationNames']);
    $GAME['spacetowns'] = explode('|', $GAME['SpaceTowns']);
    $GAME['tileindustries'] = explode('|', $GAME['TileIndustries']);
    $GAME['CanalStarts'] = explode('|', $GAME['CanalStarts']);
    $GAME['CanalEnds'] = explode('|', $GAME['CanalEnds']);
    $GAME['RailStarts'] = explode('|', $GAME['RailStarts']);
    $GAME['RailEnds'] = explode('|', $GAME['RailEnds']);
    $GAME['CanalAlwaysExists'] = explode('|', $GAME['CanalAlwaysExists']);
    $GAME['CanalExistenceArray'] = explode('|', $GAME['CanalExistenceArray']);
    $GAME['RailAlwaysExists'] = explode('|', $GAME['RailAlwaysExists']);
    $GAME['RailExistenceArray'] = explode('|', $GAME['RailExistenceArray']);
    $GAME['SpaceAlwaysExists'] = explode('|', $GAME['SpaceAlwaysExists']);
    $GAME['SpaceExistenceArray'] = explode('|', $GAME['SpaceExistenceArray']);
    $GAME['carddetailarray'] = explode('|', $GAME['CardDetailArray']);
    $GAME['carddetailarrayb'] = explode('|', $GAME['CardDetailArrayB']);
    $GAME['SpaceNumbersNotOrdinal'] = explode('|', $GAME['SpaceNumbers']);
    $GAME['spacenumbers'] = explode('|', $GAME['SpaceOrdinals']);
    $GAME['LocationAutoValue'] = explode('|', $GAME['LocationAutoValue']);
    $GAME['CanalExistenceArray'] = array_map('intval', $GAME['CanalExistenceArray']);
    $GAME['RailExistenceArray'] = array_map('intval', $GAME['RailExistenceArray']);
    $GAME['SpaceExistenceArray'] = array_map('intval', $GAME['SpaceExistenceArray']);
    $GAME['ModularBoardParts'] = (int) $GAME['ModularBoardParts'];
    $GAME['SpecialRules'] = (int) $GAME['SpecialRules'];
    if (is_null($GAME['TileXPositionsPretty'])) {
        $GAME['TileXPositions'] = array(null, explode('|', $GAME['TileXPositionsCompact']));
        $GAME['TileYPositions'] = array(null, explode('|', $GAME['TileYPositionsCompact']));
    } else {
        $GAME['TileXPositions'] = array(explode('|', $GAME['TileXPositionsPretty']), explode('|', $GAME['TileXPositionsCompact']));
        $GAME['TileYPositions'] = array(explode('|', $GAME['TileYPositionsPretty']), explode('|', $GAME['TileYPositionsCompact']));
    }
    if ($GAME['RailPhase']) {
        if (is_null($GAME['RailXPositionsPretty'])) {
            $GAME['LinkDotXPositions'] = array(null, explode('|', $GAME['RailXPositionsCompact']));
            $GAME['LinkDotYPositions'] = array(null, explode('|', $GAME['RailYPositionsCompact']));
        } else {
            $GAME['LinkDotXPositions'] = array(explode('|', $GAME['RailXPositionsPretty']), explode('|', $GAME['RailXPositionsCompact']));
            $GAME['LinkDotYPositions'] = array(explode('|', $GAME['RailYPositionsPretty']), explode('|', $GAME['RailYPositionsCompact']));
        }
    } else {
        if (is_null($GAME['CanalXPositionsPretty'])) {
            $GAME['LinkDotXPositions'] = array(null, explode('|', $GAME['CanalXPositionsCompact']));
            $GAME['LinkDotYPositions'] = array(null, explode('|', $GAME['CanalYPositionsCompact']));
        } else {
            $GAME['LinkDotXPositions'] = array(explode('|', $GAME['CanalXPositionsPretty']), explode('|', $GAME['CanalXPositionsCompact']));
            $GAME['LinkDotYPositions'] = array(explode('|', $GAME['CanalYPositionsPretty']), explode('|', $GAME['CanalYPositionsCompact']));
        }
    }
    $GAME['NumTowns'] = count($GAME['locationnames']);
    $GAME['NumIndustrySpaces'] = count($GAME['spacetowns']);
    $GAME['NumCanalLinks'] = count($GAME['CanalStarts']);
    $GAME['NumRailLinks'] = count($GAME['RailEnds']);
    $NumLinks = $GAME['RailPhase'] ? $GAME['NumRailLinks'] : $GAME['NumCanalLinks'];
    if ($NumLinks % 2) {
        $GAME['LinkStatus'] = substr($GAME['LinkStatus'], 0, -1);
    }
    if ($GAME['NumIndustrySpaces'] % 2) {
        $GAME['SpaceStatus'] = substr($GAME['SpaceStatus'], 0, -1);
        $GAME['SpaceTile'] = substr($GAME['SpaceTile'], 0, -1);
        $GAME['TechLevels'] = substr($GAME['TechLevels'], 0, -1);
        $GAME['SpaceCubes'] = substr($GAME['SpaceCubes'], 0, -1);
    }
    $GAME['CoalInLancs'] = 0;
    $GAME['IronInLancs'] = 0;
    for ($i = 0; $i < $GAME['NumIndustrySpaces']; $i++) {
        if ($GAME['SpaceStatus'][$i] != 9 and $GAME['SpaceTile'][$i] == 1) {
            $GAME['CoalInLancs'] += $GAME['SpaceCubes'][$i];
        }
        if ($GAME['SpaceStatus'][$i] != 9 and $GAME['SpaceTile'][$i] == 2) {
            $GAME['IronInLancs'] += $GAME['SpaceCubes'][$i];
        }
    }
    $GAME['Money'] = explode('|', $GAME['Money']);
    $GAME['AmountSpent'] = explode('|', $GAME['AmountSpent']);
    $GAME['VictoryPoints'] = explode('|', $GAME['VictoryPoints']);
    $GAME['IncomeSpace'] = explode('|', $GAME['IncomeSpace']);
    $GAME['RemainingTiles'] = str_split($GAME['RemainingTiles'], MAX_PLAYERS);
    for ($i = 0; $i < 6; $i++) {
        $GAME['RemainingTiles'][$i] = array_map('hexdec', str_split($GAME['RemainingTiles'][$i]));
    }
    if (is_null($GAME['Cards']) or $GAME['Cards'] == '') {
        $GAME['Cards'] = array(array(), array(), array(), array(), array());
        $GAME['HandSize'] = array(0, 0, 0, 0, 0);
    } else {
        $GAME['Cards'] = explode(':', $GAME['Cards']);
        for ($i = 0; $i < MAX_PLAYERS; $i++) {
            $GAME['Cards'][$i] = explode('|', $GAME['Cards'][$i]);
            $GAME['HandSize'][$i] = count($GAME['Cards'][$i]);
            if ($GAME['HandSize'][$i] == 1 and $GAME['Cards'][$i][0] == '') {
                $GAME['Cards'][$i] = array();
                $GAME['HandSize'][$i] = 0;
            }
        }
    }
    $GAME['CanTakeLoans'] = 1;
    if ($GAME['GameIsFinished'] or $GAME['IncomeSpace'][$GAME['PlayerToMove']] == 0 or $GAME['RailPhase'] and $GAME['NumRounds'] - $GAME['Round'] < 4) {
        $GAME['CanTakeLoans'] = 0;
    }
    if ($GAME['TilesDrawn'] == 'None') {
        $GAME['NumberOfTilesDrawn'] = 0;
    } else {
        $GAME['NumberOfTilesDrawn'] = strlen($GAME['TilesDrawn']);
    }
    if ($GAME['GameStatus'] == 'In Progress' and time() - strtotime($GAME['LastMove']) > 60 * $GAME['TimeLimitA'] and !MAINTENANCE_DISABLED) {
        $GAME['CanKickVote'] = 1;
    } else {
        $GAME['CanKickVote'] = 0;
    }
    if ($GAME['TimeLimitA'] % 1440 == 0) {
        $GAME['TimeLimitA'] /= 1440;
        if ($GAME['TimeLimitA'] == 1) {
            $GAME['TimeLimitAunit'] = transtext('_timeDay');
        } else {
            $GAME['TimeLimitAunit'] = transtext('_timeDayPl');
        }
    } else {
        if ($GAME['TimeLimitA'] % 60 == 0) {
            $GAME['TimeLimitA'] /= 60;
            if ($GAME['TimeLimitA'] == 1) {
                $GAME['TimeLimitAunit'] = transtext('_timeHour');
            } else {
                $GAME['TimeLimitAunit'] = transtext('_timeHourPl');
            }
        } else {
            $GAME['TimeLimitAunit'] = transtext('_timeMinutePl');
        }
    }
    if ($GAME['TimeLimitB'] % 1440 == 0) {
        $GAME['TimeLimitB'] /= 1440;
        if ($GAME['TimeLimitB'] == 1) {
            $GAME['TimeLimitBunit'] = transtext('_timeDay');
        } else {
            $GAME['TimeLimitBunit'] = transtext('_timeDayPl');
        }
    } else {
        if ($GAME['TimeLimitB'] % 60 == 0) {
            $GAME['TimeLimitB'] /= 60;
            if ($GAME['TimeLimitB'] == 1) {
                $GAME['TimeLimitBunit'] = transtext('_timeHour');
            } else {
                $GAME['TimeLimitBunit'] = transtext('_timeHourPl');
            }
        } else {
            $GAME['TimeLimitBunit'] = transtext('_timeMinutePl');
        }
    }
    switch ($GAME['SpecialModes']) {
        case 1:
            $GAME['DebtMode'] = 1;
            $GAME['ContinueSellingMode'] = 0;
            $GAME['SecondRailMode'] = 0;
            $GAME['SecondDevelopMode'] = 0;
            break;
        case 2:
            $GAME['DebtMode'] = 0;
            $GAME['ContinueSellingMode'] = 1;
            $GAME['SecondRailMode'] = 0;
            $GAME['SecondDevelopMode'] = 0;
            break;
        case 3:
            $GAME['DebtMode'] = 0;
            $GAME['ContinueSellingMode'] = 0;
            $GAME['SecondRailMode'] = 1;
            $GAME['SecondDevelopMode'] = 0;
            break;
        case 4:
            $GAME['DebtMode'] = 0;
            $GAME['ContinueSellingMode'] = 0;
            $GAME['SecondRailMode'] = 0;
            $GAME['SecondDevelopMode'] = 1;
            break;
        default:
            $GAME['DebtMode'] = 0;
            $GAME['ContinueSellingMode'] = 0;
            $GAME['SecondRailMode'] = 0;
            $GAME['SecondDevelopMode'] = 0;
    }
    $GAME['HasBuilt'] = array(0, 0, 0, 0, 0);
    for ($i = 0; $i < MAX_PLAYERS; $i++) {
        if (strpos($GAME['SpaceStatus'], $i) !== false or strpos($GAME['LinkStatus'], $i) !== false) {
            $GAME['HasBuilt'][$i] = 1;
        }
    }
    if ($GAME['GVersion'] == 2) {
        $GAME['NarrativeTicker'] = 2;
    } else {
        if (is_null($GAME['GameTicker'])) {
            $GAME['NarrativeTicker'] = 1;
        } else {
            $GAME['NarrativeTicker'] = 0;
        }
    }
    for ($i = 0; $i < MAX_PLAYERS; $i++) {
        $GAME['PlayerName'][$i] = transtext('_PlayerBoxAbsent');
        $GAME['PlayerFullName'][$i] = $colournames[$i] . ' (' . $GAME['PlayerName'][$i] . ')';
    }
    $GAME['MyColour'] = 50;
    $GAME['PlayersMissing'] = (int) $GAME['CurrentPlayers'];
    $GAME['PlayerMissing'] = $GAME['PlayerExists'];
    if (is_null($GAME['AbortVote']) or $GAME['AbortVote'] == '') {
        $GAME['AbortVote'] = '00000';
    }
    if (is_null($GAME['KickVote']) or $GAME['KickVote'] == '') {
        $GAME['KickVote'] = '00000';
    }
    if ($GAME['GameStatus'] == 'In Progress' and strpos($GAME['KickVote'], '1') !== false) {
        $GAME['CanKickVote'] = 1;
    }
    while ($row = db_fetch_assoc($QRP)) {
        $GAME['PlayersMissing']--;
        $GAME['PlayerMissing'][$row['Colour']] = 0;
        $GAME['PlayerUserID'][$row['Colour']] = $row['UserID'];
        $GAME['PlayerName'][$row['Colour']] = $row['Name'];
        $GAME['PlayerFullName'][$row['Colour']] = $colournames[$row['Colour']] . ' (' . $row['Name'] . ')';
        $GAME['Pronoun'][$row['Colour']] = $pronounmap_BasicUppercase[$row['Pronoun']];
        $GAME['PronounLC'][$row['Colour']] = $pronounmap_BasicLowercase[$row['Pronoun']];
        $GAME['PossessivePronounLC'][$row['Colour']] = $pronounmap_PossessiveLowercase[$row['Pronoun']];
        $GAME['OtherPronounLC'][$row['Colour']] = $pronounmap_IndirectObjectLowercase[$row['Pronoun']];
        $GAME['Notes'][$row['Colour']] = $row['Notes'];
        if ($_SESSION['LoggedIn'] and $_SESSION['MyUserID'] == $row['UserID']) {
            $GAME['MyColour'] = $row['Colour'];
            if ($GAME['AbortVote'][$row['Colour']]) {
                $GAME['IHaveAbortVoted'] = 1;
            } else {
                $GAME['IHaveAbortVoted'] = 0;
            }
            if ($GAME['KickVote'][$row['Colour']]) {
                $GAME['IHaveKickVoted'] = 1;
            } else {
                $GAME['IHaveKickVoted'] = 0;
            }
        }
    }
    $GAME['PlayerMissingAndMatters'] = $GAME['PlayerMissing'];
    $GAME['PlayersMissingThatMatter'] = $GAME['PlayersMissing'];
    for ($i = 0; $i < MAX_PLAYERS; $i++) {
        if ($GAME['PlayerMissing'][$i] and $GAME['RailPhase'] and $GAME['PlayerToMove'] != $i and !$GAME['HandSize'][$i]) {
            $GAME['PlayersMissingThatMatter']--;
            $GAME['PlayerMissingAndMatters'][$i] = 0;
        }
    }
    $GAME['PlayersVotingToAbort'] = 0;
    $GAME['PlayersVotingToKick'] = 0;
    $GAME['AbortVoteActive'] = false;
    $GAME['KickVoteActive'] = false;
    for ($i = 0; $i < MAX_PLAYERS; $i++) {
        if ($GAME['PlayerMissing'][$i] or $GAME['AbortVote'][$i]) {
            $GAME['PlayersVotingToAbort']++;
        }
        if ($GAME['PlayerMissing'][$i] or $GAME['KickVote'][$i]) {
            $GAME['PlayersVotingToKick']++;
        }
        if ($GAME['AbortVote'][$i]) {
            $GAME['AbortVoteActive'] = true;
        }
        if ($GAME['KickVote'][$i]) {
            $GAME['KickVoteActive'] = true;
        }
    }
    if ($GAME['PlayersMissingThatMatter']) {
        $GAME['ReplacementOffers'] = array();
        $GAME['ReplacementOffers_Users'] = array();
        $GAME['ReplacementOffers_Colours'] = array();
        $QRR = dbquery(DBQUERY_READ_RESULTSET, 'CALL "GameGetData_GetReplacements"(:game:)', 'game', $GameID);
        if ($QRR === 'NONE') {
            $GAME['NumReplacementOffers'] = 0;
        } else {
            $GAME['NumReplacementOffers'] = mysqli_num_rows($QRR);
            while ($row = db_fetch_assoc($QRR)) {
                $GAME['ReplacementOffers'][] = array($row['User'], $row['Name'], $row['Colour'], $row['Rating'], $row['ToCount']);
                $GAME['ReplacementOffers_Users'][] = $row['User'];
                $GAME['ReplacementOffers_Colours'][] = $row['Colour'];
            }
        }
    }
    return $GAME;
}