Ejemplo n.º 1
0
<?php

$template->assign('PageTopic', 'Show Map');
if (isset($_REQUEST['game_id'])) {
    SmrSession::updateVar('GameID', $_REQUEST['game_id']);
}
if (isset($var['GameID'])) {
    $container = create_container('map_show_processing.php');
    $container['game_id'] = $var['GameID'];
    $PHP_OUTPUT .= create_echo_form($container);
    $PHP_OUTPUT .= '<select name="account_id" size="1" id="InputFields">';
    $PHP_OUTPUT .= '<option value="0">[Please Select]</option>';
    $PHP_OUTPUT .= '<option value="all">All Players</option>';
    $db->query('SELECT * FROM player WHERE game_id = ' . $db->escapeNumber($var['GameID']) . ' ORDER BY player_name');
    while ($db->nextRecord()) {
        $PHP_OUTPUT .= '<option value="' . $db->getField('account_id') . '">' . stripslashes($db->getField('player_name')) . ' (' . $db->getField('player_id') . ')</option>';
    }
    $PHP_OUTPUT .= '</select>&nbsp;&nbsp;';
    $PHP_OUTPUT .= create_submit('Reveal Map');
    $PHP_OUTPUT .= '</form>';
} else {
    $PHP_OUTPUT .= create_echo_form(create_container('skeleton.php', 'map_show.php'));
    $PHP_OUTPUT .= '<p>Please select a game:</p>';
    $PHP_OUTPUT .= '<select name="game_id" size="1" id="InputFields">';
    $PHP_OUTPUT .= '<option value="0">[Please Select]</option>';
    $db->query('SELECT * FROM game ORDER BY game_id DESC');
    while ($db->nextRecord()) {
        $PHP_OUTPUT .= '<option value="' . $db->getField('game_id') . '">' . $db->getField('game_name') . '</option>';
    }
    $PHP_OUTPUT .= '</select>&nbsp;&nbsp;';
    $PHP_OUTPUT .= create_submit('Select');
<?php

require_once get_file_loc('SmrAlliance.class.inc');
$template->assign('PageTopic', 'Alliance VS Alliance Rankings');
require_once get_file_loc('menu.inc');
create_ranking_menu(1, 3);
$db2 = new SmrMySqlDatabase();
$container = array();
$container['url'] = 'skeleton.php';
$container['body'] = 'rankings_alliance_vs_alliance.php';
$PHP_OUTPUT .= create_echo_form($container);
if (isset($_REQUEST['alliancer'])) {
    SmrSession::updateVar('alliancer', $_REQUEST['alliancer']);
}
$alliancer = $var['alliancer'];
$PHP_OUTPUT .= '<div align="center">';
$PHP_OUTPUT .= '<p>Here are the rankings of alliances vs other alliances<br />';
$PHP_OUTPUT .= 'Click on an alliances name for more detailed death stats.</p>';
$PHP_OUTPUT .= '<table class="standard" width="95%">';
$PHP_OUTPUT .= '<tr>';
$PHP_OUTPUT .= '<th rowspan="9">Killed</th><th colspan="8">Killers</th></tr><tr><td></td>';
if (empty($alliancer)) {
    $alliance_vs = array();
    $db->query('SELECT * FROM alliance WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' ORDER BY alliance_kills DESC, alliance_name LIMIT 5');
    while ($db->nextRecord()) {
        $alliance_vs[] = $db->getField('alliance_id');
    }
    //$PHP_OUTPUT.=('empty '.$alliancer);
} else {
    $alliance_vs = $alliancer;
}
Ejemplo n.º 3
0
// check if we have enough room for the thing we are going to buy
if ($portGood['TransactionType'] == 'Buy' && $amount > $ship->getEmptyHolds()) {
    create_error('Scanning your ships indicates you don\'t have enough free cargo bays!');
}
// check if the guy has enough money
if ($portGood['TransactionType'] == 'Buy' && $player->getCredits() < $bargain_price) {
    create_error('You don\'t have enough credits!');
}
// get relations for us (global + personal)
$relations = $player->getRelation($port->getRaceID());
if (!isset($var['ideal_price'])) {
    SmrSession::updateVar('ideal_price', $port->getIdealPrice($good_id, $portGood['TransactionType'], $amount, $relations));
}
$ideal_price = $var['ideal_price'];
if (!isset($var['offered_price'])) {
    SmrSession::updateVar('offered_price', $port->getOfferPrice($ideal_price, $relations, $portGood['TransactionType']));
}
$offered_price = $var['offered_price'];
// nothing should happen here but just to avoid / by 0
if ($ideal_price == 0 || $offered_price == 0) {
    create_error('Port calculation error...buy more goods.');
}
// can we accept the current price?
if (!empty($bargain_price) && ($portGood['TransactionType'] == 'Buy' && $bargain_price >= $ideal_price || $portGood['TransactionType'] == 'Sell' && $bargain_price <= $ideal_price)) {
    // the url we going to
    $container = create_container('skeleton.php');
    transfer('ideal_price');
    transfer('offered_price');
    // base xp is the amount you would get for a perfect trade.
    // this is the absolut max. the real xp can only be smaller.
    $base_xp = SmrPort::getBaseExperience($amount, $port->getGoodDistance($good_id));
Ejemplo n.º 4
0
function checkForAttackMessage(&$msg)
{
    global $db, $player, $template;
    $contains = 0;
    $msg = str_replace('[ATTACK_RESULTS]', '', $msg, $contains);
    if ($contains > 0) {
        SmrSession::updateVar('AttackMessage', '[ATTACK_RESULTS]' . $msg);
        if (!$template->hasTemplateVar('AttackResults')) {
            $db->query('SELECT sector_id,result,type FROM combat_logs WHERE log_id=' . $db->escapeNumber($msg) . ' LIMIT 1');
            if ($db->nextRecord()) {
                if ($player->getSectorID() == $db->getField('sector_id')) {
                    $results = unserialize(gzuncompress($db->getField('result')));
                    $template->assign('AttackResultsType', $db->getField('type'));
                    $template->assignByRef('AttackResults', $results);
                }
            }
        }
    }
}
Ejemplo n.º 5
0
<?php

if (!isset($var['alliance_id'])) {
    SmrSession::updateVar('alliance_id', $player->getAllianceID());
}
$alliance_id = $var['alliance_id'];
$alliance =& SmrAlliance::getAlliance($alliance_id, $player->getGameID());
$template->assign('PageTopic', $alliance->getAllianceName() . ' (' . $alliance->getAllianceID() . ')');
require_once get_file_loc('menu.inc');
create_alliance_menu($alliance_id, $alliance->getLeaderID());
$container = create_container('alliance_stat_processing.php');
$container['alliance_id'] = $alliance_id;
$form = create_form($container, 'Change');
$role_id = $player->getAllianceRole($alliance->getAllianceID());
$db->query('SELECT * FROM alliance_has_roles WHERE alliance_id = ' . $db->escapeNumber($alliance_id) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND role_id = ' . $db->escapeNumber($role_id));
$db->nextRecord();
$PHP_OUTPUT .= $form['form'];
//$PHP_OUTPUT.=create_echo_form(create_container('alliance_stat_processing.php', ''));
$PHP_OUTPUT .= '<table cellspacing="0" cellpadding="0" class="nobord nohpad">';
if ($db->getBoolean('change_pass')) {
    $PHP_OUTPUT .= '<tr><td class="top">Password:&nbsp;</td><td><input type="password" name="password" size="30" value="' . htmlspecialchars($alliance->getPassword()) . '"></td></tr>';
}
if ($db->getBoolean('change_mod') || $account->hasPermission(PERMISSION_EDIT_ALLIANCE_DESCRIPTION)) {
    $PHP_OUTPUT .= '<tr><td class="top">Description:&nbsp;</td><td><textarea spellcheck="true" name="description">';
    $PHP_OUTPUT .= $alliance->getDescription();
    $PHP_OUTPUT .= '</textarea></td></tr>';
}
if ($player->isAllianceLeader()) {
    $PHP_OUTPUT .= '<tr><td class="top">IRC Channel:&nbsp;</td><td><input type="text" name="irc" size="30" value="' . htmlspecialchars($alliance->getIrcChannel()) . '"> (For Caretaker and autojoining via chat link - works best if you join the channel using the chat link and type "/autoconnect on" as an op)</td></tr>';
}
if ($db->getBoolean('change_mod')) {
Ejemplo n.º 6
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.º 7
0
    SmrSession::updateVar('action', 0);
}
$action = $var['action'];
if ($action == 5) {
    if (!isset($_REQUEST['id']) && !isset($var['log_ids'])) {
        $action = $var['old_action'];
    } else {
        $container = array();
        $container['url'] = 'skeleton.php';
        $container['body'] = 'combat_log_viewer.php';
        if (!isset($var['log_ids'])) {
            $container['log_ids'] = array_keys($_REQUEST['id']);
            sort($container['log_ids']);
            $container['current_log'] = 0;
            SmrSession::updateVar('log_ids', $container['log_ids']);
            SmrSession::updateVar('current_log', 0);
        } else {
            $container['log_ids'] = $var['log_ids'];
            $container['current_log'] = $var['current_log'];
        }
        $container['action'] = 5;
        if ($var['direction']) {
            if ($var['direction'] == 1) {
                --$container['current_log'];
            } else {
                ++$container['current_log'];
            }
        }
        $display_id = $container['log_ids'][$container['current_log']];
        if (count($container['log_ids']) > 1) {
            if ($container['current_log'] > 0) {
Ejemplo n.º 8
0
            $thisSec =& $thisSec->getNeighbourSector('Right');
        }
        $mapSectors[$i][$j] =& $thisSec;
    }
}
$template->assignByRef('Galaxy', $galaxy);
$template->assignByRef('Galaxies', $galaxies);
$template->assignByRef('MapSectors', $mapSectors);
$template->assignByRef('Message', $var['message']);
SmrSession::updateVar('message', null);
// Only show message once
if (isset($_REQUEST['connect']) && $_REQUEST['connect'] > 0) {
    SmrSession::updateVar('conn', $_REQUEST['connect']);
} else {
    if (!isset($var['conn'])) {
        SmrSession::updateVar('conn', 100);
    }
}
$template->assign('Connectivity', $var['conn']);
$container = $var;
$container['url'] = '1.6/universe_create_save_processing.php';
$container['body'] = '1.6/universe_create_sectors.php';
$template->assign('SubmitChangesHREF', SmrSession::getNewHref($container));
$container['submit'] = 'Jump To Galaxy';
$template->assign('JumpGalaxyHREF', SmrSession::getNewHref($container));
$container['submit'] = 'Toggle Link';
$template->assign('ToggleLink', $container);
$container = $var;
$container['body'] = '1.6/universe_create_sector_details.php';
$template->assign('UniGen', $container);
$container = $var;
Ejemplo n.º 9
0
<?php

$db2 = new SmrMySqlDatabase();
if (isset($_REQUEST['variable'])) {
    SmrSession::updateVar('variable', $_REQUEST['variable']);
}
//split variable to get start and end
list($start, $end) = explode(',', $var['variable']);
if (empty($start) || empty($end) || !is_numeric($start) || !is_numeric($end)) {
    create_error('Input was not in the correct format: "' . $var['variable'] . '"');
}
$db->query('SELECT * FROM account WHERE account_id >= ' . $db->escapeNumber($start) . ' AND account_id <= ' . $db->escapeNumber($end) . ' ORDER BY account_id');
$PHP_OUTPUT .= create_table();
$PHP_OUTPUT .= '<tr>';
$PHP_OUTPUT .= '<th align=center>Account_id</th>';
$PHP_OUTPUT .= '<th align=center>Login</th>';
$PHP_OUTPUT .= '<th align=center>eMail</th>';
$PHP_OUTPUT .= '<th align=center>Last IP</th>';
$PHP_OUTPUT .= '<th align=center>Exception</th>';
$PHP_OUTPUT .= '</tr>';
while ($db->nextRecord()) {
    $acc_id = $db->getField('account_id');
    $PHP_OUTPUT .= '<tr>';
    $PHP_OUTPUT .= '<td align=center>' . $acc_id . '</td>';
    $PHP_OUTPUT .= '<td align=center>' . $db->getField('login') . '</td>';
    $PHP_OUTPUT .= '<td align=center>' . $db->getField('email') . '</td>';
    $db2->query('SELECT * FROM account_has_ip WHERE account_id = ' . $db2->escapeNumber($acc_id) . ' ORDER BY time DESC LIMIT 1');
    if ($db2->nextRecord()) {
        $PHP_OUTPUT .= '<td align=center>' . $db2->getField('ip') . '</td>';
    } else {
        $PHP_OUTPUT .= '<td align=center>No Last IP</td>';
Ejemplo n.º 10
0
<?php

if (!Globals::isFeatureRequestOpen()) {
    create_error('Feature requests are currently not being accepted.');
}
$template->assign('PageTopic', 'Feature Request');
if (!isset($var['Status'])) {
    SmrSession::updateVar('Status', 'Opened');
}
$container = $var;
$container['Status'] = 'Implemented';
$template->assign('ViewImplementedFeaturesHref', SmrSession::getNewHREF($container));
$container = $var;
$container['Status'] = 'Opened';
$container['ShowOld'] = true;
$template->assign('ShowOldFeaturesHref', SmrSession::getNewHREF($container));
$container = $var;
$container['Status'] = 'Rejected';
$template->assign('ShowRejectedFeaturesHref', SmrSession::getNewHREF($container));
$showCurrent = (!isset($var['ShowOld']) || $var['ShowOld'] !== true) && $var['Status'] == 'Opened';
$template->assign('ShowCurrent', $showCurrent);
$template->assign('Status', $var['Status']);
if ($var['Status'] != 'Implemented') {
    $template->assign('PreviousImplementedTotal', getFeaturesCount('Implemented'));
}
if ($var['Status'] != 'Opened' || !$showCurrent) {
    $template->assign('CurrentTotal', getFeaturesCount('Opened', true));
}
if ($var['Status'] != 'Opened' || $showCurrent) {
    $template->assign('OldTotal', getFeaturesCount('Opened'));
}
Ejemplo n.º 11
0
<?php

if (!isset($var['GameID'])) {
    SmrSession::updateVar('GameID', $player->getGameID());
}
$gameID = $var['GameID'];
if (isset($_REQUEST['min_news'])) {
    $min_news = $_REQUEST['min_news'];
}
if (isset($_REQUEST['max_news'])) {
    $max_news = $_REQUEST['max_news'];
}
if (empty($min_news) || empty($max_news)) {
    $min_news = 1;
    $max_news = 50;
} elseif ($min_news > $max_news) {
    create_error('The first number must be lower than the second number!');
}
$template->assign('PageTopic', 'Reading The News');
require_once get_file_loc('menu.inc');
create_news_menu($template);
require_once get_file_loc('news.functions.inc');
doBreakingNewsAssign($gameID, $template);
doLottoNewsAssign($gameID, $template);
$template->assign('ViewNewsFormHref', SmrSession::getNewHREF(create_container('skeleton.php', 'news_read.php', array('GameID' => $var['GameID']))));
$db->query('SELECT * FROM news WHERE game_id = ' . $db->escapeNumber($gameID) . ' AND type != \'breaking\' ORDER BY news_id DESC LIMIT ' . ($min_news - 1) . ', ' . ($max_news - $min_news + 1));
if ($db->getNumRows()) {
    $NewsItems = array();
    while ($db->nextRecord()) {
        $NewsItems[] = array('Time' => $db->getField('time'), 'Message' => bbifyMessage($db->getField('news_message')), 'Type' => $db->getField('type'));
    }
Ejemplo n.º 12
0
<?php

if (isset($_REQUEST['admin_id'])) {
    SmrSession::updateVar('admin_id', $_REQUEST['admin_id']);
}
$admin_id = $var['admin_id'];
$template->assign('PageTopic', 'Manage Admin Permissions');
$PHP_OUTPUT .= 'List of Accounts with Permissions:<br /><small>Click for details</small>';
$PHP_OUTPUT .= '<ul>';
$container = create_container('skeleton.php', 'permission_manage.php');
$db->query('SELECT account_id, login
			FROM account_has_permission JOIN account USING(account_id)
			GROUP BY account_id');
while ($db->nextRecord()) {
    $container['admin_id'] = $db->getField('account_id');
    $PHP_OUTPUT .= '<li>';
    $PHP_OUTPUT .= create_link($container, $db->getField('login'));
    $PHP_OUTPUT .= '</li>';
}
$PHP_OUTPUT .= '</ul>';
$PHP_OUTPUT .= '<p>&nbsp;</p>';
// if we don't have an account_id here
// we offer a list to choose
if (empty($admin_id)) {
    $PHP_OUTPUT .= 'Select an Account to add Permissions:<br /><br />';
    $PHP_OUTPUT .= create_echo_form(create_container('skeleton.php', 'permission_manage.php'));
    $PHP_OUTPUT .= '<select name="admin_id">';
    $db->query('SELECT account_id, login
				FROM account
				WHERE validated = ' . $db->escapeBoolean(true) . '
				ORDER BY login');
Ejemplo n.º 13
0
<?php

if (isset($_REQUEST['amount'])) {
    SmrSession::updateVar('amount', $_REQUEST['amount']);
}
if (isset($_REQUEST['account_id'])) {
    SmrSession::updateVar('account_id', $_REQUEST['account_id']);
}
$amount = $var['amount'];
$account_id = $var['account_id'];
if (!is_numeric($amount)) {
    create_error('Numbers only please!');
}
if (!is_numeric($account_id)) {
    create_error('Invalid player selected!');
}
$amount = round($amount);
if ($amount <= 0) {
    create_error('You can only tranfer a positive amount!');
}
if ($amount > $account->getSmrCredits()) {
    create_error('You can\'t transfer more than you have!');
}
$template->assign('PageTopic', 'Confirmation');
$PHP_OUTPUT .= 'Are you sure you want to transfer ' . $amount . ' credits to<br />';
$PHP_OUTPUT .= 'Player with HoF name ' . SmrAccount::getAccount($account_id)->getHofName() . '?<br />';
$PHP_OUTPUT .= '<br/><h3>Please make sure this is definitely the correct person before confirming.</h3>';
$PHP_OUTPUT .= '<p>&nbsp;</p>';
$container = array();
$container['url'] = 'preferences_processing.php';
$container['account_id'] = $account_id;
Ejemplo n.º 14
0
    SmrSession::updateVar('email', '');
}
if (isset($_REQUEST['hofname'])) {
    SmrSession::updateVar('hofname', $_REQUEST['hofname']);
} elseif (!isset($var['hofname'])) {
    SmrSession::updateVar('hofname', '');
}
if (isset($_REQUEST['player_name'])) {
    SmrSession::updateVar('player_name', $_REQUEST['player_name']);
} elseif (!isset($var['player_name'])) {
    SmrSession::updateVar('player_name', '');
}
if (isset($_REQUEST['game_id'])) {
    SmrSession::updateVar('SearchGameID', $_REQUEST['game_id']);
} elseif (!isset($var['SearchGameID'])) {
    SmrSession::updateVar('SearchGameID', 0);
}
if (!empty($var['account_id']) && !is_numeric($var['account_id'])) {
    create_error('Account ID must be a number.');
}
$account_id = $var['account_id'];
$player_name = $var['player_name'];
// create account object
$curr_account = false;
if (!empty($player_name) && !is_array($player_name)) {
    $gameIDClause = $var['SearchGameID'] != 0 ? ' AND game_id = ' . $db->escapeNumber($var['SearchGameID']) . ' ' : '';
    $db->query('SELECT account_id FROM player
				WHERE player_name = ' . $db->escapeString($player_name) . $gameIDClause . '
				ORDER BY game_id DESC LIMIT 1');
    if ($db->nextRecord()) {
        $account_id = $db->getInt('account_id');
Ejemplo n.º 15
0
<?php

$template->assign('PageTopic', 'Report a Message');
if (!isset($var['notified_time'])) {
    SmrSession::updateVar('notified_time', TIME);
}
if (empty($var['message_id'])) {
    create_error('Please click the small yellow icon to report a message!');
}
// get message form db
$db->query('SELECT message_text
			FROM message
			WHERE message_id = ' . $db->escapeNumber($var['message_id']));
if (!$db->nextRecord()) {
    create_error('Could not find the message you selected!');
}
$PHP_OUTPUT .= 'You have selected the following message:<br /><br />';
//$PHP_OUTPUT.=('<textarea disabled="disabled" id="InputFields" style="width:400px;height:300px;">' . bbifyMessage($db->getField('message_text')) . '</textarea>');
$PHP_OUTPUT .= '<table class="standard"><tr><td>' . bbifyMessage($db->getField('message_text')) . '</td></tr></table>';
$PHP_OUTPUT .= '<p>Are you sure you want to notify this message to the admins?<br />';
$PHP_OUTPUT .= '<small><b>Please note:</b> Abuse of this system could end in disablement<br />Therefore, please only notify if the message is inappropriate</small></p>';
$container = create_container('message_notify_processing.php', '');
transfer('message_id');
transfer('sent_time');
transfer('notified_time');
$PHP_OUTPUT .= create_echo_form($container);
$PHP_OUTPUT .= create_submit('Yes');
$PHP_OUTPUT .= '&nbsp;&nbsp;';
$PHP_OUTPUT .= create_submit('No');
$PHP_OUTPUT .= '</form>';
Ejemplo n.º 16
0
<?php

$template->assign('PageTopic', 'Log Console - Detail');
// get the account_ids from last form
if (isset($_REQUEST['account_ids'])) {
    SmrSession::updateVar('account_ids', $_REQUEST['account_ids']);
}
$account_ids = $var['account_ids'];
// get the account_ids from last form
if (isset($_REQUEST['log_type_ids'])) {
    SmrSession::updateVar('log_type_ids', $_REQUEST['log_type_ids']);
}
$log_type_ids = $var['log_type_ids'];
// initialize order items
if (!isset($var['item'])) {
    $var['item'] = 'microtime';
}
if (!isset($var['order'])) {
    $var['order'] = 'ASC';
}
// nothing marked?
if (!is_array($account_ids) || count($account_ids) == 0) {
    $PHP_OUTPUT .= create_error('You have to select the log files you want to view/delete!');
}
$account_list = $db->escapeArray($account_ids);
$action = $_REQUEST['action'];
if ($action == 'Delete') {
    // get rid of all entries
    $db->query('DELETE FROM account_has_logs WHERE account_id IN (' . $account_list . ')');
    $db->query('DELETE FROM log_has_notes WHERE account_id IN (' . $account_list . ')');
    $PHP_OUTPUT .= 'Operation was completed successfully!';
Ejemplo n.º 17
0
        $template->assign('WithdrawalPerDay', $withdrawalPerDay);
        $db->query('SELECT sum(amount) as total FROM alliance_bank_transactions WHERE alliance_id = ' . $db->escapeNumber($alliance->getAllianceID()) . ' AND game_id = ' . $db->escapeNumber($alliance->getGameID()) . '
				AND payee_id = ' . $db->escapeNumber($player->getAccountID()) . ' AND transaction = \'Payment\' AND exempt = 0 AND time > ' . $db->escapeNumber(TIME - 86400));
        if ($db->nextRecord()) {
            $totalWithdrawn = $db->getInt('total');
        }
        $template->assign('WithdrawalPerDay', $withdrawalPerDay);
        $template->assign('RemainingWithdrawal', $withdrawalPerDay - $totalWithdrawn);
        $template->assign('TotalWithdrawn', $totalWithdrawn);
    }
}
if (isset($_REQUEST['maxValue'])) {
    SmrSession::updateVar('maxValue', $_REQUEST['maxValue']);
}
if (isset($_REQUEST['minValue'])) {
    SmrSession::updateVar('minValue', $_REQUEST['minValue']);
}
if (isset($var['maxValue']) && is_numeric($var['maxValue']) && $var['maxValue'] > 0) {
    $maxValue = $var['maxValue'];
} else {
    $db->query('SELECT MAX(transaction_id) FROM alliance_bank_transactions
				WHERE game_id=' . $db->escapeNumber($alliance->getGameID()) . '
				AND alliance_id=' . $db->escapeNumber($alliance->getAllianceID()));
    if ($db->nextRecord()) {
        $maxValue = $db->getInt('MAX(transaction_id)');
        $minValue = $maxValue - 5;
        if ($minValue < 1) {
            $minValue = 1;
        }
    }
}
Ejemplo n.º 18
0
<?php

$sector =& $player->getSector();
//first check if there is a bar here
if (!$sector->hasBar()) {
    create_error('So two guys walk into this bar...');
}
//get script to include
if (!isset($var['script'])) {
    SmrSession::updateVar('script', 'bar_opening.php');
}
$script = $var['script'];
//if ($script == 'bar_gambling_bet.php') {
//	create_error('Blackjack is currently outlawed, you will have to come back later.');
//}
//get bar name
$db->query('SELECT location_name FROM location_type JOIN location USING(location_type_id) WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND sector_id = ' . $db->escapeNumber($player->getSectorID()) . ' AND location_type_id > 800 AND location_type_id < 900');
//next welcome them
if ($db->nextRecord()) {
    $template->assign('PageTopic', 'Welcome to ' . $db->getField('location_name') . '.');
} else {
    $template->assign('PageTopic', 'Welcome to this bar');
}
require_once get_file_loc('menu.inc');
global $BAR_SCRIPTS_USED;
// HACKY
if (!is_array($BAR_SCRIPTS_USED) || !in_array($script, $BAR_SCRIPTS_USED)) {
    create_bar_menu();
    $BAR_SCRIPTS_USED[] = $script;
}
//get rid of drinks older than 30 mins
Ejemplo n.º 19
0
<?php

$good_id = $var['good_id'];
$good_name = Globals::getGoodName($good_id);
if (isset($_REQUEST['amount'])) {
    SmrSession::updateVar('amount', $_REQUEST['amount']);
}
$amount = $var['amount'];
if (!is_numeric($amount)) {
    create_error('Numbers only please!');
}
if ($amount <= 0) {
    create_error('You must actually enter an ammount > 0!');
}
if ($player->isLandedOnPlanet()) {
    create_error('You can\'t dump cargo while on a planet!');
}
if ($player->getTurns() < 1) {
    create_error('You do not have enough turns to dump cargo!');
}
//lets make sure there is actually that much on the ship
if ($amount > $ship->getCargo($good_id)) {
    create_error('You can\'t dump more than you have.');
}
$sector =& $player->getSector();
if ($sector->offersFederalProtection()) {
    create_error('You can\'t dump cargo in a Federal Sector!');
}
require_once 'shop_goods.inc';
// get the distance
$x = Globals::getGood($good_id);
Ejemplo n.º 20
0
<?php

if (isset($_REQUEST['player_id'])) {
    SmrSession::updateVar('PlayerID', $_REQUEST['player_id']);
}
if (isset($var['player_id'])) {
    SmrSession::updateVar('PlayerID', $var['player_id']);
}
if (isset($var['PlayerID'])) {
    $player_id = $var['PlayerID'];
}
if (isset($_REQUEST['player_id'])) {
    SmrSession::updateVar('PlayerName', $_REQUEST['player_name']);
}
if (isset($var['PlayerName'])) {
    $player_name = $var['PlayerName'];
}
if (!is_numeric($player_id) && !empty($player_id)) {
    create_error('Please enter only numbers!');
}
$count = 0;
$template->assign('PageTopic', 'Search Trader Results');
if (!empty($player_id)) {
    $db->query('SELECT * FROM player
				WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . '
					AND player_id = ' . $db->escapeNumber($player_id) . ' LIMIT 5');
} else {
    if (empty($player_name)) {
        $player_name = '%';
    }
    $db->query('SELECT * FROM player
Ejemplo n.º 21
0
<?php

if (isset($_REQUEST['variable'])) {
    SmrSession::updateVar('Variable', $_REQUEST['variable']);
}
$variable = $var['Variable'];
if (isset($_REQUEST['type'])) {
    SmrSession::updateVar('Type', $_REQUEST['type']);
}
$type = $var['Type'];
$db2 = new SmrMySqlDatabase();
//used to make sure we don't display deleted accounts
$del_num = 5;
$close_reason = '&nbsp;';
if (isset($var['type'])) {
    $type = $var['type'];
}
//another script for comp share
if ($type == 'comp_share') {
    include get_file_loc('comp_share.php');
} elseif ($type == 'all_acc') {
    include get_file_loc('list_all.php');
} elseif ($type == 'list') {
    if (isset($var['total'])) {
        $total = $var['total'];
    }
    if (empty($total)) {
        $total = 0;
    }
    if (isset($var['variable'])) {
        $variable = $var['variable'];
Ejemplo n.º 22
0
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');
    $IDs = array(0);
    while ($db->nextRecord()) {
        $IDs[] = $db->getInt('account_id');
    }
    $db->query('SELECT * FROM news WHERE game_id = ' . $db->escapeNumber($gameID) . ' AND (killer_id IN (' . $db->escapeArray($IDs) . ') OR dead_id IN (' . $db->escapeArray($IDs) . ')) ORDER BY news_id DESC');
} elseif ($submit_value == 'Search For Alliance') {
    if (isset($_REQUEST['allianceID'])) {
        SmrSession::updateVar('AllianceID', $_REQUEST['allianceID']);
    }
    if (!isset($var['AllianceID'])) {
        create_error('No alliance was specified!');
    }
    $allianceID = $var['AllianceID'];
    $PHP_OUTPUT .= 'Returning Results for ' . $newsAlliances[$allianceID]['Name'] . '.<br />';
    $db->query('SELECT * FROM news WHERE game_id = ' . $db->escapeNumber($gameID) . ' AND ((killer_alliance = ' . $db->escapeNumber($allianceID) . ' AND killer_id != ' . $db->escapeNumber(ACCOUNT_ID_PORT) . ') OR (dead_alliance = ' . $db->escapeNumber($allianceID) . ' AND dead_id != ' . $db->escapeNumber(ACCOUNT_ID_PORT) . ')) ORDER BY news_id DESC');
} elseif ($submit_value == 'Search For Players') {
    $PHP_OUTPUT .= 'Returning Results for ' . $_REQUEST['player1'] . ' vs. ' . $_REQUEST['player2'] . '<br />';
    $db->query('SELECT * FROM player WHERE player_name LIKE ' . $db->escapeString('%' . $_REQUEST['player1'] . '%') . ' AND game_id = ' . $db->escapeNumber($gameID) . ' LIMIT 3');
    $IDs = array(0);
    while ($db->nextRecord()) {
        $IDs[] = $db->getInt('account_id');
    }
    $db->query('SELECT * FROM player WHERE player_name LIKE ' . $db->escapeString('%' . $_REQUEST['player2'] . '%') . ' AND game_id = ' . $db->escapeNumber($gameID) . ' LIMIT 3');
Ejemplo n.º 23
0
<?php

if (!isset($var['GameID'])) {
    SmrSession::updateVar('GameID', $player->getGameID());
}
$gameID = $var['GameID'];
$template->assign('PageTopic', 'Current News');
require_once get_file_loc('menu.inc');
create_news_menu($template);
require_once get_file_loc('news.functions.inc');
doBreakingNewsAssign($gameID, $template);
doLottoNewsAssign($gameID, $template);
if (!isset($var['LastNewsUpdate'])) {
    SmrSession::updateVar('LastNewsUpdate', $player->getLastNewsUpdate());
}
$db->query('SELECT * FROM news WHERE game_id = ' . $db->escapeNumber($gameID) . ' AND time > ' . $db->escapeNumber($var['LastNewsUpdate']) . ' AND type = \'regular\' ORDER BY news_id DESC');
$player->updateLastNewsUpdate();
if ($db->getNumRows()) {
    $NewsItems = array();
    while ($db->nextRecord()) {
        $NewsItems[] = array('Time' => $db->getField('time'), 'Message' => bbifyMessage($db->getField('news_message')), 'Type' => $db->getField('type'));
    }
    $template->assign('NewsItems', $NewsItems);
}
Ejemplo n.º 24
0
<?php

$sector =& $player->getSector();
// get request variables
if (isset($_REQUEST['amount'])) {
    SmrSession::updateVar('BountyAmount', empty($_REQUEST['amount']) ? 0 : $_REQUEST['amount']);
}
if (isset($_REQUEST['smrcredits'])) {
    SmrSession::updateVar('BountySmrCredits', empty($_REQUEST['smrcredits']) ? 0 : $_REQUEST['smrcredits']);
}
if (isset($_REQUEST['player_id'])) {
    SmrSession::updateVar('BountyPlayerID', $_REQUEST['player_id']);
}
$amount = $var['BountyAmount'];
$smrCredits = $var['BountySmrCredits'];
$playerID = $var['BountyPlayerID'];
if ($playerID == '0') {
    create_error('Uhhh...who is [Please Select]?');
}
if (!is_numeric($amount) || !is_numeric($smrCredits)) {
    create_error('Numbers only please!');
}
$amount = round($amount);
if ($player->getCredits() < $amount) {
    create_error('You dont have that much money.');
}
$smrCredits = round($smrCredits);
if ($account->getSmrCredits() < $smrCredits) {
    create_error('You dont have that many SMR credits.');
}
if ($amount <= 0 && $smrCredits <= 0) {
Ejemplo n.º 25
0
$template->assign('PageTopic', $alliance->getAllianceName() . ' (' . $alliance->getAllianceID() . ')');
require_once get_file_loc('menu.inc');
create_alliance_menu($alliance->getAllianceID(), $alliance->getLeaderID());
//get the sequence
if (!isset($var['seq'])) {
    SmrSession::updateVar('seq', 'ASC');
}
$order = $var['seq'];
//get the ordering info
if (!isset($var['category'])) {
    SmrSession::updateVar('category', 'player_name');
}
$category = $var['category'];
$categorySQL = $category . ' ' . $order;
if (!isset($var['subcategory'])) {
    SmrSession::updateVar('subcategory', 'expire_time ASC');
}
$subcategory = $var['subcategory'];
$db->query('
SELECT
sum(mines) as tot_mines,
sum(combat_drones) as tot_cds,
sum(scout_drones) as tot_sds
FROM sector_has_forces JOIN player ON player.game_id=sector_has_forces.game_id AND sector_has_forces.owner_id=player.account_id
WHERE player.game_id=' . $db->escapeNumber($alliance->getGameID()) . '
AND player.alliance_id=' . $db->escapeNumber($alliance->getAllianceID()) . '
AND expire_time >= ' . $db->escapeNumber(TIME));
if ($db->nextRecord()) {
    $total['Mines'] = $db->getInt('tot_mines');
    $total['CDs'] = $db->getInt('tot_cds');
    $total['SDs'] = $db->getInt('tot_sds');
<?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.º 27
0
<?php

require_once get_file_loc('menu.inc');
if (!isset($var['race_id'])) {
    SmrSession::updateVar('race_id', $player->getRaceID());
}
$raceID = $var['race_id'];
$template->assign('PageTopic', 'Ruling Council Of ' . Globals::getRaceName($raceID));
// echo menu
create_council_menu($raceID);
$RACES =& Globals::getRaces();
$raceRelations =& Globals::getRaceRelations($player->getGameID(), $raceID);
$peaceRaces = array();
$neutralRaces = array();
$warRaces = array();
foreach ($RACES as $otherRaceID => $raceInfo) {
    if ($otherRaceID != RACE_NEUTRAL && $raceID != $otherRaceID) {
        if ($raceRelations[$otherRaceID] >= 300) {
            $peaceRaces[$otherRaceID] = $raceInfo;
        } else {
            if ($raceRelations[$otherRaceID] <= -300) {
                $warRaces[$otherRaceID] = $raceInfo;
            } else {
                $neutralRaces[$otherRaceID] = $raceInfo;
            }
        }
    }
}
$template->assignByRef('PeaceRaces', $peaceRaces);
$template->assignByRef('NeutralRaces', $neutralRaces);
$template->assignByRef('WarRaces', $warRaces);
Ejemplo n.º 28
0
        while ($db->nextRecord()) {
            // get bounty id from db
            $bounty_id = $db->getInt('bounty_id');
            $acc_id = $db->getInt('account_id');
            $amount = $db->getInt('amount');
            $smrCredits = $db->getInt('smr_credits');
            // no interest on bounties
            // $time = TIME;
            // $days = ($time - $db->getField('time')) / 60 / 60 / 24;
            // $amount = round($db->getField('amount') * pow(1.05,$days));
            // add bounty to our cash
            $player->increaseCredits($amount);
            $account->increaseSmrCredits($smrCredits);
            $name =& SmrPlayer::getPlayer($acc_id, $player->getGameID());
            $claimText .= '<span class="yellow">' . $name->getPlayerName() . '</span> : <span class="creds">' . number_format($amount) . '</span> credits and <span class="red">' . number_format($smrCredits) . '</span> SMR credits<br />';
            // add HoF stat
            $player->increaseHOF(1, array('Bounties', 'Claimed', 'Results'), HOF_PUBLIC);
            $player->increaseHOF($amount, array('Bounties', 'Claimed', 'Money'), HOF_PUBLIC);
            $player->increaseHOF($smrCredits, array('Bounties', 'Claimed', 'SMR Credits'), HOF_PUBLIC);
            // delete bounty
            $db2->query('DELETE FROM bounty
						WHERE game_id = ' . $db2->escapeNumber($player->getGameID()) . '
							AND claimer_id = ' . $db2->escapeNumber($player->getAccountID()) . '
							AND bounty_id = ' . $db2->escapeNumber($bounty_id));
        }
    } else {
        $claimText .= 'You have no claimable bounties<br /><br />';
    }
    SmrSession::updateVar('ClaimText', $claimText);
}
$PHP_OUTPUT .= $var['ClaimText'];