本文整理汇总了PHP中Universe::current方法的典型用法代码示例。如果您正苦于以下问题:PHP Universe::current方法的具体用法?PHP Universe::current怎么用?PHP Universe::current使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Universe
的用法示例。
在下文中一共展示了Universe::current方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
function show()
{
global $USER, $LNG;
$order = HTTP::_GP('order', 'units');
$sort = HTTP::_GP('sort', 'desc');
$sort = strtoupper($sort) === "DESC" ? "DESC" : "ASC";
switch ($order) {
case 'date':
$key = '%%TOPKB%%.time ' . $sort;
break;
case 'units':
default:
$key = '%%TOPKB%%.units ' . $sort;
break;
}
$db = Database::get();
$sql = "SELECT *, (\n\t\t\tSELECT DISTINCT\n\t\t\tIF(%%TOPKB_USERS%%.username = '', GROUP_CONCAT(%%USERS%%.username SEPARATOR ' & '), GROUP_CONCAT(%%TOPKB_USERS%%.username SEPARATOR ' & '))\n\t\t\tFROM %%TOPKB_USERS%%\n\t\t\tLEFT JOIN %%USERS%% ON uid = %%USERS%%.id\n\t\t\tWHERE %%TOPKB_USERS%%.rid = %%TOPKB%%.rid AND role = 1\n\t\t) as attacker,\n\t\t(\n\t\t\tSELECT DISTINCT\n\t\t\tIF(%%TOPKB_USERS%%.username = '', GROUP_CONCAT(%%USERS%%.username SEPARATOR ' & '), GROUP_CONCAT(%%TOPKB_USERS%%.username SEPARATOR ' & '))\n\t\t\tFROM %%TOPKB_USERS%% INNER JOIN %%USERS%% ON uid = id\n\t\t\tWHERE %%TOPKB_USERS%%.rid = %%TOPKB%%.`rid` AND `role` = 2\n\t\t) as defender\n\t\tFROM %%TOPKB%% WHERE universe = :universe ORDER BY " . $key . " LIMIT 100;";
$top = $db->select($sql, array(':universe' => Universe::current()));
$TopKBList = array();
foreach ($top as $data) {
$TopKBList[] = array('result' => $data['result'], 'date' => _date($LNG['php_tdformat'], $data['time'], $USER['timezone']), 'time' => TIMESTAMP - $data['time'], 'units' => $data['units'], 'rid' => $data['rid'], 'attacker' => $data['attacker'], 'defender' => $data['defender']);
}
$this->assign(array('TopKBList' => $TopKBList, 'sort' => $sort, 'order' => $order));
$this->display('page.battleHall.default.tpl');
}
示例2: show
public function show()
{
global $USER, $PLANET, $LNG;
$this->tplObj->loadscript('flotten.js');
$targetGalaxy = HTTP::_GP('galaxy', 0);
$targetSystem = HTTP::_GP('system', 0);
$targetPlanet = HTTP::_GP('planet', 0);
$targetType = HTTP::_GP('type', 0);
$targetMission = HTTP::_GP('target_mission', 0);
$fleetSpeed = HTTP::_GP('speed', 0);
$fleetGroup = HTTP::_GP('fleet_group', 0);
$token = HTTP::_GP('token', '');
if (!isset($_SESSION['fleet'][$token])) {
FleetFunctions::GotoFleetPage();
}
$fleetArray = $_SESSION['fleet'][$token]['fleet'];
$db = Database::get();
$sql = "SELECT id, id_owner, der_metal, der_crystal FROM %%PLANETS%% WHERE universe = :universe AND galaxy = :targetGalaxy AND system = :targetSystem AND planet = :targetPlanet AND planet_type = '1';";
$targetPlanetData = $db->selectSingle($sql, array(':universe' => Universe::current(), ':targetGalaxy' => $targetGalaxy, ':targetSystem' => $targetSystem, ':targetPlanet' => $targetPlanet));
if ($targetType == 2 && $targetPlanetData['der_metal'] == 0 && $targetPlanetData['der_crystal'] == 0) {
$this->printMessage($LNG['fl_error_empty_derbis'], array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=fleet1')));
}
$MisInfo = array();
$MisInfo['galaxy'] = $targetGalaxy;
$MisInfo['system'] = $targetSystem;
$MisInfo['planet'] = $targetPlanet;
$MisInfo['planettype'] = $targetType;
$MisInfo['IsAKS'] = $fleetGroup;
$MisInfo['Ship'] = $fleetArray;
$MissionOutput = FleetFunctions::GetFleetMissions($USER, $MisInfo, $targetPlanetData);
if (empty($MissionOutput['MissionSelector'])) {
$this->printMessage($LNG['fl_empty_target'], array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=fleet1')));
}
$GameSpeedFactor = FleetFunctions::GetGameSpeedFactor();
$MaxFleetSpeed = FleetFunctions::GetFleetMaxSpeed($fleetArray, $USER);
$distance = FleetFunctions::GetTargetDistance(array($PLANET['galaxy'], $PLANET['system'], $PLANET['planet']), array($targetGalaxy, $targetSystem, $targetPlanet));
$duration = FleetFunctions::GetMissionDuration($fleetSpeed, $MaxFleetSpeed, $distance, $GameSpeedFactor, $USER);
$consumption = FleetFunctions::GetFleetConsumption($fleetArray, $duration, $distance, $USER, $GameSpeedFactor);
if ($consumption > $PLANET['deuterium']) {
$this->printMessage($LNG['fl_not_enough_deuterium'], array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=fleetTable')));
}
if (!FleetFunctions::CheckUserSpeed($fleetSpeed)) {
FleetFunctions::GotoFleetPage(0);
}
$_SESSION['fleet'][$token]['speed'] = $MaxFleetSpeed;
$_SESSION['fleet'][$token]['distance'] = $distance;
$_SESSION['fleet'][$token]['targetGalaxy'] = $targetGalaxy;
$_SESSION['fleet'][$token]['targetSystem'] = $targetSystem;
$_SESSION['fleet'][$token]['targetPlanet'] = $targetPlanet;
$_SESSION['fleet'][$token]['targetType'] = $targetType;
$_SESSION['fleet'][$token]['fleetGroup'] = $fleetGroup;
$_SESSION['fleet'][$token]['fleetSpeed'] = $fleetSpeed;
if (!empty($fleet_group)) {
$targetMission = 2;
}
$fleetData = array('fleetroom' => floatToString($_SESSION['fleet'][$token]['fleetRoom']), 'consumption' => floatToString($consumption));
$this->tplObj->execscript('calculateTransportCapacity();');
$this->assign(array('fleetdata' => $fleetData, 'consumption' => floatToString($consumption), 'mission' => $targetMission, 'galaxy' => $PLANET['galaxy'], 'system' => $PLANET['system'], 'planet' => $PLANET['planet'], 'type' => $PLANET['planet_type'], 'MissionSelector' => $MissionOutput['MissionSelector'], 'StaySelector' => $MissionOutput['StayBlock'], 'fl_dm_alert_message' => sprintf($LNG['fl_dm_alert_message'], $LNG['type_mission'][11], $LNG['tech'][921]), 'fl_continue' => $LNG['fl_continue'], 'token' => $token));
$this->display('page.fleetStep2.default.tpl');
}
示例3: show
function show()
{
if (empty($_POST)) {
HTTP::redirectTo('index.php');
}
$db = Database::get();
$username = HTTP::_GP('username', '', UTF8_SUPPORT);
$password = HTTP::_GP('password', '', true);
$sql = "SELECT id, password FROM %%USERS%% WHERE universe = :universe AND username = :username;";
$loginData = $db->selectSingle($sql, array(':universe' => Universe::current(), ':username' => $username));
if (isset($loginData)) {
$hashedPassword = PlayerUtil::cryptPassword($password);
if ($loginData['password'] != $hashedPassword) {
// Fallback pre 1.7
if ($loginData['password'] == md5($password)) {
$sql = "UPDATE %%USERS%% SET password = :hashedPassword WHERE id = :loginID;";
$db->update($sql, array(':hashedPassword' => $hashedPassword, ':loginID' => $loginData['id']));
} else {
HTTP::redirectTo('index.php?code=1');
}
}
$session = Session::create();
$session->userId = (int) $loginData['id'];
$session->adminAccess = 0;
$session->save();
HTTP::redirectTo('game.php');
} else {
HTTP::redirectTo('index.php?code=1');
}
}
示例4: show
function show()
{
global $PLANET, $LNG, $resource;
$this->initTemplate();
$this->setWindow('popup');
$this->tplObj->loadscript('phalanx.js');
$Galaxy = HTTP::_GP('galaxy', 0);
$System = HTTP::_GP('system', 0);
$Planet = HTTP::_GP('planet', 0);
if (!$this->allowPhalanx($Galaxy, $System)) {
$this->printMessage($LNG['px_out_of_range']);
}
if ($PLANET[$resource[903]] < PHALANX_DEUTERIUM) {
$this->printMessage($LNG['px_no_deuterium']);
}
$db = Database::get();
$sql = "UPDATE %%PLANETS%% SET deuterium = deuterium - :phalanxDeuterium WHERE id = :planetID;";
$db->update($sql, array(':phalanxDeuterium' => PHALANX_DEUTERIUM, ':planetID' => $PLANET['id']));
$sql = "SELECT id, name, id_owner FROM %%PLANETS%% WHERE universe = :universe\n\t\tAND galaxy = :galaxy AND system = :system AND planet = :planet AND :type;";
$TargetInfo = $db->selectSingle($sql, array(':universe' => Universe::current(), ':galaxy' => $Galaxy, ':system' => $System, ':planet' => $Planet, ':type' => 1));
if (empty($TargetInfo)) {
$this->printMessage($LNG['px_out_of_range']);
}
require 'includes/classes/class.FlyingFleetsTable.php';
$fleetTableObj = new FlyingFleetsTable();
$fleetTableObj->setPhalanxMode();
$fleetTableObj->setUser($TargetInfo['id_owner']);
$fleetTableObj->setPlanet($TargetInfo['id']);
$fleetTable = $fleetTableObj->renderTable();
$this->assign(array('galaxy' => $Galaxy, 'system' => $System, 'planet' => $Planet, 'name' => $TargetInfo['name'], 'fleetTable' => $fleetTable));
$this->display('page.phalanx.default.tpl');
}
示例5: send
function send()
{
global $USER, $LNG;
$this->initTemplate();
$this->setWindow('popup');
$this->tplObj->execscript('window.setTimeout(parent.$.fancybox.close, 2000);');
$id = HTTP::_GP('id', 0);
$text = HTTP::_GP('text', '', UTF8_SUPPORT);
if ($id == $USER['id']) {
$this->printMessage($LNG['bu_cannot_request_yourself']);
}
$db = Database::get();
$sql = "SELECT COUNT(*) as count FROM %%BUDDY%% WHERE (sender = :userID AND owner = :friendID) OR (owner = :userID AND sender = :friendID);";
$exists = $db->selectSingle($sql, array(':userID' => $USER['id'], ':friendID' => $id), 'count');
if ($exists != 0) {
$this->printMessage($LNG['bu_request_exists']);
}
$sql = "INSERT INTO %%BUDDY%% SET sender = :userID,\towner = :friendID, universe = :universe;";
$db->insert($sql, array(':userID' => $USER['id'], ':friendID' => $id, ':universe' => Universe::current()));
$buddyID = $db->lastInsertId();
$sql = "INSERT INTO %%BUDDY_REQUEST%% SET id = :buddyID, text = :text;";
$db->insert($sql, array(':buddyID' => $buddyID, ':text' => $text));
$sql = "SELECT username FROM %%USERS%% WHERE id = :friendID;";
$username = $db->selectSingle($sql, array(':friendID' => $id), 'username');
PlayerUtil::sendMessage($id, $USER['id'], $USER['username'], 4, $LNG['bu_new_request_title'], sprintf($LNG['bu_new_request_body'], $username, $USER['username']), TIMESTAMP);
$this->printMessage($LNG['bu_request_send']);
}
示例6: show
function show()
{
global $USER, $LNG, $reslist;
$db = Database::get();
$sql = "SELECT elementID, level, userID, username\n\t\tFROM %%USERS%%\n\t\tINNER JOIN %%RECORDS%% ON userID = id\n\t\tWHERE universe = :universe;";
$recordResult = $db->select($sql, array(':universe' => Universe::current()));
$defenseList = array_fill_keys($reslist['defense'], array());
$fleetList = array_fill_keys($reslist['fleet'], array());
$researchList = array_fill_keys($reslist['tech'], array());
$buildList = array_fill_keys($reslist['build'], array());
foreach ($recordResult as $recordRow) {
if (in_array($recordRow['elementID'], $reslist['defense'])) {
$defenseList[$recordRow['elementID']][] = $recordRow;
} elseif (in_array($recordRow['elementID'], $reslist['fleet'])) {
$fleetList[$recordRow['elementID']][] = $recordRow;
} elseif (in_array($recordRow['elementID'], $reslist['tech'])) {
$researchList[$recordRow['elementID']][] = $recordRow;
} elseif (in_array($recordRow['elementID'], $reslist['build'])) {
$buildList[$recordRow['elementID']][] = $recordRow;
}
}
require_once 'includes/classes/Cronjob.class.php';
$this->assign(array('defenseList' => $defenseList, 'fleetList' => $fleetList, 'researchList' => $researchList, 'buildList' => $buildList, 'update' => _date($LNG['php_tdformat'], Cronjob::getLastExecutionTime('statistic'), $USER['timezone'])));
$this->display('page.records.default.tpl');
}
示例7: getLoginData
public function getLoginData()
{
$uid = $this->getAccount();
$sql = 'SELECT user.id, id_planet
FROM %%USERS_AUTH%% auth
INNER JOIN %%USERS%% user ON auth.id = user.id AND user.universe = :universe
WHERE auth.account = :accountId AND mode = :mode;';
return Database::get()->selectSingle($sql, array(':mode' => 'facebook', ':accountId' => $uid, ':universe' => Universe::current()));
}
示例8: createTicket
public function createTicket($ownerID, $categoryID, $subject)
{
$sql = 'INSERT INTO %%TICKETS%% SET
ownerID = :ownerId,
universe = :universe,
categoryID = :categoryId,
subject = :subject,
time = :time;';
Database::get()->insert($sql, array(':ownerId' => $ownerID, ':universe' => Universe::current(), ':categoryId' => $categoryID, ':subject' => $subject, ':time' => TIMESTAMP));
return Database::get()->lastInsertId();
}
示例9: get
/**
* Return an config object for the requested universe
*
* @param int $universe Universe ID
*
* @return Config
*/
public static function get($universe = 0)
{
if (empty(self::$instances)) {
self::generateInstances();
}
if ($universe === 0) {
$universe = Universe::current();
}
if (!isset(self::$instances[$universe])) {
throw new Exception("Unknown universe id: " . $universe);
}
return self::$instances[$universe];
}
示例10: show
function show()
{
global $LNG;
$db = Database::get();
$sql = "SELECT *, (\n\t\t\tSELECT DISTINCT\n\t\t\tIF(%%TOPKB_USERS%%.username = '', GROUP_CONCAT(%%USERS%%.username SEPARATOR ' & '), GROUP_CONCAT(%%TOPKB_USERS%%.username SEPARATOR ' & '))\n\t\t\tFROM %%TOPKB_USERS%%\n\t\t\tLEFT JOIN %%USERS%% ON uid = %%USERS%%.id\n\t\t\tWHERE %%TOPKB_USERS%%.`rid` = %%TOPKB%%.`rid` AND `role` = 1\n\t\t) as `attacker`,\n\t\t(\n\t\t\tSELECT DISTINCT\n\t\t\tIF(%%TOPKB_USERS%%.username = '', GROUP_CONCAT(%%USERS%%.username SEPARATOR ' & '), GROUP_CONCAT(%%TOPKB_USERS%%.username SEPARATOR ' & '))\n\t\t\tFROM %%TOPKB_USERS%% INNER JOIN %%USERS%% ON uid = id\n\t\t\tWHERE %%TOPKB_USERS%%.`rid` = %%TOPKB%%.`rid` AND `role` = 2\n\t\t) as `defender`\n\t\tFROM %%TOPKB%% WHERE `universe` = :universe ORDER BY units DESC LIMIT 100;";
$hallRaw = $db->select($sql, array(':universe' => Universe::current()));
$hallList = array();
foreach ($hallRaw as $hallRow) {
$hallList[] = array('result' => $hallRow['result'], 'time' => _date($LNG['php_tdformat'], $hallRow['time']), 'units' => $hallRow['units'], 'rid' => $hallRow['rid'], 'attacker' => $hallRow['attacker'], 'defender' => $hallRow['defender']);
}
$universeSelect = $this->getUniverseSelector();
$this->assign(array('universeSelect' => $universeSelect, 'hallList' => $hallList));
$this->display('page.battleHall.default.tpl');
}
示例11: send
function send()
{
global $LNG;
$username = HTTP::_GP('username', '', UTF8_SUPPORT);
$mail = HTTP::_GP('mail', '', true);
$errorMessages = array();
if (empty($username)) {
$errorMessages[] = $LNG['passwordUsernameEmpty'];
}
if (empty($mail)) {
$errorMessages[] = $LNG['passwordErrorMailEmpty'];
}
$config = Config::get();
if ($config->capaktiv == 1) {
require_once 'includes/libs/reCAPTCHA/recaptchalib.php';
$recaptcha_challenge_field = HTTP::_GP('recaptcha_challenge_field', '');
$recaptcha_response_field = HTTP::_GP('recaptcha_response_field', '');
$resp = recaptcha_check_answer($config->capprivate, Session::getClientIp(), $recaptcha_challenge_field, $recaptcha_response_field);
if (!$resp->is_valid) {
$errorMessages[] = $LNG['registerErrorCaptcha'];
}
}
if (!empty($errorMessages)) {
$message = implode("<br>\r\n", $errorMessages);
$this->printMessage($message, array(array('label' => $LNG['passwordBack'], 'url' => 'index.php?page=lostPassword')));
}
$db = Database::get();
$sql = "SELECT id FROM %%USERS%% WHERE universe = :universe AND username = :username AND email_2 = :mail;";
$userID = $db->selectSingle($sql, array(':universe' => Universe::current(), ':username' => $username, ':mail' => $mail), 'id');
if (empty($userID)) {
$this->printMessage($LNG['passwordErrorUnknown'], array(array('label' => $LNG['passwordBack'], 'url' => 'index.php?page=lostPassword')));
}
$sql = "SELECT COUNT(*) as state FROM %%LOSTPASSWORD%% WHERE userID = :userID AND time > :time AND hasChanged = 0;";
$hasChanged = $db->selectSingle($sql, array(':userID' => $userID, ':time' => TIMESTAMP - 86400), 'state');
if (!empty($hasChanged)) {
$this->printMessage($LNG['passwordErrorOnePerDay'], array(array('label' => $LNG['passwordBack'], 'url' => 'index.php?page=lostPassword')));
}
$validationKey = md5(uniqid());
$MailRAW = $LNG->getTemplate('email_lost_password_validation');
$MailContent = str_replace(array('{USERNAME}', '{GAMENAME}', '{VALIDURL}'), array($username, $config->game_name . ' - ' . $config->uni_name, HTTP_PATH . 'index.php?page=lostPassword&mode=newPassword&u=' . $userID . '&k=' . $validationKey), $MailRAW);
require 'includes/classes/Mail.class.php';
$subject = sprintf($LNG['passwordValidMailTitle'], $config->game_name);
Mail::send($mail, $username, $subject, $MailContent);
$sql = "INSERT INTO %%LOSTPASSWORD%% SET userID = :userID, `key` = :validationKey, `time` = :timestamp, fromIP = :remoteAddr;";
$db->insert($sql, array(':userID' => $userID, ':timestamp' => TIMESTAMP, ':validationKey' => $validationKey, ':remoteAddr' => Session::getClientIp()));
$this->printMessage($LNG['passwordValidMailSend'], array(array('label' => $LNG['passwordNext'], 'url' => 'index.php')));
}
示例12: show
function show()
{
global $USER, $LNG;
$page = HTTP::_GP('side', 1);
$db = Database::get();
$sql = "SELECT COUNT(*) as count FROM %%BANNED%% WHERE universe = :universe ORDER BY time DESC;";
$banCount = $db->selectSingle($sql, array(':universe' => Universe::current()), 'count');
$maxPage = ceil($banCount / BANNED_USERS_PER_PAGE);
$page = max(1, min($page, $maxPage));
$sql = "SELECT * FROM %%BANNED%% WHERE universe = :universe ORDER BY time DESC LIMIT :offset, :limit;";
$banResult = $db->select($sql, array(':universe' => Universe::current(), ':offset' => ($page - 1) * BANNED_USERS_PER_PAGE, ':limit' => BANNED_USERS_PER_PAGE));
$banList = array();
foreach ($banResult as $banRow) {
$banList[] = array('player' => $banRow['who'], 'theme' => $banRow['theme'], 'from' => _date($LNG['php_tdformat'], $banRow['time'], $USER['timezone']), 'to' => _date($LNG['php_tdformat'], $banRow['longer'], $USER['timezone']), 'admin' => $banRow['author'], 'mail' => $banRow['email'], 'info' => sprintf($LNG['bn_writemail'], $banRow['author']));
}
$this->assign(array('banList' => $banList, 'banCount' => $banCount, 'page' => $page, 'maxPage' => $maxPage));
$this->display('page.banList.default.tpl');
}
示例13: insert
public function insert()
{
global $LNG, $USER;
$priority = HTTP::_GP('priority', 1);
$title = HTTP::_GP('title', '', true);
$text = HTTP::_GP('text', '', true);
$id = HTTP::_GP('id', 0);
$title = !empty($title) ? $title : $LNG['nt_no_title'];
$text = !empty($text) ? $text : $LNG['nt_no_text'];
$db = Database::get();
if ($id == 0) {
$sql = "INSERT INTO %%NOTES%% SET owner = :userID, time = :time, priority = :priority, title = :title, text = :text, universe = :universe;";
$db->insert($sql, array(':userID' => $USER['id'], ':time' => TIMESTAMP, ':priority' => $priority, ':title' => $title, ':text' => $text, ':universe' => Universe::current()));
} else {
$sql = "UPDATE %%NOTES%% SET time = :time, priority = :priority, title = :title, text = :text WHERE id = :noteID;";
$db->update($sql, array(':noteID' => $id, ':time' => TIMESTAMP, ':priority' => $priority, ':title' => $title, ':text' => $text));
}
$this->redirectTo('game.php?page=notes');
}
示例14: getGalaxyData
public function getGalaxyData()
{
global $USER;
$sql = 'SELECT SQL_BIG_RESULT DISTINCT
p.galaxy, p.system, p.planet, p.id, p.id_owner, p.name, p.image, p.last_update, p.diameter, p.temp_min, p.destruyed, p.der_metal, p.der_crystal, p.id_luna,
u.id as userid, u.ally_id, u.username, u.onlinetime, u.urlaubs_modus, u.banaday,
m.id as m_id, m.diameter as m_diameter, m.name as m_name, m.temp_min as m_temp_min, m.last_update as m_last_update,
s.total_points, s.total_rank,
a.id as allyid, a.ally_tag, a.ally_web, a.ally_members, a.ally_name,
allys.total_rank as ally_rank,
COUNT(buddy.id) as buddy,
d.level as diploLevel
FROM %%PLANETS%% p
LEFT JOIN %%USERS%% u ON p.id_owner = u.id
LEFT JOIN %%PLANETS%% m ON m.id = p.id_luna
LEFT JOIN %%STATPOINTS%% s ON s.id_owner = u.id AND s.stat_type = :statTypeUser
LEFT JOIN %%ALLIANCE%% a ON a.id = u.ally_id
LEFT JOIN %%DIPLO%% as d ON (d.owner_1 = :allianceId AND d.owner_2 = a.id) OR (d.owner_1 = a.id AND d.owner_2 = :allianceId) AND d.accept = :accept
LEFT JOIN %%STATPOINTS%% allys ON allys.stat_type = :statTypeAlliance AND allys.id_owner = a.id
LEFT JOIN %%BUDDY%% buddy ON (buddy.sender = :userId AND buddy.owner = u.id) OR (buddy.sender = u.id AND buddy.owner = :userId)
WHERE p.universe = :universe AND p.galaxy = :galaxy AND p.system = :system AND p.planet_type = :planetTypePlanet
GROUP BY p.id;';
$galaxyResult = Database::get()->select($sql, array(':statTypeUser' => 1, ':statTypeAlliance' => 2, ':allianceId' => $USER['ally_id'], ':userId' => $USER['id'], ':universe' => Universe::current(), ':galaxy' => $this->Galaxy, ':system' => $this->System, ':planetTypePlanet' => 1, ':accept' => 1));
foreach ($galaxyResult as $galaxyRow) {
$this->galaxyRow = $galaxyRow;
if ($this->galaxyRow['destruyed'] != 0) {
$this->galaxyData[$this->galaxyRow['planet']] = self::PLANET_DESTROYED;
continue;
}
$this->galaxyData[$this->galaxyRow['planet']] = array();
$this->isOwnPlanet();
$this->setLastActivity();
$this->getAllowedMissions();
$this->getPlayerData();
$this->getPlanetData();
$this->getAllianceData();
$this->getDebrisData();
$this->getMoonData();
$this->getActionButtons();
}
return $this->galaxyData;
}
示例15: _activeUser
private function _activeUser()
{
global $LNG;
$validationID = HTTP::_GP('i', 0);
$validationKey = HTTP::_GP('k', '');
$db = Database::get();
$sql = "SELECT * FROM %%USERS_VALID%%\n\t\tWHERE validationID\t= :validationID\n\t\tAND validationKey\t= :validationKey\n\t\tAND universe\t\t= :universe;";
$userData = $db->selectSingle($sql, array(':validationKey' => $validationKey, ':validationID' => $validationID, ':universe' => Universe::current()));
if (empty($userData)) {
$this->printMessage($LNG['vertifyNoUserFound']);
}
$config = Config::get();
$sql = "DELETE FROM %%USERS_VALID%% WHERE validationID = :validationID;";
$db->delete($sql, array(':validationID' => $validationID));
list($userID, $planetID) = PlayerUtil::createPlayer($userData['universe'], $userData['userName'], $userData['password'], $userData['email'], $userData['language']);
if ($config->mail_active == 1) {
require 'includes/classes/Mail.class.php';
$MailSubject = sprintf($LNG['registerMailCompleteTitle'], $config->game_name, Universe::current());
$MailRAW = $LNG->getTemplate('email_reg_done');
$MailContent = str_replace(array('{USERNAME}', '{GAMENAME}', '{GAMEMAIL}'), array($userData['userName'], $config->game_name . ' - ' . $config->uni_name, $config->smtp_sendmail), $MailRAW);
try {
Mail::send($userData['email'], $userData['userName'], $MailSubject, $MailContent);
} catch (Exception $e) {
// This mail is wayne.
}
}
if (!empty($userData['referralID'])) {
$sql = "UPDATE %%USERS%% SET\n\t\t\t`ref_id`\t= :referralId,\n\t\t\t`ref_bonus`\t= 1\n\t\t\tWHERE\n\t\t\t`id`\t\t= :userID;";
$db->update($sql, array(':referralId' => $userData['referralID'], ':userID' => $userID));
}
if (!empty($userData['externalAuthUID'])) {
$sql = "INSERT INTO %%USERS_AUTH%% SET\n\t\t\t`id`\t\t= :userID,\n\t\t\t`account`\t= :externalAuthUID,\n\t\t\t`mode`\t\t= :externalAuthMethod;";
$db->insert($sql, array(':userID' => $userID, ':externalAuthUID' => $userData['externalAuthUID'], ':externalAuthMethod' => $userData['externalAuthMethod']));
}
$senderName = $LNG['registerWelcomePMSenderName'];
$subject = $LNG['registerWelcomePMSubject'];
$message = sprintf($LNG['registerWelcomePMText'], $config->game_name, $userData['universe']);
PlayerUtil::sendMessage($userID, 1, $senderName, 1, $subject, $message, TIMESTAMP);
return array('userID' => $userID, 'userName' => $userData['userName'], 'planetID' => $planetID);
}