Esempio n. 1
0
<?php

$defaultEnd = TIME + 2 * 31 * 86400;
//3 months
$template->assign('DefaultEnd', $defaultEnd);
$template->assign('GameTypes', array('Default', 'Semi Wars', 'Draft', 'Newbie', 'FFA'));
//get information
$container = create_container('1.6/universe_create_save_processing.php', '1.6/universe_create_galaxies.php');
$template->assign('CreateGalaxiesHREF', SmrSession::getNewHREF($container));
$container['body'] = '1.6/universe_create_sectors.php';
$template->assign('EditGameHREF', SmrSession::getNewHREF($container));
if ($account->hasPermission(PERMISSION_EDIT_STARTED_GAMES)) {
    $games = Globals::getGameInfo();
} else {
    $games = array();
    $db->query('SELECT game_id FROM game WHERE start_date > ' . $db->escapeNumber(TIME) . ' ORDER BY end_date DESC');
    while ($db->nextRecord()) {
        $games[$db->getInt('game_id')] = Globals::getGameInfo($db->getInt('game_id'));
    }
}
$template->assignByRef('EditGames', $games);
Esempio n. 2
0
<?php

$template->assign('PageTopic', 'Send Message');
if (isset($_REQUEST['game_id'])) {
    SmrSession::updateVar('SendGameID', $_REQUEST['game_id']);
}
$gameID = $var['SendGameID'];
// check if we know the game yet
if (empty($gameID)) {
    $template->assign('AdminMessageChooseGameFormHref', SmrSession::getNewHREF(create_container('skeleton.php', 'admin_message_send.php')));
    $template->assignByRef('Games', Globals::getGameInfo());
} else {
    $container = create_container('admin_message_send_processing.php');
    $container['SendGameID'] = $gameID;
    $template->assign('AdminMessageSendFormHref', SmrSession::getNewHREF($container));
    $template->assign('MessageGameID', $gameID);
    $template->assign('ExpireTime', 1);
    if ($gameID != 20000) {
        $gamePlayers = array();
        $db->query('SELECT account_id,player_id,player_name FROM player WHERE game_id = ' . $db->escapeNumber($gameID) . ' ORDER BY player_name');
        while ($db->nextRecord()) {
            $gamePlayers[] = array('AccountID' => $db->getField('account_id'), 'PlayerID' => $db->getField('player_id'), 'Name' => $db->getField('player_name'));
        }
        $template->assignByRef('GamePlayers', $gamePlayers);
    }
    if (isset($var['preview'])) {
        $template->assign('Preview', $var['preview']);
        $template->assign('ExpireTime', $var['expire']);
    }
}
Esempio n. 3
0
    }
    ?>
					</td>
				</tr><?php 
} else {
    ?>
				<tr>
					<td align="right" class="bold">Player Name:</td>
					<td><input type="text" name="player_name" id="InputFields" size="20"></td>
				</tr>
				<tr>
					<td align="right" class="bold">Game:</td>
					<td>
						<select name="game_id" size="1" id="InputFields">
							<option value="0">All Games</option><?php 
    $Games =& Globals::getGameInfo();
    foreach ($Games as &$Game) {
        ?>
<option value="<?php 
        echo $Game['ID'];
        ?>
"><?php 
        echo $Game['GameName'];
        ?>
</option><?php 
    }
    unset($Game);
    ?>
						</select>
					</td>
				</tr><?php 
Esempio n. 4
0
<?php

$game =& Globals::getGameInfo($var['game_id']);
$template->assignByRef('Game', $game);
// do we need credits for this game?
if ($game['GameCreditsRequired'] > 0) {
    // do we have enough
    if ($account->getTotalSmrCredits() < $game['GameCreditsRequired']) {
        create_error('Sorry you do not have enough SMR Credits to play this game.<br />To get SMR credits you need to donate to SMR.');
    }
}
// is the game already full?
if (SmrGame::getGame($var['game_id'])->getTotalPlayers() >= $game['GameMaxPlayers']) {
    create_error('The maximum number of players in that game is reached!');
}
//if (TIME < $game['StartDate'])
//	create_error('You want to join a game that hasn\'t started yet?');
if (TIME > $game['EndDate']) {
    create_error('You want to join a game that is already over?');
}
$template->assign('PageTopic', 'Join Game');
$raceInfo =& Globals::getRaces();
$raceDescriptions = '';
$first = true;
foreach ($raceInfo as $race) {
    if ($first) {
        $raceDescriptions .= '\'' . str_replace('\'', '\\\'"', $race['Description']) . '\'';
        $first = false;
    } else {
        $raceDescriptions .= ', \'' . str_replace('\'', '\\\'', $race['Description']) . '\'';
    }