本文整理汇总了PHP中page::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP page::redirect方法的具体用法?PHP page::redirect怎么用?PHP page::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类page
的用法示例。
在下文中一共展示了page::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DoTask
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.');
}
示例2: DoTask
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.');
}
示例3: DoTask
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, 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.');
}
示例4: DoTask
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.');
}
示例5: DoTask
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.');
}
示例6: not_logged_in_action
public function not_logged_in_action()
{
if (account::logged_in()) {
//y u lie tho?
page::redirect('/world');
}
}
示例7: DoTask
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.');
}
示例8: scanBlocks
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");
}
示例9: DoTask
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.');
}
示例10: DoTask
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.');
}
示例11: index_action
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);
}
示例12: DoTask
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.');
}
示例13: DoTask
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.');
}
示例14: DoTask
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.');
}
示例15: DoTask
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.');
}