本文整理汇总了PHP中Universe::getEmulated方法的典型用法代码示例。如果您正苦于以下问题:PHP Universe::getEmulated方法的具体用法?PHP Universe::getEmulated怎么用?PHP Universe::getEmulated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Universe
的用法示例。
在下文中一共展示了Universe::getEmulated方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
示例2: 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');
}
示例3: 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');
}
示例4: 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');
}
示例5: 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');
}
示例6: 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');
}
示例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: ShowSendMessagesPage
function ShowSendMessagesPage()
{
global $USER, $LNG;
$ACTION = HTTP::_GP('action', '');
if ($ACTION == 'send') {
switch ($USER['authlevel']) {
case AUTH_MOD:
$class = 'mod';
break;
case AUTH_OPS:
$class = 'ops';
break;
case AUTH_ADM:
$class = 'admin';
break;
default:
$class = '';
break;
}
$Subject = HTTP::_GP('subject', '', true);
$Message = HTTP::_GP('text', '', true);
$Mode = HTTP::_GP('mode', 0);
$Lang = HTTP::_GP('lang', '');
if (!empty($Message) && !empty($Subject)) {
require 'includes/classes/BBCode.class.php';
if ($Mode == 0 || $Mode == 2) {
$From = '<span class="' . $class . '">' . $LNG['user_level'][$USER['authlevel']] . ' ' . $USER['username'] . '</span>';
$pmSubject = '<span class="' . $class . '">' . $Subject . '</span>';
$pmMessage = '<span class="' . $class . '">' . BBCode::parse($Message) . '</span>';
$USERS = $GLOBALS['DATABASE']->query("SELECT `id`, `username` FROM " . USERS . " WHERE `universe` = '" . Universe::getEmulated() . "'" . (!empty($Lang) ? " AND `lang` = '" . $GLOBALS['DATABASE']->sql_escape($Lang) . "'" : "") . ";");
while ($UserData = $GLOBALS['DATABASE']->fetch_array($USERS)) {
$sendMessage = str_replace('{USERNAME}', $UserData['username'], $pmMessage);
PlayerUtil::sendMessage($UserData['id'], $USER['id'], $From, 50, $pmSubject, $sendMessage, TIMESTAMP, NULL, 1, Universe::getEmulated());
}
}
if ($Mode == 1 || $Mode == 2) {
require 'includes/classes/Mail.class.php';
$userList = array();
$USERS = $GLOBALS['DATABASE']->query("SELECT `email`, `username` FROM " . USERS . " WHERE `universe` = '" . Universe::getEmulated() . "'" . (!empty($Lang) ? " AND `lang` = '" . $GLOBALS['DATABASE']->sql_escape($Lang) . "'" : "") . ";");
while ($UserData = $GLOBALS['DATABASE']->fetch_array($USERS)) {
$userList[$UserData['email']] = array('username' => $UserData['username'], 'body' => BBCode::parse(str_replace('{USERNAME}', $UserData['username'], $Message)));
}
Mail::multiSend($userList, strip_tags($Subject));
}
exit($LNG['ma_message_sended']);
} else {
exit($LNG['ma_subject_needed']);
}
}
$sendModes = $LNG['ma_modes'];
if (Config::get()->mail_active == 0) {
unset($sendModes[1]);
unset($sendModes[2]);
}
$template = new template();
$template->assign_vars(array('langSelector' => array_merge(array('' => $LNG['ma_all']), $LNG->getAllowedLangs(false)), 'modes' => $sendModes));
$template->show('SendMessagesPage.tpl');
}
示例9: ShowMessageListPage
function ShowMessageListPage()
{
global $LNG;
$page = HTTP::_GP('side', 1);
$type = HTTP::_GP('type', 100);
$sender = HTTP::_GP('sender', '', UTF8_SUPPORT);
$receiver = HTTP::_GP('receiver', '', UTF8_SUPPORT);
$dateStart = HTTP::_GP('dateStart', array());
$dateEnd = HTTP::_GP('dateEnd', array());
$perSide = 50;
$messageList = array();
$userWhereSQL = '';
$dateWhereSQL = '';
$countJoinSQL = '';
$categories = $LNG['mg_type'];
unset($categories[999]);
$dateStart = array_filter($dateStart, 'is_numeric');
$dateEnd = array_filter($dateEnd, 'is_numeric');
$useDateStart = count($dateStart) == 3;
$useDateEnd = count($dateEnd) == 3;
if ($useDateStart && $useDateEnd) {
$dateWhereSQL = ' AND message_time BETWEEN ' . mktime(0, 0, 0, (int) $dateStart['month'], (int) $dateStart['day'], (int) $dateStart['year']) . ' AND ' . mktime(23, 59, 59, (int) $dateEnd['month'], (int) $dateEnd['day'], (int) $dateEnd['year']);
} elseif ($useDateStart) {
$dateWhereSQL = ' AND message_time > ' . mktime(0, 0, 0, (int) $dateStart['month'], (int) $dateStart['day'], (int) $dateStart['year']);
} elseif ($useDateStart) {
$dateWhereSQL = ' AND message_time < ' . mktime(23, 59, 59, (int) $dateEnd['month'], (int) $dateEnd['day'], (int) $dateEnd['year']);
}
if (!empty($sender)) {
$countJoinSQL .= ' LEFT JOIN ' . USERS . ' as us ON message_sender = us.id';
$userWhereSQL .= ' AND us.username = "' . $GLOBALS['DATABASE']->escape($sender) . '"';
}
if (!empty($receiver)) {
$countJoinSQL .= ' LEFT JOIN ' . USERS . ' as u ON message_owner = u.id';
$userWhereSQL .= ' AND u.username = "' . $GLOBALS['DATABASE']->escape($receiver) . '"';
}
if ($type != 100) {
$MessageCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . MESSAGES . $countJoinSQL . " WHERE message_type = " . $type . " AND message_universe = " . Universe::getEmulated() . $dateWhereSQL . $userWhereSQL . ";");
} else {
$MessageCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . MESSAGES . $countJoinSQL . " WHERE message_universe = " . Universe::getEmulated() . $dateWhereSQL . $userWhereSQL . ";");
}
$maxPage = max(1, ceil($MessageCount / $perSide));
$page = max(1, min($page, $maxPage));
$sqlLimit = ($page - 1) * $perSide . ", " . ($perSide - 1);
if ($type == 100) {
$messageRaw = $GLOBALS['DATABASE']->query("SELECT u.username, us.username as senderName, m.* \n\t\tFROM " . MESSAGES . " as m \n\t\tLEFT JOIN " . USERS . " as u ON m.message_owner = u.id \n\t\tLEFT JOIN " . USERS . " as us ON m.message_sender = us.id\n\t\tWHERE m.message_universe = " . Universe::getEmulated() . "\n\t\t" . $dateWhereSQL . "\n\t\t" . $userWhereSQL . "\n\t\tORDER BY message_time DESC, message_id DESC\n\t\tLIMIT " . $sqlLimit . ";");
} else {
$messageRaw = $GLOBALS['DATABASE']->query("SELECT u.username, us.username as senderName, m.* \n\t\tFROM " . MESSAGES . " as m\n\t\tLEFT JOIN " . USERS . " as u ON m.message_owner = u.id\n\t\tLEFT JOIN " . USERS . " as us ON m.message_sender = us.id\n\t\tWHERE m.message_type = " . $type . " AND message_universe = " . Universe::getEmulated() . "\n\t\t" . $dateWhereSQL . "\n\t\t" . $userWhereSQL . "\n\t\tORDER BY message_time DESC, message_id DESC\n\t\tLIMIT " . $sqlLimit . ";");
}
while ($messageRow = $GLOBALS['DATABASE']->fetch_array($messageRaw)) {
$messageList[$messageRow['message_id']] = array('sender' => empty($messageRow['senderName']) ? $messageRow['message_from'] : $messageRow['senderName'] . ' (ID: ' . $messageRow['message_sender'] . ')', 'receiver' => $messageRow['username'] . ' (ID: ' . $messageRow['message_owner'] . ')', 'subject' => $messageRow['message_subject'], 'text' => $messageRow['message_text'], 'type' => $messageRow['message_type'], 'time' => str_replace(' ', ' ', _date($LNG['php_tdformat'], $messageRow['message_time']), $USER['timezone']));
}
$template = new template();
$template->assign_vars(array('categories' => $categories, 'maxPage' => $maxPage, 'page' => $page, 'messageList' => $messageList, 'type' => $type, 'dateStart' => $dateStart, 'dateEnd' => $dateEnd, 'sender' => $sender, 'receiver' => $receiver));
$template->show('MessageList.tpl');
}
示例10: ShowTopnavPage
/**
* 2Moons
* Copyright (C) 2012 Jan Kröpke
*
* For the full copyright and license information, please view the LICENSE
*
* @package 2Moons
* @author Jan Kröpke <info@2moons.cc>
* @copyright 2012 Jan Kröpke <info@2moons.cc>
* @licence MIT
* @version 1.7.2 (2013-03-18)
* @info $Id$
* @link http://2moons.cc/
*/
function ShowTopnavPage()
{
global $LNG, $USER;
$template = new template();
$universeSelect = array();
foreach (Universe::availableUniverses() as $uniId) {
$config = Config::get($uniId);
$universeSelect[$uniId] = sprintf('%s (ID: %d)', $config->uni_name, $uniId);
}
ksort($universeSelect);
$template->assign_vars(array('ad_authlevel_title' => $LNG['ad_authlevel_title'], 're_reset_universe' => $LNG['re_reset_universe'], 'mu_universe' => $LNG['mu_universe'], 'mu_moderation_page' => $LNG['mu_moderation_page'], 'adm_cp_title' => $LNG['adm_cp_title'], 'adm_cp_index' => $LNG['adm_cp_index'], 'adm_cp_logout' => $LNG['adm_cp_logout'], 'sid' => session_id(), 'id' => $USER['id'], 'authlevel' => $USER['authlevel'], 'AvailableUnis' => $universeSelect, 'UNI' => Universe::getEmulated()));
$template->show('ShowTopnavPage.tpl');
}
示例11: ShowGiveaway
function ShowGiveaway()
{
global $LNG, $resource, $reslist;
$template = new template();
$action = HTTP::_GP('action', '');
if ($action == 'send') {
$planet = HTTP::_GP('planet', 0);
$moon = HTTP::_GP('moon', 0);
$mainplanet = HTTP::_GP('mainplanet', 0);
$no_inactive = HTTP::_GP('no_inactive', 0);
if (!$planet && !$moon) {
$template->message($LNG['ga_selectplanettype']);
exit;
}
$planetIN = array();
if ($planet) {
$planetIN[] = "'1'";
}
if ($moon) {
$planetIN[] = "'3'";
}
$data = array();
$DataIDs = array_merge($reslist['resstype'][1], $reslist['resstype'][3], $reslist['build'], $reslist['tech'], $reslist['fleet'], $reslist['defense'], $reslist['officier']);
$logOld = array();
$logNew = array();
foreach ($DataIDs as $ID) {
$amount = max(0, round(HTTP::_GP('element_' . $ID, 0.0)));
$data[] = $resource[$ID] . " = " . $resource[$ID] . " + " . $amount;
$logOld[$ID] = 0;
$logNew[$ID] = $amount;
}
$SQL = "UPDATE " . PLANETS . " p INNER JOIN " . USERS . " u ON p.id_owner = u.id";
if ($mainplanet == true) {
$SQL .= " AND p.id = u.id_planet";
}
if ($no_inactive == true) {
$SQL .= " AND u.onlinetime > " . (TIMESTAMP - INACTIVE);
}
$SQL .= " SET " . implode(', ', $data) . " WHERE p.universe = " . Universe::getEmulated() . " AND p.planet_type IN (" . implode(',', $planetIN) . ")";
$GLOBALS['DATABASE']->query($SQL);
$LOG = new Log(4);
$LOG->target = 0;
$LOG->old = $logOld;
$LOG->new = $logNew;
$LOG->save();
$template->message($LNG['ga_success']);
exit;
}
$template->assign_vars(array('reslist' => $reslist));
$template->show("giveaway.tpl");
}
示例12: ShowActivePage
function ShowActivePage()
{
global $LNG, $USER;
$id = HTTP::_GP('id', 0);
if ($_GET['action'] == 'delete' && !empty($id)) {
$GLOBALS['DATABASE']->query("DELETE FROM " . USERS_VALID . " WHERE `validationID` = '" . $id . "' AND `universe` = '" . Universe::getEmulated() . "';");
}
$query = $GLOBALS['DATABASE']->query("SELECT * FROM " . USERS_VALID . " WHERE `universe` = '" . Universe::getEmulated() . "' ORDER BY validationID ASC");
$Users = array();
while ($User = $GLOBALS['DATABASE']->fetch_array($query)) {
$Users[] = array('id' => $User['validationID'], 'name' => $User['userName'], 'date' => _date($LNG['php_tdformat'], $User['date'], $USER['timezone']), 'email' => $User['email'], 'ip' => $User['ip'], 'password' => $User['password'], 'validationKey' => $User['validationKey']);
}
$template = new template();
$template->assign_vars(array('Users' => $Users, 'uni' => Universe::getEmulated()));
$template->show('ActivePage.tpl');
}
示例13: ShowFacebookPage
function ShowFacebookPage()
{
global $LNG;
$config = Config::get(Universe::getEmulated());
if ($_POST) {
$fb_on = isset($_POST['fb_on']) && $_POST['fb_on'] == 'on' && !empty($_POST['fb_skey']) && !empty($_POST['fb_apikey']) ? 1 : 0;
$fb_apikey = HTTP::_GP('fb_apikey', '');
$fb_skey = HTTP::_GP('fb_skey', '');
foreach (array('fb_on' => $fb_on, 'fb_apikey' => $fb_apikey, 'fb_skey' => $fb_skey) as $key => $value) {
$config->{$key} = $value;
}
$config->save();
}
$template = new template();
$template->assign_vars(array('se_save_parameters' => $LNG['se_save_parameters'], 'fb_info' => $LNG['fb_info'], 'fb_secrectkey' => $LNG['fb_secrectkey'], 'fb_api_key' => $LNG['fb_api_key'], 'fb_active' => $LNG['fb_active'], 'fb_settings' => $LNG['fb_settings'], 'fb_on' => $config->fb_on, 'fb_apikey' => $config->fb_apikey, 'fb_skey' => $config->fb_skey, 'fb_curl' => function_exists('curl_init') ? 1 : 0, 'fb_curl_info' => function_exists('curl_init') ? $LNG['fb_curl_yes'] : $LNG['fb_curl_no']));
$template->show('FacebookPage.tpl');
}
示例14: ShowConfigBasicPage
function ShowConfigBasicPage()
{
global $LNG;
$config = Config::get(Universe::getEmulated());
if (!empty($_POST)) {
$config_before = array('ttf_file' => $config->ttf_file, 'game_name' => $config->game_name, 'mail_active' => $config->mail_active, 'mail_use' => $config->mail_use, 'smail_path' => $config->smail_path, 'smtp_host' => $config->smtp_host, 'smtp_port' => $config->smtp_port, 'smtp_user' => $config->smtp_user, 'smtp_pass' => $config->smtp_pass, 'smtp_ssl' => $config->smtp_ssl, 'smtp_sendmail' => $config->smtp_sendmail, 'ga_active' => $config->ga_active, 'ga_key' => $config->ga_key, 'capaktiv' => $config->capaktiv, 'cappublic' => $config->cappublic, 'capprivate' => $config->capprivate, 'del_oldstuff' => $config->del_oldstuff, 'del_user_manually' => $config->del_user_manually, 'del_user_automatic' => $config->del_user_automatic, 'del_user_sendmail' => $config->del_user_sendmail, 'sendmail_inactive' => $config->sendmail_inactive, 'timezone' => $config->timezone, 'dst' => $config->dst, 'close_reason' => $config->close_reason);
$capaktiv = isset($_POST['capaktiv']) && $_POST['capaktiv'] == 'on' ? 1 : 0;
$ga_active = isset($_POST['ga_active']) && $_POST['ga_active'] == 'on' ? 1 : 0;
$sendmail_inactive = isset($_POST['sendmail_inactive']) && $_POST['sendmail_inactive'] == 'on' ? 1 : 0;
$mail_active = isset($_POST['mail_active']) && $_POST['mail_active'] == 'on' ? 1 : 0;
$ttf_file = HTTP::_GP('ttf_file', '');
$close_reason = HTTP::_GP('close_reason', '', true);
$game_name = HTTP::_GP('game_name', '', true);
$capprivate = HTTP::_GP('capprivate', '');
$cappublic = HTTP::_GP('cappublic', '');
$ga_key = HTTP::_GP('ga_key', '', true);
$mail_use = HTTP::_GP('mail_use', 0);
$smail_path = HTTP::_GP('smail_path', '');
$smtp_host = HTTP::_GP('smtp_host', '', true);
$smtp_port = HTTP::_GP('smtp_port', 0);
$smtp_user = HTTP::_GP('smtp_user', '', true);
$smtp_sendmail = HTTP::_GP('smtp_sendmail', '', true);
$smtp_pass = HTTP::_GP('smtp_pass', '', true);
$smtp_ssl = HTTP::_GP('smtp_ssl', '');
$del_oldstuff = HTTP::_GP('del_oldstuff', 0);
$del_user_manually = HTTP::_GP('del_user_manually', 0);
$del_user_automatic = HTTP::_GP('del_user_automatic', 0);
$del_user_sendmail = HTTP::_GP('del_user_sendmail', 0);
$timezone = HTTP::_GP('timezone', '');
$dst = HTTP::_GP('dst', 0);
$config_after = array('ttf_file' => $ttf_file, 'game_name' => $game_name, 'mail_active' => $mail_active, 'mail_use' => $mail_use, 'smail_path' => $smail_path, 'smtp_host' => $smtp_host, 'smtp_port' => $smtp_port, 'smtp_user' => $smtp_user, 'smtp_pass' => $smtp_pass, 'smtp_ssl' => $smtp_ssl, 'smtp_sendmail' => $smtp_sendmail, 'ga_active' => $ga_active, 'ga_key' => $ga_key, 'capaktiv' => $capaktiv, 'cappublic' => $cappublic, 'capprivate' => $capprivate, 'del_oldstuff' => $del_oldstuff, 'del_user_manually' => $del_user_manually, 'del_user_automatic' => $del_user_automatic, 'del_user_sendmail' => $del_user_sendmail, 'sendmail_inactive' => $sendmail_inactive, 'timezone' => $timezone, 'dst' => $dst, 'close_reason' => $close_reason);
foreach ($config_after as $key => $value) {
$config->{$key} = $value;
}
$config->save();
$LOG = new Log(3);
$LOG->target = 0;
$LOG->old = $config_before;
$LOG->new = $config_after;
$LOG->save();
}
$TimeZones = get_timezone_selector();
$template = new template();
$template->assign_vars(array('del_oldstuff' => $config->del_oldstuff, 'del_user_manually' => $config->del_user_manually, 'del_user_automatic' => $config->del_user_automatic, 'del_user_sendmail' => $config->del_user_sendmail, 'sendmail_inactive' => $config->sendmail_inactive, 'ttf_file' => $config->ttf_file, 'game_name' => $config->game_name, 'mail_active' => $config->mail_active, 'mail_use' => $config->mail_use, 'smail_path' => $config->smail_path, 'smtp_host' => $config->smtp_host, 'smtp_port' => $config->smtp_port, 'smtp_user' => $config->smtp_user, 'smtp_pass' => $config->smtp_pass, 'smtp_sendmail' => $config->smtp_sendmail, 'smtp_ssl' => $config->smtp_ssl, 'capprivate' => $config->capprivate, 'cappublic' => $config->cappublic, 'capaktiv' => $config->capaktiv, 'ga_active' => $config->ga_active, 'ga_key' => $config->ga_key, 'timezone' => $config->timezone, 'dst' => $config->dst, 'Selector' => array('timezone' => $TimeZones, 'mail' => $LNG['se_mail_sel'], 'encry' => array('' => $LNG['se_smtp_ssl_1'], 'ssl' => $LNG['se_smtp_ssl_2'], 'tls' => $LNG['se_smtp_ssl_3']))));
$template->show('ConfigBasicBody.tpl');
}
示例15: ShowModulePage
function ShowModulePage()
{
global $LNG;
$config = Config::get(Universe::getEmulated());
$module = explode(';', $config->moduls);
if ($_GET['mode']) {
$module[HTTP::_GP('id', 0)] = $_GET['mode'] == 'aktiv' ? 1 : 0;
$config->moduls = implode(";", $module);
$config->save();
}
$IDs = range(0, MODULE_AMOUNT - 1);
foreach ($IDs as $ID => $Name) {
$Modules[$ID] = array('name' => $LNG['modul'][$ID], 'state' => isset($module[$ID]) ? $module[$ID] : 1);
}
asort($Modules);
$template = new template();
$template->assign_vars(array('Modules' => $Modules, 'mod_module' => $LNG['mod_module'], 'mod_info' => $LNG['mod_info'], 'mod_active' => $LNG['mod_active'], 'mod_deactive' => $LNG['mod_deactive'], 'mod_change_active' => $LNG['mod_change_active'], 'mod_change_deactive' => $LNG['mod_change_deactive']));
$template->show('ModulePage.tpl');
}