コード例 #1
0
<?php

//we need to see if they are actually still on the planet.
if ($player->land_on_planet == 'FALSE') {
    forward(create_container("skeleton.php", "current_sector.php"));
} else {
    forward(create_container("skeleton.php", "planet_main.php"));
}
コード例 #2
0
ファイル: album_edit.php プロジェクト: smrealms/smrv2.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', '')));
コード例 #3
0
<?php

//check to see if there is a paper already online
$db->query('SELECT * FROM galactic_post_online WHERE game_id = ' . $db->escapeNumber($player->getGameID()));
if ($db->nextRecord()) {
    $del_paper_id = $db->getField('paper_id');
}
if (!empty($del_paper_id)) {
    $db->query('DELETE FROM galactic_post_online WHERE paper_id = ' . $del_paper_id);
}
//insert the new paper in.
$db->query('INSERT INTO galactic_post_online (paper_id, game_id, online_since) VALUES (' . $var['id'] . ', ' . $db->escapeNumber($player->getGameID()) . ', ' . TIME . ' )');
//all done lets send back to the main GP page.
$container = create_container('skeleton.php', 'galactic_post.php');
forward($container);
コード例 #4
0
<?php

$disable_account = $_REQUEST['disable_account'];
foreach ($disable_account as $currAccountID) {
    //never expire
    SmrAccount::getAccount($currAccountID)->banAccount(0, $account, 2, 'Double password');
}
forward(create_container('skeleton.php', 'admin_tools.php'));
コード例 #5
0
 print "<tr>";
 print "<td valign=\"top\" align=\"center\"";
 if ($player->alliance_id == $id) {
     print " style=\"font-weight:bold;\"";
 } elseif ($out) {
     print " style=\"color:red;\"";
 }
 print ">{$rank}</td>";
 print "<td valign=\"top\"";
 if ($player->alliance_id == $id) {
     print " style=\"font-weight:bold;\"";
 } elseif ($out) {
     print " style=\"color:red;\"";
 }
 print ">";
 $container = create_container('skeleton.php', 'alliance_roster.php');
 $container["alliance_id"] = $id;
 if ($out) {
     print $currAllianceName;
 } else {
     print_link($container, $currAllianceName);
 }
 print "</td>";
 print "<td valign=\"top\" align=\"right\"";
 if ($player->alliance_id == $id) {
     print " style=\"font-weight:bold;\"";
 }
 if ($out) {
     print " style=\"color:red;\"";
 }
 print ">" . number_format($numKills) . "</td>";
コード例 #6
0
        } else {
            if ($var['task'] == 'reset_website') {
                $db->query('UPDATE album SET website = \'\' WHERE account_id = ' . $db->escapeNumber($account_id));
            } else {
                if ($var['task'] == 'reset_birthdate') {
                    $db->query('UPDATE album SET day = 0, month = 0, year = 0 WHERE account_id = ' . $db->escapeNumber($account_id));
                } else {
                    if ($var['task'] == 'reset_other') {
                        $db->query('UPDATE album SET other = \'\' WHERE account_id = ' . $db->escapeNumber($account_id));
                    } else {
                        if ($var['task'] == 'delete_comment') {
                            $comment_ids = $_REQUEST['comment_ids'];
                            // we just ignore if nothing was set
                            if (count($comment_ids) > 0) {
                                $db->query('DELETE
					FROM album_has_comments
					WHERE album_id = ' . $db->escapeNumber($account_id) . ' AND
						  comment_id IN (' . $db->escapeArray($comment_ids) . ')');
                            }
                        } else {
                            create_error('No action chosen!');
                        }
                    }
                }
            }
        }
    }
}
$container = create_container('skeleton.php', 'album_moderate.php');
transfer('account_id');
forward($container);
コード例 #7
0
        // now transfer
        $planet->shields += $amount;
        $ship->hardware[1] -= $amount;
        $account->log(11, "Player puts {$amount} shields on planet.", $player->sector_id);
        // do the user wants to transfer drones?
    } else {
        if ($type_id == 4) {
            // do we want transfer more than we have?
            if ($amount > $ship->hardware[4]) {
                create_error("You can't transfer more combat drones than you carry!");
            }
            // do we want to transfer more than we can carry?
            if ($amount + $planet->drones > $planet->construction[2] * 20) {
                create_error("The planet can't hold more than " . $planet->construction[2] * 20 . " drones!");
            }
            // now transfer
            $planet->drones += $amount;
            $ship->hardware[4] -= $amount;
            $account->log(11, "Player puts {$amount} drones on planet.", $player->sector_id);
        }
    }
} else {
    create_error("You must choose if you want to transfer to planet or to the ship!");
}
$ship->mark_seen();
// update both
$planet->update();
$ship->update_hardware();
$ship->mark_seen();
forward(create_container("skeleton.php", "planet_defense.php"));
コード例 #8
0
ファイル: bounty_place.php プロジェクト: smrealms/smrv2.0
<?php

$sector =& $player->getSector();
$template->assign('PageTopic', 'Place a Bounty');
require_once get_file_loc('menu.inc');
if ($sector->hasHQ()) {
    create_hq_menu();
} else {
    create_ug_menu();
}
$container = create_container('skeleton.php', 'bounty_place_confirm.php');
transfer('LocationID');
$PHP_OUTPUT .= create_echo_form($container);
$PHP_OUTPUT .= 'Select the player you want to add the bounty to<br />';
$PHP_OUTPUT .= '<select name="player_id" size="1" id="InputFields">';
$PHP_OUTPUT .= '<option value="0">[Please Select]</option>';
$db->query('SELECT player_id, player_name FROM player JOIN account USING(account_id) WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND account_id != ' . $db->escapeNumber($player->getAccountID()) . ' ORDER BY player_name');
while ($db->nextRecord()) {
    $PHP_OUTPUT .= '<option value="' . $db->getInt('player_id') . '">' . $db->getField('player_name') . '</option>';
}
$PHP_OUTPUT .= '</select>';
$PHP_OUTPUT .= '<br /><br />';
$PHP_OUTPUT .= 'Enter the amount you wish to place on this player<br />';
$PHP_OUTPUT .= '<table class="standardnobord"><tr><td>Credits:</td><td><input type="number" name="amount" maxlength="10" size="10" id="InputFields"></td></tr>';
$PHP_OUTPUT .= '<tr><td>Smr Credits:</td><td><input type="number" name="smrcredits" maxlength="10" size="10" id="InputFields"></td></tr></table>';
$PHP_OUTPUT .= '<br /><br />';
$PHP_OUTPUT .= create_submit('Place');
コード例 #9
0
ファイル: login.php プロジェクト: smrealms/smrv2.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);
}
コード例 #10
0
ファイル: word_filter_add.php プロジェクト: smrealms/smrv2.0
<?php

$container = create_container('skeleton.php', 'word_filter.php');
if (!isset($_REQUEST['Word']) || !isset($_REQUEST['WordReplacement'])) {
    $container['error'] = 1;
    forward($container);
    exit;
}
$word = strtoupper(trim($_REQUEST['Word']));
$word_replacement = strtoupper(trim($_REQUEST['WordReplacement']));
if (empty($word) || empty($word_replacement)) {
    $container['error'] = 1;
    forward($container);
    exit;
}
$db = new SmrMySqlDatabase();
$db->query('SELECT word_id FROM word_filter WHERE word_value=' . $db->escapeString($word) . ' LIMIT 1');
if ($db->nextRecord()) {
    $container['error'] = 1;
    forward($container);
    exit;
}
$db->query('INSERT INTO word_filter(word_value,word_replacement) VALUES (' . $db->escapeString($word) . ',' . $db->escapeString($word_replacement) . ')');
$container['error'] = 2;
forward($container);
コード例 #11
0
ファイル: bar_read_wall.php プロジェクト: smrealms/smrv2.0
    $amount = $db->getInt('message_id') + 1;
} else {
    $amount = 1;
}
$wall = $_REQUEST['wall'];
if (isset($wall)) {
    $db->query('INSERT INTO bar_wall (sector_id, game_id, message_id, message, time) VALUES (' . $db->escapeNumber($sector->getSectorID()) . ', ' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($amount) . ',  ' . $db->escapeString($wall) . ' , ' . $db->escapeNumber(TIME) . ')');
}
$db->query('SELECT * FROM bar_wall WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND sector_id = ' . $db->escapeNumber($player->getSectorID()) . ' ORDER BY time DESC');
if ($db->getNumRows()) {
    $PHP_OUTPUT .= '<table class="standard">';
    $PHP_OUTPUT .= '<tr>';
    $PHP_OUTPUT .= '<th align="center">Time written</th>';
    $PHP_OUTPUT .= '<th align="center">Message</th>';
    $PHP_OUTPUT .= '</tr>';
    while ($db->nextRecord()) {
        $time = $db->getInt('time');
        $message_on_wall = $db->getField('message');
        $PHP_OUTPUT .= '<tr>';
        $PHP_OUTPUT .= '<td align="center"><b> ' . date(DATE_FULL_SHORT, $time) . ' </b></td>';
        $PHP_OUTPUT .= '<td align="center"><b>' . $message_on_wall . '</b></td>';
        $PHP_OUTPUT .= '</tr>';
    }
    $PHP_OUTPUT .= '</table>';
}
$template->assign('PageTopic', 'Write on the wall');
$PHP_OUTPUT .= '<br />';
$PHP_OUTPUT .= create_echo_form(create_container('skeleton.php', 'bar_read_wall.php'));
$PHP_OUTPUT .= '<textarea spellcheck="true" name="wall" id="InputFieldsText"></textarea><br /><br />';
$PHP_OUTPUT .= create_submit('Write it');
$PHP_OUTPUT .= '</form>';
コード例 #12
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')));
コード例 #13
0
ファイル: shop_ship.php プロジェクト: smrealms/smrv2.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);
}
コード例 #14
0
ファイル: planet_stockpile.php プロジェクト: smrealms/smrv2.0
$table .= '<th>Good</th>';
$table .= '<th>Ship</th>';
$table .= '<th>Planet</th>';
$table .= '<th>Amount</th>';
$table .= '<th>Transfer to</th>';
$table .= '</tr>';
$GOODS =& Globals::getGoods();
foreach ($GOODS as $goodID => $good) {
    if (!$ship->hasCargo($goodID) && !$planet->hasStockpile($goodID)) {
        continue;
    }
    if (!$present) {
        $present = true;
        $PHP_OUTPUT = "";
    }
    $container = create_container('planet_stockpile_processing.php');
    $container['good_id'] = $goodID;
    $PHP_OUTPUT .= create_echo_form($container);
    $PHP_OUTPUT .= '<tr>';
    $PHP_OUTPUT .= '<td class="left"><img src="' . $good['ImageLink'] . '" width="13" height="16" title="' . $good['Name'] . '" alt=""></td>';
    $PHP_OUTPUT .= '<td>' . $good['Name'] . '</td>';
    $PHP_OUTPUT .= '<td align="center">' . $ship->getCargo($goodID) . '</td>';
    $PHP_OUTPUT .= '<td align="center">' . $planet->getStockpile($goodID) . '</td>';
    $PHP_OUTPUT .= '<td align="center"><input type="number" name="amount" value="' . $ship->getCargo($goodID) . '" id="InputFields" size="4" class="center"/></td>';
    $PHP_OUTPUT .= '<td>';
    $PHP_OUTPUT .= create_submit('Ship');
    $PHP_OUTPUT .= '&nbsp;';
    $PHP_OUTPUT .= create_submit('Planet');
    $PHP_OUTPUT .= '</td>';
    $PHP_OUTPUT .= '</tr>';
    $PHP_OUTPUT .= '</form>';
コード例 #15
0
 $PHP_OUTPUT .= create_link($container, '<b>Edit this article</b>');
 $PHP_OUTPUT .= '<br />';
 $container = array();
 $container['url'] = 'skeleton.php';
 $container['body'] = 'galactic_post_delete_confirm.php';
 $container['article'] = 'yes';
 transfer('id');
 $PHP_OUTPUT .= create_link($container, '<b>Delete This article</b>');
 $PHP_OUTPUT .= '<br /><br />';
 $db->query('SELECT * FROM galactic_post_paper WHERE game_id = ' . $db->escapeNumber($player->getGameID()));
 $container = array();
 $container['url'] = 'galactic_post_add_article_to_paper.php';
 transfer('id');
 if (!$db->getNumRows()) {
     $PHP_OUTPUT .= 'You have no papers made that you can add an article to.';
     $PHP_OUTPUT .= create_link(create_container('skeleton.php', 'galactic_post_make_paper.php'), '<b>Click Here</b>');
     $PHP_OUTPUT .= 'To make a new one.';
 }
 while ($db->nextRecord()) {
     $paper_title = $db->getField('title');
     $paper_id = $db->getField('paper_id');
     $container['paper_id'] = $paper_id;
     $PHP_OUTPUT .= create_link($container, '<b>Add this article to ' . $paper_title . '!</b>');
     $PHP_OUTPUT .= '<br />';
 }
 $container = array();
 $container['url'] = 'skeleton.php';
 $container['body'] = 'galactic_post_view_article.php';
 $container['news'] = $message;
 transfer('id');
 $PHP_OUTPUT .= '<small><br />note: breaking news is in the news section.<br /></small>';
コード例 #16
0
ファイル: trader_search.php プロジェクト: smrealms/smrv2.0
<?php

$template->assign('PageTopic', 'Search Trader');
$template->assign('TraderSearchHREF', SmrSession::getNewHREF(create_container('skeleton.php', 'trader_search_result.php')));
コード例 #17
0
ファイル: chess_play.php プロジェクト: smrealms/smrv2.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']))));
コード例 #18
0
        continue;
    }
    $db->query('INSERT INTO player_visited_sector (account_id, game_id, sector_id) VALUES (' . $db->escapeNumber(SmrSession::$account_id) . ', ' . $db->escapeNumber($gameID) . ', ' . $db->escapeNumber($i) . ')');
}
$db->query('INSERT INTO player_has_stats (account_id, game_id) VALUES (' . $db->escapeNumber(SmrSession::$account_id) . ', ' . $db->escapeNumber($gameID) . ')');
// update stats
$db->query('UPDATE account_has_stats SET games_joined = games_joined + 1 WHERE account_id = ' . $db->escapeNumber($account->getAccountID()));
// is this our first game?
$db->query('SELECT * FROM account_has_stats WHERE account_id = ' . $db->escapeNumber($account->getAccountID()));
if ($db->nextRecord() && $db->getInt('games_joined') == 1) {
    //we are a newb set our alliance to be Newbie Help Allaince
    $db->query('UPDATE player SET alliance_id = ' . $db->escapeNumber(NHA_ID) . ' WHERE account_id = ' . $db->escapeNumber($account->getAccountID()) . ' AND game_id = ' . $db->escapeNumber($gameID));
    $db->query('INSERT INTO player_has_alliance_role (game_id, account_id, role_id,alliance_id) VALUES (' . $db->escapeNumber($gameID) . ', ' . $db->escapeNumber($account->getAccountID()) . ', 2,' . $db->escapeNumber(NHA_ID) . ')');
    //we need to send them some messages
    $message = 'Welcome to Space Merchant Realms, this message is to get you underway with information to start you off in the game. All newbie and beginner rated player are placed into a teaching alliance run by a Veteran player who is experienced enough to answer all your questions and give you a helping hand at learning the basics of the game.<br /><br />
	Apart from your leader (denoted with a star on your alliance roster) there are various other ways to get information and help. Newbie helpers are players in Blue marked on the Current Players List which you can view by clicking the link on the left-hand side of the screen that says "Current Players". Also you can visit the SMR Wiki via a link on the left which gives detailed information on all aspects fo the game.<br /><br />
	SMR is a very community orientated game and as such there is an IRC Chat server setup for people to talk with each other and coordinate your alliances. There is a link on the left which will take you directly to the main SMR room where people come to hang out and chat. You can also get help in the game in the #smr room. You can access this by typing /join #smr-help in the server window. If you prefer to use a dedicated program to access IRC Chat rather than a browser you can goto http://www.mirc.com which is a good shareware program (asks to register the program after 30 days but you can still use it after 30 days so you won\'t get cut off from using it) or http://www.xchat.org which is a free alternative. In the options of either program you will need to enter the server information to access the server. Add a new server and enter the server address irc.coldfront.net using port 6667. Once connected you can use the /join command to join #smr (/join #smr) or any other room on the server as normal.<br /><br />
	Apart from this you can view the webboard via a link on the left to join in community chat and conversations, ask questions for help and make suggestions for the game in various forums.<br /><br />
	To get underway, click the alliance link on the left where you can get more information on 	how to get started on the alliance message board which will get you into your alliance chat 	on IRC so you can get started and have your questions answered.<br /><br />Depending on the size and resolution of your monitor the default font size may be too large or small. This can be changed using the preferences link on the left panel.';
    SmrPlayer::sendMessageFromAdmin($gameID, $account->getAccountID(), $message);
}
if ($race_id == RACE_ALSKANT) {
    // Give Alskants 250 personal relations to start.
    $player =& SmrPlayer::getPlayer($account->getAccountID(), $gameID);
    $RACES =& Globals::getRaces();
    foreach ($RACES as $raceID => $raceInfo) {
        $player->setRelations(250, $raceID);
    }
}
forward(create_container('skeleton.php', 'game_play.php'));
コード例 #19
0
<?php

$alliance =& $player->getAlliance();
$template->assign('PageTopic', $alliance->getAllianceName() . ' (' . $alliance->getAllianceID() . ')');
require_once get_file_loc('menu.inc');
create_alliance_menu($player->getAllianceID(), $alliance->getLeaderID());
$container = create_container('alliance_leadership_processing.php');
$form = create_form($container, 'Handover Leadership');
$PHP_OUTPUT .= $form['form'];
$PHP_OUTPUT .= 'Please select the new Leader:&nbsp;&nbsp;&nbsp;<select name="leader_id" size="1">';
$db->query('
SELECT account_id,player_id,player_name 
FROM player 
WHERE game_id=' . $db->escapeNumber($alliance->getGameID()) . '
AND alliance_id=' . $db->escapeNumber($alliance->getAllianceID()));
while ($db->nextRecord()) {
    $PHP_OUTPUT .= '<option value="' . $db->getField('account_id') . '"';
    if ($db->getField('account_id') == $player->getAccountID()) {
        $PHP_OUTPUT .= ' selected="selected"';
    }
    $PHP_OUTPUT .= '>';
    $PHP_OUTPUT .= $db->getField('player_name');
    $PHP_OUTPUT .= ' (';
    $PHP_OUTPUT .= $db->getField('player_id');
    $PHP_OUTPUT .= ')</option>';
}
$PHP_OUTPUT .= '</select><br /><br />';
$PHP_OUTPUT .= $form['submit'];
$PHP_OUTPUT .= '</form>';
コード例 #20
0
ファイル: message_view.php プロジェクト: smrealms/smrv2.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;
}
コード例 #21
0
ファイル: alliance_forces.php プロジェクト: smrealms/smrv2.0
ORDER BY ' . $categorySQL . ', ' . $subcategory);
$PHP_OUTPUT .= '<div align="center"><a href="http://wiki.smrealms.de/index.php?title=Game_Guide:_Forces" target="_blank"><img align="right" src="images/silk/help.png" width="16" height="16" alt="Wiki Link" title="Goto SMR Wiki: Forces"/></a>';
if ($db->getNumRows() > 0) {
    $PHP_OUTPUT .= 'Your alliance currently has ';
    $PHP_OUTPUT .= $db->getNumRows();
    $PHP_OUTPUT .= ' stacks of forces in the universe!<br />';
    $hardwareTypes =& Globals::getHardwareTypes();
    $PHP_OUTPUT .= create_table();
    $PHP_OUTPUT .= '<th>Number of Force</th><th>Value</th></tr>';
    $PHP_OUTPUT .= '<tr><td><span class="yellow">' . number_format($total['Mines']) . '</span> mines</td><td><span class="creds">' . number_format($total['Mines'] * $hardwareTypes[HARDWARE_MINE]['Cost']) . '</span> credits</td></tr>';
    $PHP_OUTPUT .= '<tr><td><span class="yellow">' . number_format($total['CDs']) . '</span> combat drones</td><td><span class="creds">' . number_format($total['CDs'] * $hardwareTypes[HARDWARE_COMBAT]['Cost']) . '</span> credits</td></tr>';
    $PHP_OUTPUT .= '<tr><td><span class="yellow">' . number_format($total['SDs']) . '</span> scout drones</td><td><span class="creds">' . number_format($total['SDs'] * $hardwareTypes[HARDWARE_SCOUT]['Cost']) . '</span> credits</td></tr>';
    $PHP_OUTPUT .= '<tr><td><span class="yellow bold">' . number_format(array_sum($total)) . '</span> forces</td><td><span class="creds bold">' . number_format($total['Mines'] * $hardwareTypes[HARDWARE_MINE]['Cost'] + $total['CDs'] * $hardwareTypes[HARDWARE_COMBAT]['Cost'] + $total['SDs'] * $hardwareTypes[HARDWARE_SCOUT]['Cost']) . '</span> credits</td></tr>';
    $PHP_OUTPUT .= '</table><br />';
    $PHP_OUTPUT .= '<table class="standard inset"><tr>';
    $container = create_container('skeleton.php', 'alliance_forces.php');
    $container['seq'] = $order == 'ASC' ? 'DESC' : 'ASC';
    setCategories($container, 'player_name', $category, $categorySQL, $subcategory);
    $PHP_OUTPUT .= '<th>';
    $PHP_OUTPUT .= create_header_link($container, 'Player Name');
    $PHP_OUTPUT .= '</th>';
    setCategories($container, 'sector_has_forces.sector_id', $category, $categorySQL, $subcategory);
    $PHP_OUTPUT .= '<th>';
    $PHP_OUTPUT .= create_header_link($container, 'Sector ID');
    $PHP_OUTPUT .= '</th>';
    setCategories($container, 'combat_drones', $category, $categorySQL, $subcategory);
    $PHP_OUTPUT .= '<th>';
    $PHP_OUTPUT .= create_header_link($container, 'Combat Drones');
    $PHP_OUTPUT .= '</th>';
    setCategories($container, 'scout_drones', $category, $categorySQL, $subcategory);
    $PHP_OUTPUT .= '<th>';
コード例 #22
0
            // do we want to transfer more than we can carry?
            if ($amount + $planet->getCDs() > $planet->getMaxCDs()) {
                create_error('The planet can\'t hold more than ' . $planet->getMaxCDs() . ' drones!');
            }
            // now transfer
            $planet->increaseCDs($amount);
            $ship->decreaseCDs($amount);
            $account->log(LOG_TYPE_PLANETS, 'Player puts ' . $amount . ' drones on planet.', $player->getSectorID());
        } else {
            if ($type_id == HARDWARE_ARMOUR) {
                // do we want transfer more than we have?
                if ($amount >= $ship->getArmour()) {
                    create_error('You can\'t transfer more armour than what you carry minus one!');
                }
                // do we want to transfer more than we can carry?
                if ($amount + $planet->getArmour() > $planet->getMaxArmour()) {
                    create_error('The planet can\'t hold more than ' . $planet->getMaxArmour() . ' armour!');
                }
                // now transfer
                $planet->increaseArmour($amount);
                $ship->decreaseArmour($amount);
                $account->log(LOG_TYPE_PLANETS, 'Player puts ' . $amount . ' armour on planet.', $player->getSectorID());
            }
        }
    }
} else {
    create_error('You must choose if you want to transfer to planet or to the ship!');
}
$ship->removeUnderAttack();
forward(create_container('skeleton.php', 'planet_defense.php'));
コード例 #23
0
<?php

$action = $_REQUEST['action'];
if ($action == 'Marked Messages') {
    if (!isset($_REQUEST['message_id'])) {
        create_error('You must choose the messages you want to delete.');
    }
    foreach ($_REQUEST['message_id'] as $id) {
        $db->query('DELETE FROM message_boxes WHERE message_id = ' . $db->escapeNumber($id));
    }
} else {
    if ($action == 'All Messages') {
        if (!isset($var['box_type_id'])) {
            create_error('No box selected.');
        }
        $db->query('DELETE FROM message_boxes WHERE box_type_id = ' . $db->escapeNumber($var['box_type_id']));
    }
}
forward(create_container('skeleton.php', 'box_view.php'));
コード例 #24
0
<?php

$notify_id = $_REQUEST['notify_id'];
if (!isset($notify_id)) {
    create_error('You must choose the messages you want to delete.');
}
$db->query('DELETE FROM message_notify WHERE notify_id IN (' . $db->escapeArray($notify_id) . ')');
forward(create_container('skeleton.php', 'notify_view.php'));
コード例 #25
0
ファイル: planet_main.php プロジェクト: smrealms/smrv2.0
print "</tr>";
print "<tr>";
print "<td>Turrets</td><td align=\"center\">" . $planet->construction[3] . "</td><td align=\"center\">" . $planet->accuracy() . " %</td>";
print "</tr>";
print "</table>";
print "<br />";
$db->query("SELECT * FROM player WHERE sector_id = {$player->sector_id} AND " . "game_id = " . SmrSession::$game_id . " AND " . "account_id != " . SmrSession::$old_account_id . " AND " . "land_on_planet = 'TRUE' " . "ORDER BY last_active DESC");
while ($db->next_record()) {
    $planet_player = new SMR_PLAYER($db->f("account_id"), SmrSession::$game_id);
    $container = array();
    $container["url"] = "planet_kick_processing.php";
    $container["account_id"] = $planet_player->account_id;
    print_form($container);
    $container = array();
    $container["url"] = "skeleton.php";
    $container["body"] = "trader_search_result.php";
    $container["player_id"] = $planet_player->player_id;
    print_link($container, "<span style=\"color:yellow;\">{$planet_player->player_name}</span>");
    print "&nbsp;";
    // should we be able to kick this player from our rock?
    if (($player->alliance_id != $planet_player->alliance_id || $player->alliance_id == 0) && $planet->owner_id == $player->account_id) {
        print_submit("Kick");
    }
    print "</form>";
}
if ($db->nf() > 0) {
    print "<br>";
}
print_form(create_container("planet_launch_processing.php", ""));
print_submit("Launch");
print "</form>";
コード例 #26
0
ファイル: alliance_stat.php プロジェクト: smrealms/smrv2.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')) {
コード例 #27
0
}
if ($newShip['RaceID'] != 1 && $player->getRaceID() != $newShip['RaceID']) {
    create_error('You can\'t buy other race\'s ships!');
}
/*if ($player->getAccountID() == 101)
	create_error('Cheaters do NOT get ships!');*/
// do we have enough cash?
if ($player->getCredits() < $cost) {
    create_error('You do not have enough cash to purchase this ship!');
}
// adapt turns
$player->setTurns(round($player->getTurns() * $newShip['Speed'] / $ship->getSpeed()));
//Don't times by game speed as getSpeed doesn't include it meaning ratio will be the same but less work.
// take the money from the user
if ($cost > 0) {
    $player->decreaseCredits($cost);
} else {
    $player->increaseCredits(-$cost);
}
// assign the new ship
$ship->decloak();
$ship->disableIllusion();
$ship->setShipTypeID($shipID);
// update again
$ship->removeUnderAttack();
$ship->update();
$player->update();
$account->log(LOG_TYPE_HARDWARE, 'Buys a ' . $ship->getName() . ' for ' . $cost . ' credits', $player->getSectorID());
$container = create_container('skeleton.php', 'current_sector.php');
transfer('LocationID');
forward($container);
コード例 #28
0
ファイル: log_console.php プロジェクト: smrealms/smrv2.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);
コード例 #29
0
ファイル: universe_create.php プロジェクト: smrealms/smrv2.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);
コード例 #30
0
<?php

if ($_REQUEST['action'] == 'Approve') {
    $approved = 'YES';
} else {
    $approved = 'NO';
}
$db->query('UPDATE album
			SET approved = ' . $db->escapeString($approved) . '
			WHERE account_id = ' . $db->escapeNumber($var['album_id']));
forward(create_container('skeleton.php', 'album_approve.php'));