Esempio n. 1
0
function get_album_nick($album_id)
{
    if ($album_id == 0) {
        return 'System';
    }
    $album = new SmrMySqlDatabase();
    $account =& SmrAccount::getAccount($album_id);
    return $account->getHofName();
}
Esempio n. 2
0
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;
}
Esempio n. 3
0
function check_sms_response($fp)
{
    // get one dlr per time so we do not spam anyone
    $db = new SmrMySqlDatabase();
    $db->query('SELECT *
				FROM account_sms_response
				LEFT JOIN account_sms_log USING (message_id)
				WHERE announce = 0');
    if ($db->nextRecord()) {
        $response_id = $db->getField('response_id');
        $message_id = $db->getField('message_id');
        $message = $db->getField('message');
        $orig_sender_id = $db->getField('account_id');
        echo_r('Found new SMS response... ' . $message_id);
        $orig_sender =& SmrAccount::getAccount($orig_sender_id, true);
        fputs($fp, 'NOTICE ' . $orig_sender->getIrcNick() . ' :You have received a response to your text: ' . EOL);
        fputs($fp, 'NOTICE ' . $orig_sender->getIrcNick() . ' :' . $message . EOL);
        // update announce status
        $db->query('UPDATE account_sms_response
					SET announce = 1
					WHERE response_id = ' . $response_id);
    }
}
Esempio n. 4
0
$PHP_OUTPUT .= 'Following accounts where accessed by these logged people:';
$PHP_OUTPUT .= '<p>&nbsp;</p>';
$PHP_OUTPUT .= '<p>';
while ($db->nextRecord()) {
    if ($anon_id != $db->getField('anon_id')) {
        // if this is not the first entry we have to close previous list
        if ($anon_id > 0) {
            $PHP_OUTPUT .= '</ul>';
        }
        // set current anon_id
        $anon_id = $db->getInt('anon_id');
        // start topic for it
        $PHP_OUTPUT .= 'Account #' . $anon_id;
        $PHP_OUTPUT .= '<ul>';
    }
    $curr_account =& SmrAccount::getAccount($db->getInt('account_id'));
    $transaction_id = $db->getInt('transaction_id');
    $db2->query('SELECT * FROM anon_bank_transactions
				 WHERE account_id = ' . $db2->escapeNumber($curr_account->getAccountID()) . ' AND
					   anon_id = ' . $db2->escapeNumber($anon_id) . ' AND
					   transaction_id = ' . $db2->escapeNumber($transaction_id));
    if ($db2->nextRecord()) {
        $text = strtolower($db2->getField('transaction')) . ' ' . number_format($db2->getInt('amount')) . ' credits';
    }
    $PHP_OUTPUT .= '<li>' . $curr_account->getLogin() . ' ' . $text . '</li>';
}
$PHP_OUTPUT .= '</ul>';
$PHP_OUTPUT .= '</p>';
$PHP_OUTPUT .= '<p>&nbsp;</p>';
$PHP_OUTPUT .= '<p>';
$PHP_OUTPUT .= create_link(create_container('skeleton.php', 'log_console.php'), '<b>&lt; Back</b>');
Esempio n. 5
0
            ?>
								</select><?php 
        } else {
            echo $Roles[$PlayerRole];
        }
        ?>
						</td><?php 
    }
    if ($ThisPlayer->getAllianceID() == $Alliance->getAllianceID()) {
        ?>
						<td class="center status"><?php 
        if (in_array($AlliancePlayer->getAccountID(), $ActiveIDs)) {
            ?>
								<span class="friendly">Online</span><?php 
        } else {
            if ($ThisPlayer->getAccountID() == $Alliance->getLeaderID() && ($Disabled = SmrAccount::getAccount($AlliancePlayer->getAccountID())->isDisabled())) {
                ?>
								<span class="enemy">Banned Until:<br/><?php 
                echo date(DATE_FULL_SHORT_SPLIT, $Disabled['Time']);
                ?>
</span><?php 
            } else {
                ?>
								<span class="enemy">Offline</span><?php 
            }
        }
        ?>
						</td><?php 
    }
    ?>
				</tr><?php 
<?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'));
Esempio n. 7
0
        $PHP_OUTPUT .= '</td></tr>';
    }
} else {
    $PHP_OUTPUT .= '<tr><th>Rank</th><th>Player</th><th>Total</th></tr>';
    $gameIDSql = ' AND game_id ' . (isset($var['game_id']) ? '= ' . $db->escapeNumber($var['game_id']) : 'IN (SELECT game_id FROM game WHERE ignore_stats = ' . $db->escapeBoolean(false) . ')');
    $vis = HOF_PUBLIC;
    $rank = 1;
    $foundMe = false;
    $viewType = $var['type'];
    $viewType[] = $var['view'];
    if ($var['view'] == DONATION_NAME) {
        $db->query('SELECT account_id, SUM(amount) as amount FROM account_donated
					GROUP BY account_id ORDER BY amount DESC LIMIT 25');
    } else {
        if ($var['view'] == USER_SCORE_NAME) {
            $statements = SmrAccount::getUserScoreCaseStatement($db);
            $query = 'SELECT account_id, ' . $statements['CASE'] . ' amount FROM (SELECT account_id, type, SUM(amount) amount FROM player_hof WHERE type IN (' . $statements['IN'] . ')' . $gameIDSql . ' GROUP BY account_id,type) x GROUP BY account_id ORDER BY amount DESC LIMIT 25';
            $db->query($query);
        } else {
            $db->query('SELECT visibility FROM hof_visibility WHERE type = ' . $db->escapeArray($viewType, false, true, ':', false) . ' LIMIT 1');
            if ($db->nextRecord()) {
                $vis = $db->getField('visibility');
            }
            $db->query('SELECT account_id,SUM(amount) amount FROM player_hof WHERE type=' . $db->escapeArray($viewType, false, true, ':', false) . $gameIDSql . ' GROUP BY account_id ORDER BY amount DESC LIMIT 25');
        }
    }
    $db2 = new SmrMySqlDatabase();
    while ($db->nextRecord()) {
        $accountID = $db->getField('account_id');
        if ($accountID == $account->getAccountID()) {
            $foundMe = true;
Esempio n. 8
0
function changeNPCLogin()
{
    global $NPC_LOGIN, $actions, $NPC_LOGINS_USED, $underAttack, $previousContainer;
    if ($actions > 0) {
        debug('We have taken actions and now want to change NPC, let\'s exit and let next script choose a new NPC to reset execution time', getrusage());
        exitNPC();
    }
    $actions = -1;
    $GLOBALS['TRADE_ROUTE'] = null;
    $db = new SmrMySqlDatabase();
    $db->query('UPDATE npc_logins SET working=' . $db->escapeBoolean(false) . ' WHERE login='******'Login']));
    if ($db->getChangedRows() > 0) {
        debug('Unlocked NPC: ' . $NPC_LOGIN['Login']);
    } else {
        debug('Failed to unlock NPC: ' . $NPC_LOGIN['Login']);
    }
    $NPC_LOGIN = null;
    // We chose a new NPC, we don't care what we were doing beforehand.
    $previousContainer = null;
    debug('Choosing new NPC');
    $db2 = new SmrMySqlDatabase();
    $db->query('SELECT login, npc.player_name, alliance_name
				FROM npc_logins npc
				LEFT JOIN account a USING(login)
				LEFT JOIN player p ON a.account_id = p.account_id AND p.game_id = ' . $db->escapeNumber(NPC_GAME_ID) . '
				WHERE active=' . $db->escapeBoolean(true) . ' AND working=' . $db->escapeBoolean(false) . ' AND login NOT IN (' . $db->escapeArray($NPC_LOGINS_USED) . ')
				ORDER BY (turns IS NOT NULL), turns DESC');
    while ($db->nextRecord()) {
        $db2->query('UPDATE npc_logins SET working=' . $db2->escapeBoolean(true) . ' WHERE login='******'login')) . ' AND working=' . $db2->escapeBoolean(false));
        if ($db2->getChangedRows() > 0) {
            $NPC_LOGIN = array('Login' => $db->getField('login'), 'PlayerName' => $db->getField('player_name'), 'AllianceName' => $db->getField('alliance_name'));
            break;
        }
    }
    $NPC_LOGINS_USED[] = $NPC_LOGIN['Login'];
    if ($NPC_LOGIN === null) {
        debug('No free NPCs');
        exitNPC();
    }
    debug('Chosen NPC: ' . $NPC_LOGIN['Login']);
    if (SmrAccount::getAccountByName($NPC_LOGIN['Login']) == null) {
        debug('Creating account for: ' . $NPC_LOGIN['Login']);
        $account =& SmrAccount::createAccount($NPC_LOGIN['Login'], '', '*****@*****.**', 'NPC', 'NPC', 'NPC', 'NPC', 'NPC', 'NPC', 'NPC', 0, 0);
        $account->setValidated(true);
    } else {
        $account =& SmrAccount::getAccountByName($NPC_LOGIN['Login']);
    }
    $GLOBALS['account'] =& $account;
    SmrSession::$account_id = $account->getAccountID();
    $underAttack = false;
    //Auto-create player if need be.
    $db->query('SELECT 1 FROM player WHERE account_id = ' . $account->getAccountID() . ' AND game_id = ' . NPC_GAME_ID . ' LIMIT 1');
    if (!$db->nextRecord()) {
        SmrSession::$game_id = 0;
        //Have to be out of game to join game.
        debug('Auto-creating player: ' . $account->getLogin());
        processContainer(joinGame(SmrSession::$game_id, $NPC_LOGIN['PlayerName']));
    }
    throw new Exception('Forward');
}
Esempio n. 9
0
function channel_msg_sms_send($fp, $rdata, $account, $player)
{
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:!sms send ([^ ]+) (.*)\\s$/i', $rdata, $msg)) {
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $channel = $msg[4];
        $recv = $msg[5];
        $msg = trim($msg[6]);
        echo_r('[SMS_SEND] by ' . $nick . ' in ' . $channel . ' for ' . $recv);
        if (($blacklist_reason = $account->isSmsBlacklisted()) !== false) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', you are not allowed to send text messages via ' . IRC_BOT_NICK . '. Reason: ' . $blacklist_reason . EOL);
            return true;
        }
        // check if we know this user we try to send a text too
        $recv_account =& SmrAccount::getAccountByIrcNick($recv, true);
        if ($recv_account == null) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', I don\'t know a player that goes by the nick \'' . $recv . '\'.' . EOL);
            return true;
        }
        // do we have a cellphone number?
        if (strlen($recv_account->getCellPhone()) == 0) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', ' . $recv_account->getIrcNick() . ' has not provided a cell phone number.' . EOL);
            return true;
        }
        // do we have a msg
        if (empty($msg)) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', you don\'t mind me asking what do you want to send to ' . $recv_account->getIrcNick() . '?' . EOL);
            return true;
        }
        // message too long?
        if (strlen($msg) > 160) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', the message you want to send contains more than 160 characters.' . EOL);
            return true;
        }
        // +--------------------------------------------+
        // | Copyright (c) 2007-2009 by MOBILANT.DE     |
        // +--------------------------------------------+
        $url = 'http://gw.mobilant.com';
        $request = '';
        $param = array();
        $param['key'] = SMS_GATEWAY_KEY;
        $param['message'] = $msg;
        // numbers like +177 will be (for some reason) 'corrected' to a german number because it's a common area code here
        // therefor support asked me to use 00-1-77 instad of +1-77
        $param['to'] = '00' . substr($recv_account->getCellPhone(), 1);
        //		$param['from'] = 'SMR';
        $param['route'] = 'direct';
        $param['debug'] = SMS_DEBUG;
        $param['message_id'] = '1';
        $param['dlr'] = '1';
        $param['response'] = '1';
        foreach ($param as $key => $val) {
            $request .= $key . '=' . urlencode($val);
            $request .= '&';
        }
        echo_r('Calling url: ' . $url . '?' . $request);
        // request url = send text
        $response = @file($url . '?' . $request);
        $response_code = intval($response[0]);
        $message_id = intval($response[1]);
        // insert log
        $db = new SmrMySqlDatabase();
        $db->query('INSERT INTO account_sms_log (account_id, time, receiver_id, receiver_cell, response_code, message_id)
					VALUES (' . $account->getAccountID() . ', ' . time() . ', ' . $recv_account->getAccountID() . ', ' . $db->escapeString($recv_account->getCellPhone()) . ', ' . $response_code . ', ' . $message_id . ')');
        // confirm sending
        if (SMS_DEBUG) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', sending SMS messages is currently disabled.' . EOL);
        } else {
            if ($response_code == 100) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', your text message will be delivered to ' . $recv_account->getIrcNick() . ' immediately.' . EOL);
            } elseif ($response_code == 10) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Unknown receiver number!' . EOL);
            } elseif ($response_code == 20) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Unknown sender number!' . EOL);
            } elseif ($response_code == 30) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Error in message!' . EOL);
            } elseif ($response_code == 40) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Unknown route!' . EOL);
            } elseif ($response_code == 50) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Identification failed!' . EOL);
            } elseif ($response_code == 60) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Insufficient funds! Please donate!' . EOL);
            } elseif ($response_code == 70) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Text message can\'t be delivered!' . EOL);
            } elseif ($response_code == 71) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Feature not possible!' . EOL);
            } elseif ($response_code == 80) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Error while delivering to SMS-C!' . EOL);
            } else {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message' . EOL);
            }
        }
        return true;
    }
    return false;
}
Esempio n. 10
0
 $PHP_OUTPUT .= create_link($container, '<span class="lgreen">Race</span>');
 $PHP_OUTPUT .= '</th>';
 $container['sort'] = 'alliance_id';
 $PHP_OUTPUT .= '<th>';
 $PHP_OUTPUT .= create_link($container, '<span class="lgreen">Alliance</span>');
 $PHP_OUTPUT .= '</th>';
 $container['sort'] = 'experience';
 $PHP_OUTPUT .= '<th>';
 $PHP_OUTPUT .= create_link($container, '<span class="lgreen">Experience</span>');
 $PHP_OUTPUT .= '</th>';
 $PHP_OUTPUT .= '</tr>';
 $db2 = new SmrMySqlDatabase();
 while ($db->nextRecord()) {
     $accountID = $db->getField('account_id');
     $curr_player =& SmrPlayer::getPlayer($accountID, $player->getGameID());
     $curr_account =& SmrAccount::getAccount($accountID);
     $class = '';
     if ($player->equals($curr_player)) {
         $class .= 'bold';
     }
     if ($curr_account->isNewbie()) {
         $class .= ' newbie';
     }
     if ($class != '') {
         $class = ' class="' . trim($class) . '"';
     }
     $PHP_OUTPUT .= '<tr' . $class . '>';
     $PHP_OUTPUT .= '<td valign="top">';
     $container = array();
     $container['url'] = 'skeleton.php';
     $container['body'] = 'trader_search_result.php';
Esempio n. 11
0
         $account->setCellPhone(null);
         $container['msg'] = '<span class="green">SUCCESS: </span>You have deleted your cell phone number.';
     } else {
         // validate number
         if (preg_match('/^\\+[0-9] {3,24}$/', $cellPhone) == 0) {
             create_error('Cell phone numbers must be given in the international format, eg: +15551234567 (For details see this link: http://www.ehow.com/how_5547899_write-phone-number-international-format.html)');
         }
         // and save cell phone
         $account->setCellPhone($cellPhone);
         $container['msg'] = '<span class="green">SUCCESS: </span>You have changed your cell phone number.';
     }
 } elseif ($action == 'Yes') {
     $account_id = $var['account_id'];
     $amount = $var['amount'];
     // create his account
     $his_account =& SmrAccount::getAccount($account_id);
     // take from us
     $account->decreaseSmrCredits($amount);
     // add to him
     $his_account->increaseSmrCredits($amount);
     $container['msg'] = '<span class="green">SUCCESS: </span>You have sent SMR credits.';
 } elseif ($action == 'Change Timezone') {
     $timez = $_REQUEST['timez'];
     if (!is_numeric($timez)) {
         create_error('Numbers only please');
     }
     $db->query('UPDATE account SET offset = ' . $db->escapeNumber($timez) . ' WHERE account_id = ' . $db->escapeNumber($account->getAccountID()));
     $container['msg'] = '<span class="green">SUCCESS: </span>You have changed your time offset.';
 } elseif ($action == 'Change Date Formats') {
     $account->setShortDateFormat($_REQUEST['dateformat']);
     $account->setShortTimeFormat($_REQUEST['timeformat']);
Esempio n. 12
0
    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;
$container['amount'] = $amount;
$PHP_OUTPUT .= create_echo_form($container);
$PHP_OUTPUT .= create_submit('Yes');
$PHP_OUTPUT .= '&nbsp;&nbsp;';
$PHP_OUTPUT .= create_submit('No');
$PHP_OUTPUT .= '</form>';
<?php

if (!Globals::isFeatureRequestOpen()) {
    create_error('Feature requests are currently not being accepted.');
}
$template->assign('PageTopic', 'Feature Request Comments');
$container = $var;
$container['body'] = 'feature_request.php';
$template->assign('BackHref', SmrSession::getNewHREF($container));
$db->query('SELECT *
			FROM feature_request
			JOIN feature_request_comments USING(feature_request_id)
			WHERE feature_request_id = ' . $db->escapeNumber($var['RequestID']) . '
			ORDER BY comment_id ASC');
if ($db->getNumRows() > 0) {
    $featureModerator = $account->hasPermission(PERMISSION_MODERATE_FEATURE_REQUEST);
    $template->assign('FeatureModerator', $featureModerator);
    $featureRequestComments = array();
    while ($db->nextRecord()) {
        $commentID = $db->getField('comment_id');
        $featureRequestComments[$commentID] = array('CommentID' => $commentID, 'Message' => $db->getField('text'), 'Time' => date(DATE_FULL_SHORT, $db->getField('posting_time')), 'Anonymous' => $db->getBoolean('anonymous'));
        if ($featureModerator || !$db->getBoolean('anonymous')) {
            $featureRequestComments[$commentID]['PosterAccount'] =& SmrAccount::getAccount($db->getField('poster_id'));
        }
    }
    $template->assignByRef('FeatureRequests', $featureRequestComments);
}
$container = $var;
$container['url'] = 'feature_request_comment_processing.php';
unset($container['body']);
$template->assign('FeatureRequestCommentFormHREF', SmrSession::getNewHREF($container));
Esempio n. 14
0
<?php

$template->assign('PageTopic', 'Reply To Reported Messages');
$container = create_container('box_reply_processing.php');
transfer('game_id');
transfer('sender_id');
$template->assign('BoxReplyFormHref', SmrSession::getNewHREF($container));
$template->assignByRef('Sender', SmrPlayer::getPlayer($var['sender_id'], $var['game_id']));
$template->assignByRef('SenderAccount', SmrAccount::getAccount($var['sender_id']));
if (isset($var['Preview'])) {
    $template->assign('Preview', $var['Preview']);
}
if (isset($var['BanPoints'])) {
    $template->assign('BanPoints', $var['BanPoints']);
}
Esempio n. 15
0
 $banReasons = array();
 $db->query('SELECT * FROM closing_reason');
 while ($db->nextRecord()) {
     $reason = $db->getField('reason');
     if (strlen($reason) > 50) {
         $reason = substr($reason, 0, 75) . '...';
     }
     $banReasons[$db->getInt('reason_id')] = $reason;
 }
 $template->assign('BanReasons', $banReasons);
 $closingHistory = array();
 $db->query('SELECT * FROM account_has_closing_history WHERE account_id = ' . $db->escapeNumber($curr_account->getAccountID()) . ' ORDER BY time DESC');
 while ($db->nextRecord()) {
     // if an admin did it we get his/her name
     if ($admin_id > 0) {
         $admin = SmrAccount::getAccount($db->getInt('admin_id'))->getLogin();
     } else {
         $admin = 'System';
     }
     $closingHistory[] = array('Time' => $db->getInt('time'), 'Action' => $db->getField('action'), 'AdminName' => $admin);
 }
 $template->assign('ClosingHistory', $closingHistory);
 $db->query('SELECT * FROM account_exceptions WHERE account_id = ' . $curr_account->getAccountID());
 if ($db->nextRecord()) {
     $template->assign('Exception', $db->getField('reason'));
 }
 $recentIPs = array();
 $db->query('SELECT ip, time, host FROM account_has_ip WHERE account_id = ' . $db->escapeNumber($curr_account->getAccountID()) . ' ORDER BY time DESC');
 while ($db->nextRecord()) {
     $recentIPs[] = array('IP' => $db->getField('ip'), 'Time' => $db->getField('time'), 'Host' => $db->getField('host'));
 }
Esempio n. 16
0
    }
    $container['OffenderBanPoints'] = $_REQUEST['offenderBanPoints'];
    if (!empty($offendedReply)) {
        $container['PreviewOffended'] = $offendedReply;
    }
    $container['OffendedBanPoints'] = $_REQUEST['offendedBanPoints'];
    forward($container);
}
if (isset($offenderReply) && $offenderReply != '') {
    SmrPlayer::sendMessageFromAdmin($var['game_id'], $var['offender'], $offenderReply);
    //do we have points?
    if ($_REQUEST['offenderBanPoints']) {
        $suspicion = 'Inappropriate In-Game Message';
        $offenderAccount =& SmrAccount::getAccount($var['offender']);
        $offenderAccount->addPoints($_REQUEST['offenderBanPoints'], $account, 7, $suspicion);
    }
}
if (isset($_REQUEST['offendedReply'])) {
    $offendedReply = $_REQUEST['offendedReply'];
}
if (isset($offendedReply) && $offendedReply != '') {
    //next message
    SmrPlayer::sendMessageFromAdmin($var['game_id'], $var['offended'], $offendedReply);
    //do we have points?
    if ($_REQUEST['offendedBanPoints']) {
        $suspicion = 'Inappropriate In-Game Message';
        $offenderAccount =& SmrAccount::getAccount($var['offended']);
        $offenderAccount->addPoints($_REQUEST['offendedBanPoints'], $account, 7, $suspicion);
    }
}
forward(create_container('skeleton.php', 'notify_view.php'));
Esempio n. 17
0
    }
    $template->assign('Boxes', $boxes);
} else {
    $template->assign('BackHREF', SmrSession::getNewHREF(create_container('skeleton.php', 'box_view.php')));
    $db->query('SELECT * FROM message_boxes WHERE box_type_id=' . $db->escapeNumber($var['box_type_id']) . ' ORDER BY send_time DESC');
    $messages = array();
    if ($db->getNumRows()) {
        $container = create_container('box_delete_processing.php');
        $container['box_type_id'] = $var['box_type_id'];
        $template->assign('DeleteHREF', SmrSession::getNewHREF($container));
        while ($db->nextRecord()) {
            $gameID = $db->getInt('game_id');
            $validGame = $gameID > 0 && Globals::isValidGame($gameID);
            $messageID = $db->getInt('message_id');
            $messages[$messageID] = array('ID' => $messageID);
            $senderAccount =& SmrAccount::getAccount($db->getField('sender_id'));
            $senderName = $senderAccount->getLogin() . ' (' . $senderAccount->getAccountID() . ')';
            if ($validGame) {
                $senderPlayer =& SmrPlayer::getPlayer($senderAccount->getAccountID(), $gameID);
                if ($senderAccount->getLogin() != $senderPlayer->getPlayerName()) {
                    $senderName .= ' a.k.a ' . $senderPlayer->getPlayerName();
                }
                $container = create_container('skeleton.php', 'box_reply.php');
                $container['sender_id'] = $senderAccount->getAccountID();
                $container['game_id'] = $gameID;
                $messages[$messageID]['ReplyHREF'] = SmrSession::getNewHREF($container);
            }
            $messages[$messageID]['SenderName'] = $senderName;
            if (!$validGame) {
                $messages[$messageID]['GameName'] = 'Game no longer exists';
            } else {
Esempio n. 18
0
     if ($db2->getField(0) == 1) {
         //this is the ip search way
         $users = explode(',', $info);
         $PHP_OUTPUT .= '<td align=center>User IP was found to match ';
     } elseif ($db3->getField(0) == 1) {
         //this is the comp share way
         $users = explode('-', $info);
         $PHP_OUTPUT .= '<td align=center>User was found to share comp with ';
     } else {
         //the admin closed (Edit account_account way)
         $users = explode('+', $info);
         $PHP_OUTPUT .= '<td align=center>User was closed via Edit Account with ';
     }
     $size = sizeof($users);
     foreach ($users as $key => $value) {
         $curr_account =& SmrAccount::getAccount($value);
         if ($curr_account->getAccountID() != $id) {
             $PHP_OUTPUT .= $curr_account->getLogin();
             if ($key + 1 < $size) {
                 $PHP_OUTPUT .= ', ';
             }
         }
     }
     $PHP_OUTPUT .= '.</td>';
 } elseif ($method == 'Auto') {
     //closed by admin with multi tools
     $PHP_OUTPUT .= '<td align=center>Closed by Admin After viewing the accounts IPs</td>';
 } else {
     //method unsupported for lookup
     $db2->query('SELECT * FROM account_is_closed WHERE account_id = ' . $db->escapeNumber($id));
     if ($db2->nextRecord()) {
        $msg = 'Password is missing!';
        header('Location: ' . URL . '/error.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES)));
        exit;
    }
    $pass_verify = $_REQUEST['pass_verify'];
    if ($password != $pass_verify) {
        $msg = 'The passwords you entered do not match.';
        header('Location: ' . URL . '/error.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES)));
        exit;
    }
    // get this user from db
    $login = $_REQUEST['login'];
    if ($login == $password) {
        $msg = 'Your chosen password is invalid!';
        header('Location: ' . URL . '/error.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES)));
        exit;
    }
    // creates a new user account object
    $account =& SmrAccount::getAccountByName($login);
    $old_password = $_REQUEST['old_password'];
    //$passwordReset = $_REQUEST['password_reset'];
    if ($account == null || $account->checkPassword($old_password)) {
        // unknown user
        header('Location: ' . URL . '/error.php?msg=' . rawurlencode('User does not exist or your current password is wrong.'));
        exit;
    }
    $account->setPassword($password);
    header('Location: ' . URL . '/login.php');
} catch (Exception $e) {
    handleException($e);
}
Esempio n. 20
0
             } elseif (in_array($match_sec, $next_arr)) {
                 $stop = 'yes';
                 continue;
             } else {
                 $next_arr[] = $match_sec;
             }
         }
     } elseif ($isset == 'yes' && !$db2->nextRecord()) {
         $PHP_OUTPUT .= 'Data Error 2: ' . $match_sec . ' does not exist!<br />';
         $continue = '0';
     } else {
         $continue = '0';
     }
 } else {
     if (isset($match) && $match != '') {
         $curr_acc =& SmrAccount::getAccountByName($match);
         $id = $curr_acc->getAccountID();
     }
     $db2->query('SELECT * FROM account_is_closed WHERE account_id = ' . $db->escapeNumber($id));
     if ($db2->nextRecord()) {
         $match = $db2->getField('suspicion');
         if (in_array($match, $names)) {
             $continue = 'next';
         } else {
             $continue = 'TRUE';
             $names[] = $match;
             if ($match != $login_name) {
                 $PHP_OUTPUT .= $login_name . ' is disabled matching ' . $match . '<br />';
             }
         }
     } else {
Esempio n. 21
0
 $PHP_OUTPUT .= create_echo_form($container);
 $PHP_OUTPUT .= '<br />';
 $PHP_OUTPUT .= 'Click either name to reply<br />';
 $PHP_OUTPUT .= '<table width="100%" class="standard">';
 while ($db->nextRecord()) {
     $PHP_OUTPUT .= '<tr>';
     $notify_id = $db->getField('notify_id');
     $PHP_OUTPUT .= '<td><input type="checkbox" name="notify_id[]" value="' . $notify_id . '"></td>';
     $gameID = $db->getField('game_id');
     $sender =& getMessagePlayer($db->getField('from_id'), $gameID);
     $receiver =& getMessagePlayer($db->getField('to_id'), $gameID);
     if (is_object($sender)) {
         $sender_acc = SmrAccount::getAccount($db->getField('from_id'));
     }
     if (is_object($receiver)) {
         $receiver_acc = SmrAccount::getAccount($db->getField('to_id'));
     }
     $container = create_container('skeleton.php', 'notify_reply.php');
     $container['offender'] = $db->getField('from_id');
     $container['offended'] = $db->getField('to_id');
     $container['game_id'] = $gameID;
     $PHP_OUTPUT .= '<td class="noWrap">';
     $offender = 'From: ';
     if (is_object($sender)) {
         $offender .= $sender_acc->getLogin() . ' (' . $sender_acc->getAccountID() . ')';
         if ($sender_acc->getLogin() != $sender->getPlayerName()) {
             $offender .= ' a.k.a ' . $sender->getPlayerName();
         }
     } else {
         $offender .= $sender;
     }
Esempio n. 22
0
<?php

$account_id = $var['account_id'];
$curr_account =& SmrAccount::getAccount($account_id);
// request
$donation = $_REQUEST['donation'];
$smr_credit = $_REQUEST['smr_credit'];
$reopenType = $_REQUEST['reopen_type'];
$choise = $_REQUEST['choise'];
$reason_pre_select = $_REQUEST['reason_pre_select'];
$reason_msg = $_REQUEST['reason_msg'];
$veteran_status = $_REQUEST['veteran_status'] == 'TRUE';
$logging_status = $_REQUEST['logging_status'] == 'TRUE';
$except = $_REQUEST['exception_add'];
$names = $_REQUEST['player_name'];
$points = intval($_REQUEST['points']);
$mailBan = intval($_REQUEST['mailban']);
$delete = $_REQUEST['delete'];
$msg = 'You ';
if (!empty($donation)) {
    // add entry to account donated table
    $db->query('INSERT INTO account_donated (account_id, time, amount) VALUES (' . $db->escapeNumber($account_id) . ', ' . $db->escapeNumber(TIME) . ' , ' . $db->escapeNumber($donation) . ')');
    // add the credits to the players account - if requested
    if (!empty($smr_credit)) {
        $curr_account->increaseSmrCredits($donation * CREDITS_PER_DOLLAR);
    }
    $msg .= 'added $' . $donation;
}
if (!empty($_REQUEST['grant_credits']) && is_numeric($_REQUEST['grant_credits'])) {
    $curr_account->increaseSmrRewardCredits($_REQUEST['grant_credits']);
    if (strlen($msg) > 9) {
Esempio n. 23
0
<?php

$template->assign('PageTopic', 'Reply To Reported Messages');
require_once get_file_loc('message.functions.inc');
$container = create_container('notify_reply_processing.php');
transfer('game_id');
transfer('offended');
transfer('offender');
$template->assign('NotifyReplyFormHref', SmrSession::getNewHREF($container));
$offender =& getMessagePlayer($var['offender'], $var['game_id']);
$offended =& getMessagePlayer($var['offended'], $var['game_id']);
if (is_object($offender)) {
    $template->assignByRef('OffenderAccount', SmrAccount::getAccount($var['offender']));
}
if (is_object($offended)) {
    $template->assignByRef('OffendedAccount', SmrAccount::getAccount($var['offended']));
}
$template->assignByRef('Offender', $offender);
$template->assignByRef('Offended', $offended);
if (isset($var['PreviewOffender'])) {
    $template->assign('PreviewOffender', $var['PreviewOffender']);
}
if (isset($var['OffenderBanPoints'])) {
    $template->assign('OffenderBanPoints', $var['OffenderBanPoints']);
}
if (isset($var['PreviewOffended'])) {
    $template->assign('PreviewOffended', $var['PreviewOffended']);
}
if (isset($var['OffendedBanPoints'])) {
    $template->assign('OffendedBanPoints', $var['OffendedBanPoints']);
}
Esempio n. 24
0
    }
}
$db->query('SELECT * ' . 'FROM feature_request ' . 'JOIN feature_request_comments super USING(feature_request_id) ' . 'WHERE comment_id = 1 ' . 'AND status = ' . $db->escapeString($var['Status']) . ($showCurrent ? ' AND EXISTS(SELECT posting_time FROM feature_request_comments WHERE feature_request_id = super.feature_request_id AND posting_time > ' . (TIME - 14 * 86400) . ')' : '') . ' ORDER BY (SELECT MAX(posting_time) FROM feature_request_comments WHERE feature_request_id = super.feature_request_id) DESC');
if ($db->getNumRows() > 0) {
    $featureModerator = $account->hasPermission(PERMISSION_MODERATE_FEATURE_REQUEST);
    $template->assign('FeatureModerator', $featureModerator);
    $template->assign('FeatureRequestVoteFormHREF', SmrSession::getNewHREF(create_container('feature_request_vote_processing.php', '')));
    $commentsContainer = $var;
    $commentsContainer['body'] = 'feature_request_comments.php';
    $db2 = new SmrMySqlDatabase();
    $featureRequests = array();
    while ($db->nextRecord()) {
        $featureRequestID = $db->getInt('feature_request_id');
        $featureRequests[$featureRequestID] = array('RequestID' => $featureRequestID, 'Message' => $db->getField('text'), 'Votes' => array('FAVOURITE' => $db->getInt('fav'), 'YES' => $db->getInt('yes'), 'NO' => $db->getInt('no')), 'VotedFor' => isset($featureVotes[$featureRequestID]) ? $featureVotes[$featureRequestID] : false);
        if ($featureModerator) {
            $featureRequests[$featureRequestID]['RequestAccount'] =& SmrAccount::getAccount($db->getInt('poster_id'));
        }
        if ($var['Status'] == 'Opened') {
            $db2->query('SELECT COUNT(*), vote_type
						FROM account_votes_for_feature
						WHERE feature_request_id=' . $db2->escapeNumber($featureRequestID) . '
						GROUP BY vote_type');
            while ($db2->nextRecord()) {
                $featureRequests[$featureRequestID]['Votes'][$db2->getField('vote_type')] = $db2->getInt('COUNT(*)');
            }
        }
        $db2->query('SELECT COUNT(*)
					FROM feature_request_comments
					WHERE feature_request_id=' . $db2->escapeNumber($featureRequestID));
        while ($db2->nextRecord()) {
            $featureRequests[$featureRequestID]['Comments'] = $db2->getInt('COUNT(*)');
Esempio n. 25
0
<?php

$message = trim($_REQUEST['message']);
if ($_REQUEST['action'] == 'Preview message') {
    $container = create_container('skeleton.php', 'box_reply.php');
    $container['BanPoints'] = $_REQUEST['BanPoints'];
    transfer('game_id');
    transfer('sender_id');
    $container['Preview'] = $message;
    forward($container);
}
if (!empty($message)) {
    SmrPlayer::sendMessageFromAdmin($var['game_id'], $var['sender_id'], $_REQUEST['message']);
    //do we have points?
    if ($_REQUEST['BanPoints']) {
        $suspicion = 'Inappropriate Actions';
        $senderAccount =& SmrAccount::getAccount($var['sender_id']);
        $senderAccount->addPoints($_REQUEST['BanPoints'], $account, 7, $suspicion);
    }
}
forward(create_container('skeleton.php', 'box_view.php'));
Esempio n. 26
0
     foreach ($newer_ip as $db_ip) {
         $ip_numbers[] = $db_ip;
         $account_numbers[] = $acc_id;
     }
 }
 foreach ($ip_numbers as $something) {
     $amount += 1;
 }
 reset($ip_numbers);
 array_multisort($ip_numbers, $account_numbers);
 $i = 0;
 while ($i < $amount) {
     $account_wanted = array_shift($account_numbers);
     $ip_wanted = array_shift($ip_numbers);
     $new_acc =& SmrAccount::getAccount($account_wanted);
     $last_acc =& SmrAccount::getAccount($last_acc_id);
     $db2->query('SELECT * FROM account_is_closed WHERE account_id = ' . $db2->escapeNumber($acc_id));
     if ($db2->getNumRows() && $db_ip != $last_ip) {
         continue;
     }
     $PHP_OUTPUT .= '<tr>';
     $PHP_OUTPUT .= '<td align=center>' . $new_acc->getLogin() . ' (' . $new_acc->getAccountID() . ')</td>';
     $PHP_OUTPUT .= '<td align=center>' . $ip_wanted . '</td>';
     if ($ip_wanted == $last_ip && !$db2->nextRecord()) {
         $PHP_OUTPUT .= '<td align=center><span class="red">MATCH w/ ' . $last_acc->getLogin() . '</span></td>';
     } elseif ($ip_wanted == $last_ip) {
         $PHP_OUTPUT .= '<td align=center><span class="red">(Already disabled) MATCH w/ ' . $last_acc->getLogin() . '</span></td>';
     } else {
         $PHP_OUTPUT .= '<td align=center>&nbsp;</td>';
     }
     $PHP_OUTPUT .= '<td><input type="checkbox" name="account_id[]" value="' . $new_acc->getAccountID() . '"></td>';
Esempio n. 27
0
<?php

$account_id = $_REQUEST['account_id'];
$exception = $_REQUEST['exception'];
if (!is_array($account_id)) {
    create_error('Please check the boxes next to the names you wish to open.');
}
$action = $_REQUEST['action'];
if ($action == 'Reopen and add to exceptions') {
    foreach ($account_id as $id) {
        $curr_exception = $exception[$id];
        $bannedAccount =& SmrAccount::getAccount($id);
        $bannedAccount->unbanAccount($account, $curr_exception);
    }
} else {
    foreach ($account_id as $id) {
        $bannedAccount =& SmrAccount::getAccount($id);
        $bannedAccount->unbanAccount($account);
    }
}
forward(create_container('skeleton.php', 'admin_tools.php'));
 //Check the captcha if it's a standard registration.
 if (!$socialLogin && strlen(RECAPTCHA_PRIVATE) > 0) {
     require_once LIB . 'External/recaptcha/recaptchalib.php';
     $resp = recaptcha_check_answer(RECAPTCHA_PRIVATE, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
     if (!$resp->is_valid) {
         $msg = 'Invalid captcha!';
         header('Location: ' . URL . '/error.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES)));
         exit;
     }
 }
 $icq = $_REQUEST['icq'];
 // create account
 $timez = $_REQUEST['timez'];
 // creates a new user account object
 try {
     $account =& SmrAccount::createAccount($login, $password, $email, $first_name, $last_name, $address, $city, $postal_code, $country_code, $icq, $timez, $referral);
 } catch (Exception $e) {
     $msg = 'Invalid referral id!';
     header('Location: ' . URL . '/error.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES)));
     exit;
 }
 $account->increaseSmrRewardCredits(2 * CREDITS_PER_DOLLAR);
 // Give $2 worth of "reward" credits for joining.
 if ($socialLogin) {
     $account->addAuthMethod($_SESSION['socialLogin']->getLoginType(), $_SESSION['socialLogin']->getUserID());
     $account->setValidated(true);
     session_destroy();
 }
 // register session
 SmrSession::$account_id = $account->getAccountID();
 // save ip
Esempio n. 29
0
<?php

try {
    // includes
    require_once 'config.inc';
    require_once ENGINE . 'Default/smr.inc';
    require_once LIB . 'Default/SmrMySqlDatabase.class.inc';
    require_once get_file_loc('SmrAccount.class.inc');
    require_once get_file_loc('SmrSession.class.inc');
    $db = new SmrMySqlDatabase();
    if (SmrSession::$account_id > 0) {
        $account =& SmrAccount::getAccount(SmrSession::$account_id);
        $disabled = $account->isDisabled();
        if ($disabled !== false) {
            $reason = $disabled['Reason'];
            if ($disabled['Time'] > 0) {
                $reason .= '  Your account is set to reopen on ' . date(DEFAULT_DATE_FULL_LONG, $disabled['Time']) . '.';
            } else {
                $reason .= '  Your account is set to never reopen.  If you believe this is wrong contact an admin.';
            }
        }
        //	SmrSession::destroy();
    } else {
        if (USE_COMPATIBILITY && SmrSession::$old_account_id > 0) {
            foreach (Globals::getCompatibilityDatabases('Game') as $databaseClassName => $gameType) {
                require_once get_file_loc($databaseClassName . '.class.inc');
                $db = new $databaseClassName();
                $db->query('SELECT * FROM account_is_closed JOIN closing_reason USING(reason_id) WHERE account_id = ' . $db->escapeNumber(SmrSession::$old_account_id));
                if ($db->nextRecord()) {
                    $time = $db->getField('expires');
                    $reason = $db->getField('reason');
$action = $_REQUEST['action'];
if ($action == 'End >>') {
    $container = create_container('skeleton.php', 'universe_create_end.php');
    $container['game_id'] = $var['game_id'];
    forward($container);
}
// check if no account was selected
if ($_POST['admin_id'] == 0) {
    create_error('No Account selected!');
}
if (empty($_POST['player_name'])) {
    create_error('You must select a name for that player!');
}
// create an account object from the guy
$admin_account =& SmrAccount::getAccount($_POST['admin_id']);
// check if hof entry is there
$db->query('SELECT * FROM account_has_stats WHERE account_id = ' . $admin_account->getAccountID());
if (!$db->getNumRows()) {
    $db->query('INSERT INTO account_has_stats (account_id, HoF_name) VALUES (' . $admin_account->getAccountID() . ', ' . $db->escape_string($admin_account->getLogin(), true) . ')');
}
// give game stats entry
$db->query('INSERT INTO player_has_stats (account_id, game_id) VALUES (' . $admin_account->getAccountID() . ', ' . $var['game_id'] . ')');
// put him in a sector with a hq
$hq_id = $_POST['race_id'] + 101;
$db->query('SELECT * FROM location JOIN sector USING(game_id, sector_id) ' . 'WHERE game_id = ' . $var['game_id'] . ' AND ' . 'location_type_id = ' . $hq_id);
if ($db->nextRecord()) {
    $home_sector_id = $db->getField('sector_id');
} else {
    $home_sector_id = 1;
}