} 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>';
<?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; }
<?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', '')));
<?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: </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: </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: </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')) {
<?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']))));
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')));
<?php $template->assign('PageTopic', 'Search Trader'); $template->assign('TraderSearchHREF', SmrSession::getNewHREF(create_container('skeleton.php', 'trader_search_result.php')));
<?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 = ' '; 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'];
<?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']); }
<?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']); }
<?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']); }
<?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')));
<?php require_once '../htdocs/config.inc'; require_once LIB . 'Default/Globals.class.inc'; require_once get_file_loc('ChessGame.class.inc'); SmrSession::$game_id = 44; $db = new SmrMySqlDatabase(); $db->query('DELETE FROM player_hof WHERE type LIKE \'Chess%\''); $db->query('SELECT chess_game_id FROM chess_game'); while ($db->nextRecord()) { $chessGameID = $db->getInt('chess_game_id'); $game =& ChessGame::getChessGame($chessGameID); echo 'Running game ' . $chessGameID . ' for white id "' . $game->getWhiteID() . '", black id "' . $game->getBlackID() . '", winner "' . $game->getWinner() . '"' . EOL; echoChessMoves($game); $game->rerunGame(true); echo 'Finished game ' . $chessGameID . ' for white id "' . $game->getWhiteID() . '", black id "' . $game->getBlackID() . '", winner "' . $game->getWinner() . '"' . EOL; echoChessMoves($game); } function echoChessMoves($game) { echo 'Moves: ' . EOL; $moves = $game->getMoves(); foreach ($moves as $move) { echo $move . EOL; } echo EOL; }
$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); }
<?php require_once get_file_loc('smr_sector.inc'); // register game_id SmrSession::$game_id = $var["game_id"]; // check if hof entry is there $db->query("SELECT * FROM account_has_stats WHERE account_id = " . SmrSession::$old_account_id); if (!$db->nf()) { $db->query("INSERT INTO account_has_stats (account_id, HoF_name, games_joined) VALUES ({$account->account_id}, " . format_string($account->login, true) . ", 1)"); } $player = new SMR_PLAYER(SmrSession::$old_account_id, $var["game_id"]); include get_file_loc('out_check.php'); $player->last_sector_id = 0; $player->last_active = time(); $player->update(); // get rid of old plotted course $player->delete_plotted_course(); // log $account->log(2, "Player entered game " . SmrSession::$game_id, $player->sector_id); $container = array(); $container["url"] = "skeleton.php"; if ($player->land_on_planet == "TRUE") { $container["body"] = "planet_main.php"; } else { $container["body"] = "current_sector.php"; } require_once get_file_loc('smr_alliance.inc'); require_once get_file_loc("smr_force.inc"); require_once get_file_loc("smr_planet.inc"); require_once get_file_loc("smr_port.inc"); require_once get_file_loc('smr_sector.inc');
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); } } } } }
$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); }
<?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']); }
// * // * 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); }
<?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); }
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; }
<?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); }
<?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);
<?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'))); }
$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');
if ($player->last_sector_id == $links[4]) { echo ' green'; } else { if (isset($unvisited[$links[4]])) { echo ' yellow'; } else { echo ' dgreen'; } } echo '" href="loader2.php?sn=' . SmrSession::get_new_sn($container1) . '">'; echo $links[4]; echo '</a></div>'; if (!empty($ship->hardware[HARDWARE_SCANNER])) { $container2['target_sector'] = $links[4]; echo '</td><td>'; echo '<div class="cssv"><a class="cssc" href="loader2.php?sn=' . SmrSession::get_new_sn($container2) . '">S<br>C<br>A<br>N</a></div>'; } echo '</td></tr></table>'; } echo '</div><br>'; echo '</td><td style="padding:0px;vertical-align:top;width:32em;">'; // check if we have a course plotted $db->query(' SELECT course,distance FROM player_plotted_course WHERE account_id=' . $player->account_id . ' AND game_id=' . $player->game_id . ' LIMIT 1'); if ($db->next_record()) { // get the array back $path_list = unserialize(stripslashes($db->f("course"))); $distance = $db->f("distance");
<?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);
} function writeToEngine($s, $block = true, $read = true) { global $toEngine; debug('--> ' . $s); fputs($toEngine, $s . EOL); if ($read === true) { readFromEngine($block); } } readFromEngine(); writeToEngine('uci'); writeToEngine('setoption name Hash value ' . UCI_HASH_SIZE_MB, false); writeToEngine('isready'); writeToEngine('ucinewgame', false); SmrSession::$game_id = NPC_GAME_ID; require_once get_file_loc('ChessGame.class.inc'); while (true) { //Redefine MICRO_TIME and TIME, the rest of the game expects them to be the single point in time that the script is executing, with it being redefined for each page load - unfortunately NPCs are one consistent script so we have to do a hack and redefine it (or change every instance of the TIME constant). runkit_constant_redefine('MICRO_TIME', microtime()); runkit_constant_redefine('TIME', (int) microtimeSec(MICRO_TIME)); $chessGames =& ChessGame::getNPCMoveGames(true); foreach ($chessGames as &$chessGame) { debug('Looking at game: ' . $chessGame->getChessGameID()); writeToEngine('position fen ' . $chessGame->getFENString(), false); writeToEngine('go ' . ($chessGame->getCurrentTurnColour() == ChessGame::PLAYER_WHITE ? 'w' : 'b') . 'time ' . UCI_TIME_PER_MOVE_MS, true, false); stream_set_blocking($fromEngine, 1); while (stripos($move = trim(fgets($fromEngine)), 'bestmove') !== 0) { debug('<-- ' . $move); if (stripos($move, 'Seg') === 0) { // Segfault
<?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);
<?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);