本文整理汇总了PHP中Universe类的典型用法代码示例。如果您正苦于以下问题:PHP Universe类的具体用法?PHP Universe怎么用?PHP Universe使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Universe类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUniverse
public function setUniverse(Universe $universe, $sync = true)
{
$this->universe = $universe;
if ($sync) {
$universe->addCelestialBodyTypeSpecs($this, false);
}
}
示例2: show
function show()
{
global $LNG;
$referralID = HTTP::_GP('ref', 0);
if (!empty($referralID)) {
$this->redirectTo('index.php?page=register&referralID=' . $referralID);
}
$universeSelect = array();
foreach (Universe::availableUniverses() as $uniId) {
$config = Config::get($uniId);
$universeSelect[$uniId] = $config->uni_name . ($config->game_disable == 0 ? $LNG['uni_closed'] : '');
}
$Code = HTTP::_GP('code', 0);
$loginCode = false;
if (isset($LNG['login_error_' . $Code])) {
$loginCode = $LNG['login_error_' . $Code];
}
$config = Config::get();
$this->assign(array('universeSelect' => $universeSelect, 'code' => $loginCode, 'descHeader' => sprintf($LNG['loginWelcome'], $config->game_name), 'descText' => sprintf($LNG['loginServerDesc'], $config->game_name), 'loginInfo' => sprintf($LNG['loginInfo'], '<a href="index.php?page=rules">' . $LNG['menu_rules'] . '</a>')));
$screenshots = array();
$directoryIterator = new DirectoryIterator('styles/resource/images/login/screens/');
foreach ($directoryIterator as $fileInfo) {
/** @var $fileInfo DirectoryIterator */
if (!$fileInfo->isFile()) {
continue;
}
$thumbnail = 'styles/resource/images/login/screens/' . $fileInfo->getFilename();
if (file_exists('styles/resource/images/login/screens/thumbnails/' . $fileInfo->getFilename())) {
$thumbnail = 'styles/resource/images/login/screens/thumbnails/' . $fileInfo->getFilename();
}
$screenshots[] = array('path' => 'styles/resource/images/login/screens/' . $fileInfo->getFilename(), 'thumbnail' => $thumbnail);
}
$this->assign(array('screenshots' => $screenshots));
$this->display('page.index.default.tpl');
}
示例3: 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');
}
示例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: ShowMenuPage
/**
* 2Moons
* Copyright (C) 2012 Jan Kröpke
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package 2Moons
* @author Jan Kröpke <info@2moons.cc>
* @copyright 2012 Jan Kröpke <info@2moons.cc>
* @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License
* @version 1.7.2 (2013-03-18)
* @info $Id$
* @link http://2moons.cc/
*/
function ShowMenuPage()
{
global $USER;
$template = new template();
$template->assign_vars(array('supportticks' => $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . TICKETS . " WHERE universe = " . Universe::getEmulated() . " AND status = 0;")));
$template->show('ShowMenuPage.tpl');
}
示例6: send
function send()
{
global $USER, $LNG;
$ticketID = HTTP::_GP('id', 0);
$message = HTTP::_GP('message', '', true);
$change = HTTP::_GP('change_status', 0);
$ticketDetail = $GLOBALS['DATABASE']->getFirstRow("SELECT ownerID, subject, status FROM " . TICKETS . " WHERE ticketID = " . $ticketID . ";");
$status = $change ? $ticketDetail['status'] <= 1 ? 2 : 1 : 1;
if (!$change && empty($message)) {
HTTP::redirectTo('admin.php?page=support&mode=view&id=' . $ticketID);
}
$subject = "RE: " . $ticketDetail['subject'];
if ($change && $status == 1) {
$this->ticketObj->createAnswer($ticketID, $USER['id'], $USER['username'], $subject, $LNG['ti_admin_open'], $status);
}
if (!empty($message)) {
$this->ticketObj->createAnswer($ticketID, $USER['id'], $USER['username'], $subject, $message, $status);
}
if ($change && $status == 2) {
$this->ticketObj->createAnswer($ticketID, $USER['id'], $USER['username'], $subject, $LNG['ti_admin_close'], $status);
}
$subject = sprintf($LNG['sp_answer_message_title'], $ticketID);
$text = sprintf($LNG['sp_answer_message'], $ticketID);
PlayerUtil::sendMessage($ticketDetail['ownerID'], $USER['id'], $USER['username'], 4, $subject, $text, TIMESTAMP, NULL, 1, Universe::getEmulated());
HTTP::redirectTo('admin.php?page=support');
}
示例7: ShowMultiIPPage
function ShowMultiIPPage()
{
global $LNG;
switch ($_GET['action']) {
case 'known':
$GLOBALS['DATABASE']->query("INSERT INTO " . MULTI . " SET userID = " . (int) $_GET['id'] . ";");
HTTP::redirectTo("admin.php?page=multiips");
break;
case 'unknown':
$GLOBALS['DATABASE']->query("DELETE FROM " . MULTI . " WHERE userID = " . (int) $_GET['id'] . ";");
HTTP::redirectTo("admin.php?page=multiips");
break;
}
$Query = $GLOBALS['DATABASE']->query("SELECT id, username, email, register_time, onlinetime, user_lastip, IFNULL(multiID, 0) as isKnown FROM " . USERS . " LEFT JOIN " . MULTI . " ON userID = id WHERE `universe` = '" . Universe::getEmulated() . "' AND user_lastip IN (SELECT user_lastip FROM " . USERS . " WHERE `universe` = '" . Universe::getEmulated() . "' GROUP BY user_lastip HAVING COUNT(*)>1) ORDER BY user_lastip, id ASC;");
$IPs = array();
while ($Data = $GLOBALS['DATABASE']->fetch_array($Query)) {
if (!isset($IPs[$Data['user_lastip']])) {
$IPs[$Data['user_lastip']] = array();
}
$Data['register_time'] = _date($LNG['php_tdformat'], $Data['register_time']);
$Data['onlinetime'] = _date($LNG['php_tdformat'], $Data['onlinetime']);
$IPs[$Data['user_lastip']][$Data['id']] = $Data;
}
$template = new template();
$template->assign_vars(array('multiGroups' => $IPs));
$template->show('MultiIPs.tpl');
}
示例8: 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');
}
示例9: ShowTeamspeakPage
function ShowTeamspeakPage()
{
global $LNG;
$config = Config::get(Universe::getEmulated());
if ($_POST) {
$config_before = array('ts_timeout' => $config->ts_timeout, 'ts_modon' => $config->ts_modon, 'ts_server' => $config->ts_server, 'ts_tcpport' => $config->ts_tcpport, 'ts_udpport' => $config->ts_udpport, 'ts_version' => $config->ts_version, 'ts_login' => $config->ts_login, 'ts_password' => $config->ts_password, 'ts_cron_interval' => $config->ts_cron_interval);
$ts_modon = isset($_POST['ts_on']) && $_POST['ts_on'] == 'on' ? 1 : 0;
$ts_server = HTTP::_GP('ts_ip', '');
$ts_tcpport = HTTP::_GP('ts_tcp', 0);
$ts_udpport = HTTP::_GP('ts_udp', 0);
$ts_timeout = HTTP::_GP('ts_to', 0);
$ts_version = HTTP::_GP('ts_v', 0);
$ts_login = HTTP::_GP('ts_login', '');
$ts_password = HTTP::_GP('ts_password', '', true);
$ts_cron_interval = HTTP::_GP('ts_cron', 0);
$config_after = array('ts_timeout' => $ts_timeout, 'ts_modon' => $ts_modon, 'ts_server' => $ts_server, 'ts_tcpport' => $ts_tcpport, 'ts_udpport' => $ts_udpport, 'ts_version' => $ts_version, 'ts_login' => $ts_login, 'ts_password' => $ts_password, 'ts_cron_interval' => $ts_cron_interval);
foreach ($config_after as $key => $value) {
$config->{$key} = $value;
}
$config->save();
$sql = "UPDATE %%CRONJOBS%%\n\t\tSET isActive = :isActive, `lock` = NULL, nextTime = 0\n\t\tWHERE name = 'teamspeak';";
Database::get()->update($sql, array(':isActive' => $ts_modon));
$LOG = new Log(3);
$LOG->target = 4;
$LOG->old = $config_before;
$LOG->new = $config_after;
$LOG->save();
}
$template = new template();
$template->assign_vars(array('se_save_parameters' => $LNG['se_save_parameters'], 'ts_tcpport' => $LNG['ts_tcpport'], 'ts_serverip' => $LNG['ts_serverip'], 'ts_version' => $LNG['ts_version'], 'ts_active' => $LNG['ts_active'], 'ts_settings' => $LNG['ts_settings'], 'ts_udpport' => $LNG['ts_udpport'], 'ts_timeout' => $LNG['ts_timeout'], 'ts_server_query' => $LNG['ts_server_query'], 'ts_sq_login' => $LNG['ts_login'], 'ts_sq_pass' => $LNG['ts_pass'], 'ts_lng_cron' => $LNG['ts_cron'], 'ts_to' => $config->ts_timeout, 'ts_on' => $config->ts_modon, 'ts_ip' => $config->ts_server, 'ts_tcp' => $config->ts_tcpport, 'ts_udp' => $config->ts_udpport, 'ts_v' => $config->ts_version, 'ts_login' => $config->ts_login, 'ts_password' => $config->ts_password, 'ts_cron' => $config->ts_cron_interval));
$template->show('TeamspeakPage.tpl');
}
示例10: 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');
}
示例11: 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');
}
}
示例12: ShowChatConfigPage
function ShowChatConfigPage()
{
global $LNG;
$config = Config::get(Universe::getEmulated());
if (!empty($_POST)) {
$config_before = array('chat_closed' => $config->chat_closed, 'chat_allowchan' => $config->chat_allowchan, 'chat_allowmes' => $config->chat_allowmes, 'chat_allowdelmes' => $config->chat_allowdelmes, 'chat_logmessage' => $config->chat_logmessage, 'chat_nickchange' => $config->chat_nickchange, 'chat_botname' => $config->chat_botname, 'chat_channelname' => $config->chat_channelname);
$chat_allowchan = isset($_POST['chat_allowchan']) && $_POST['chat_allowchan'] == 'on' ? 1 : 0;
$chat_allowmes = isset($_POST['chat_allowmes']) && $_POST['chat_allowmes'] == 'on' ? 1 : 0;
$chat_allowdelmes = isset($_POST['chat_allowdelmes']) && $_POST['chat_allowdelmes'] == 'on' ? 1 : 0;
$chat_logmessage = isset($_POST['chat_logmessage']) && $_POST['chat_logmessage'] == 'on' ? 1 : 0;
$chat_nickchange = isset($_POST['chat_nickchange']) && $_POST['chat_nickchange'] == 'on' ? 1 : 0;
$chat_closed = isset($_POST['chat_closed']) && $_POST['chat_closed'] == 'on' ? 1 : 0;
$chat_channelname = HTTP::_GP('chat_channelname', '', true);
$chat_botname = HTTP::_GP('chat_botname', '', true);
$config_after = array('chat_closed' => $chat_closed, 'chat_allowchan' => $chat_allowchan, 'chat_allowmes' => $chat_allowmes, 'chat_allowdelmes' => $chat_allowdelmes, 'chat_logmessage' => $chat_logmessage, 'chat_nickchange' => $chat_nickchange, 'chat_botname' => $chat_botname, 'chat_channelname' => $chat_channelname);
foreach ($config_after as $key => $value) {
$config->{$key} = $value;
}
$config->save();
$LOG = new Log(3);
$LOG->target = 3;
$LOG->old = $config_before;
$LOG->new = $config_after;
$LOG->save();
}
$template = new template();
$template->assign_vars(array('chat_closed' => $config->chat_closed, 'chat_allowchan' => $config->chat_allowchan, 'chat_allowmes' => $config->chat_allowmes, 'chat_logmessage' => $config->chat_logmessage, 'chat_nickchange' => $config->chat_nickchange, 'chat_botname' => $config->chat_botname, 'chat_channelname' => $config->chat_channelname, 'se_server_parameters' => $LNG['se_server_parameters'], 'se_save_parameters' => $LNG['se_save_parameters'], 'ch_closed' => $LNG['ch_closed'], 'ch_allowchan' => $LNG['ch_allowchan'], 'ch_allowmes' => $LNG['ch_allowmes'], 'ch_allowdelmes' => $LNG['ch_allowdelmes'], 'ch_logmessage' => $LNG['ch_logmessage'], 'ch_nickchange' => $LNG['ch_nickchange'], 'ch_botname' => $LNG['ch_botname'], 'ch_channelname' => $LNG['ch_channelname']));
$template->show('ChatConfigBody.tpl');
}
示例13: ShowDisclamerPage
function ShowDisclamerPage()
{
global $LNG;
$config = Config::get(Universe::getEmulated());
if (!empty($_POST)) {
$config_before = array('disclamerAddress' => $config->disclamerAddress, 'disclamerPhone' => $config->disclamerPhone, 'disclamerMail' => $config->disclamerMail, 'disclamerNotice' => $config->disclamerNotice);
$disclaimerAddress = HTTP::_GP('disclaimerAddress', '', true);
$disclaimerPhone = HTTP::_GP('disclaimerPhone', '', true);
$disclaimerMail = HTTP::_GP('disclaimerMail', '', true);
$disclaimerNotice = HTTP::_GP('disclaimerNotice', '', true);
$config_after = array('disclamerAddress' => $disclaimerAddress, 'disclamerPhone' => $disclaimerPhone, 'disclamerMail' => $disclaimerMail, 'disclamerNotice' => $disclaimerNotice);
foreach ($config_after as $key => $value) {
$config->{$key} = $value;
}
$config->save();
$LOG = new Log(3);
$LOG->target = 5;
$LOG->old = $config_before;
$LOG->new = $config_after;
$LOG->save();
}
$template = new template();
$template->loadscript('../base/jquery.autosize-min.js');
$template->execscript('$(\'textarea\').autosize();');
$template->assign_vars(array('disclaimerAddress' => $config->disclamerAddress, 'disclaimerPhone' => $config->disclamerPhone, 'disclaimerMail' => $config->disclamerMail, 'disclaimerNotice' => $config->disclamerNotice, 'se_server_parameters' => $LNG['mu_disclaimer'], 'se_save_parameters' => $LNG['se_save_parameters'], 'se_disclaimerAddress' => $LNG['se_disclaimerAddress'], 'se_disclaimerPhone' => $LNG['se_disclaimerPhone'], 'se_disclaimerMail' => $LNG['se_disclaimerMail'], 'se_disclaimerNotice' => $LNG['se_disclaimerNotice']));
$template->show('DisclamerConfigBody.tpl');
}
示例14: ShowFlyingFleetPage
function ShowFlyingFleetPage()
{
global $LNG;
$id = HTTP::_GP('id', 0);
if (!empty($id)) {
$lock = HTTP::_GP('lock', 0);
$GLOBALS['DATABASE']->query("UPDATE " . FLEETS . " SET `fleet_busy` = '" . $lock . "' WHERE `fleet_id` = '" . $id . "' AND `fleet_universe` = '" . Universe::getEmulated() . "';");
$SQL = $lock == 0 ? "NULL" : "'ADM_LOCK'";
$GLOBALS['DATABASE']->query("UPDATE " . FLEETS_EVENT . " SET `lock` = " . $SQL . " WHERE `fleetID` = " . $id . ";");
}
$orderBy = "fleet_id";
$fleetResult = $GLOBALS['DATABASE']->query("SELECT \n\tfleet.*,\n\tevent.`lock`,\n\tCOUNT(event.fleetID) as error,\n\tpstart.name as startPlanetName,\n\tptarget.name as targetPlanetName,\n\tustart.username as startUserName,\n\tutarget.username as targetUserName,\n\tacs.name as acsName\n\tFROM " . FLEETS . " fleet\n\tLEFT JOIN " . FLEETS_EVENT . " event ON fleetID = fleet_id\n\tLEFT JOIN " . PLANETS . " pstart ON pstart.id = fleet_start_id\n\tLEFT JOIN " . PLANETS . " ptarget ON ptarget.id = fleet_end_id\n\tLEFT JOIN " . USERS . " ustart ON ustart.id = fleet_owner\n\tLEFT JOIN " . USERS . " utarget ON utarget.id = fleet_target_owner\n\tLEFT JOIN " . AKS . " acs ON acs.id = fleet_group\n\tWHERE fleet_universe = " . Universe::getEmulated() . "\n\tGROUP BY event.fleetID\n\tORDER BY " . $orderBy . ";");
$FleetList = array();
while ($fleetRow = $GLOBALS['DATABASE']->fetch_array($fleetResult)) {
$shipList = array();
$shipArray = array_filter(explode(';', $fleetRow['fleet_array']));
foreach ($shipArray as $ship) {
$shipDetail = explode(',', $ship);
$shipList[$shipDetail[0]] = $shipDetail[1];
}
$FleetList[] = array('fleetID' => $fleetRow['fleet_id'], 'lock' => !empty($fleetRow['lock']), 'count' => $fleetRow['fleet_amount'], 'error' => !$fleetRow['error'], 'ships' => $shipList, 'state' => $fleetRow['fleet_mess'], 'starttime' => _date($LNG['php_tdformat'], $fleetRow['start_time'], $USER['timezone']), 'arrivaltime' => _date($LNG['php_tdformat'], $fleetRow['fleet_start_time'], $USER['timezone']), 'stayhour' => round(($fleetRow['fleet_end_stay'] - $fleetRow['fleet_start_time']) / 3600), 'staytime' => $fleetRow['fleet_start_time'] !== $fleetRow['fleet_end_stay'] ? _date($LNG['php_tdformat'], $fleetRow['fleet_end_stay'], $USER['timezone']) : 0, 'endtime' => _date($LNG['php_tdformat'], $fleetRow['fleet_end_time'], $USER['timezone']), 'missionID' => $fleetRow['fleet_mission'], 'acsID' => $fleetRow['fleet_group'], 'acsName' => $fleetRow['acsName'], 'startUserID' => $fleetRow['fleet_owner'], 'startUserName' => $fleetRow['startUserName'], 'startPlanetID' => $fleetRow['fleet_start_id'], 'startPlanetName' => $fleetRow['startPlanetName'], 'startPlanetGalaxy' => $fleetRow['fleet_start_galaxy'], 'startPlanetSystem' => $fleetRow['fleet_start_system'], 'startPlanetPlanet' => $fleetRow['fleet_start_planet'], 'startPlanetType' => $fleetRow['fleet_start_type'], 'targetUserID' => $fleetRow['fleet_target_owner'], 'targetUserName' => $fleetRow['targetUserName'], 'targetPlanetID' => $fleetRow['fleet_end_id'], 'targetPlanetName' => $fleetRow['targetPlanetName'], 'targetPlanetGalaxy' => $fleetRow['fleet_end_galaxy'], 'targetPlanetSystem' => $fleetRow['fleet_end_system'], 'targetPlanetPlanet' => $fleetRow['fleet_end_planet'], 'targetPlanetType' => $fleetRow['fleet_end_type'], 'resource' => array(901 => $fleetRow['fleet_resource_metal'], 902 => $fleetRow['fleet_resource_crystal'], 903 => $fleetRow['fleet_resource_deuterium'], 921 => $fleetRow['fleet_resource_darkmatter']));
}
$GLOBALS['DATABASE']->free_result($fleetResult);
$template = new template();
$template->assign_vars(array('FleetList' => $FleetList));
$template->show('FlyingFleetPage.tpl');
}
示例15: 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']);
}