Ejemplo n.º 1
0
<?php

$template->assign('PageTopic', 'IP Menu');
$db->query('SELECT max(account_id) max_account_id FROM account');
$db->nextRecord();
$template->assign('MaxAccountID', $db->getInt('max_account_id'));
$template->assign('IpFormHref', SmrSession::getNewHREF(create_container('skeleton.php', 'ip_view_results.php')));
Ejemplo n.º 2
0
<?php

$template->assign('PageTopic', 'Log Console');
$loggedAccounts = array();
$db->query('SELECT account_id as account_id, login, count(*) as number_of_entries
			FROM account_has_logs
			JOIN account USING(account_id)
			GROUP BY account_id');
if ($db->getNumRows()) {
    $db2 = new SmrMySqlDatabase();
    while ($db->nextRecord()) {
        $accountID = $db->getInt('account_id');
        $loggedAccounts[$accountID] = array('AccountID' => $accountID, 'Login' => $db->getField('login'), 'TotalEntries' => $db->getInt('number_of_entries'), 'Checked' => is_array($var['account_ids']) && in_array($accountID, $var['account_ids']), 'Notes' => '');
        $db2->query('SELECT notes FROM log_has_notes WHERE account_id = ' . $db2->escapeNumber($accountID));
        if ($db2->nextRecord()) {
            $loggedAccounts[$accountID]['Notes'] = nl2br($db2->getField('notes'));
        }
    }
    // put hidden fields in for log type to have all fields selected on next page.
    $logTypes = array();
    $db->query('SELECT log_type_id FROM log_type');
    while ($db->nextRecord()) {
        $logTypes[] = $db->getInt('log_type_id');
    }
    $template->assignByRef('LogTypes', $logTypes);
    $template->assign('LogConsoleFormHREF', SmrSession::getNewHREF(create_container('skeleton.php', 'log_console_detail.php')));
    $template->assign('AnonAccessHRE', SmrSession::getNewHREF(create_container('skeleton.php', 'log_anonymous_account.php')));
}
$template->assignByRef('LoggedAccounts', $loggedAccounts);
Ejemplo n.º 3
0
<?php

$template->assign('PageTopic', 'Edit Photo');
$db->query('SELECT * FROM album WHERE account_id = ' . $db->escapeNumber(SmrSession::$account_id));
if ($db->nextRecord()) {
    $albumEntry['Location'] = stripslashes($db->getField('location'));
    $albumEntry['Email'] = stripslashes($db->getField('email'));
    $albumEntry['Website'] = stripslashes($db->getField('website'));
    $albumEntry['Day'] = $db->getInt('day');
    $albumEntry['Month'] = $db->getInt('month');
    $albumEntry['Year'] = $db->getInt('year');
    $albumEntry['Other'] = stripslashes($db->getField('other'));
    $approved = $db->getField('approved');
    if ($approved == 'TBC') {
        $albumEntry['Status'] = '<span style="color:orange;">Waiting approval</span>';
    } elseif ($approved == 'NO') {
        $albumEntry['Status'] = '<span class="red">Approval denied</span>';
    } elseif ($db->getBoolean('disabled')) {
        $albumEntry['Status'] = '<span class="red">Disabled</span>';
    } elseif ($approved == 'YES') {
        $albumEntry['Status'] = '<a href="' . URL . '/album/?' . $account->getHofName() . '" class="dgreen">Online</a>';
    }
    if (is_readable(UPLOAD . SmrSession::$account_id)) {
        $albumEntry['Image'] = URL . '/upload/' . SmrSession::$account_id;
    }
    $template->assign('AlbumEntry', $albumEntry);
}
$template->assign('AlbumEditHref', SmrSession::getNewHREF(create_container('album_edit_processing.php', '')));
Ejemplo n.º 4
0
create_ranking_menu(1, 3);
$db->query('SELECT count(*) FROM alliance
			WHERE game_id = ' . $db->escapeNumber($player->getGameID()));
$db->nextRecord();
$numAlliances = $db->getInt('count(*)');
$ourRank = 0;
if ($player->hasAlliance()) {
    $db->query('SELECT count(*)
				FROM alliance
				WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . '
				AND (
					alliance_deaths > ' . $db->escapeNumber($player->getAlliance()->getDeaths()) . '
					OR (
						alliance_deaths = ' . $db->escapeNumber($player->getAlliance()->getDeaths()) . '
						AND alliance_name <= ' . $db->escapeString($player->getAllianceName()) . '
					)
				)');
    $db->nextRecord();
    $ourRank = $db->getInt('count(*)');
    $template->assign('OurRank', $ourRank);
}
$db->query('SELECT alliance_id, alliance_deaths amount FROM alliance
			WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' ORDER BY amount DESC, alliance_name LIMIT 10');
$template->assignByRef('Rankings', Rankings::collectAllianceRankings($db, $player, 0));
Rankings::calculateMinMaxRanks($ourRank, $numAlliances);
$lowerLimit = $var['MinRank'] - 1;
$db->query('SELECT alliance_id, alliance_deaths amount FROM alliance
			WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' ORDER BY amount DESC, alliance_name LIMIT ' . $lowerLimit . ', ' . ($var['MaxRank'] - $lowerLimit));
$template->assignByRef('FilteredRankings', Rankings::collectAllianceRankings($db, $player, 0));
$template->assign('FilterRankingsHREF', SmrSession::getNewHREF(create_container('skeleton.php', 'rankings_alliance_death.php')));
Ejemplo n.º 5
0
<?php

$template->assign('PageTopic', 'Search Trader');
$template->assign('TraderSearchHREF', SmrSession::getNewHREF(create_container('skeleton.php', 'trader_search_result.php')));
Ejemplo n.º 6
0
<?php

$template->assign('PageTopic', 'Create Vote');
$template->assign('VoteFormHREF', SmrSession::getNewHREF(create_container('vote_create_processing.php', '')));
$voting = array();
$db->query('SELECT * FROM voting WHERE end > ' . $db->escapeNumber(TIME));
while ($db->nextRecord()) {
    $voteID = $db->getField('vote_id');
    $voting[$voteID]['ID'] = $voteID;
    $voting[$voteID]['Question'] = $db->getField('question');
}
$template->assign('CurrentVotes', $voting);
if (isset($var['PreviewVote'])) {
    $template->assign('PreviewVote', $var['PreviewVote']);
}
if (isset($var['Days'])) {
    $template->assign('Days', $var['Days']);
}
if (isset($var['PreviewOption'])) {
    $template->assign('PreviewOption', $var['PreviewOption']);
}
if (isset($var['VoteID'])) {
    $template->assign('VoteID', $var['VoteID']);
}
Ejemplo n.º 7
0
<?php

$template->assign('PageTopic', 'Naming Your Ship');
if (isset($var['Preview'])) {
    $template->assign('Preview', $var['Preview']);
    $template->assign('ContinueHref', SmrSession::getNewHREF(create_container('skeleton.php', 'buy_ship_name_processing.php', array('ShipName' => $var['Preview']))));
} else {
    $template->assign('ShipNameFormHref', SmrSession::getNewHREF(create_container('skeleton.php', 'buy_ship_name_processing.php')));
}
Ejemplo n.º 8
0
<?php

$template->assign('PageTopic', 'Create Universe - Create Game (1/10)');
// create a container that will hold next url and additional variables.
$container = array();
$container['url'] = 'universe_create_game_processing.php';
$template->assign('CreateUniverseFormHref', SmrSession::getNewHREF($container));
$db->query('SELECT * FROM game ORDER BY game_id');
$games = array();
while ($db->nextRecord()) {
    $games[] = array('ID' => $db->getField('game_id'), 'Name' => $db->getField('game_name'));
}
$template->assign('Games', $games);
$template->assign('DefaultStartDate', date('Y/m/d', TIME));
$template->assign('DefaultEndDate', date('Y/m/d', TIME + 5184000));
$db->query('SELECT game_name
			FROM game
			WHERE enabled = \'FALSE\'');
if ($db->getNumRows()) {
    $disabledGames = array();
    while ($db->nextRecord()) {
        $disabledGames[] = $db->getField('game_name');
    }
    $template->assign('DisabledGames', $disabledGames);
}
Ejemplo n.º 9
0
				AND transaction_id<=' . $db->escapeNumber($maxValue) . '
				ORDER BY time LIMIT ' . (1 + $maxValue - $minValue);
} else {
    $query .= ' ORDER BY time LIMIT 10';
}
$db->query($query);
// only if we have at least one result
if ($db->getNumRows() > 0) {
    $bankTransactions = array();
    while ($db->nextRecord()) {
        $bankTransactions[$db->getInt('transaction_id')] = array('Time' => $db->getInt('time'), 'Player' => SmrPlayer::getPlayer($db->getInt('payee_id'), $player->getGameID()), 'Reason' => $db->getField('reason'), 'TransactionType' => $db->getField('transaction'), 'Withdrawal' => $db->getField('transaction') == 'Payment' ? $db->getInt('amount') : '', 'Deposit' => $db->getField('transaction') == 'Deposit' ? $db->getInt('amount') : '', 'Exempt' => $db->getInt('exempt') == 1);
    }
    $template->assignByRef('BankTransactions', $bankTransactions);
    $template->assign('MinValue', $minValue);
    $template->assign('MaxValue', $maxValue);
    $container = create_container('skeleton.php', 'bank_alliance.php');
    $container['alliance_id'] = $alliance->getAllianceID();
    $template->assign('FilterTransactionsFormHREF', SmrSession::getNewHREF($container));
    $container = create_container('bank_alliance_exempt_processing.php');
    $container['minVal'] = $minValue;
    $container['maxVal'] = $maxValue;
    $template->assign('ExemptTransactionsFormHREF', SmrSession::getNewHREF($container));
    $template->assignByRef('Alliance', $alliance);
}
$container = create_container('skeleton.php', 'bank_report.php');
$container['alliance_id'] = $alliance->getAllianceID();
$template->assign('BankReportHREF', SmrSession::getNewHREF($container));
$container = create_container('bank_alliance_processing.php');
$container['alliance_id'] = $alliance->getAllianceID();
$template->assign('BankTransactionFormHREF', SmrSession::getNewHREF($container));
Ejemplo n.º 10
0
    $players[$db->getInt('account_id')] = SmrPlayer::getPlayer($db->getInt('account_id'), $player->getGameID())->getLinkedDisplayName(false);
}
$db->query('SELECT mb_messages FROM player_has_alliance_role JOIN alliance_has_roles USING(game_id,alliance_id,role_id) WHERE account_id = ' . $db->escapeNumber($player->getAccountID()) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND alliance_id=' . $db->escapeNumber($alliance->getAllianceID()) . ' LIMIT 1');
$db->nextRecord();
$thread['CanDelete'] = $db->getBoolean('mb_messages');
$db->query('SELECT text, sender_id, time, reply_id
FROM alliance_thread
WHERE game_id=' . $db->escapeNumber($player->getGameID()) . '
AND alliance_id=' . $db->escapeNumber($alliance->getAllianceID()) . '
AND thread_id=' . $db->escapeNumber($thread_id) . '
ORDER BY reply_id LIMIT ' . $var['thread_replies'][$thread_index]);
$thread['CanDelete'] = $db->getNumRows() > 1 && $thread['CanDelete'];
$thread['Replies'] = array();
$container = create_container('alliance_message_delete_processing.php', '', $var);
$container['thread_id'] = $thread_id;
while ($db->nextRecord()) {
    $thread['Replies'][$db->getInt('reply_id')] = array('Sender' => $players[$db->getInt('sender_id')], 'Message' => $db->getField('text'), 'SendTime' => $db->getInt('time'));
    if ($thread['CanDelete']) {
        $container['reply_id'] = $db->getInt('reply_id');
        $thread['Replies'][$db->getInt('reply_id')]['DeleteHref'] = SmrSession::getNewHREF($container);
    }
}
if ($mbWrite || in_array($player->getAccountID(), Globals::getHiddenPlayers())) {
    $container = create_container('alliance_message_add_processing.php', '', $var);
    $container['thread_index'] = $thread_index;
    $thread['CreateThreadReplyFormHref'] = SmrSession::getNewHREF($container);
}
$template->assignByRef('Thread', $thread);
if (isset($var['preview'])) {
    $template->assign('Preview', $var['preview']);
}
<?php

require_once get_file_loc('menu.inc');
create_galactic_post_menu();
$container = create_container('galactic_post_write_article_processing.php');
if (isset($var['id'])) {
    $container['id'] = $var['id'];
    $template->assign('PageTopic', 'Editing An Article');
    if (!isset($var['Preview'])) {
        $db->query('SELECT title, text FROM galactic_post_article WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND article_id = ' . $db->escapeNumber($var['id']) . ' LIMIT 1');
        if ($db->nextRecord()) {
            SmrSession::updateVar('PreviewTitle', $db->getField('title'));
            SmrSession::updateVar('Preview', $db->getField('text'));
        }
    }
} else {
    $template->assign('PageTopic', 'Writing An Article');
}
if (isset($var['Preview'])) {
    $template->assign('PreviewTitle', $var['PreviewTitle']);
    $template->assign('Preview', $var['Preview']);
}
$template->assign('SubmitArticleHref', SmrSession::getNewHREF($container));
Ejemplo n.º 12
0
<?php

if (!$player->isLandedOnPlanet()) {
    create_error('You are not on a planet!');
}
// create planet object
$planet =& $player->getSectorPlanet();
$template->assign('PageTopic', 'Planet : ' . $planet->getName() . ' [Sector #' . $player->getSectorID() . ']');
require_once get_file_loc('menu.inc');
create_planet_menu($planet);
//echo the dump cargo message or other message.
if (isset($var['errorMsg'])) {
    $template->assign('ErrorMsg', $var['errorMsg']);
}
if (isset($var['msg'])) {
    $template->assign('Msg', bbifyMessage($var['msg']));
}
$template->assignByRef('ThisPlanet', $planet);
doTickerAssigns($template, $player, $db);
$template->assign('LaunchFormLink', SmrSession::getNewHREF(create_container('planet_launch_processing.php', '')));
Ejemplo n.º 13
0
    } elseif ($var['Dir'] == 'Down') {
        $player->increaseZoom(1);
    }
}
$dist = $player->getZoom();
$template->assign('isZoomOn', $zoomOn);
$container = array();
$container['url'] = 'skeleton.php';
$container['Dir'] = 'Down';
$container['rid'] = 'zoom_down';
$container['body'] = 'map_local.php';
$container['valid_for'] = -5;
$template->assign('ZoomDownLink', SmrSession::getNewHREF($container));
$container['Dir'] = 'Up';
$container['rid'] = 'zoom_up';
$template->assign('ZoomUpLink', SmrSession::getNewHREF($container));
$span = 1 + $dist * 2;
$topLeft =& $player->getSector();
$galaxy =& $topLeft->getGalaxy();
$template->assign('GalaxyName', $galaxy->getName());
//figure out what should be the top left and bottom right
//go left then up
for ($i = 0; $i < $dist && $i < (int) ($galaxy->getWidth() / 2); $i++) {
    $topLeft =& $topLeft->getNeighbourSector('Left');
}
for ($i = 0; $i < $dist && $i < (int) ($galaxy->getHeight() / 2); $i++) {
    $topLeft =& $topLeft->getNeighbourSector('Up');
}
$mapSectors = array();
$leftMostSec =& $topLeft;
for ($i = 0; $i < $span && $i < $galaxy->getHeight(); $i++) {
Ejemplo n.º 14
0
<?php

$template->assign('PageTopic', 'Kill Rankings');
require_once get_file_loc('Rankings.inc');
require_once get_file_loc('menu.inc');
create_ranking_menu(0, 2);
// what rank are we?
$db->query('SELECT count(*) FROM player
			WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . '
			AND (
				kills > ' . $db->escapeNumber($player->getKills()) . '
				OR (
					kills = ' . $db->escapeNumber($player->getKills()) . '
					AND player_name <= ' . $db->escapeString($player->getPlayerName(), true) . '
				)
			)');
$db->nextRecord();
$ourRank = $db->getInt('count(*)');
$template->assign('OurRank', $ourRank);
$totalPlayers = $player->getGame()->getTotalPlayers();
$db->query('SELECT account_id, kills amount FROM player WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' ORDER BY kills DESC, player_name LIMIT 10');
$template->assignByRef('Rankings', Rankings::collectRankings($db, $player, 0));
Rankings::calculateMinMaxRanks($ourRank, $totalPlayers);
$template->assign('FilterRankingsHREF', SmrSession::getNewHREF(create_container('skeleton.php', 'rankings_player_kills.php')));
$lowerLimit = $var['MinRank'] - 1;
$db->query('SELECT account_id, kills amount FROM player WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' ORDER BY kills DESC, player_name LIMIT ' . $lowerLimit . ', ' . ($var['MaxRank'] - $lowerLimit));
$template->assignByRef('FilteredRankings', Rankings::collectRankings($db, $player, $lowerLimit));
Ejemplo n.º 15
0
<?php

$template->assign('PageTopic', 'Reply To Reported Messages');
require_once get_file_loc('message.functions.inc');
$container = create_container('notify_reply_processing.php');
transfer('game_id');
transfer('offended');
transfer('offender');
$template->assign('NotifyReplyFormHref', SmrSession::getNewHREF($container));
$offender =& getMessagePlayer($var['offender'], $var['game_id']);
$offended =& getMessagePlayer($var['offended'], $var['game_id']);
if (is_object($offender)) {
    $template->assignByRef('OffenderAccount', SmrAccount::getAccount($var['offender']));
}
if (is_object($offended)) {
    $template->assignByRef('OffendedAccount', SmrAccount::getAccount($var['offended']));
}
$template->assignByRef('Offender', $offender);
$template->assignByRef('Offended', $offended);
if (isset($var['PreviewOffender'])) {
    $template->assign('PreviewOffender', $var['PreviewOffender']);
}
if (isset($var['OffenderBanPoints'])) {
    $template->assign('OffenderBanPoints', $var['OffenderBanPoints']);
}
if (isset($var['PreviewOffended'])) {
    $template->assign('PreviewOffended', $var['PreviewOffended']);
}
if (isset($var['OffendedBanPoints'])) {
    $template->assign('OffendedBanPoints', $var['OffendedBanPoints']);
}
Ejemplo n.º 16
0
<?php

$template->assign('PageTopic', 'Plot A Course');
require_once get_file_loc('menu.inc');
create_nav_menu($template, $player);
$container = array();
$container['url'] = 'course_plot_processing.php';
$container['body'] = '';
$template->assign('PlotCourseFormLink', SmrSession::getNewHREF($container));
$container['url'] = 'course_plot_nearest_processing.php';
$template->assign('PlotNearestFormLink', SmrSession::getNewHREF($container));
if ($ship->hasJump()) {
    $container = create_container('sector_jump_processing.php', '');
    $container['target_page'] = 'current_sector.php';
    $template->assign('JumpDriveFormLink', SmrSession::getNewHREF($container));
}
if (isset($_REQUEST['xtype'])) {
    SmrSession::updateVar('XType', $_REQUEST['xtype']);
} else {
    if (!isset($var['XType'])) {
        SmrSession::updateVar('XType', 'Technology');
    }
}
$template->assign('XType', $var['XType']);
$template->assign('AllXTypes', array('Technology', 'Ships', 'Weapons', 'Locations', 'Goods'));
// get saved destinations
$template->assign('StoredDestinations', $player->getStoredDestinations());
$container = create_container('course_destination_button_processing.php');
$container['target_page'] = 'course_plot.php';
$template->assign('ManageDestination', SmrSession::getNewHREF($container));
Ejemplo n.º 17
0
<?php

$template->assign('PageTopic', 'Create Announcement');
$template->assign('AnnouncementCreateFormHref', SmrSession::getNewHREF(create_container('announcement_create_processing.php')));
if (isset($var['preview'])) {
    $template->assign('Preview', $var['preview']);
}
Ejemplo n.º 18
0
<?php

if (!$player->isPresident()) {
    create_error('Only the president can view the embassy.');
}
require_once get_file_loc('council.inc');
require_once get_file_loc('menu.inc');
$template->assign('PageTopic', 'Ruling Council Of ' . $player->getRaceName());
create_council_menu($player->getRaceID());
$voteRaces = array();
$RACES = Globals::getRaces();
foreach ($RACES as $raceID => $raceInfo) {
    if ($raceID == RACE_NEUTRAL || $raceID == $player->getRaceID()) {
        continue;
    }
    $db->query('SELECT 1 FROM race_has_voting
				WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . '
				AND race_id_1 = ' . $db->escapeNumber($player->getRaceID()) . '
				AND race_id_2 = ' . $db->escapeNumber($raceID));
    if ($db->getNumRows() > 0) {
        continue;
    }
    $voteRaces[$raceID] = SmrSession::getNewHREF(create_container('council_embassy_processing.php', '', array('race_id' => $raceID)));
}
$template->assign('VoteRaceHrefs', $voteRaces);
Ejemplo n.º 19
0
<?php

if (isset($var['errorMsg'])) {
    $template->assign('ErrorMessage', $var['errorMsg']);
}
if (isset($var['msg'])) {
    $template->assign('Message', $var['msg']);
}
$db->query('SELECT * FROM account_has_permission JOIN permission USING (permission_id) WHERE account_id = ' . $db->escapeNumber($account->getAccountID()));
if ($db->getNumRows()) {
    $adminPermissions = array();
    while ($db->nextRecord()) {
        $adminPermissions[] = array('PermissionLink' => $db->getField('link_to') ? SmrSession::getNewHREF(create_container('skeleton.php', $db->getField('link_to'))) : false, 'Name' => $db->getField('permission_name'));
    }
    $template->assign('AdminPermissions', $adminPermissions);
}
Ejemplo n.º 20
0
    $allianceRoles[$roleID]['EditingRole'] = $var['role_id'] == $roleID;
    if ($allianceRoles[$roleID]['EditingRole']) {
        $container = create_container('alliance_roles_processing.php');
        $allianceRoles[$roleID]['WithdrawalLimit'] = $db->getInt('with_per_day');
        $allianceRoles[$roleID]['PositiveBalance'] = $db->getBoolean('positive_balance');
        $allianceRoles[$roleID]['TreatyCreated'] = $db->getBoolean('treaty_created');
        $allianceRoles[$roleID]['RemoveMember'] = $db->getBoolean('remove_member');
        $allianceRoles[$roleID]['ChangePass'] = $db->getBoolean('change_pass');
        $allianceRoles[$roleID]['ChangeMod'] = $db->getBoolean('change_mod');
        $allianceRoles[$roleID]['ChangeRoles'] = $db->getBoolean('change_roles');
        $allianceRoles[$roleID]['PlanetAccess'] = $db->getBoolean('planet_access');
        $allianceRoles[$roleID]['ModerateMessageboard'] = $db->getBoolean('mb_messages');
        $allianceRoles[$roleID]['ExemptWithdrawals'] = $db->getBoolean('exempt_with');
        $allianceRoles[$roleID]['SendAllianceMessage'] = $db->getBoolean('send_alliance_msg');
    } else {
        $container = create_container('skeleton.php', 'alliance_roles.php');
        $form = create_form($container, 'Edit');
        $PHP_OUTPUT .= $form['form'];
        $PHP_OUTPUT .= '<input type="text" name="role" value="' . htmlspecialchars($db->getField('role')) . '" maxlength="32">&nbsp;&nbsp;';
        $PHP_OUTPUT .= $form['submit'];
        $PHP_OUTPUT .= '</form><br />';
    }
    $container['role_id'] = $roleID;
    $container['alliance_id'] = $alliance->getAllianceID();
    $allianceRoles[$roleID]['HREF'] = SmrSession::getNewHREF($container);
}
$template->assignByRef('AllianceRoles', $allianceRoles);
$container = create_container('alliance_roles_processing.php');
$container['alliance_id'] = $alliance->getAllianceID();
$template->assign('CreateRole', array('HREF' => SmrSession::getNewHREF($container), 'CreatingRole' => true, 'EditingRole' => true, 'WithdrawalLimit' => 0, 'TreatyCreated' => false, 'RemoveMember' => false, 'ChangePass' => false, 'ChangeMod' => false, 'ChangeRoles' => false, 'PlanetAccess' => true, 'ModerateMessageboard' => false, 'ExemptWithdrawals' => false, 'SendAllianceMessage' => false));
Ejemplo n.º 21
0
$template->assign('PageTopic', 'Ship Dealer');
$db->query('SELECT ship_type_id FROM location
			JOIN location_sells_ships USING (location_type_id)
			WHERE sector_id = ' . $db->escapeNumber($player->getSectorID()) . '
				AND game_id = ' . $db->escapeNumber($player->getGameID()) . '
				AND location_type_id = ' . $db->escapeNumber($var['LocationID']));
$shipsSold = array();
if ($db->getNumRows() > 0) {
    $container = create_container('skeleton.php', 'shop_ship.php');
    transfer('LocationID');
    while ($db->nextRecord()) {
        $shipTypeID = $db->getField('ship_type_id');
        $shipsSold[$shipTypeID] =& AbstractSmrShip::getBaseShip(Globals::getGameType($player->getGameID()), $shipTypeID);
        $container['ship_id'] = $shipTypeID;
        $container['level_needed'] = $shipsSold[$shipTypeID]['Level'];
        $shipsSoldHREF[$shipTypeID] = SmrSession::getNewHREF($container);
    }
}
$template->assign('ShipsSold', $shipsSold);
$template->assign('ShipsSoldHREF', $shipsSoldHREF);
if (isset($var['ship_id'])) {
    $compareShip = AbstractSmrShip::getBaseShip(Globals::getGameType($player->getGameID()), $var['ship_id']);
    $compareShip['RealSpeed'] = $compareShip['Speed'] * Globals::getGameSpeed($player->getGameID());
    $compareShip['Turns'] = round($player->getTurns() * $compareShip['Speed'] / $ship->getSpeed());
    $container = create_container('shop_ship_processing.php');
    transfer('LocationID');
    transfer('ship_id');
    $compareShip['BuyHREF'] = SmrSession::getNewHREF($container);
    $template->assign('CompareShip', $compareShip);
}
Ejemplo n.º 22
0
} else {
    $PHP_OUTPUT .= 'Gal_on not found!!';
}
$galaxy =& SmrGalaxy::getGalaxy($var['game_id'], $var['gal_on']);
$galSectors =& $galaxy->getSectors();
//get totals
$numberOfPlanets = 0;
foreach ($galSectors as &$galSector) {
    if ($galSector->hasPlanet()) {
        $numberOfPlanets++;
    }
}
//universe_create_planets.php
$container = $var;
$container['url'] = '1.6/universe_create_save_processing.php';
$container['body'] = '1.6/universe_create_sectors.php';
$PHP_OUTPUT .= create_echo_form($container);
$galaxy =& SmrGalaxy::getGalaxy($var['game_id'], $var['gal_on']);
$PHP_OUTPUT .= 'Working on Galaxy : ' . $galaxy->getName() . ' (' . $galaxy->getGalaxyID() . ')<br />';
$PHP_OUTPUT .= '<table class="standard">';
$PHP_OUTPUT .= '<tr><td class="right">Uninhabited Planets</td><td>';
$PHP_OUTPUT .= '<input type="number" value="' . $numberOfPlanets . '" size="5" name="Uninhab"></td></tr>';
$PHP_OUTPUT .= '<tr><td class="right">NPC Planets - Won\'t work</td><td>';
$PHP_OUTPUT .= '<input type="number" value="' . (isset($planet_info['NPC']) ? $planet_info['NPC'] : 0) . '" size="5" name="NPC"></td></tr>';
$PHP_OUTPUT .= '<tr><td colspan="2" class="center"><input type="submit" name="submit" value="Create Planets">';
$container = $var;
$container['body'] = '1.6/universe_create_sectors.php';
$PHP_OUTPUT .= '<br /><br /><a href="' . SmrSession::getNewHREF($container) . '" class="submitStyle">Cancel</a>';
$PHP_OUTPUT .= '</td></tr></table></form>';
$PHP_OUTPUT .= '<span class="small">Note: When you press "Create Planets" this will rearrange all current planets.<br />';
$PHP_OUTPUT .= 'To add new planets without rearranging everything use the edit sector feature.</span>';
Ejemplo n.º 23
0
    // *
    // * I n c l u d e s   h e r e
    // *
    // ********************************
    require_once 'config.inc';
    require_once LIB . 'Default/SmrMySqlDatabase.class.inc';
    require_once ENGINE . 'Default/smr.inc';
    require_once get_file_loc('SmrSession.class.inc');
    require_once get_file_loc('SmrAccount.class.inc');
    // ********************************
    // *
    // * S e s s i o n
    // *
    // ********************************
    if (SmrSession::$account_id > 0) {
        // creates a new user account object
        $account =& SmrAccount::getAccount(SmrSession::$account_id);
        // update last login column
        $account->updateLastLogin();
        $href = SmrSession::getNewHREF(create_container('login_check_processing.php'), true);
        SmrSession::update();
        header('Location: ' . $href);
        exit;
    }
    if (isset($_REQUEST['msg'])) {
        $template->assign('Message', htmlentities(trim($_REQUEST['msg']), ENT_COMPAT, 'utf-8'));
    }
    require_once LIB . 'Login/loginSmarty.php';
} catch (Exception $e) {
    handleException($e);
}
Ejemplo n.º 24
0
                $type = ' saved';
                break;
            case 6:
                $type = ' force';
                break;
        }
        $template->assign('LogType', $type);
        $container = create_container('skeleton.php', 'combat_log_viewer.php');
        $container['action'] = 5;
        $container['old_action'] = $action;
        $container['direction'] = 0;
        $template->assign('LogFormHREF', SmrSession::getNewHREF($container));
        $container = $var;
        if ($page > 0) {
            $container['page'] = $page - 1;
            $template->assign('PreviousPage', SmrSession::getNewHREF($container));
        }
        if (($page + 1) * COMBAT_LOGS_PER_PAGE < $totalLogs) {
            $container['page'] = $page + 1;
            $template->assign('NextPage', SmrSession::getNewHREF($container));
        }
        // Saved logs
        $template->assign('CanDelete', $action == 4);
        $template->assign('CanSave', $action != 4);
        while ($db->nextRecord()) {
            $sectorID = $db->getInt('sector_id');
            $logs[$db->getField('log_id')] = array('Attacker' => getParticipantName($db->getInt('attacker_id'), $sectorID), 'Defender' => getParticipantName($db->getInt('defender_id'), $sectorID), 'Time' => $db->getInt('timestamp'), 'Sector' => $sectorID);
        }
    }
    $template->assign('Logs', $logs);
}
Ejemplo n.º 25
0
function displayMessage(&$messageBox, $message_id, $receiver_id, $sender_id, $message_text, $send_time, $msg_read, $type, $sentMessage = false)
{
    require_once get_file_loc('message.functions.inc');
    global $player, $account;
    $message = array();
    $sender = false;
    $senderName =& getMessagePlayer($sender_id, $player->getGameID(), $type);
    if ($senderName instanceof SmrPlayer) {
        $sender =& $senderName;
        unset($senderName);
        $replace = explode('?', $message_text);
        foreach ($replace as $key => $timea) {
            if ($sender_id > 0 && $timea != '' && ($final = strtotime($timea)) !== false) {
                //WARNING: Expects PHP 5.1.0 or later
                $send_acc =& $sender->getAccount();
                $final += $account->getOffset() * 3600 - $send_acc->getOffset() * 3600;
                $message_text = str_replace('?' . $timea . '?', date(DATE_FULL_SHORT, $final), $message_text);
            }
        }
        $container = create_container('skeleton.php', 'trader_search_result.php');
        $container['player_id'] = $sender->getPlayerID();
        $senderName =& create_link($container, $sender->getDisplayName());
    }
    $container = create_container('skeleton.php', 'message_notify_confirm.php');
    $container['message_id'] = $message_id;
    $container['sent_time'] = $send_time;
    $message['ReportHref'] = SmrSession::getNewHREF($container);
    if (is_object($sender)) {
        $container = create_container('skeleton.php', 'message_blacklist_add.php');
        $container['account_id'] = $sender_id;
        $message['BlacklistHref'] = SmrSession::getNewHREF($container);
        $container = create_container('skeleton.php', 'message_send.php');
        $container['receiver'] = $sender->getAccountID();
        $message['ReplyHref'] = SmrSession::getNewHREF($container);
        $message['Sender'] =& $sender;
    }
    $message['ID'] = $message_id;
    $message['Text'] = $message_text;
    $message['SenderDisplayName'] = $senderName;
    $receiver =& SmrPlayer::getPlayer($receiver_id, $player->getGameID());
    if ($sentMessage && is_object($receiver)) {
        $container = create_container('skeleton.php', 'trader_search_result.php');
        $container['player_id'] = $receiver->getPlayerID();
        $message['ReceiverDisplayName'] = create_link($container, $receiver->getDisplayName());
    }
    $message['Unread'] = $msg_read == 'FALSE';
    $message['SendTime'] = $send_time;
    $messageBox['Messages'][] =& $message;
}
Ejemplo n.º 26
0
<?php

if (!$sector->hasPort()) {
    create_error('This sector does not have a port.');
}
if ($sector->getPort()->isDestroyed()) {
    forward(create_container('skeleton.php', 'port_attack.php'));
}
$template->assign('PageTopic', 'Port Raid');
$template->assign('PortAttackHREF', SmrSession::getNewHREF(create_container('port_attack_processing.php')));
Ejemplo n.º 27
0
<?php

require_once get_file_loc('ChessGame.class.inc');
$template->assignByRef('ChessGame', ChessGame::getChessGame($var['ChessGameID']));
$template->assign('ChessMoveHREF', SmrSession::getNewHREF(create_container('chess_move_processing.php', '', array('AJAX' => true, 'ChessGameID' => $var['ChessGameID']))));
Ejemplo n.º 28
0
<?php

$alliance =& SmrAlliance::getAlliance($var['alliance_id'], $player->getGameID());
$template->assign('PageTopic', $alliance->getAllianceName() . ' (' . $alliance->getAllianceID() . ')');
require_once get_file_loc('menu.inc');
create_alliance_menu($alliance->getAllianceID(), $alliance->getLeaderID());
$container = create_container('message_send_processing.php');
$container['alliance_id'] = $var['alliance_id'];
$template->assign('MessageSendFormHref', SmrSession::getNewHREF($container));
$template->assign('Receiver', 'Whole Alliance');
if (isset($var['preview'])) {
    $template->assign('Preview', $var['preview']);
}
Ejemplo n.º 29
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);
Ejemplo n.º 30
0
//		(
//			SELECT DISTINCT dead_alliance
//			FROM news
//			WHERE game_id = ' . $db->escapeNumber($gameID) . '
//		)
//	)');
$db->query('SELECT alliance_id, alliance_name
			FROM alliance
			WHERE game_id = ' . $db->escapeNumber($gameID));
$newsAlliances = array();
$newsAlliances[0] = array('ID' => 0, 'Name' => 'None');
while ($db->nextRecord()) {
    $newsAlliances[$db->getField('alliance_id')] = array('ID' => $db->getField('alliance_id'), 'Name' => $db->getField('alliance_name'));
}
$template->assign('NewsAlliances', $newsAlliances);
$template->assign('AdvancedNewsFormHref', SmrSession::getNewHREF(create_container('skeleton.php', 'news_read_advanced.php', $basicContainer)));
if (isset($_REQUEST['submit'])) {
    $submit_value = $_REQUEST['submit'];
} elseif (isset($var['submit'])) {
    $submit_value = $var['submit'];
} else {
    $submit_value = 'Default';
}
if ($submit_value == 'Search For Player') {
    if (isset($_REQUEST['playerName'])) {
        $p_name = $_REQUEST['playerName'];
    } else {
        $p_name = $var['playerName'];
    }
    $PHP_OUTPUT .= 'Returning Results for ' . $p_name . '.<br />';
    $db->query('SELECT * FROM player WHERE player_name LIKE ' . $db->escapeString('%' . $p_name . '%') . ' AND game_id = ' . $db->escapeNumber($gameID) . ' LIMIT 3');