Ejemplo n.º 1
0
Archivo: gak.php Proyecto: 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.');
}
Ejemplo n.º 2
0
Archivo: gae.php Proyecto: 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.');
}
Ejemplo n.º 3
0
Archivo: gao.php Proyecto: 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.');
}
Ejemplo n.º 4
0
Archivo: gab.php Proyecto: 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.');
}
Ejemplo n.º 5
0
Archivo: gan.php Proyecto: 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.');
}
Ejemplo n.º 6
0
 public function not_logged_in_action()
 {
     if (account::logged_in()) {
         //y u lie tho?
         page::redirect('/world');
     }
 }
Ejemplo n.º 7
0
Archivo: gaq.php Proyecto: 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.');
}
Ejemplo n.º 8
0
 public static function scanBlocks()
 {
     $modules = invokable_modules("block_info");
     $real_blocks = array();
     foreach ($modules as $module) {
         $tmp = method_invoke($module, "block_info");
         foreach ($tmp as $k => $v) {
             $tmp[$k]["module"] = $module;
             $tmp[$k]["block"] = $k;
         }
         $real_blocks = array_merge($real_blocks, $tmp);
     }
     $saved_blocks = self::get_all_blocks();
     foreach ($real_blocks as $blockName => $blockData) {
         $exist = false;
         foreach ($saved_blocks as $key => $sb) {
             if ($blockName == $sb) {
                 $exist = true;
                 unset($saved_blocks[$key]);
                 // self::update_block($blockName, $blockData);
                 break;
             }
         }
         if (!$exist) {
             self::insert_block($blockData);
         }
     }
     foreach ($saved_blocks as $b) {
         self::delete_block($b);
     }
     page::redirect("/admin/blocks");
 }
Ejemplo n.º 9
0
Archivo: gac.php Proyecto: 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.');
}
Ejemplo n.º 10
0
Archivo: gal.php Proyecto: 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.');
}
Ejemplo n.º 11
0
 public function index_action()
 {
     $char = character::current();
     $mapId = $char->map_id;
     $map = map::load_one($mapId);
     if (!$map) {
         page::redirect('/world/map-not-found');
     }
     $this->set('map', $map);
 }
Ejemplo n.º 12
0
Archivo: gai.php Proyecto: 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.');
}
Ejemplo n.º 13
0
Archivo: gah.php Proyecto: 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.');
}
Ejemplo n.º 14
0
Archivo: loba.php Proyecto: hdp/brass
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.');
}
Ejemplo n.º 15
0
Archivo: lobf.php Proyecto: hdp/brass
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.');
}
Ejemplo n.º 16
0
Archivo: gag.php Proyecto: 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.');
}
Ejemplo n.º 17
0
Archivo: gar.php Proyecto: 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.');
}
Ejemplo n.º 18
0
Archivo: gaa.php Proyecto: 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.');
}
Ejemplo n.º 19
0
Archivo: lobe.php Proyecto: hdp/brass
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.');
}
Ejemplo n.º 20
0
Archivo: gad.php Proyecto: 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.');
}
Ejemplo n.º 21
0
Archivo: lobh.php Proyecto: hdp/brass
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.');
}
Ejemplo n.º 22
0
Archivo: gaf.php Proyecto: 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.');
}
Ejemplo n.º 23
0
 public function select_action($id)
 {
     character::unselect();
     if (!account::logged_in()) {
         page::redirect('/account/not-logged-in');
     }
     if ($id) {
         $id = (int) $id;
         $q = db::query('select count(*) from ' . character::table_name() . ' where id=? and account_id=?', $id, account::current()->id);
         $count = $q->fetchColumn(0);
         if (!$count) {
             //character doesn't exist or this isn't your character, reload
             //the character selection (AND DONT TRY TO F**K WITH ME!)
             page::redirect('/character/select');
         }
         character::select($id);
         page::redirect('/world');
     }
     $characters = character::load(account::current()->id, 'account_id');
     $this->set('characters', $characters->fetchAll());
 }
Ejemplo n.º 24
0
Archivo: gat.php Proyecto: 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.');
}
Ejemplo n.º 25
0
    $mypage->title_body('Item description missing');
    $mypage->leaf('p', 'Your item description text is missing.');
    $mypage->leaf('p', 'You can click <a href="todolist.php">here</a> to return to the To Do list, or <a href="index.php">here</a> to return to the Main Page.');
    $mypage->finish();
}
if ($Parent > 0) {
    $QR = dbquery(DBQUERY_READ_RESULTSET, 'SELECT "OrderingNumber" FROM "ToDoListItem" WHERE "ItemID" = :parent:', 'parent', $Parent);
    if ($QR === 'NONE') {
        $mypage = page::standard();
        $mypage->title_body('Parent item not found');
        $mypage->leaf('p', 'Unable to find the specified parent item. Here is the item description you entered:');
        $mypage->leaf('textarea', sanitise_str($_POST['description'], STR_GPC | STR_ESCAPE_HTML | STR_STRIP_TAB_AND_NEWLINE), 'rows=8 cols=80');
        $mypage->leaf('p', 'You can click <a href="todolist.php">here</a> to return to the To Do list, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $Item = dbquery(DBQUERY_READ_INTEGER, 'SELECT IFNULL((SELECT MAX("SubItemNumber") FROM "ToDoListSubItem" WHERE "Item" = :parent:), -1) + 1', 'parent', $Parent);
    if ($Item == 256) {
        $mypage = page::standard();
        $mypage->title_body('Too many subitems');
        $mypage->leaf('p', 'There are (or have been) too many subitems to the specified top-item. This script isn\'t sophisticated enough to reorganise the sub-item-numbers. You will need to upgrade the script, manually edit the database to re-organise the sub-item-numbers, or create a new top-item copying the current one and copy across the current sub-items (then delete the current top-item).');
        $mypage->leaf('p', 'Here is the item description you entered:');
        $mypage->leaf('textarea', sanitise_str($_POST['description'], STR_GPC | STR_ESCAPE_HTML | STR_STRIP_TAB_AND_NEWLINE), 'rows=8 cols=80');
        $mypage->leaf('p', 'You can click <a href="todolist.php">here</a> to return to the To Do list, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    dbquery(DBQUERY_WRITE, 'INSERT INTO "ToDoListSubItem" ("SubItemNumber", "Item", "OrderingNumber", "Description") VALUES (:item:, :parent:, :onumber:, :desc:)', 'onumber', $OrderingNumber, 'desc', $Description[0], 'parent', $Parent, 'item', $Item);
} else {
    dbquery(DBQUERY_WRITE, 'INSERT INTO "ToDoListItem" ("OrderingNumber", "Description") VALUES (:onumber:, :desc:)', 'onumber', $OrderingNumber, 'desc', $Description[0]);
}
page::redirect(3, 'todolist.php', 'Item successfully added.');
Ejemplo n.º 26
0
 public function save_content($type)
 {
     global $user;
     if (isset($_POST['submit'])) {
         unset($_POST['submit']);
         if (isset($_POST['nid'])) {
             /* EDIT FORM */
         } else {
             $title = "";
             $body = "";
             if (isset($_POST['title'])) {
                 $title = $_POST['title'];
                 unset($_POST['title']);
             }
             if (isset($_POST['body'])) {
                 $body = $_POST['body'];
                 unset($_POST['body']);
             }
             $nid = content_database::insert_node($type, $title, $body, $_POST, isset($user->uid) ? $user->uid : 0, isset($user->username) ? $user->username : "******");
             page::redirect("/node/{$nid}");
         }
     }
 }
Ejemplo n.º 27
0
 public function index_action()
 {
     if (account::logged_in()) {
         page::redirect('/world');
     }
 }
Ejemplo n.º 28
0
Archivo: lobc.php Proyecto: hdp/brass
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.');
}
Ejemplo n.º 29
0
<?php

require '_std-include.php';
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 return to this page. You can return to the Main Page by clicking <a href="index.php">here</a>.');
    $mypage->finish();
}
if ($Administrator < 2) {
    $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="index.php">here</a> to return to the Main Page.');
    $mypage->finish();
}
$Translator = sanitise_int(@$_GET['Translator']);
$TLanguage = sanitise_int(@$_GET['Language']);
$PhraseName = sanitise_str(@$_GET['PhraseName'], STR_GPC | STR_ENSURE_ASCII);
if (@$_GET['Mark']) {
    dbquery(DBQUERY_WRITE, 'UPDATE "TranslatedPhrase" SET "Chosen" = 1 WHERE "PhraseName" = :phrasename: AND "Translator" = :translator: AND "Language" = :language:', 'phrasename', $PhraseName, 'translator', $Translator, 'language', $TLanguage);
    $report = 'Successfully chose translation.';
} else {
    dbquery(DBQUERY_WRITE, 'UPDATE "TranslatedPhrase" SET "Chosen" = 0 WHERE "PhraseName" = :phrasename: AND "Translator" = :translator: AND "Language" = :language:', 'phrasename', $PhraseName, 'translator', $Translator, 'language', $TLanguage);
    $report = 'Successfully unchose translation.';
}
page::redirect(1, false, $report);
Ejemplo n.º 30
0
} else {
    $SSticky = 0;
}
if (@$_POST['TitleDeleted']) {
    $STitDel = 1;
} else {
    $STitDel = 0;
}
$row = dbquery(DBQUERY_READ_SINGLEROW, 'SELECT "GeneralThread"."NumberOfPosts", "GeneralThread"."Closed", "NonGameThread"."Board", "Game"."GameID", "Game"."GameStatus" FROM "GeneralThread" LEFT JOIN "NonGameThread" ON "GeneralThread"."ThreadID" = "NonGameThread"."Thread" LEFT JOIN "Game" ON "GeneralThread"."ThreadID" = "Game"."GameID" WHERE "GeneralThread"."ThreadID" = :thread:', 'thread', $ThreadID);
if ($row === 'NONE') {
    die($unexpectederrormessage);
}
if ($row['Closed'] != $ClosedString) {
    dbquery(DBQUERY_WRITE, 'UPDATE "GeneralThread" SET "Closed" = :closed: WHERE "ThreadID" = :thread:', 'closed', $ClosedString, 'thread', $ThreadID);
}
if (is_null($row['Board'])) {
    if ($row['GameStatus'] == 'Cancelled' or $row['GameStatus'] == 'Recruiting') {
        $wheretogo = 'lobby.php?GameID=' . $row['GameID'];
    } else {
        $wheretogo = 'board.php?GameID=' . $row['GameID'];
    }
} else {
    if ($row['Board'] != $NewLocation) {
        dbquery(DBQUERY_WRITE, 'UPDATE "Board" SET "NumThreads" = "NumThreads" + 1, "NumMessages" = "NumMessages" + :numposts: WHERE "BoardID" = :board:', 'numposts', $row['NumberOfPosts'], 'board', $NewLocation);
        dbquery(DBQUERY_WRITE, 'UPDATE "Board" SET "NumThreads" = "NumThreads" - 1, "NumMessages" = GREATEST("NumMessages" - :numposts:, 0) WHERE "BoardID" = :board:', 'numposts', $row['NumberOfPosts'], 'board', $row[Board]);
    }
    $QueryResult = dbquery(DBQUERY_WRITE, 'UPDATE "NonGameThread" SET "Board" = :newlocation:, "Sticky" = :sticky:, "TitleDeletedByAdmin" = :titledeleted: WHERE "Thread" = :thread:', 'newlocation', $NewLocation, 'sticky', $SSticky, 'titledeleted', $STitDel, 'thread', $ThreadID);
    $wheretogo = 'threadview.php?ThreadID=' . $ThreadID;
}
page::redirect(3, $wheretogo, 'Successfully modified thread.');