Beispiel #1
0
Datei: gae.php Projekt: hdp/brass
function DoTask()
{
    global $GAME, $unexpectederrormessage;
    if ($GAME['GameStatus'] != 'In Progress' and $GAME['GameStatus'] != 'Recruiting Replacement') {
        $mypage = page::standard();
        $mypage->title_body('Cannot abort this game');
        $mypage->leaf('p', 'This game cannot be aborted just now, perhaps because it has finished. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game, so you cannot vote to abort it. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['AbortVoteActive']) {
        myerror($unexpectederrormessage, 'Unexpected vote page "gae.php" reached');
    }
    if ($GAME['CurrentPlayers'] - $GAME['PlayersMissing'] == 1) {
        abortgame(0);
        dbformatgamedata();
        page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted and aborted game.');
    }
    $GAME['AbortVote'][$GAME['MyColour']] = 1;
    dbformatgamedata();
    for ($i = 0; $i < MAX_PLAYERS; $i++) {
        if ($GAME['PlayerExists'][$i] == 1 and !$GAME['PlayerMissing'][$i] and $i != $GAME['MyColour'] and $GAME['EmailPrompt'][$i] and $GAME['Email'][$i] != '') {
            $subject = 'There is a vote to abort game number ' . $GAME['GameID'];
            $body = '<p>This is an automated message. One of your fellow players in game number ' . $GAME['GameID'] . ' has initiated a vote to abort the game. In order for the game to be aborted, all of the players must agree; this means that a unanimous vote is required. Please visit the game\'s page and either vote in favour of aborting it, or shut the vote down by voting not to abort. Here is the URL of the game page:</p><p><a href="' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '">' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '</a></p>' . EMAIL_FOOTER;
            send_email($subject, $body, $GAME['Email'][$i], null);
        }
    }
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
}
Beispiel #2
0
Datei: gak.php Projekt: hdp/brass
function DoTask()
{
    global $GAME;
    if ($GAME['GameStatus'] != 'In Progress' and $GAME['GameStatus'] != 'Recruiting Replacement' or !$GAME['PlayersMissingThatMatter']) {
        $mypage = page::standard();
        $mypage->title_body('No replacements needed');
        $mypage->leaf('p', 'No replacement players are needed for this game at the moment. (Perhaps something happened after you loaded the board page.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $mycol = dbquery(DBQUERY_READ_SINGLEROW, 'SELECT "Colour" FROM "ReplacementOffer" WHERE "Game" = :game: AND "User" = :user:'******'game', $GAME['GameID'], 'user', $_SESSION['MyUserID']);
    if ($mycol === 'NONE') {
        $mypage = page::standard();
        $mypage->title_body('Not currently a candidate replacement');
        $mypage->leaf('p', 'You are not currently a candidate replacement. You might be seeing this message because you clicked the button twice. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    dbquery(DBQUERY_WRITE, 'DELETE FROM "ReplacementOffer" WHERE "Game" = :game: AND "User" = :user:'******'game', $GAME['GameID'], 'user', $_SESSION['MyUserID']);
    if ($mycol['Colour'] == $GAME['PlayerToMove']) {
        $GAME['AltGameTicker'] .= '8F' . callmovetimediff() . letter_end_number($_SESSION['MyUserID']) . letter_end_number($_SESSION['MyGenderCode']);
        $GAME['GameTickerNames'] .= '|' . $_SESSION['MyUserName'];
        dbformatgamedata();
    } else {
        dbquery(DBQUERY_COMMIT);
    }
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully withdrew request.');
}
Beispiel #3
0
Datei: gab.php Projekt: hdp/brass
function DoTask()
{
    global $Administrator, $GAME;
    if (!$Administrator) {
        $mypage = page::standard();
        $mypage->title_body('Not authorised');
        $mypage->leaf('p', 'You are not authorised to make use of this page. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $thenumber = sanitise_int(@$_POST['thenumber']);
    if ($thenumber < -9 or $thenumber > 99 or $thenumber == 0) {
        $mypage = page::standard();
        $mypage->title_body('Invalid input');
        $mypage->leaf('p', 'Expected a nonzero integer between -9 and 99 inclusive, but received ' . $thenumber . '. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $interval = sanitise_enum(@$_POST['theinterval'], array('MINUTE', 'HOUR', 'DAY'));
    if (@$_POST['whattime'] == 'now') {
        $whattime = 'UTC_TIMESTAMP()';
    } else {
        $whattime = '"LastMove"';
    }
    $time_expr = 'TIMESTAMPADD(' . $interval . ', :thenumber:, ' . $whattime . ')';
    dbquery(DBQUERY_WRITE, 'UPDATE "Game" JOIN "GameInProgress" ON "Game"."GameID" = "GameInProgress"."Game" SET "Game"."LastMove" = ' . $time_expr . ', "GameInProgress"."GIPLastMove" = ' . $time_expr . ' "Game"."GameTicker" = CONCAT("Game"."GameTicker", :tickerconcat:), "Game"."GameTickerNames" = CONCAT("Game"."GameTickerNames", :namesconcat:) WHERE "GameID" = :game:', 'thenumber', $thenumber, 'tickerconcat', '3A' . callmovetimediff() . letter_end_number($_SESSION['MyUserID']) . letter_end_number($_SESSION['MyGenderCode']), 'namesconcat', '|' . $_SESSION['MyUserName'], 'game', $GAME['GameID']);
    dbquery(DBQUERY_COMMIT);
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully altered clock.');
}
Beispiel #4
0
Datei: gaq.php Projekt: hdp/brass
function DoTask()
{
    global $GAME;
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (@$_POST['FirstCardNotMyTurn'] == 'NoCardSelected' or @$_POST['SecondCardNotMyTurn'] == 'NoCardSelected') {
        $mypage = page::standard();
        $mypage->title_body('Cards not selected');
        $mypage->leaf('p', 'You omitted to select a card in one or both of the selection lists. Please select a card in each list and then try again. Click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $FC = sanitise_int(@$_POST['FirstCardNotMyTurn'], SANITISE_NO_FLAGS, 0, $GAME['HandSize'][$GAME['MyColour']] - 1);
    $SC = sanitise_int(@$_POST['SecondCardNotMyTurn'], SANITISE_NO_FLAGS, 0, $GAME['HandSize'][$GAME['MyColour']] - 1);
    if ($FC == $SC) {
        $mypage = page::standard();
        $mypage->title_body('Same cards selected');
        $mypage->leaf('p', 'You selected the same card in each selection list. Please select a different card in each list and then try again. Click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $CardSwitch = $GAME['Cards'][$GAME['MyColour']][$FC];
    $GAME['Cards'][$GAME['MyColour']][$FC] = $GAME['Cards'][$GAME['MyColour']][$SC];
    $GAME['Cards'][$GAME['MyColour']][$SC] = $CardSwitch;
    dbformatgamedata();
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully swapped cards.');
}
Beispiel #5
0
Datei: gan.php Projekt: hdp/brass
function DoTask()
{
    global $GAME;
    if ($GAME['GameStatus'] != 'In Progress' and $GAME['GameStatus'] != 'Recruiting Replacement') {
        $mypage = page::standard();
        $mypage->title_body('Cannot quit game');
        $mypage->leaf('p', 'You cannot presently quit this game, perhaps because it has finished. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game. You might be seeing this message because you clicked the button twice. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (!@$_POST['CheckA'] or !@$_POST['CheckB']) {
        $mypage = page::standard();
        $mypage->title_body('Tick boxes left unticked');
        $mypage->leaf('p', 'One or both tick boxes were left unticked. You need to make sure both boxes are ticked - this is to prevent accidental use of the "quit" function. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['PlayersMissing'] + 1 == $GAME['CurrentPlayers']) {
        abortgame(0);
        dbformatgamedata();
        $mypage = page::standard();
        $mypage->title_body('Game aborted instead');
        $mypage->leaf('p', 'Since you were the only player left in the game, the game has instead been aborted. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    KickPlayer($GAME['MyColour'], 0);
    dbformatgamedata();
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully quit game.');
}
Beispiel #6
0
Datei: gao.php Projekt: hdp/brass
function DoTask()
{
    global $GAME;
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game, so unfortunately you cannot save notes on it. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $EscapedNotes = sanitise_str_fancy(@$_POST['GameNotes'], 1, 25000, STR_GPC | STR_ESCAPE_HTML);
    if ($EscapedNotes[1] == 1) {
        $mypage = page::standard();
        $mypage->title_body('Notes too long');
        $mypage->leaf('p', 'The notes you entered are too long. The limit is around 25,&thinsp;000 characters (proviso: depending on the content you enter, the number of characters after the content is processed may vary slightly from that before). Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page. Here are the notes you entered:');
        $mypage->leaf('textarea', $EscapedNotes[0], 'cols=80 rows=20');
        $mypage->finish();
    }
    if ($EscapedNotes[1] == -1) {
        dbquery(DBQUERY_WRITE, 'DELETE FROM "PlayerGameNotes" WHERE "Game" = :game: AND "User" = :user:'******'game', $GAME['GameID'], 'user', $GAME['PlayerUserID'][$GAME['MyColour']]);
    } else {
        dbquery(DBQUERY_WRITE, 'REPLACE INTO "PlayerGameNotes" ("Game", "User", "Notes") VALUES (:game:, :user:, :notes:)', 'game', $GAME['GameID'], 'user', $GAME['PlayerUserID'][$GAME['MyColour']], 'notes', $EscapedNotes[0]);
    }
    dbquery(DBQUERY_COMMIT);
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully saved notes.');
}
Beispiel #7
0
Datei: gac.php Projekt: hdp/brass
function DoTask()
{
    global $Administrator, $GAME;
    if (!$Administrator) {
        $mypage = page::standard();
        $mypage->title_body('Not authorised');
        $mypage->leaf('p', 'You are not authorised to make use of this page. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (!@$_POST['CheckD']) {
        $mypage = page::standard();
        $mypage->title_body('Tick box left unticked');
        $mypage->leaf('p', 'The tick box was left unticked. You need to make sure the box is ticked - this is to prevent accidental use of the administrator controls. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['GameStatus'] != 'In Progress' and $GAME['GameStatus'] != 'Recruiting Replacement') {
        $mypage = page::standard();
        $mypage->title_body('Cannot abort game');
        $mypage->leaf('p', 'This game cannot be aborted just now, perhaps because it has finished. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    abortgame(1);
    dbformatgamedata();
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully aborted game.');
}
Beispiel #8
0
Datei: gal.php Projekt: hdp/brass
function DoTask()
{
    global $Administrator, $GAME, $unexpectederrormessage;
    if ($GAME['GameStatus'] != 'Recruiting Replacement') {
        $mypage = page::standard();
        $mypage->title_body('Current player is not missing');
        $mypage->leaf('p', 'The current player is not missing. (Perhaps somebody accepted a replacement player after you had loaded the board page.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game, so you cannot choose replacement players. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $ReplacementValid = false;
    for ($i = 0; $i < count($GAME['ReplacementOffers']); $i++) {
        if ($GAME['ReplacementOffers'][$i][2] == $GAME['PlayerToMove'] and $GAME['ReplacementOffers'][$i][0] == @$_POST['whotoaccept']) {
            $ReplacementValid = $i;
        }
    }
    if ($ReplacementValid === false) {
        $mypage = page::standard();
        $mypage->title_body('User ID not found among replacements');
        $mypage->leaf('p', 'The submitted user ID was not found among the candidate replacements. (Perhaps the user withdrew his request after you had loaded the board page.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $QR = dbquery(DBQUERY_READ_SINGLEROW, 'SELECT "Name", "Pronoun", "Email", "EmailPrompt" FROM "User" WHERE "UserID" = :user:'******'user', $GAME['ReplacementOffers'][$ReplacementValid][0]);
    if ($QR === 'NONE') {
        myerror($unexpectederrormessage, 'Candidate replacements list contains invalid user');
    }
    switch ($QR['Pronoun']) {
        case 'He':
            $RepPronoun = 'A';
            break;
        case 'She':
            $RepPronoun = 'B';
            break;
        default:
            $RepPronoun = 'C';
            break;
    }
    $GAME['AltGameTicker'] .= '8E' . callmovetimediff() . letter_end_number($GAME['ReplacementOffers'][$ReplacementValid][0]) . $RepPronoun . letter_end_number($GAME['MyColour']);
    $GAME['GameTickerNames'] .= '|' . $GAME['ReplacementOffers'][$ReplacementValid][1];
    $GAME['PlayerName'][$GAME['PlayerToMove']] = $QR['Name'];
    $GAME['KickVote'] = '00000';
    $GAME['GameStatus'] = 'In Progress';
    $GAME['MoveMade'] = 1;
    dbquery(DBQUERY_WRITE, 'DELETE FROM "ReplacementOffer" WHERE "Game" = :game: AND "Colour" = :colour:', 'game', $GAME['GameID'], 'colour', $GAME['PlayerToMove']);
    dbquery(DBQUERY_WRITE, 'INSERT INTO "PlayerGameRcd" ("User", "Game", "GameResult", "Inherited", "GameCounts", "Colour", "NumLongTurns", "CurrentOccupant") VALUES (:user:, :game:, \'Playing\', 1, :counts:, :colour:, 0, 0)', 'user', $GAME['ReplacementOffers'][$ReplacementValid][0], 'game', $GAME['GameID'], 'counts', $GAME['ReplacementOffers'][$ReplacementValid][3], 'colour', $GAME['PlayerToMove']);
    dbformatgamedata();
    if ($QR['EmailPrompt'] and $QR['Email'] != '') {
        $subject = 'Your request to join game number ' . $GAME['GameID'] . ' has been accepted';
        $body = '<p>This is an automated message. One of the players in game number ' . $GAME['GameID'] . ' has accepted your request to join the game as a replacement player. This means that it is now your turn to move; please visit the game\'s page and take your turn. Here is the URL of the game page:</p><p><a href="' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '">' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '</a></p>' . EMAIL_FOOTER;
        send_email($subject, $body, $QR['Email'], null);
    }
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully accepted replacement.');
}
Beispiel #9
0
Datei: gai.php Projekt: hdp/brass
function DoTask()
{
    global $GAME, $PlayersVotingToKick;
    if ($GAME['GameStatus'] != 'Recruiting Replacement') {
        $mypage = page::standard();
        $mypage->title_body('Cannot vote to downsize this game');
        $mypage->leaf('p', 'This game is not currently seeking a replacement player, so you cannot vote to downsize it. (Perhaps something happened after you loaded the board page.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['CurrentPlayers'] == 3) {
        $mypage = page::standard();
        $mypage->title_body('Cannot downsize a 3-player game');
        $mypage->leaf('p', 'At present, it is not permitted for a 3-player game to be downsized. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['CurrentPlayers'] == $GAME['MinimumPlayersAllowed'] and $GAME['MinimumPlayersAllowed'] > 2) {
        $mypage = page::standard();
        $mypage->title_body('Cannot downsize from this number of players');
        $mypage->leaf('p', 'This game cannot be downsized, as the game board in use does not support fewer than ' . $GAME['MinimumPlayersAllowed'] . ' players. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game, so you cannot vote to downsize it. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (@$_POST['DSVote'] == 'Yes') {
        if ($GAME['PlayersVotingToKick'] - $GAME['IHaveKickVoted'] + 1 >= $GAME['CurrentPlayers']) {
            require HIDDEN_FILES_PATH . 'downsizeresource.php';
            downsizegame(false);
            $didsomething = 1;
            while ($didsomething) {
                $didsomething = gamecheck();
            }
            dbformatgamedata();
            page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted and downsized game.');
        }
        $GAME['KickVote'][$GAME['MyColour']] = 1;
        dbformatgamedata();
        if (!$GAME['KickVoteActive']) {
            for ($i = 0; $i < MAX_PLAYERS; $i++) {
                if ($GAME['PlayerExists'][$i] == 1 and !$GAME['PlayerMissing'][$i] and !$GAME['PlayersVotingToKick'] and $i != $GAME['MyColour'] and $GAME['EmailPrompt'][$i] and $GAME['Email'][$i] != '') {
                    $subject = 'There is a vote to downsize game number ' . $GAME['GameID'];
                    $body = '<p>This is an automated message. One of your fellow players in game number ' . $GAME['GameID'] . ' has initiated a vote to downsize the game instead of recruiting a replacement player. In order for the game to be downsized, all of the players must agree; this means that a unanimous vote is required. If you would like the game to be downsized, then please visit the game\'s page and vote in favour of downsizing. If you do not want the game to be downsized, then no action is required other than to accept a replacement if one asks to join. (You will be emailed if this happens. Bear in mind that if a replacement is not found before the Time Limit B for this game is exceeded, then the game will be downsized anyway.) Here is the URL of the game page:</p><p><a href="' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '">' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '</a></p>' . EMAIL_FOOTER;
                    send_email($subject, $body, $GAME['Email'][$i], null);
                }
            }
        }
        page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
    }
    $GAME['KickVote'][$GAME['MyColour']] = 0;
    dbformatgamedata();
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
}
Beispiel #10
0
Datei: gah.php Projekt: hdp/brass
function DoTask()
{
    global $GAME;
    if ($GAME['GameStatus'] != 'In Progress') {
        $mypage = page::standard();
        $mypage->title_body('Cannot vote to remove players from this game');
        $mypage->leaf('p', 'At the moment you cannot vote to remove players from this game. This might be because the game has finished, or it might be because the game is seeking a replacement player. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game, so you cannot vote to remove players. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == $GAME['PlayerToMove']) {
        $mypage = page::standard();
        $mypage->title_body('Cannot vote to kick yourself');
        $mypage->leaf('p', 'You cannot vote to kick yourself. If you want to leave the game, please select the option to "Quit" instead. Click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (!$GAME['CanKickVote']) {
        $mypage = page::standard();
        $mypage->title_body('Kick vote not currently available');
        $mypage->leaf('p', 'The option to vote to kick the current player is not presently available. (Perhaps the player you were waiting for took his turn in the meantime.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (!$GAME['KickVoteActive']) {
        $mypage = page::standard();
        $mypage->title_body('No vote is taking place');
        $mypage->leaf('p', 'At present, no vote on kicking the current player is taking place. (Perhaps the player you were waiting for took his turn in the meantime, or perhaps another player voted against.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (@$_POST['votevalueA']) {
        if ($GAME['PlayersVotingToKick'] - $GAME['IHaveKickVoted'] + 2 >= $GAME['CurrentPlayers']) {
            $NameOfKickedPlayer = $GAME['PlayerFullName'][$GAME['PlayerToMove']];
            KickPlayer($GAME['PlayerToMove'], 2);
            dbformatgamedata();
            page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted and kicked player.');
        }
        $GAME['KickVote'][$GAME['MyColour']] = 1;
        dbformatgamedata();
        page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
    }
    $GAME['KickVote'] = '00000';
    dbformatgamedata();
    for ($i = 0; $i < MAX_PLAYERS; $i++) {
        if ($GAME['PlayerExists'][$i] == 1 and !$GAME['PlayerMissing'][$i] and $i != $GAME['MyColour'] and $GAME['EmailPrompt'][$i] and $GAME['Email'][$i] != '' and $i != $GAME['PlayerToMove']) {
            $subject = 'The vote to kick ' . $GAME['PlayerFullName'][$GAME['PlayerToMove']] . 'from game number ' . $GAME['GameID'] . ' has failed';
            $body = '<p>This is an automated message. One of your fellow players in game number ' . $GAME['GameID'] . ' has voted against kicking ' . $GAME['PlayerFullName'][$GAME['PlayerToMove']] . ' from the game. In order for ' . $GAME['OtherPronounLC'][$GAME['PlayerToMove']] . ' to be kicked, all of the players must agree; this means that a unanimous vote is required. So, ' . $GAME['PronounLC'][$GAME['PlayerToMove']] . ' will not be kicked at this time. Here is the URL of the game page:</p><p><a href="' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '">' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '</a></p>' . EMAIL_FOOTER;
            send_email($subject, $body, $GAME['Email'][$i], null);
        }
    }
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
}
Beispiel #11
0
function DoTask()
{
    global $Administrator, $GAME;
    $ColourToRemove = $_POST['FormActionID'] - 10;
    $PostFailureTitle = false;
    do {
        if (!$_SESSION['LoggedIn']) {
            $PostFailureTitle = 'Not logged in';
            $PostFailureMessage = 'You are not logged in. Please log in and then try again. Click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['GameStatus'] == 'Cancelled') {
            $PostFailureTitle = 'Game cancelled';
            $PostFailureMessage = 'This game has been cancelled. Please click <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['GameStatus'] != 'Recruiting') {
            $PostFailureTitle = 'Game has already started';
            $PostFailureMessage = 'This game has been started, so you cannot remove players from it using this method. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['GameCreator'] == $GAME['PlayerUserID'][$ColourToRemove]) {
            $PostFailureTitle = 'Cannot remove game creator';
            $PostFailureMessage = 'You cannot remove the creator of the game. You may want to cancel the game instead. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['CurrentPlayers'] == 1) {
            $PostFailureTitle = 'Only one player left';
            $PostFailureMessage = 'This game has only one player left, so you cannot remove players from it. You may want to cancel the game instead. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if (!$Administrator and $_SESSION['MyUserID'] != $GAME['GameCreator']) {
            $PostFailureTitle = 'Cannot remove player';
            $PostFailureMessage = 'You cannot remove players from this game, as it was not created by you. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if (!$GAME['PlayerExists'][$ColourToRemove]) {
            $PostFailureTitle = 'Player doesn\'t exist';
            $PostFailureMessage = 'There is no player currently waiting to play as that colour. Perhaps something happened after you loaded the game page. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
    } while (false);
    if ($PostFailureTitle !== false) {
        $mypage = page::standard();
        $mypage->title_body($PostFailureTitle);
        $mypage->leaf('p', $PostFailureMessage);
        $mypage->finish();
    }
    $GAME['PlayerExists'][$ColourToRemove] = 0;
    dbquery(DBQUERY_WRITE, 'DELETE FROM "PlayerGameRcd" WHERE "Game" = :game: AND "User" = :user:'******'game', $GAME['GameID'], 'user', $GAME['PlayerUserID'][$ColourToRemove]);
    dbquery(DBQUERY_WRITE, 'UPDATE "Game" SET "CurrentPlayers" = "CurrentPlayers" - 1, "PlayerExists" = :playerexists: WHERE "GameID" = :game:', 'playerexists', $GAME['PlayerExists'], 'game', $GAME['GameID']);
    dbquery(DBQUERY_COMMIT);
    page::redirect(3, 'lobby.php?GameID=' . $GAME['GameID'], 'Successfully removed player.');
}
Beispiel #12
0
function DoTask()
{
    global $GAME;
    $EscapedNewPassword = sanitise_str(@$_POST['PasswordB'], STR_GPC | STR_ESCAPE_HTML | STR_STRIP_TAB_AND_NEWLINE);
    $PostFailureTitle = false;
    do {
        if (!$_SESSION['LoggedIn']) {
            $PostFailureTitle = 'Not logged in';
            $PostFailureMessage = 'You are not logged in. Please log in and then try again. Click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['GameStatus'] == 'Cancelled') {
            $PostFailureTitle = 'Game cancelled';
            $PostFailureMessage = 'This game has been cancelled. Please click <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['GameStatus'] != 'Recruiting') {
            $PostFailureTitle = 'Game has already started';
            $PostFailureMessage = 'This game has now been started. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($_SESSION['MyUserID'] != $GAME['GameCreator']) {
            $PostFailureTitle = 'Cannot change game settings';
            $PostFailureMessage = 'You cannot change the game\'s settings, because you are not the game\'s creator. Click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if (@$_POST['GPrivateBox'] and mb_strlen($EscapedNewPassword, 'UTF-8') > 20) {
            $PostFailureTitle = 'New password too long';
            $PostFailureMessage = 'The new password you entered is too long. Maximum 20 characters. Click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if (@$_POST['GPrivateBox'] and mb_strlen($EscapedNewPassword, 'UTF-8') < 3) {
            $PostFailureTitle = 'New password too short';
            $PostFailureMessage = 'The new password you entered is too short. Minimum 3 characters. Click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
    } while (false);
    if ($PostFailureTitle !== false) {
        $mypage = page::standard();
        $mypage->title_body($PostFailureTitle);
        $mypage->leaf('p', $PostFailureMessage);
        $mypage->finish();
    }
    if (@$_POST['GPrivateBox']) {
        $NewPrivValue = 1;
    } else {
        $NewPrivValue = 0;
        $EscapedNewPassword = mb_substr($EscapedNewPassword, 0, 20, 'UTF-8');
    }
    dbquery(DBQUERY_WRITE, 'UPDATE "LobbySettings" SET "GPrivate" = :private:, "Password" = :pass: WHERE "Game" = :game:', 'private', $NewPrivValue, 'game', $GAME['GameID'], 'pass', $EscapedNewPassword);
    page::redirect(3, 'lobby.php?GameID=' . $GAME['GameID'], 'Game settings successfully changed.');
}
Beispiel #13
0
Datei: gag.php Projekt: hdp/brass
function DoTask()
{
    global $GAME, $unexpectederrormessage;
    if ($GAME['GameStatus'] != 'In Progress') {
        $mypage = page::standard();
        $mypage->title_body('Cannot vote to remove players from this game');
        $mypage->leaf('p', 'At the moment you cannot vote to remove players from this game. This might be because the game has finished, or it might be because the game is seeking a replacement player. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game, so you cannot vote to remove players. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == $GAME['PlayerToMove']) {
        $mypage = page::standard();
        $mypage->title_body('Cannot vote to kick yourself');
        $mypage->leaf('p', 'You cannot vote to kick yourself. If you want to leave the game, please select the option to "Quit" instead. Click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (!$GAME['CanKickVote']) {
        $mypage = page::standard();
        $mypage->title_body('Kick vote not currently available');
        $mypage->leaf('p', 'The option to vote to kick the current player is not presently available. (Perhaps the player you were waiting for took his turn in the meantime.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['KickVoteActive']) {
        myerror($unexpectederrormessage, 'Unexpected vote page "gag.php" reached');
    }
    if ($GAME['CurrentPlayers'] - $GAME['PlayersMissing'] == 2) {
        $NameOfKickedPlayer = $GAME['PlayerFullName'][$GAME['PlayerToMove']];
        KickPlayer($GAME['PlayerToMove'], 2);
        dbformatgamedata();
        page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted and kicked player.');
    }
    $GAME['KickVote'][$GAME['MyColour']] = 1;
    dbformatgamedata();
    for ($i = 0; $i < MAX_PLAYERS; $i++) {
        if ($GAME['PlayerExists'][$i] == 1 and !$GAME['PlayerMissing'][$i] and $i != $GAME['MyColour'] and $GAME['EmailPrompt'][$i] and $GAME['Email'][$i] != '') {
            if ($i == $GAME['PlayerToMove']) {
                $subject = 'There is a vote to kick you from game number ' . $GAME['GameID'];
                $body = 'This is an automated message. One of your fellow players in game number ' . $GAME['GameID'] . ' has initiated a vote to kick you from the game, as you are taking a long time to make your move. In order for you to be kicked, all of the other players must agree; this means that a unanimous vote is required. However, you can end the vote immediately by taking your turn. Please visit the game\'s page and shut the vote down by taking your turn. Here is the URL of the game page:' . "\n\n" . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . EMAIL_FOOTER;
            } else {
                $subject = 'There is a vote to kick ' . $GAME['PlayerFullName'][$GAME['PlayerToMove']] . ' from game number ' . $GAME['GameID'];
                $body = '<p>This is an automated message. One of your fellow players in game number ' . $GAME['GameID'] . ' has initiated a vote to kick ' . $GAME['PlayerFullName'][$GAME['PlayerToMove']] . ' from the game, as ' . $GAME['PronounLC'][$GAME['PlayerToMove']] . ' is taking a long time to make ' . $GAME['PossessivePronounLC'][$GAME['PlayerToMove']] . ' move. In order for ' . $GAME['OtherPronounLC'][$GAME['PlayerToMove']] . ' to be kicked, all of the players must agree; this means that a unanimous vote is required. Please visit the game\'s page and either vote in favour of kicking ' . $GAME['PlayerName'][$GAME['PlayerToMove']] . ', or shut the vote down by voting not to kick ' . $GAME['OtherPronounLC'][$GAME['PlayerToMove']] . '. Here is the URL of the game page:</p><p><a href="' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '">' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '</a></p>' . EMAIL_FOOTER;
            }
            send_email($subject, $body, $GAME['Email'][$i], null);
        }
    }
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
}
Beispiel #14
0
Datei: gaa.php Projekt: hdp/brass
function DoTask()
{
    global $Administrator, $GAME;
    if (!$Administrator) {
        $mypage = page::standard();
        $mypage->title_body('Not authorised');
        $mypage->leaf('p', 'You are not authorised to make use of this page. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    dbquery(DBQUERY_WRITE, 'UPDATE "Game" SET "GTitleDeletedByAdmin" = 1 - "GTitleDeletedByAdmin" WHERE "GameID" = :game:', 'game', $GAME['GameID']);
    dbquery(DBQUERY_COMMIT);
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully modified title.');
}
Beispiel #15
0
Datei: gar.php Projekt: hdp/brass
function DoTask()
{
    global $GAME;
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    sort($GAME['Cards'][$GAME['MyColour']]);
    dbformatgamedata();
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully sorted cards.');
}
Beispiel #16
0
function DoTask()
{
    global $GAME;
    $PostFailureTitle = false;
    do {
        if (!$_SESSION['LoggedIn']) {
            $PostFailureTitle = 'Not logged in';
            $PostFailureMessage = 'You are not logged in. Please log in and then try again. Click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['GameStatus'] == 'Cancelled') {
            $PostFailureTitle = 'Game cancelled';
            $PostFailureMessage = 'This game has been cancelled. Please click <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['GameStatus'] != 'Recruiting') {
            $PostFailureTitle = 'Game has already started';
            $PostFailureMessage = 'This game has now been started, so you cannot leave it by this method. If you really want to leave, you can quit the game from the board page. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['MyColour'] == 50) {
            $PostFailureTitle = 'Not playing in this game';
            $PostFailureMessage = 'You are not currently playing in this game. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($_SESSION['MyUserID'] == $GAME['GameCreator']) {
            $PostFailureTitle = 'Cannot leave game';
            $PostFailureMessage = 'You are the creator of this game, so you cannot leave it. Please select to cancel the game instead. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['CurrentPlayers'] == 1) {
            $PostFailureTitle = 'Only one player left';
            $PostFailureMessage = 'You are the only player currently in this game, so you cannot leave it. Please contact an Administrator if you want the game to be cancelled. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
    } while (false);
    if ($PostFailureTitle !== false) {
        $mypage = page::standard();
        $mypage->title_body($PostFailureTitle);
        $mypage->leaf('p', $PostFailureMessage);
        $mypage->finish();
    }
    $GAME['PlayerExists'][$GAME['MyColour']] = 0;
    dbquery(DBQUERY_WRITE, 'UPDATE "Game" SET "CurrentPlayers" = "CurrentPlayers" - 1, "PlayerExists" = :playerexists: WHERE "GameID" = :game:', 'playerexists', $GAME['PlayerExists'], 'game', $GAME['GameID']);
    dbquery(DBQUERY_WRITE, 'DELETE FROM "PlayerGameRcd" WHERE "Game" = :game: AND "User" = :user:'******'game', $GAME['GameID'], 'user', $GAME['PlayerUserID'][$GAME['MyColour']]);
    dbquery(DBQUERY_COMMIT);
    page::redirect(3, 'lobby.php?GameID=' . $GAME['GameID'], 'Successfully withdrew from game.');
}
Beispiel #17
0
Datei: gad.php Projekt: hdp/brass
function DoTask()
{
    global $Administrator, $GAME, $unexpectederrormessage;
    $AdminKickList = sanitise_int(@$_POST['AdminKickList']);
    $PostFailureTitle = false;
    do {
        if (!$Administrator) {
            $PostFailureTitle = 'Not authorised';
            $PostFailureMessage = 'You are not authorised to make use of this page. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if (!@$_POST['CheckC']) {
            $PostFailureTitle = 'Tick box left unticked';
            $PostFailureMessage = 'The tick box was left unticked. You need to make sure the box is ticked - this is to prevent accidental use of the administrator controls. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['GameStatus'] != 'In Progress' and $GAME['GameStatus'] != 'Recruiting Replacement') {
            $PostFailureTitle = 'Cannot kick player';
            $PostFailureMessage = 'Players cannot be kicked right now, perhaps because the game has finished. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($AdminKickList < 0 or $AdminKickList >= MAX_PLAYERS) {
            $PostFailureTitle = 'Invalid input';
            $PostFailureMessage = 'Expected an integer between 0 and ' . (MAX_PLAYERS - 1) . ' inclusive, but received ' . $AdminKickList . '. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if (!$GAME['PlayerExists'][$AdminKickList] or $GAME['PlayerMissing'][$AdminKickList]) {
            $PostFailureTitle = 'Seat is empty';
            $PostFailureMessage = 'The chosen seat is empty, or the chosen colour does not exist in this game. Perhaps the player was kicked in the meantime. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['PlayersMissing'] + 1 == $GAME['CurrentPlayers']) {
            $PostFailureTitle = 'Only one player is not missing';
            $PostFailureMessage = 'This is the only player who is not missing. If you do not want the game to continue, please select to abort it instead. Click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
    } while (false);
    if ($PostFailureTitle !== false) {
        $mypage = page::standard();
        $mypage->title_body($PostFailureTitle);
        $mypage->leaf('p', $PostFailureMessage);
        $mypage->finish();
    }
    KickPlayer($AdminKickList, 1);
    dbformatgamedata();
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully kicked player.');
}
Beispiel #18
0
function DoTask()
{
    global $Administrator, $GAME;
    if (!$_SESSION['LoggedIn']) {
        $mypage = page::standard();
        $mypage->title_body('Not logged in');
        $mypage->leaf('p', 'You are not logged in. Please log in and then try again. Click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (!$Administrator) {
        $mypage = page::standard();
        $mypage->title_body('Not authorised');
        $mypage->leaf('p', 'You are not authorised to make use of this page. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    dbquery(DBQUERY_WRITE, 'UPDATE "Game" SET "GTitleDeletedByAdmin" = 0 WHERE "GameID" = :game:', 'game', $GAME['GameID']);
    page::redirect(3, 'lobby.php?GameID=' . $GAME['GameID'], 'Successfully modified title.');
}
Beispiel #19
0
function DoTask()
{
    global $Administrator, $cxn, $GAME;
    if ($Administrator) {
        $affrows = dbquery(DBQUERY_AFFECTED_ROWS, 'UPDATE Game SET GameStatus = \'Cancelled\', LastMove = UTC_TIMESTAMP() WHERE GameID = :game: AND GameStatus = \'Recruiting\'', 'game', $GAME['GameID']);
    } else {
        $affrows = dbquery(DBQUERY_AFFECTED_ROWS, 'UPDATE Game SET GameStatus = \'Cancelled\', LastMove = UTC_TIMESTAMP() WHERE GameID = :game: AND GameStatus = \'Recruiting\' AND GameCreator = :user:'******'game', $GAME['GameID'], 'user', $_SESSION['MyUserID']);
    }
    $mypage = page::standard();
    if ($affrows) {
        $mypage->title_body('Game cancelled');
        $mypage->leaf('p', 'The game was successfully cancelled. Click <a href="index.php">here</a> to return to the Main Page.');
    } else {
        $mypage->title_body('Cancellation unsuccessful');
        $mypage->leaf('p', 'The game was not successfully cancelled. The most likely reason for this is that somebody started it before you submitted the command (but it may have been for another reason). Click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page for the game, or <a href="index.php">here</a> to return to the Main Page.');
    }
    $mypage->finish();
}
Beispiel #20
0
Datei: gaf.php Projekt: hdp/brass
function DoTask()
{
    global $GAME;
    if ($GAME['GameStatus'] != 'In Progress' and $GAME['GameStatus'] != 'Recruiting Replacement') {
        $mypage = page::standard();
        $mypage->title_body('Cannot abort this game');
        $mypage->leaf('p', 'This game cannot be aborted just now, perhaps because it has finished. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game, so you cannot vote to abort it. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (!$GAME['AbortVoteActive']) {
        $mypage = page::standard();
        $mypage->title_body('No vote is taking place');
        $mypage->leaf('p', 'At present, no vote on aborting the game is taking place. Perhaps somebody voted against aborting the game in the meantime. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (@$_POST['votevalue']) {
        if ($GAME['PlayersVotingToAbort'] - $GAME['IHaveAbortVoted'] + 1 >= $GAME['CurrentPlayers']) {
            abortgame(0);
            dbformatgamedata();
            page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted and aborted game.');
        }
        $GAME['AbortVote'][$GAME['MyColour']] = 1;
        dbformatgamedata();
        page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
    }
    $GAME['AbortVote'] = '00000';
    dbformatgamedata();
    for ($i = 0; $i < MAX_PLAYERS; $i++) {
        if ($GAME['PlayerExists'][$i] == 1 and !$GAME['PlayerMissing'][$i] and $i != $GAME['MyColour'] and $GAME['EmailPrompt'][$i] and $GAME['Email'][$i] != '') {
            $subject = 'The vote to abort game number ' . $GAME['GameID'] . ' has failed';
            $body = '<p>This is an automated message. One of your fellow players in game number ' . $GAME['GameID'] . ' has voted against aborting the game. In order for the game to be aborted, all of the players must agree; this means that a unanimous vote is required. So, the game will not be aborted at this time. Here is the URL of the game page:</p><p><a href="' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '">' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '</a></p>' . EMAIL_FOOTER;
            send_email($subject, $body, $GAME['Email'][$i], null);
        }
    }
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
}
Beispiel #21
0
Datei: gat.php Projekt: hdp/brass
function DoTask()
{
    global $Administrator, $GAME, $unexpectederrormessage;
    if (!$Administrator) {
        $mypage = page::standard();
        $mypage->title_body('Not authorised');
        $mypage->leaf('p', 'You are not authorised to make use of this page. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $EscapedComment = sanitise_str(@$_POST['AdminComment'], STR_GPC | STR_STRIP_TAB_AND_NEWLINE);
    $EscapedComment = str_replace(array('|', '"'), array('', ''), $EscapedComment);
    $EscapedComment = htmlspecialchars($EscapedComment);
    if ($EscapedComment == '') {
        $mypage = page::standard();
        $mypage->title_body('Comment is missing');
        $mypage->leaf('p', 'The coment you entered is missing. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    dbquery(DBQUERY_WRITE, 'UPDATE "Game" SET "GameTicker" = CONCAT("GameTicker", :tickerconcat:), "GameTickerNames" = CONCAT("GameTickerNames", :namesconcat:) WHERE "GameID" = :game:', 'tickerconcat', '3B' . callmovetimediff() . letter_end_number($_SESSION['MyUserID']) . letter_end_number($_SESSION['MyGenderCode']), 'namesconcat', '|' . $_SESSION['MyUserName'] . '|' . $EscapedComment, 'game', $GAME['GameID']);
    dbquery(DBQUERY_COMMIT);
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully added comment.');
}
Beispiel #22
0
<?php

require '_std-include.php';
$mypage = page::standard();
if (isset($_POST['FormSubmit'])) {
    require HIDDEN_FILES_PATH . 'sanitise_str_fancy.php';
    $EscapedUserID = sanitise_int(@$_POST['Target']);
    $EscapedContent = sanitise_str_fancy(@$_POST['TheEmail'], 6, 25000, STR_GPC | STR_EMAIL_FORMATTING | STR_CONVERT_ESCAPE_SEQUENCES | STR_STRIP_TAB_AND_NEWLINE);
    $therow = dbquery(DBQUERY_READ_SINGLEROW, 'SELECT "Name", "UserValidated", "AllowContact", "Email", "Pronoun" FROM "User" WHERE "UserID" = :user:'******'user', $EscapedUserID);
    if ($therow === 'NONE') {
        die($unexpectederrormessage);
    }
    if (!$therow['UserValidated']) {
        die($unexpectederrormessage);
    }
    $PostFailureTitle = false;
    do {
        if (!$_SESSION['LoggedIn']) {
            $PostFailureTitle = 'Not logged in';
            $PostFailureMessage = 'You may not contact ' . $therow['Name'] . ' by email, because you are not logged in. Please click <a href="index.php">here</a> to return to the Main Page. Here is the text of the message you entered:';
            break;
        }
        if ($Banned) {
            $PostFailureTitle = 'Banned';
            $PostFailureMessage = 'You may not contact ' . $therow['Name'] . ' by email, because you are banned. Please click <a href="userdetails.php?UserID=' . $EscapedUserID . '">here</a> to visit ' . $therow['Name'] . '\'s User Details page, or <a href="index.php">here</a> to return to the Main Page. Here is the text of the message you entered:';
            break;
        }
        if (!EMAIL_ENABLED) {
            $PostFailureTitle = 'User email messaging disabled';
            $PostFailureMessage = 'The user email messaging function has been disabled by an Administrator. Please click <a href="userdetails.php?UserID=' . $EscapedUserID . '">here</a> to visit this user\'s User Details page, or <a href="index.php">here</a> to return to the Main Page. Here is the text of the message you entered:';
            break;
Beispiel #23
0
Datei: gaj.php Projekt: hdp/brass
function DoTask()
{
    global $Banned, $GAME;
    if (@$_POST['Counts']) {
        $ToCount = 1;
    } else {
        $ToCount = 0;
    }
    if ($GAME['RailPhase']) {
        $ToCount = 0;
    }
    $ChosenColour = sanitise_int(@$_POST['colourtoreplace'], SANITISE_NO_FLAGS, 0, MAX_PLAYERS - 1);
    $PostFailureTitle = false;
    do {
        if (!$GAME['PlayersMissing']) {
            $PostFailureTitle = 'No missing players';
            $PostFailureMessage = 'There aren\'t any players missing from this game at the moment. (Perhaps something happened after you loaded the board page.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['GameStatus'] != 'In Progress' and $GAME['GameStatus'] != 'Recruiting Replacement' or !$GAME['PlayersMissingThatMatter']) {
            $PostFailureTitle = 'No replacements needed';
            $PostFailureMessage = 'No replacement players are needed for this game at the moment. (Perhaps something happened after you loaded the board page.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if (!$GAME['PlayerMissingAndMatters'][$ChosenColour]) {
            $PostFailureTitle = 'Cannot join as selected colour';
            $PostFailureMessage = 'You cannot join this game as the selected colour. (Perhaps something happened after you loaded the board page.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['MyColour'] != 50) {
            $PostFailureTitle = 'Already playing in this game';
            $PostFailureMessage = 'You cannot join this game as a replacement, because you are already playing in it. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($Banned) {
            $PostFailureTitle = 'Banned';
            $PostFailureMessage = 'You cannot join this game as a replacement, because you are banned. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if (in_array($_SESSION['MyUserID'], $GAME['ReplacementOffers_Users'])) {
            $PostFailureTitle = 'Request already received';
            $PostFailureMessage = 'You have already made a request to join this game. You might be seeing this message because you clicked the button twice. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if (dbquery(DBQUERY_READ_RESULTSET, 'SELECT "User" FROM "PlayerGameRcd" WHERE "User" = :user: AND "Game" = :game:', 'user', $_SESSION['MyUserID'], 'game', $GAME['GameID']) !== 'NONE') {
            $PostFailureTitle = 'You have previously played in this game';
            $PostFailureMessage = 'You have previously played in this game. It is not possible to re-join the game. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
    } while (false);
    if ($PostFailureTitle !== false) {
        $mypage = page::standard();
        $mypage->title_body($PostFailureTitle);
        $mypage->leaf('p', $PostFailureMessage);
        $mypage->finish();
    }
    dbquery(DBQUERY_WRITE, 'INSERT INTO "ReplacementOffer" ("Game", "User", "Colour", "ToCount") VALUES (:game:, :user:, :colour:, :tocount:)', 'game', $GAME['GameID'], 'user', $_SESSION['MyUserID'], 'colour', $ChosenColour, 'tocount', $ToCount);
    if ($ChosenColour == $GAME['PlayerToMove']) {
        $GAME['AltGameTicker'] .= '8A' . callmovetimediff() . letter_end_number($_SESSION['MyUserID']) . letter_end_number($_SESSION['MyGenderCode']);
        $GAME['GameTickerNames'] .= '|' . $_SESSION['MyUserName'];
        dbformatgamedata();
        for ($i = 0; $i < MAX_PLAYERS; $i++) {
            if ($GAME['PlayerExists'][$i] == 1 and !$GAME['PlayerMissing'][$i] and $GAME['EmailPrompt'][$i] and $GAME['Email'][$i] != '') {
                $subject = $_SESSION['MyUserName'] . ' wants to join game number ' . $GAME['GameID'] . ' as a replacement';
                $body = '<p>This is an automated message. ' . $_SESSION['MyUserName'] . ' has asked to join game number ' . $GAME['GameID'] . ' as a replacement. As you are playing in this game, you can choose to accept this request. Here is the URL of the game page:</p><p><a href="' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '">' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '</a></p>' . EMAIL_FOOTER;
                send_email($subject, $body, $GAME['Email'][$i], null);
            }
        }
    } else {
        dbformatgamedata();
    }
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully requested to join.');
}
Beispiel #24
0
function DoTask()
{
    global $Banned, $Email, $EmailPrompt, $EmailPromptAgain, $GAME, $HasBeenEmailed, $Rating;
    $EscapedPassword = sanitise_str(@$_POST['Password'], STR_GPC | STR_ESCAPE_HTML | STR_STRIP_TAB_AND_NEWLINE);
    $PostFailureTitle = false;
    do {
        if (!$_SESSION['LoggedIn']) {
            $PostFailureTitle = 'Not logged in';
            $PostFailureMessage = 'You cannot join this game, because you are not logged in. Please log in and then try again. Click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($Banned) {
            $PostFailureTitle = 'Banned';
            $PostFailureMessage = 'You cannot join this game, because you are banned. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['GameStatus'] == 'Cancelled') {
            $PostFailureTitle = 'Game cancelled';
            $PostFailureMessage = 'This game has been cancelled. Please click <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['GameStatus'] != 'Recruiting') {
            $PostFailureTitle = 'Game has already started';
            $PostFailureMessage = 'This game has now been started, so you cannot join it. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['MyColour'] != 50) {
            $PostFailureTitle = 'Already playing';
            $PostFailureMessage = 'You cannot join this game, because you are playing in it already. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['GPrivate'] and $GAME['Password'] != $EscapedPassword) {
            $PostFailureTitle = 'Incorrect password';
            $PostFailureMessage = 'The password you entered is incorrect. Please note that the password you need to enter here is <b>not</b> your user account password, but a different password that has been set by the game\'s creator to control access to the game. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['CurrentPlayers'] >= $GAME['MaximumPlayers']) {
            $PostFailureTitle = 'Game is full';
            $PostFailureMessage = 'You cannot join this game, because it has already reached its maximum number of players. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['MinimumRating'] > $Rating) {
            $PostFailureTitle = 'Player rating too low';
            $PostFailureMessage = 'You cannot join this game, because your player rating is too low. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if (!is_null($GAME['MaximumRating']) and $GAME['MaximumRating'] < $Rating) {
            $PostFailureTitle = 'Player rating too high';
            $PostFailureMessage = 'You cannot join this game, because your player rating is too high. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
    } while (false);
    if ($PostFailureTitle !== false) {
        $mypage = page::standard();
        $mypage->title_body($PostFailureTitle);
        $mypage->leaf('p', $PostFailureMessage);
        $mypage->finish();
    }
    $GAME['CurrentPlayers']++;
    for ($i = 0; $i < MAX_PLAYERS; $i++) {
        if (!$GAME['PlayerExists'][$i]) {
            $GAME['PlayerExists'][$i] = 1;
            $GAME['PlayerUserID'][$i] = $_SESSION['MyUserID'];
            $GAME['PlayerName'][$i] = $_SESSION['MyUserName'];
            $GAME['PlayerRating'][$i] = $Rating;
            $GAME['Email'][$i] = $Email;
            $GAME['EmailPrompt'][$i] = $EmailPrompt;
            $GAME['EmailPromptAgain'][$i] = $EmailPromptAgain;
            $GAME['HasBeenEmailed'][$i] = $HasBeenEmailed;
            switch ($_SESSION['MyGenderCode']) {
                case 0:
                    $GAME['Pronoun_Eng'][$i] = 'He';
                    break;
                case 1:
                    $GAME['Pronoun_Eng'][$i] = 'She';
                    break;
                default:
                    $GAME['Pronoun_Eng'][$i] = 'It';
            }
            dbquery(DBQUERY_WRITE, 'UPDATE "Game" SET "CurrentPlayers" = :currentplayers:, "PlayerExists" = :playerexists: WHERE "GameID" = :game:', 'currentplayers', $GAME['CurrentPlayers'], 'playerexists', $GAME['PlayerExists'], 'game', $GAME['GameID']);
            dbquery(DBQUERY_WRITE, 'INSERT INTO "PlayerGameRcd" ("User", "Game", "GameResult", "Inherited", "GameCounts", "Colour", "NumLongTurns", "CurrentOccupant") VALUES (:user:, :game:, \'Playing\', 0, 1, :colour:, 0, 0)', 'user', $_SESSION['MyUserID'], 'game', $GAME['GameID'], 'colour', $i);
            break;
        }
    }
    if ($GAME['CurrentPlayers'] == $GAME['MaximumPlayers']) {
        if ($GAME['AutoStart']) {
            require HIDDEN_FILES_PATH . 'sgresource.php';
            startgame(true);
            page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully joined and started game.');
        } else {
            if ($GAME['CreatorEmailPrompt'] and $GAME['CreatorEmail'] != '') {
                $subject = 'Game is ready to be started';
                $body = '<p>Your game, number ' . $GAME['GameID'] . ', now has a full complement of players. Please review the game\'s lobby page and if you approve of the players, start the game. The URL of the lobby page is:</p><p><a href="' . SITE_ADDRESS . 'lobby.php?GameID=' . $GAME['GameID'] . '">' . SITE_ADDRESS . 'lobby.php?GameID=' . $GAME['GameID'] . '</a></p>' . EMAIL_FOOTER;
                send_email($subject, $body, $GAME['CreatorEmail'], null);
            }
        }
    }
    dbquery(DBQUERY_COMMIT);
    page::redirect(3, 'lobby.php?GameID=' . $GAME['GameID'], 'Successfully joined game.');
}
Beispiel #25
0
 public static function redirect($seconds, $targeturl, $blurb = 'Thankyou.', $special = false)
 {
     $seconds = (int) $seconds;
     if ($seconds < 1) {
         $seconds = 1;
     }
     if ($seconds > 20) {
         $seconds = 20;
     }
     $spl = $seconds == 1 ? '' : 's';
     $me = page::standard();
     $me->script('redirect.js');
     if ($targeturl === false) {
         $me->title_body('Brass Online - Closing in ' . $seconds . ' second' . $spl, 'onLoad="redirect_begin(' . $seconds . ', false)"');
         $me->leaf('p', $blurb . ' <span id="redirect_notice">This window will automatically close in <span id="num_seconds">' . $seconds . ' second' . $spl . '</span>.</span>');
         $me->leaf('p', 'If this does not happen, please click <a href="javascript:window.close();">here</a>.');
     } else {
         $me->title_body('Brass Online - Redirecting in ' . $seconds . ' second' . $spl, 'onLoad="redirect_begin(' . $seconds . ', \'' . $targeturl . '\')"');
         $me->leaf('p', $blurb . ' <span id="redirect_notice">You should be automatically redirected in <span id="num_seconds">' . $seconds . ' second' . $spl . '</span>.</span>');
         $me->leaf('p', 'If this does not happen, please click <a href="' . $targeturl . '">here</a>.');
     }
     if ($special) {
         return $me;
     }
     $me->finish();
 }
Beispiel #26
0
function DoTask()
{
    global $Administrator, $Banned, $GAME, $Rating;
    if ($GAME['GameStatus'] == 'Cancelled' and !$Administrator) {
        $mypage = page::standard();
        $mypage->title_body('Cannot find game');
        $mypage->leaf('p', 'Cannot find a game with that game ID number. Please click <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['GameStatus'] == 'Cancelled') {
        $GAME['GameName_Page'] .= ' <span style="font-size: 150%; color: #FF0000;">[CANCELLED]</span>';
    }
    $CreationTimeText = date('Y-m-d H:i:s', strtotime($GAME['CreationTime']));
    if ($GAME['SpecialRules'] & 1) {
        $ReverseVCText = 'Yes';
    } else {
        $ReverseVCText = 'No';
    }
    if ($GAME['SpecialRules'] & 2) {
        $ForbidSCText = 'Yes';
    } else {
        $ForbidSCText = 'No';
    }
    if ($GAME['SpecialRules'] & 4) {
        $ORAWText = 'Yes';
    } else {
        $ORAWText = 'No';
    }
    if ($GAME['AnyPlayerStarts']) {
        $APSText = 'Yes';
    } else {
        $APSText = 'No';
    }
    if ($GAME['Friendly']) {
        $FriendText = 'Friendly';
    } else {
        $FriendText = 'Competitive';
    }
    if ($GAME['AutoStart']) {
        $AutoStartText = 'Yes';
    } else {
        $AutoStartText = 'No';
    }
    if ($GAME['GPrivate']) {
        $PrivateText = ' checked';
    } else {
        $PrivateText = '';
    }
    if ($GAME['TimeLimitA_Minutes'] <= 30) {
        $x = 5;
        $TimeLimitAAlert = 'class="bigalert"';
    } else {
        if ($GAME['TimeLimitA_Minutes'] <= 90) {
            $x = 4;
            $TimeLimitAAlert = 'class="bigalert"';
        } else {
            if ($GAME['TimeLimitA_Minutes'] <= 720) {
                $x = 3;
                $TimeLimitAAlert = 'class="alert"';
            } else {
                if ($GAME['TimeLimitA_Minutes'] <= 1080) {
                    $x = 2;
                    $TimeLimitAAlert = 'class="alert"';
                } else {
                    if ($GAME['TimeLimitA_Minutes'] <= 1800) {
                        $x = 1;
                        $TimeLimitAAlert = 'style="font-weight: bold;"';
                    } else {
                        $x = 0;
                        $TimeLimitAAlert = null;
                    }
                }
            }
        }
    }
    if ($GAME['TimeLimitB_Minutes'] <= 60) {
        $y = 5;
        $TimeLimitBAlert = 'class="bigalert"';
    } else {
        if ($GAME['TimeLimitB_Minutes'] <= 180) {
            $y = 4;
            $TimeLimitBAlert = 'class="bigalert"';
        }
    }
    if ($GAME['TimeLimitB_Minutes'] <= 1440) {
        $y = 3;
        $TimeLimitBAlert = 'class="alert"';
    } else {
        if ($GAME['TimeLimitB_Minutes'] <= 2160) {
            $y = 2;
            $TimeLimitBAlert = 'class="alert"';
        } else {
            if ($GAME['TimeLimitB_Minutes'] <= 3600) {
                $y = 1;
                $TimeLimitBAlert = 'style="font-weight: bold;"';
            } else {
                $y = 0;
                $TimeLimitBAlert = null;
            }
        }
    }
    $cbmessageID = max($x, $y);
    $ShowTimeLimitWarning = true;
    switch ($cbmessageID) {
        case 5:
            $TimeLimitsWarning = 'These time limits indicate that the game\'s creator probably wants to play the game in near-real time. You should only join if you have a good stretch of time to spare and are prepared to play the game in a sitting. Failure to play rapidly when it is your turn may result in your being kicked from the game.';
            $TimeLimitsWarningAttributes = 'class="bigalert"';
            break;
        case 4:
            $TimeLimitsWarning = 'These time limits indicate that the game\'s creator probably wants to play through the game in the space of a day or less. You should only join if you will be able to check back frequently to make your moves until the game is over. Failure to play rapidly when it is your turn may result in your being kicked from the game.';
            $TimeLimitsWarningAttributes = 'class="bigalert"';
            break;
        case 3:
            $TimeLimitsWarning = 'These time limits indicate that the game\'s creator probably wants players to check the game several times a day to make their moves. You should only join if you can make this commitment. Delaying for too long when it is your turn may result in your being kicked from the game.';
            $TimeLimitsWarningAttributes = 'class="alert"';
            break;
        case 2:
            $TimeLimitsWarning = 'These time limits indicate that the game\'s creator probably wants players to check the game at least a couple of times a day to make their moves. You should only join if you can make this commitment. Delaying for too long when it is your turn may result in your being kicked from the game.';
            $TimeLimitsWarningAttributes = 'class="alert"';
            break;
        case 1:
            $TimeLimitsWarning = 'These time limits indicate that the game\'s creator probably wants players to check the game at least once a day to make their moves. You should only join if you can make this commitment. Delaying for too long when it is your turn may result in your being kicked from the game.';
            $TimeLimitsWarningAttributes = 'style="font-weight: bold;"';
            break;
        default:
            $ShowTimeLimitWarning = false;
    }
    $mypage = page::standard();
    $mypage->script('lobby.js');
    $mypage->title_body('Brass - #' . $GAME['GameID'] . ' ' . $GAME['GameName_Title']);
    $mypage->loginbox(array('Location' => 6, 'GameID' => $GAME['GameID']));
    $FormOpen = false;
    if ($GAME['GameStatus'] != 'Cancelled' and @$_SESSION['LoggedIn'] and !$Banned) {
        $FormOpen = true;
    }
    $mypage->leaf('h3', $GAME['GameName_Page']);
    if ($FormOpen) {
        $mypage->opennode('form', 'action="lobby.php" method="POST"');
    }
    $mypage->leaf('p', 'Game details:');
    $mypage->opennode('table', 'class="table_no_borders table_extra_horizontal_padding" style="text-align: left;"');
    $mypage->opennode('tr');
    $mypage->leaf('td', 'Created by:', 'align=right style="min-width: 350px;"');
    if ($_SESSION['LoggedIn']) {
        $mypage->leaf('td', '<a href="userdetails.php?UserID=' . $GAME['GameCreator'] . '">' . $GAME['GameCreatorName'] . '</a>');
    } else {
        $mypage->leaf('td', $GAME['GameCreatorName']);
    }
    $mypage->next();
    $mypage->leaf('td', 'Creation time:', 'align=right');
    $mypage->leaf('td', $CreationTimeText);
    $mypage->next();
    $mypage->leaf('td', 'Friendly or Competitive?', 'align=right');
    $mypage->leaf('td', $FriendText);
    $mypage->next();
    $mypage->leaf('td', 'Game version:', 'align=right');
    $mypage->leaf('td', $GAME['VersionName'] . ' (' . $GAME['Creators'] . ')');
    $mypage->next();
    $mypage->leaf('td', 'Can be started by any player?', 'align=right');
    $mypage->leaf('td', $APSText);
    $mypage->next();
    $mypage->leaf('td', 'Starts automatically on reaching capacity?', 'align=right');
    $mypage->leaf('td', $AutoStartText);
    $mypage->next();
    $mypage->leaf('td', 'Minimum number of players:', 'align=right');
    $mypage->leaf('td', $GAME['MinimumPlayers']);
    $mypage->next();
    $mypage->leaf('td', 'Maximum number of players:', 'align=right');
    $mypage->leaf('td', $GAME['MaximumPlayers']);
    $mypage->next();
    $mypage->leaf('td', 'Reverse Virtual Connection?', 'align=right');
    $mypage->leaf('td', $ReverseVCText);
    $mypage->next();
    $mypage->leaf('td', 'Forbid the Canal Link to Scotland?', 'align=right');
    $mypage->leaf('td', $ForbidSCText);
    $mypage->next();
    $mypage->leaf('td', 'Modified Coal Overbuild Rules?', 'align=right');
    $mypage->leaf('td', $ORAWText);
    $mypage->next();
    $mypage->leaf('td', 'Initial Turn Order:', 'align=right');
    $mypage->leaf('td', $GAME['InitialTurnOrder']);
    $mypage->next();
    $mypage->leaf('td', 'Talk Rules:', 'align=right');
    $mypage->leaf('td', $GAME['TalkRules']);
    $mypage->next();
    $mypage->leaf('td', 'Time Limit A:', 'align=right');
    $mypage->leaf('td', $GAME['TimeLimitA'] . ' ' . $GAME['TimeLimitAunit'], $TimeLimitAAlert);
    $mypage->next();
    $mypage->leaf('td', 'Time Limit B:', 'align=right');
    $mypage->leaf('td', $GAME['TimeLimitB'] . ' ' . $GAME['TimeLimitBunit'], $TimeLimitBAlert);
    if ($ShowTimeLimitWarning) {
        $mypage->next();
        $mypage->leaf('td', '');
        $mypage->leaf('td', $TimeLimitsWarning, $TimeLimitsWarningAttributes);
    }
    $mypage->next();
    $mypage->leaf('td', 'Behaviour at Time Limit B:', 'align=right');
    $mypage->leaf('td', $GAME['DoWhatAtB']);
    $mypage->next();
    $mypage->leaf('td', 'Minimum Player Rating:', 'align=right');
    $mypage->leaf('td', $GAME['MinimumRating'] ? $GAME['MinimumRating'] : 'None');
    $mypage->next();
    $mypage->leaf('td', 'Maximum Player Rating:', 'align=right');
    $mypage->leaf('td', is_null($GAME['MaximumRating']) ? 'None' : $GAME['MinimumRating']);
    if ($_SESSION['LoggedIn'] and ($GAME['MinimumRating'] or !is_null($GAME['MaximumRating']))) {
        $mypage->next();
        $mypage->leaf('td', '');
        $mypage->leaf('td', '(Your player rating is ' . $Rating . ')');
    }
    $mypage->next('style="height: 10px;"');
    $mypage->leaf('td', '');
    $mypage->leaf('td', '&nbsp;');
    if ($GAME['GameCreator'] == @$_SESSION['MyUserID']) {
        $IAmTheCreator = true;
    } else {
        $IAmTheCreator = false;
    }
    $EnglishColourNames = array('Red', 'Yellow', 'Green', 'Purple', 'Grey');
    $TranslatedColourNames = array(transtext('_colourRed'), transtext('_colourYellow'), transtext('_colourGreen'), transtext('_colourPurple'), transtext('_colourGrey'));
    $PlayerColours = array('FFC18A', 'FFFFAF', '9FFF9F', 'FFC6FF', 'C4C4C4');
    $SlotAvailable = false;
    for ($i = 0; $i < MAX_PLAYERS; $i++) {
        $mypage->next();
        $mypage->leaf('td', $TranslatedColourNames[$i] . ':', 'align=right style="background-color: #' . $PlayerColours[$i] . ';"');
        echo '<td>';
        if (!$GAME['PlayerExists'][$i]) {
            echo '&nbsp;&mdash;';
            if ($FormOpen and @$_SESSION['LoggedIn'] and !$Banned and $GAME['MyColour'] == 50 and $GAME['CurrentPlayers'] < $GAME['MaximumPlayers'] and $Rating >= $GAME['MinimumRating'] and (is_null($GAME['MaximumRating']) or $Rating <= $GAME['MaximumRating'])) {
                $SlotAvailable = true;
                echo '&nbsp;&nbsp;<input type="submit" name="FormSubmit" value="Join Game as ' . $EnglishColourNames[$i] . '" onClick="';
                if ($ShowTimeLimitWarning) {
                    echo 'ConfirmTimeLimit(';
                } else {
                    echo 'ChangeActionID(';
                }
                echo 20 + $i . ')">';
            }
        } else {
            if ($GAME['MyColour'] == $i) {
                echo '&nbsp;<b>You</b>';
                if ($FormOpen and $GAME['CurrentPlayers'] > 1 and !$IAmTheCreator) {
                    echo '&nbsp;&nbsp;<input type="submit" name="FormSubmit" value="Leave this game" onClick="ChangeActionID(31)">';
                }
            } else {
                if (@$_SESSION['LoggedIn']) {
                    echo '&nbsp;<a href="userdetails.php?UserID=' . $GAME['PlayerUserID'][$i] . '">' . $GAME['PlayerName'][$i] . '</a>';
                    if ($FormOpen and ($Administrator or $IAmTheCreator) and $GAME['CurrentPlayers'] > 1 and $GAME['PlayerUserID'][$i] != $GAME['GameCreator']) {
                        echo '&nbsp;&nbsp;<input type="submit" name="FormSubmit" value="Remove ' . $EnglishColourNames[$i] . ' from the game" onClick="ChangeActionID(' . (10 + $i) . ')">';
                    }
                } else {
                    echo '&nbsp;' . $GAME['PlayerName'][$i];
                }
            }
        }
        echo '</td>';
    }
    $mypage->closenode(2);
    // tr, table
    if ($FormOpen and $SlotAvailable) {
        $mypage->leaf('p', '<input type="submit" name="FormSubmit" value="Join as Any" onClick="' . ($ShowTimeLimitWarning ? 'ConfirmTimeLimit' : 'ChangeActionID') . '(28);">');
        if ($GAME['GPrivate']) {
            $mypage->opennode('p');
            $mypage->text('This game is private. In order to join it, you must first enter the password here (the game password, <i>not</i> your user password):');
            $mypage->emptyleaf('input', 'type="text" name="Password" size=20 maxlength=20');
            $mypage->closenode();
            // p
        }
    }
    if ($FormOpen and $IAmTheCreator) {
        $mypage->opennode('p');
        $mypage->text('As the creator of the game, you may change whether the game is private or not.');
        $mypage->text('<br>Game is private?');
        $mypage->emptyleaf('input', 'type="checkbox" name="GPrivateBox" value=1' . $PrivateText);
        $mypage->text('Password:'******'input', 'type="text" name="PasswordB" size=20 maxlength=20 value="' . $GAME['Password'] . '"');
        $mypage->emptyleaf('input', 'type="submit" name="FormSubmit" value="Amend" onClick="ChangeActionID(32);"');
        $mypage->text('<br>(The "Password" field is ignored if the game is not private. If used, the password should be between 3 and 20 characters. Please note that game passwords are stored merely as plain text, and not in encrypted form like user passwords; they are intended only as a simple barrier to joining the game for people to whom you have not given the password.)');
        $mypage->closenode();
        // p
    }
    if ($FormOpen and ($GAME['CurrentPlayers'] >= $GAME['MinimumPlayersAllowed'] and $Administrator or $GAME['CurrentPlayers'] >= $GAME['MinimumPlayers'] and ($IAmTheCreator or $GAME['AnyPlayerStarts'] and $GAME['MyColour'] != 50))) {
        $mypage->opennode('p');
        $mypage->leaf('a', 'Start the game', 'href="startgame.php?GameID=' . $GAME['GameID'] . '&amp;NumPlayers=' . $GAME['CurrentPlayers'] . '"');
        if ($GAME['CurrentPlayers'] < $GAME['MinimumPlayers']) {
            $mypage->text('<br>(note: it does not have its "minimum number" of players yet)');
        }
        if (!$GAME['AnyPlayerStarts'] and !$IAmTheCreator) {
            $mypage->text('<br>(note: the game creator does not intend others to start it)');
        }
        $mypage->closenode();
        // p
    }
    if ($FormOpen and ($Administrator or $IAmTheCreator)) {
        $mypage->leaf('p', '<input type="submit" name="FormSubmit" value="Cancel this game" onClick="ChangeActionID(30);">');
    }
    if ($FormOpen and $Administrator) {
        if ($GAME['GTitleDeletedByAdmin']) {
            $mypage->leaf('p', '<input type="submit" name="FormSubmit" value="Unclear title" onClick="ChangeActionID(34);">');
        } else {
            $mypage->leaf('p', '<input type="submit" name="FormSubmit" value="Clear title" onClick="ChangeActionID(33);">');
        }
    }
    if ($FormOpen) {
        $mypage->emptyleaf('input', 'type="hidden" name="GameID" value="' . $GAME['GameID'] . '"');
        $mypage->emptyleaf('input', 'type="hidden" name="FormActionID" id="FormActionIDid" value=0');
        $mypage->closenode();
        // form
    }
    require HIDDEN_FILES_PATH . 'displaythread.php';
    if ($Administrator) {
        if ($GAME['Closed'] == 'Forced Closed') {
            $StringFC = ' selected';
        } else {
            $StringFC = '';
        }
        if ($GAME['Closed'] == 'Closed') {
            $StringC = ' selected';
        } else {
            $StringC = '';
        }
        if ($GAME['Closed'] == 'Forced Open') {
            $StringFO = ' selected';
        } else {
            $StringFO = '';
        }
        if ($GAME['Closed'] == 'Open') {
            $StringO = ' selected';
        } else {
            $StringO = '';
        }
        echo '<form action="threadview.php" method="POST"><p>Thread is <select name="Closedness"><option value="FC"' . $StringFC . '>Forced Closed<option value="C"' . $StringC . '>Closed<option value="FO"' . $StringFO . '>Forced Open<option value="O"' . $StringO . '>Open</select><input type="hidden" name="ThreadSticky" value="0"> --- <input type="submit" name="FormSubmitA" value="Execute"></p><input type="hidden" name="WhichThread" value=' . $GAME['Thread'] . '></form>';
    } else {
        if ($GAME['Closed'] == 'Closed' or $GAME['Closed'] == 'Forced Closed') {
            $mypage->leaf('h3', 'This game\'s discussion thread has been closed by an Administrator.');
        }
    }
    displaythread($GAME['Thread'], $GAME['Closed'], 1, $Administrator, $Banned);
    $mypage->leaf('p', 'Click <a href="index.php">here</a> to return to the Main Page.');
    $mypage->finish();
}