function check_for_registration(&$account, &$player, $fp, $nick, $channel, $callback, $validationMessages = true) { //Force $validationMessages to always be boolean. $validationMessages = $validationMessages === true; $db = new SmrMySqlDatabase(); // only registered users are allowed to use this command $db->query('SELECT * FROM irc_seen WHERE nick = ' . $db->escapeString($nick) . ' AND registered = 1 AND channel = ' . $db->escapeString($channel)); if (!$db->nextRecord()) { global $actions; // execute a whois and continue here on whois fputs($fp, 'WHOIS ' . $nick . EOL); array_push($actions, array('MSG_318', $channel, $nick, $callback, time(), $validationMessages)); return true; } $registeredNick = $db->getField('registered_nick'); // get alliance_id and game_id for this channel $alliance =& SmrAlliance::getAllianceByIrcChannel($channel, true); if ($alliance == null) { if ($validationMessages === true) { fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', the channel ' . $channel . ' has not been registered with me.' . EOL); } return true; } // get smr account $account = SmrAccount::getAccountByIrcNick($nick, true); if ($account == null) { if ($registeredNick != '') { $account = SmrAccount::getAccountByIrcNick($registeredNick, true); } if ($account == null) { if ($validationMessages === true) { fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', please set your \'irc nick\' in SMR preferences to your registered nick so i can recognize you.' . EOL); } return true; } } // get smr player $player = SmrPlayer::getPlayer($account->getAccountID(), $alliance->getGameId(), true); if ($player == null) { if ($validationMessages === true) { fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', you have not joined the game that this channel belongs to.' . EOL); } return true; } // is the user part of this alliance? (no need to check for 0, cannot happen at this point in code) if ($player->getAllianceID() != $alliance->getAllianceID()) { if ($validationMessages === true) { fputs($fp, 'KICK ' . $channel . ' ' . $nick . ' :You are not a member of this alliance!' . EOL); } return true; } return false; }
} else { $PHP_OUTPUT .= $main_alliance->getAllianceName() . ' has no kills!'; } $PHP_OUTPUT .= '</td><td width="10%"> </td><td width="45%" align="center" valign="top">'; $db->query('SELECT * FROM alliance_vs_alliance WHERE alliance_id_2 = ' . $db->escapeNumber($var['alliance_id']) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()) . ' ORDER BY kills DESC'); if ($db->getNumRows() > 0) { $PHP_OUTPUT .= '<div align="center">Deaths for ' . $main_alliance->getAllianceName(); $PHP_OUTPUT .= '<table class="standard"><tr><th align=center>Alliance Name</th>'; $PHP_OUTPUT .= '<th align="center">Amount</th></tr>'; while ($db->nextRecord()) { $kills = $db->getField('kills'); $id = $db->getField('alliance_id_1'); if ($id > 0) { $killer_alliance =& SmrAlliance::getAlliance($id, $player->getGameID()); $alliance_name = $killer_alliance->getAllianceName(); } elseif ($id == 0) { $alliance_name = '<span class="blue">No Alliance</span>'; } elseif ($id == -1) { $alliance_name = '<span class="blue">Forces</span>'; } elseif ($id == -2) { $alliance_name = '<span class="blue">Planets</span>'; } elseif ($id == -3) { $alliance_name = '<span class="blue">Ports</span>'; } $PHP_OUTPUT .= '<tr><td align="center">' . $alliance_name . '</td><td align="center">' . $kills . '</td></tr>'; } $PHP_OUTPUT .= '</table>'; } else { $PHP_OUTPUT .= $main_alliance->getAllianceName() . ' has no deaths!';
<?php if (!isset($var['alliance_id'])) { SmrSession::updateVar('alliance_id', $player->getAllianceID()); } $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()); //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()) . '
<?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')) {
} $alliance =& SmrAlliance::getAlliance($var['alliance_id'], $player->getGameID()); $template->assign('PageTopic', 'Bank'); require_once get_file_loc('menu.inc'); create_bank_menu(); $db->query('SELECT * FROM alliance_treaties WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND (alliance_id_1 = ' . $db->escapeNumber($player->getAllianceID()) . ' OR alliance_id_2 = ' . $db->escapeNumber($player->getAllianceID()) . ') AND aa_access = 1 AND official = \'TRUE\''); $alliedAllianceBanks = array(); if ($db->getNumRows() > 0) { $alliedAllianceBanks[$player->getAllianceID()] = $player->getAlliance(); while ($db->nextRecord()) { if ($db->getInt('alliance_id_1') == $player->getAllianceID()) { $alliedAllianceBanks[$db->getInt('alliance_id_2')] = SmrAlliance::getAlliance($db->getInt('alliance_id_2'), $alliance->getGameID()); } else { $alliedAllianceBanks[$db->getInt('alliance_id_1')] = SmrAlliance::getAlliance($db->getInt('alliance_id_1'), $alliance->getGameID()); } } } $template->assignByRef('AlliedAllianceBanks', $alliedAllianceBanks); $db->query('SELECT transaction, 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()) . ' GROUP BY transaction'); while ($db->nextRecord()) { $playerTrans[$db->getField('transaction')] = $db->getInt('total'); } if ($alliance->getAllianceID() == $player->getAllianceID()) { $role_id = $player->getAllianceRole($alliance->getAllianceID()); $query = 'role_id = ' . $db->escapeNumber($role_id); } else { $query = 'role = ' . $db->escapeString($player->getAllianceName());