本文整理汇总了PHP中template::loadscript方法的典型用法代码示例。如果您正苦于以下问题:PHP template::loadscript方法的具体用法?PHP template::loadscript怎么用?PHP template::loadscript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类template
的用法示例。
在下文中一共展示了template::loadscript方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ShowDisclamerPage
function ShowDisclamerPage()
{
global $LNG, $USER;
$CONF = Config::getAll(NULL, $_SESSION['adminuni']);
if (!empty($_POST)) {
$config_before = array('disclamerAddress' => $CONF['disclamerAddress'], 'disclamerPhone' => $CONF['disclamerPhone'], 'disclamerMail' => $CONF['disclamerMail'], 'disclamerNotice' => $CONF['disclamerNotice']);
$disclamerAddress = HTTP::_GP('disclamerAddress', '', true);
$disclamerPhone = HTTP::_GP('disclamerPhone', '', true);
$disclamerMail = HTTP::_GP('disclamerMail', '', true);
$disclamerNotice = HTTP::_GP('disclamerNotice', '', true);
$config_after = array('disclamerAddress' => $disclamerAddress, 'disclamerPhone' => $disclamerPhone, 'disclamerMail' => $disclamerMail, 'disclamerNotice' => $disclamerNotice);
Config::update($config_after);
$CONF = Config::getAll(NULL, $_SESSION['adminuni']);
$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('disclamerAddress' => $CONF['disclamerAddress'], 'disclamerPhone' => $CONF['disclamerPhone'], 'disclamerMail' => $CONF['disclamerMail'], 'disclamerNotice' => $CONF['disclamerNotice'], 'se_server_parameters' => $LNG['mu_disclamer'], 'se_save_parameters' => $LNG['se_save_parameters'], 'se_disclamerAddress' => $LNG['se_disclamerAddress'], 'se_disclamerPhone' => $LNG['se_disclamerPhone'], 'se_disclamerMail' => $LNG['se_disclamerMail'], 'se_disclamerNotice' => $LNG['se_disclamerNotice']));
$template->show('DisclamerConfigBody.tpl');
}
示例2: ShowFleetTraderPage
/**
_ \_/ |\ | /¯¯\ \ / /\ |¯¯) |_¯ \ / /¯¯\ | | |´¯|¯` | /¯¯\ |\ |5
¯ /¯\ | \| \__/ \/ /--\ |¯¯\ |__ \/ \__/ |__ \_/ | | \__/ | \|Core.
* @author: Copyright (C) 2011 by Brayan Narvaez (Prinick) developer of xNova Revolution
* @link: http://www.xnovarevolution.con.ar
* @package 2Moons
* @author Slaver <slaver7@gmail.com>
* @copyright 2009 Lucky <douglas@crockford.com> (XGProyecto)
* @copyright 2011 Slaver <slaver7@gmail.com> (Fork/2Moons)
* @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License
* @version 1.3 (2011-01-21)
* @link http://code.google.com/p/2moons/
* Please do not remove the credits
*/
function ShowFleetTraderPage()
{
global $USER, $PLANET, $LNG, $CONF, $pricelist, $resource;
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$CONF['trade_allowed_ships'] = explode(',', $CONF['trade_allowed_ships']);
$ID = request_var('id', 0);
if (!empty($ID) && in_array($ID, $CONF['trade_allowed_ships'])) {
$Count = max(min(request_var('count', '0'), $PLANET[$resource[$ID]]), 0);
$PLANET['metal'] = bcadd($PLANET['metal'], bcmul($Count, bcmul($pricelist[$ID]['metal'], (double) (1 - $CONF['trade_charge']))));
$PLANET['crystal'] = bcadd($PLANET['crystal'], bcmul($Count, bcmul($pricelist[$ID]['crystal'], (double) (1 - $CONF['trade_charge']))));
$PLANET['deuterium'] = bcadd($PLANET['deuterium'], bcmul($Count, bcmul($pricelist[$ID]['deuterium'], (double) (1 - $CONF['trade_charge']))));
$PLANET['norio'] = bcadd($PLANET['norio'], bcmul($Count, bcmul($pricelist[$ID]['norio'], (double) (1 - $CONF['trade_charge']))));
$USER['darkmatter'] = bcadd($USER['darkmatter'], bcmul($Count, bcmul($pricelist[$ID]['darkmatter'], (double) (1 - $CONF['trade_charge']))));
$PlanetRess->Builded[$ID] = bcadd(bcmul('-1', $Count), $PlanetRess->Builded[$ID]);
}
$PlanetRess->SavePlanetToDB();
$template = new template();
$template->loadscript('fleettrader.js');
$template->execscript('updateVars();');
$Cost = array();
foreach ($CONF['trade_allowed_ships'] as $ID) {
$Cost[$ID] = array($PLANET[$resource[$ID]], $pricelist[$ID]['metal'], $pricelist[$ID]['crystal'], $pricelist[$ID]['deuterium'], $pricelist[$ID]['darkmatter'], $pricelist[$ID]['norio']);
}
$template->assign_vars(array('tech' => $LNG['tech'], 'ft_head' => $LNG['ft_head'], 'ft_count' => $LNG['ft_count'], 'ft_max' => $LNG['ft_max'], 'ft_total' => $LNG['ft_total'], 'ft_charge' => $LNG['ft_charge'], 'ft_absenden' => $LNG['ft_absenden'], 'trade_allowed_ships' => $CONF['trade_allowed_ships'], 'CostInfos' => json_encode($Cost), 'Charge' => $CONF['trade_charge']));
$template->show("fleettrader_overview.tpl");
}
示例3: 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');
}
示例4: __construct
public function __construct()
{
global $CONF, $dpath, $LNG, $db, $USER, $PLANET;
$mode = request_var('mode', '');
$msg = request_var('msg', '', true);
$ctype = request_var('chat_type', '');
$MessageID = request_var('id', 0);
switch ($mode) {
case "delete":
$this->DelMeassageFromChat($MessageID);
break;
case "send":
$this->SetMeassageInChat($ctype, $msg);
break;
case "call":
$this->GetMessages($ctype);
break;
default:
$template = new template();
$template->execscript("showMessage();setInterval(showMessage, 10000);");
$template->loadscript("chat.js");
if (empty($ctype)) {
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$PlanetRess->SavePlanetToDB();
} else {
$template->isPopup(true);
}
$template->assign_vars(array('ctype' => $ctype, 'chat_send' => $LNG['chat_send'], 'chat_disc' => $LNG['chat_disc'], 'chat_message' => $LNG['chat_message'], 'chat_bbcode' => $LNG['chat_bbcode'], 'chat_fontcolor' => $LNG['chat_fontcolor'], 'chat_color_white' => $LNG['chat_color_white'], 'chat_color_blue' => $LNG['chat_color_blue'], 'chat_color_yellow' => $LNG['chat_color_yellow'], 'chat_color_green' => $LNG['chat_color_green'], 'chat_color_pink' => $LNG['chat_color_pink'], 'chat_color_red' => $LNG['chat_color_red'], 'chat_color_orange' => $LNG['chat_color_orange'], 'chat_notext' => $LNG['chat_notext'], 'chat_request_url' => $LNG['chat_request_url'], 'chat_request_url_desc' => $LNG['chat_request_url_desc']));
$template->show("chat_overview.tpl");
break;
}
}
示例5: ShowOverviewPage
function ShowOverviewPage()
{
global $CONF, $LNG, $PLANET, $USER, $db, $resource, $UNI;
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$PlanetRess->SavePlanetToDB();
$template = new template();
$template->getplanets();
$AdminsOnline = $AllPlanets = $Moon = array();
foreach ($template->UserPlanets as $ID => $CPLANET) {
if ($ID == $_SESSION['planet'] || $CPLANET['planet_type'] == 3) {
continue;
}
if (!empty($CPLANET['b_building']) && $CPLANET['b_building'] > TIMESTAMP) {
$Queue = explode(';', $CPLANET['b_building_id']);
$CurrBuild = explode(',', $Queue[0]);
$BuildPlanet = $LNG['tech'][$CurrBuild[0]] . " (" . $CurrBuild[1] . ")<br><span style=\"color:#7F7F7F;\">(" . pretty_time($CurrBuild[3] - TIMESTAMP) . ")</span>";
} else {
$BuildPlanet = $LNG['ov_free'];
}
$AllPlanets[] = array('id' => $CPLANET['id'], 'name' => $CPLANET['name'], 'image' => $CPLANET['image'], 'build' => $BuildPlanet);
}
if ($PLANET['id_luna'] != 0) {
$Moon = $db->uniquequery("SELECT `id`, `name` FROM " . PLANETS . " WHERE `id` = '" . $PLANET['id_luna'] . "';");
}
if (!empty($PLANET['b_building'])) {
$Queue = explode(';', $PLANET['b_building_id']);
$CurrBuild = explode(',', $Queue[0]);
$Build = $LNG['tech'][$CurrBuild[0]] . ' (' . $CurrBuild[1] . ')<br><div id="blc">"' . pretty_time($PLANET['b_building'] - TIMESTAMP) . '</div>';
$template->execscript('BuildTime();');
} else {
$Build = $LNG['ov_free'];
}
$OnlineAdmins = $db->query("SELECT `id`,`username` FROM " . USERS . " WHERE `universe` = '" . $UNI . "' AND `onlinetime` >= '" . (TIMESTAMP - 10 * 60) . "' AND `authlevel` > '0';");
while ($AdminRow = $db->fetch_array($OnlineAdmins)) {
$AdminsOnline[$AdminRow['id']] = $AdminRow['username'];
}
$db->free_result($OnlineAdmins);
$template->loadscript('mbContainer.js');
$template->loadscript('overview.js');
$template->execscript('GetFleets(true);');
$template->assign_vars(array('user_rank' => sprintf($LNG['ov_userrank_info'], pretty_number($USER['total_points']), $LNG['ov_place'], $USER['total_rank'], $USER['total_rank'], $LNG['ov_of'], $CONF['users_amount']), 'is_news' => $CONF['OverviewNewsFrame'], 'news' => makebr($CONF['OverviewNewsText']), 'planetname' => $PLANET['name'], 'planetimage' => $PLANET['image'], 'galaxy' => $PLANET['galaxy'], 'system' => $PLANET['system'], 'planet' => $PLANET['planet'], 'buildtime' => $PLANET['b_building'], 'userid' => $USER['id'], 'username' => $USER['username'], 'build' => $Build, 'Moon' => $Moon, 'AllPlanets' => $AllPlanets, 'AdminsOnline' => $AdminsOnline, 'Teamspeak' => GetTeamspeakData(), 'messages' => $USER['new_message'] > 0 ? $USER['new_message'] == 1 ? $LNG['ov_have_new_message'] : sprintf($LNG['ov_have_new_messages'], pretty_number($USER['new_message'])) : false, 'planet_diameter' => pretty_number($PLANET['diameter']), 'planet_field_current' => $PLANET['field_current'], 'planet_field_max' => CalculateMaxPlanetFields($PLANET), 'planet_temp_min' => $PLANET['temp_min'], 'planet_temp_max' => $PLANET['temp_max'], 'ov_news' => $LNG['ov_news'], 'fcm_moon' => $LNG['fcm_moon'], 'ov_server_time' => $LNG['ov_server_time'], 'ov_planet' => $LNG['ov_planet'], 'ov_planetmenu' => $LNG['ov_planetmenu'], 'ov_diameter' => $LNG['ov_diameter'], 'ov_distance_unit' => $LNG['ov_distance_unit'], 'ov_developed_fields' => $LNG['ov_developed_fields'], 'ov_max_developed_fields' => $LNG['ov_max_developed_fields'], 'ov_fields' => $LNG['ov_fields'], 'ov_temperature' => $LNG['ov_temperature'], 'ov_aprox' => $LNG['ov_aprox'], 'ov_temp_unit' => $LNG['ov_temp_unit'], 'ov_to' => $LNG['ov_to'], 'ov_position' => $LNG['ov_position'], 'ov_points' => $LNG['ov_points'], 'ov_events' => $LNG['ov_events'], 'ov_admins_online' => $LNG['ov_admins_online'], 'ov_no_admins_online' => $LNG['ov_no_admins_online'], 'ov_userbanner' => $LNG['ov_userbanner'], 'ov_teamspeak' => $LNG['ov_teamspeak'], 'ov_your_planet' => $LNG['ov_your_planet'], 'ov_coords' => $LNG['ov_coords'], 'ov_planet_name' => $LNG['ov_planet_name'], 'ov_actions' => $LNG['ov_actions'], 'ov_abandon_planet' => $LNG['ov_abandon_planet'], 'ov_planet_rename' => $LNG['ov_planet_rename'], 'ov_planet_rename_action' => $LNG['ov_planet_rename_action'], 'ov_password' => $LNG['ov_password'], 'ov_with_pass' => $LNG['ov_with_pass'], 'ov_security_confirm' => $LNG['ov_security_confirm'], 'ov_security_request' => $LNG['ov_security_request'], 'ov_delete_planet' => $LNG['ov_delete_planet'], 'ov_planet_abandoned' => $LNG['ov_planet_abandoned'], 'path' => PROTOCOL . $_SERVER['HTTP_HOST'] . HTTP_ROOT));
$template->show("overview_body.tpl");
}
示例6: ShowVertify
function ShowVertify()
{
global $CONF, $LNG;
$EXT = explode("|", HTTP::_GP("ext", ""));
$action = HTTP::_GP("action", "");
$file = HTTP::_GP("file", "");
$template = new template();
switch ($action) {
case 'check':
$REV = explode(".", Config::get("VERSION"));
$REV = $REV[2];
$ch = curl_init();
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_URL, 'http://2moons.googlecode.com/svn-history/r' . $REV . '/trunk/' . $file);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_USERAGENT, "2Moons Update API");
curl_setopt($ch, CURLOPT_CRLF, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$FILE = curl_exec($ch);
$SVNHASH = crc32(preg_replace(array("/(\r\n)|(\r)/", '/(\\/\\*[\\d\\D]*?\\*\\/)/', '/\\$I' . 'd[^\\$]+\\$/'), array("\n", '', ''), $FILE));
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) == 404) {
echo 4;
exit;
}
if (curl_errno($ch)) {
echo 3;
exit;
}
curl_close($ch);
$FILE2 = file_get_contents(ROOT_PATH . $file);
$LOCALHASH = crc32(preg_replace(array("/(\r\n)|(\r)/", '/(\\/\\*[\\d\\D]*?\\*\\/)/', '/\\$I' . 'd[^\\$]+\\$/'), array("\n", '', ''), $FILE2));
if ($SVNHASH == $LOCALHASH) {
echo 1;
exit;
} else {
echo 2;
exit;
}
exit;
break;
case 'vertify':
$template->loadscript('vertify.js');
$template->show("VertifyPageResult.tpl");
exit;
break;
case 'getFileList':
echo json_encode(array_merge(dir_tree('./', $EXT, false), dir_tree('chat/', $EXT), dir_tree('includes/', $EXT), dir_tree('includes/', $EXT), dir_tree('language/', $EXT), dir_tree('scripts/', $EXT), dir_tree('styles/', $EXT)));
exit;
break;
}
$template->show("VertifyPage.tpl");
}
示例7: __construct
public function __construct()
{
global $USER, $PLANET, $dpath, $resource, $LNG, $db, $reslist;
$template = new template();
$template->page_header();
$template->page_topnav();
$template->page_leftmenu();
$template->page_planetmenu();
$template->page_footer();
$template->loadscript('galaxy.js');
$maxfleet = $db->num_rows($db->query("SELECT fleet_id FROM " . FLEETS . " WHERE `fleet_owner` = '" . $USER['id'] . "' AND `fleet_mission` != 10;"));
$mode = request_var('mode', 0);
$galaxyLeft = request_var('galaxyLeft', '');
$galaxyRight = request_var('galaxyRight', '');
$systemLeft = request_var('systemLeft', '');
$systemRight = request_var('systemRight', '');
$galaxy = min(max(abs(request_var('galaxy', $PLANET['galaxy'])), 1), MAX_GALAXY_IN_WORLD);
$system = min(max(abs(request_var('system', $PLANET['system'])), 1), MAX_SYSTEM_IN_GALAXY);
$planet = min(max(abs(request_var('planet', $PLANET['planet'])), 1), MAX_PLANET_IN_SYSTEM);
$current = request_var('current', 0);
if ($mode == 1) {
if (!empty($galaxyLeft)) {
$galaxy = max($galaxy - 1, 1);
} elseif (!empty($galaxyRight)) {
$galaxy = min($galaxy + 1, MAX_GALAXY_IN_WORLD);
}
if (!empty($systemLeft)) {
$system = max($system - 1, 1);
} elseif (!empty($systemRight)) {
$system = min($system + 1, MAX_SYSTEM_IN_GALAXY);
}
}
if (!($galaxy == $PLANET['galaxy'] && $system == $PLANET['system']) && $mode != 0) {
if ($PLANET['deuterium'] < 10) {
$template->message($LNG['gl_no_deuterium_to_view_galaxy'], "game.php?page=galaxy&mode=0", 2);
exit;
} else {
$PLANET['deuterium'] -= 10;
}
}
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$PlanetRess->SavePlanetToDB();
unset($reslist['defense'][array_search(502, $reslist['defense'])]);
$MissleSelector[0] = $LNG['gl_all_defenses'];
foreach ($reslist['defense'] as $Element) {
$MissleSelector[$Element] = $LNG['tech'][$Element];
}
$Result = $this->ShowGalaxyRows($galaxy, $system);
$template->assign_vars(array('GalaxyRows' => $Result['Result'], 'planetcount' => sprintf($LNG['gl_populed_planets'], $Result['planetcount']), 'mode' => $mode, 'galaxy' => $galaxy, 'system' => $system, 'planet' => $planet, 'current' => $current, 'currentmip' => pretty_number($PLANET[$resource[503]]), 'maxfleetcount' => $maxfleet, 'fleetmax' => $USER['computer_tech'] + 1 + $USER['rpg_commandant'] * COMMANDANT, 'grecyclers' => pretty_number($PLANET[$resource[219]]), 'recyclers' => pretty_number($PLANET[$resource[209]]), 'spyprobes' => pretty_number($PLANET[$resource[210]]), 'missile_count' => sprintf($LNG['gl_missil_to_launch'], $PLANET[$resource[503]]), 'spio_anz' => $USER['spio_anz'], 'settings_fleetactions' => $USER['settings_fleetactions'], 'current_galaxy' => $PLANET['galaxy'], 'current_system' => $PLANET['system'], 'current_planet' => $PLANET['planet'], 'planet_type' => $PLANET['planet_type'], 'MissleSelector' => $MissleSelector, 'gl_solar_system' => $LNG['gl_solar_system'], 'gl_galaxy' => $LNG['gl_galaxy'], 'gl_missil_launch_action' => $LNG['gl_missil_launch_action'], 'gl_objective' => $LNG['gl_objective'], 'gl_missil_launch' => $LNG['gl_missil_launch'], 'gl_pos' => $LNG['gl_pos'], 'gl_planet' => $LNG['gl_planet'], 'gl_alliance' => $LNG['gl_alliance'], 'gl_actions' => $LNG['gl_actions'], 'gl_name_activity' => $LNG['gl_name_activity'], 'gl_player_estate' => $LNG['gl_player_estate'], 'gl_debris' => $LNG['gl_debris'], 'gl_moon' => $LNG['gl_moon'], 'gl_show' => $LNG['gl_show'], 'gl_out_space' => $LNG['gl_out_space'], 'gl_legend' => $LNG['gl_legend'], 'gl_strong_player' => $LNG['gl_strong_player'], 'gl_s' => $LNG['gl_s'], 'gl_week_player' => $LNG['gl_week_player'], 'gl_w' => $LNG['gl_w'], 'gl_vacation' => $LNG['gl_vacation'], 'gl_v' => $LNG['gl_v'], 'gl_banned' => $LNG['gl_banned'], 'gl_b' => $LNG['gl_b'], 'gl_inactive_seven' => $LNG['gl_inactive_seven'], 'gl_i' => $LNG['gl_i'], 'gl_inactive_twentyeight' => $LNG['gl_inactive_twentyeight'], 'gl_I' => $LNG['gl_I'], 'gl_avaible_grecyclers' => $LNG['gl_avaible_grecyclers'], 'gl_avaible_recyclers' => $LNG['gl_avaible_recyclers'], 'gl_avaible_spyprobes' => $LNG['gl_avaible_spyprobes'], 'gl_fleets' => $LNG['gl_fleets'], 'gl_avaible_missiles' => $LNG['gl_avaible_missiles'], 'gl_moon' => $LNG['gl_moon'], 'gl_diameter' => $LNG['gl_diameter'], 'gl_features' => $LNG['gl_features'], 'gl_temperature' => $LNG['gl_temperature'], 'gl_actions' => $LNG['gl_actions'], 'gl_debris_field' => $LNG['gl_debris_field'], 'gl_resources' => $LNG['gl_resources'], 'gl_collect' => $LNG['gl_collect'], 'gl_with' => $LNG['gl_with'], 'gl_alliance_page' => $LNG['gl_alliance_page'], 'gl_see_on_stats' => $LNG['gl_see_on_stats'], 'gl_alliance_web_page' => $LNG['gl_alliance_web_page'], 'gl_spy' => $LNG['gl_spy'], 'gl_buddy_request' => $LNG['gl_buddy_request'], 'gl_missile_attack' => $LNG['gl_missile_attack'], 'gl_player' => $LNG['gl_player'], 'gl_playercard' => $LNG['gl_playercard'], 'gl_phalanx' => $LNG['gl_phalanx'], 'gl_points' => $LNG['gl_points'], 'gl_ajax_status_ok' => $LNG['gl_ajax_status_ok'], 'gl_ajax_status_fail' => $LNG['gl_ajax_status_fail'], 'write_message' => $LNG['write_message']));
$template->show('galaxy_overview.tpl');
}
示例8: ShowSupportTickets
private function ShowSupportTickets()
{
global $USER, $PLANET, $db, $LNG;
$query = $db->query("SELECT ID,time,text,subject,status FROM " . SUPP . " WHERE `player_id` = '" . $USER['id'] . "';");
$TicketsList = array();
while ($ticket = $db->fetch_array($query)) {
$TicketsList[$ticket['ID']] = array('status' => $ticket['status'], 'subject' => $ticket['subject'], 'date' => date(TDFORMAT, $ticket['time']), 'text' => html_entity_decode($ticket['text'], ENT_NOQUOTES, "UTF-8"));
}
$db->free_result($query);
$template = new template();
$template->loadscript('support.js');
$template->assign_vars(array('TicketsList' => $TicketsList, 'text' => $LNG['text'], 'supp_header' => $LNG['supp_header'], 'ticket_id' => $LNG['ticket_id'], 'subject' => $LNG['subject'], 'status' => $LNG['status'], 'ticket_posted' => $LNG['ticket_posted'], 'supp_send' => $LNG['supp_send'], 'supp_close' => $LNG['supp_close'], 'supp_open' => $LNG['supp_open'], 'supp_admin_answer' => $LNG['supp_admin_answer'], 'supp_player_answer' => $LNG['supp_player_answer'], 'supp_ticket_close' => $LNG['supp_ticket_close'], 'subject' => $LNG['subject'], 'status' => $LNG['status'], 'ticket_new' => $LNG['ticket_new']));
$template->show("support_overview.tpl");
}
示例9: ShowImperiumPage
function ShowImperiumPage()
{
global $LNG, $USER, $PLANET, $resource, $reslist, $db;
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$PlanetRess->SavePlanetToDB();
$template = new template();
$template->loadscript("trader.js");
$template->page_topnav();
$template->page_header();
$template->page_leftmenu();
$template->page_planetmenu();
$template->page_footer();
$SQLArray = array_merge($reslist['build'], $reslist['fleet'], $reslist['defense']);
$Query = "";
foreach ($SQLArray as $id => $gid) {
$Query .= ",`" . $resource[$gid] . "`";
}
if ($USER['planet_sort'] == 0) {
$Order = "`id` ";
} elseif ($USER['planet_sort'] == 1) {
$Order = "`galaxy`, `system`, `planet`, `planet_type` ";
} elseif ($USER['planet_sort'] == 2) {
$Order = "`name` ";
}
$Order .= $USER['planet_sort_order'] == 1 ? "DESC" : "ASC";
$PlanetsRAW = $db->query("\r\n\tSELECT `id`,`name`,`galaxy`,`system`,`planet`,`planet_type`,\r\n\t`image`,`field_current`,`field_max`,`metal`,`crystal`,`deuterium`,\r\n\t`energy_used`,`energy_max` " . $Query . " FROM " . PLANETS . " WHERE `id_owner` = '" . $USER['id'] . "' AND `destruyed` = '0' ORDER BY " . $Order . ";");
while ($Planet = $db->fetch_array($PlanetsRAW)) {
$InfoList = array('id' => $Planet['id'], 'name' => $Planet['name'], 'image' => $Planet['image'], 'galaxy' => $Planet['galaxy'], 'system' => $Planet['system'], 'planet' => $Planet['planet'], 'field_current' => $Planet['field_current'], 'field_max' => CalculateMaxPlanetFields($Planet), 'metal' => pretty_number($Planet['metal']), 'crystal' => pretty_number($Planet['crystal']), 'deuterium' => pretty_number($Planet['deuterium']), 'energy_used' => pretty_number($Planet['energy_max'] + $Planet['energy_used']), 'energy_max' => pretty_number($Planet['energy_max']));
foreach ($reslist['build'] as $gid) {
$BuildsList[$gid] = pretty_number($Planet[$resource[$gid]]);
}
foreach ($reslist['fleet'] as $gid) {
$FleetsList[$gid] = pretty_number($Planet[$resource[$gid]]);
}
foreach ($reslist['defense'] as $gid) {
$DefensesList[$gid] = pretty_number($Planet[$resource[$gid]]);
}
$PlanetsList[] = array('InfoList' => $InfoList, 'BuildsList' => $BuildsList, 'FleetsList' => $FleetsList, 'DefensesList' => $DefensesList);
}
foreach ($reslist['tech'] as $gid) {
$ResearchList[$gid] = pretty_number($USER[$resource[$gid]]);
}
$template->assign_vars(array('colspan' => count($PlanetsList) + 1, 'PlanetsList' => $PlanetsList, 'ResearchList' => $ResearchList, 'iv_imperium_title' => $LNG['iv_imperium_title'], 'iv_planet' => $LNG['iv_planet'], 'iv_name' => $LNG['iv_name'], 'iv_coords' => $LNG['iv_coords'], 'iv_fields' => $LNG['iv_fields'], 'iv_resources' => $LNG['iv_resources'], 'Metal' => $LNG['Metal'], 'Crystal' => $LNG['Crystal'], 'Deuterium' => $LNG['Deuterium'], 'Energy' => $LNG['Energy'], 'iv_buildings' => $LNG['iv_buildings'], 'iv_technology' => $LNG['iv_technology'], 'iv_ships' => $LNG['iv_ships'], 'iv_defenses' => $LNG['iv_defenses'], 'tech' => $LNG['tech'], 'build' => $reslist['build'], 'fleet' => $reslist['fleet'], 'defense' => $reslist['defense'], 'research' => $reslist['tech']));
$template->show("empire_overview.tpl");
}
示例10: __construct
public function __construct()
{
global $USER, $PLANET, $resource, $reslist, $LNG, $db, $ExtraDM;
$action = request_var('action', '');
$Offi = request_var('offi', 0);
$Extra = request_var('extra', 0);
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
if ($action == "send" && $USER['urlaubs_modus'] == 0) {
if (!empty($Offi) && !CheckModule(8)) {
$this->UpdateOfficier($Offi);
} elseif (!empty($Extra) && !CheckModule(18)) {
$this->UpdateExtra($Extra);
}
}
$PlanetRess->SavePlanetToDB();
$template = new template();
$template->loadscript('officier.js');
$template->page_header();
$template->page_topnav();
$template->page_leftmenu();
$template->page_planetmenu();
$template->page_footer();
if (!CheckModule(8)) {
foreach ($reslist['dmfunc'] as $Element) {
if ($USER[$resource[$Element]] > TIMESTAMP) {
$template->execscript("GetOfficerTime(" . $Element . ", " . ($USER[$resource[$Element]] - TIMESTAMP) . ");");
}
$ExtraDMList[] = array('id' => $Element, 'active' => $USER[$resource[$Element]] - TIMESTAMP, 'price' => pretty_number($ExtraDM[$Element]['darkmatter']), 'isok' => $USER['darkmatter'] - $ExtraDM[$Element]['darkmatter'] >= 0 ? true : false, 'time' => pretty_time($ExtraDM[$Element]['time'] * 3600), 'name' => $LNG['tech'][$Element], 'desc' => sprintf($LNG['res']['descriptions'][$Element], $ExtraDM[$Element]['add'] * 100));
}
}
if (!CheckModule(18)) {
foreach ($reslist['officier'] as $Element) {
if (($Result = $this->IsOfficierAccessible($Element)) === 0) {
continue;
}
$OfficierList[] = array('id' => $Element, 'level' => $USER[$resource[$Element]], 'name' => $LNG['tech'][$Element], 'desc' => $LNG['res']['descriptions'][$Element], 'Result' => $Result);
}
}
$template->assign_vars(array('ExtraDMList' => $ExtraDMList, 'OfficierList' => $OfficierList, 'user_darkmatter' => floor($USER['darkmatter'] / DM_PRO_OFFICIER_LEVEL), 'of_max_lvl' => $LNG['of_max_lvl'], 'of_recruit' => $LNG['of_recruit'], 'of_darkmatter' => sprintf($LNG['of_points_per_thousand_darkmatter'], DM_PRO_OFFICIER_LEVEL, $LNG['Darkmatter']), 'of_available_points' => $LNG['of_available_points'], 'alv_points' => $LNG['alv_points'], 'of_lvl' => $LNG['of_lvl'], 'in_dest_durati' => $LNG['in_dest_durati'], 'of_still' => $LNG['of_still'], 'of_active' => $LNG['of_active'], 'of_update' => $LNG['of_update'], 'in_dest_durati' => $LNG['in_dest_durati'], 'of_dm_trade' => sprintf($LNG['of_dm_trade'], $LNG['Darkmatter'])));
$template->show("officier_overview.tpl");
}
示例11: ShowBanPage
function ShowBanPage()
{
global $LNG, $db, $USER;
if ($_GET['order'] == 'id') {
$ORDER = "id";
} else {
$ORDER = "username";
}
if ($_GET['view'] == 'bana') {
$WHEREBANA = "AND `bana` = '1'";
}
$UserList = $db->query("SELECT `username`, `id`, `bana` FROM " . USERS . " WHERE `id` != 1 AND `authlevel` <= '" . $USER['authlevel'] . "' " . $WHEREBANA . " ORDER BY " . $ORDER . " ASC;");
$UserSelect = array('List' => '', 'ListBan' => '');
$Users = 0;
while ($a = $db->fetch_array($UserList)) {
$UserSelect['List'] .= '<option value="' . $a['username'] . '">' . $a['username'] . ' (ID: ' . $a['id'] . ')' . ($a['bana'] == '1' ? $LNG['bo_characters_suus'] : '') . '</option>';
$Users++;
}
$db->free_result($UserList);
if ($_GET['order2'] == 'id') {
$ORDER2 = "id";
} else {
$ORDER2 = "username";
}
$Banneds = 0;
$UserListBan = $db->query("SELECT `username`, `id` FROM " . USERS . " WHERE `bana` = '1' ORDER BY " . $ORDER2 . " ASC;");
while ($b = $db->fetch_array($UserListBan)) {
$UserSelect['ListBan'] .= '<option value="' . $b['username'] . '">' . $b['username'] . ' (ID: ' . $b['id'] . ')</option>';
$Banneds++;
}
$db->free_result($UserListBan);
$template = new template();
$template->loadscript('filterlist.js');
$template->page_header();
if (isset($_POST['panel'])) {
$Name = request_var('ban_name', '', true);
$BANUSER = $db->uniquequery("SELECT b.theme, b.longer, u.id, u.urlaubs_modus, u.banaday FROM " . USERS . " as u LEFT JOIN " . BANNED . " as b ON u.`username` = b.`who` WHERE u.`username` = '" . $db->sql_escape($Name) . "';");
if ($BANUSER['banaday'] <= TIMESTAMP) {
$title = $LNG['bo_bbb_title_1'];
$changedate = $LNG['bo_bbb_title_2'];
$changedate_advert = '';
$reas = '';
$timesus = '';
} else {
$title = $LNG['bo_bbb_title_3'];
$changedate = $LNG['bo_bbb_title_6'];
$changedate_advert = '<td class="c" width="18px"><img src="./styles/images/Adm/i.gif" onMouseOver="return overlib(\'' . $LNG['bo_bbb_title_4'] . '\', CENTER, OFFSETX, -80, OFFSETY, -65, WIDTH, 250);" onMouseOut="return nd();"></td>';
$reas = $BANUSER['theme'];
$timesus = "<tr>\r\n\t\t\t\t\t<th>" . $LNG['bo_bbb_title_5'] . "</th>\r\n\t\t\t\t\t<th height=25 colspan=2>" . date("d-m-Y H:i:s", $BANUSER['longer']) . "</th>\r\n\t\t\t\t</tr>";
}
$vacation = $BANUSER['urlaubs_modus'] == 1 ? true : false;
$template->assign_vars(array('name' => $Name, 'bantitle' => $title, 'changedate' => $changedate, 'reas' => $reas, 'changedate_advert' => $changedate_advert, 'timesus' => $timesus, 'vacation' => $vacation, 'bo_characters_1' => $LNG['bo_characters_1'], 'bo_reason' => $LNG['bo_reason'], 'bo_username' => $LNG['bo_username'], 'bo_vacation_mode' => $LNG['bo_vacation_mode'], 'bo_vacaations' => $LNG['bo_vacaations'], 'time_seconds' => $LNG['time_seconds'], 'time_minutes' => $LNG['time_minutes'], 'time_hours' => $LNG['time_hours'], 'time_days' => $LNG['time_days']));
} elseif (isset($_POST['bannow']) && $BANUSER['id'] != 1) {
$Name = request_var('ban_name', '', true);
$reas = request_var('why', '', true);
$days = request_var('days', 0);
$hour = request_var('hour', 0);
$mins = request_var('mins', 0);
$secs = request_var('secs', 0);
$admin = $USER['username'];
$mail = $USER['email'];
$BanTime = $days * 86400 + $hour * 3600 + $mins * 60 + $secs;
if ($BANUSER['longer'] > TIMESTAMP) {
$BanTime += $BANUSER['longer'] - TIMESTAMP;
}
if ($BanTime + TIMESTAMP < TIMESTAMP) {
$BannedUntil = TIMESTAMP;
} else {
$BannedUntil = TIMESTAMP + $BanTime;
}
if ($BANUSER['banaday'] > TIMESTAMP) {
$SQL = "UPDATE " . BANNED . " SET ";
$SQL .= "`who` = '" . $Name . "', ";
$SQL .= "`theme` = '" . $reas . "', ";
$SQL .= "`who2` = '" . $Name . "', ";
$SQL .= "`time` = '" . TIMESTAMP . "', ";
$SQL .= "`longer` = '" . $BannedUntil . "', ";
$SQL .= "`author` = '" . $admin . "', ";
$SQL .= "`email` = '" . $mail . "' ";
$SQL .= "WHERE `who2` = '" . $Name . "';";
$db->query($SQL);
} else {
$SQL = "INSERT INTO " . BANNED . " SET ";
$SQL .= "`who` = '" . $Name . "', ";
$SQL .= "`theme` = '" . $reas . "', ";
$SQL .= "`who2` = '" . $Name . "', ";
$SQL .= "`time` = '" . TIMESTAMP . "', ";
$SQL .= "`longer` = '" . $BannedUntil . "', ";
$SQL .= "`author` = '" . $admin . "', ";
$SQL .= "`email` = '" . $mail . "';";
$db->query($SQL);
}
$SQL = "UPDATE " . USERS . " SET ";
$SQL .= "`bana` = '1', ";
$SQL .= "`banaday` = '" . $BannedUntil . "', ";
if (isset($_POST['vacat'])) {
$SQL .= "`urlaubs_modus` = '1'";
} else {
$SQL .= "`urlaubs_modus` = '0'";
}
//.........这里部分代码省略.........
示例12: __construct
public function __construct()
{
global $ProdGrid, $LNG, $resource, $reslist, $CONF, $db, $PLANET, $USER;
include_once ROOT_PATH . 'includes/functions/IsTechnologieAccessible.php';
include_once ROOT_PATH . 'includes/functions/GetElementPrice.php';
$TheCommand = request_var('cmd', '');
$Element = request_var('building', 0);
$ListID = request_var('listid', 0);
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
if (!empty($Element) && $USER['urlaubs_modus'] == 0 && (IsTechnologieAccessible($USER, $PLANET, $Element) && in_array($Element, $reslist['allow'][$PLANET['planet_type']])) || $TheCommand == "cancel" || $TheCommand == "remove") {
if ($Element == 31 && $USER["b_tech_planet"] != 0 || ($Element == 15 || $Element == 21) && !empty($PLANET['b_hangar_id'])) {
$TheCommand = '';
}
switch ($TheCommand) {
case 'cancel':
$this->CancelBuildingFromQueue($PlanetRess);
break;
case 'remove':
$this->RemoveBuildingFromQueue($ListID, $PlanetRess);
break;
case 'insert':
$this->AddBuildingToQueue($Element, true);
break;
case 'destroy':
$this->AddBuildingToQueue($Element, false);
break;
}
}
$PlanetRess->SavePlanetToDB();
$Queue = $this->ShowBuildingQueue();
$template = new template();
$CanBuildElement = count($Queue) < MAX_BUILDING_QUEUE_SIZE ? true : false;
$BuildingPage = "";
$CurrentMaxFields = CalculateMaxPlanetFields($PLANET);
$RoomIsOk = $PLANET["field_current"] < $CurrentMaxFields - count($Queue) ? true : false;
$BuildEnergy = $USER[$resource[113]];
$BuildLevelFactor = 10;
$BuildTemp = $PLANET['temp_max'];
foreach ($reslist['allow'][$PLANET['planet_type']] as $ID => $Element) {
if (!IsTechnologieAccessible($USER, $PLANET, $Element)) {
continue;
}
$HaveRessources = IsElementBuyable($USER, $PLANET, $Element, true, false);
if (in_array($Element, $reslist['prod'])) {
$BuildLevel = $PLANET[$resource[$Element]];
$Need = floor(eval($ProdGrid[$Element]['formule']['energy']) * $CONF['resource_multiplier']) * (1 + ($this->TIME - $this->USER[$resource[704]] <= 0) ? 1 + $ExtraDM[704]['add'] : 1);
$BuildLevel += 1;
$Prod = floor(eval($ProdGrid[$Element]['formule']['energy']) * $CONF['resource_multiplier']) * (1 + ($this->TIME - $this->USER[$resource[704]] <= 0) ? 1 + $ExtraDM[704]['add'] : 1);
$EnergyNeed = $Prod - $Need;
} else {
unset($EnergyNeed);
}
$parse['click'] = '';
$NextBuildLevel = $PLANET[$resource[$Element]] + 1;
if ($RoomIsOk && $CanBuildElement) {
$parse['click'] = $HaveRessources == true ? "<a href=\"game.php?page=buildings&cmd=insert&building=" . $Element . "\"><span style=\"color:#00FF00\">" . ($PLANET['b_building'] != 0 ? $LNG['bd_add_to_list'] : ($NextBuildLevel == 1 ? $LNG['bd_build'] : $LNG['bd_build_next_level'] . $NextBuildLevel)) . "</span></a>" : "<span style=\"color:#FF0000\">" . ($NextBuildLevel == 1 ? $LNG['bd_build'] : $LNG['bd_build_next_level'] . $NextBuildLevel) . "</span>";
} elseif ($RoomIsOk && !$CanBuildElement) {
$parse['click'] = "<span style=\"color:#FF0000\">" . ($NextBuildLevel == 1 ? $LNG['bd_build'] : $LNG['bd_build_next_level'] . $NextBuildLevel) . "</span>";
} else {
$parse['click'] = "<span style=\"color:#FF0000\">" . $LNG['bd_no_more_fields'] . "</span>";
}
if (($Element == 6 || $Element == 31) && $USER['b_tech'] > TIMESTAMP) {
$parse['click'] = "<span style=\"color:#FF0000\">" . $LNG['bd_working'] . "</span>";
} elseif (($Element == 15 || $Element == 21) && !empty($PLANET['b_hangar_id'])) {
$parse['click'] = "<span style=\"color:#FF0000\">" . $LNG['bd_working'] . "</span>";
}
$BuildInfoList[] = array('id' => $Element, 'name' => $LNG['tech'][$Element], 'descriptions' => $LNG['res']['descriptions'][$Element], 'level' => $PLANET[$resource[$Element]], 'destroyress' => array_map('pretty_number', GetBuildingPrice($USER, $PLANET, $Element, true, true)), 'destroytime' => pretty_time(GetBuildingTime($USER, $PLANET, $Element, true)), 'price' => GetElementPrice($USER, $PLANET, $Element, true), 'time' => pretty_time(GetBuildingTime($USER, $PLANET, $Element)), 'EnergyNeed' => isset($EnergyNeed) ? sprintf($EnergyNeed < 0 ? $LNG['bd_need_engine'] : $LNG['bd_more_engine'], pretty_number(abs($EnergyNeed)), $LNG['Energy']) : "", 'BuildLink' => $parse['click'], 'restprice' => $this->GetRestPrice($Element));
}
if ($PLANET['b_building'] != 0) {
$template->execscript('ReBuildView();Buildlist();');
$template->loadscript('buildlist.js');
$template->assign_vars(array('data' => json_encode(array('bd_cancel' => $LNG['bd_cancel'], 'bd_continue' => $LNG['bd_continue'], 'bd_finished' => $LNG['bd_finished'], 'build' => $Queue))));
}
$template->assign_vars(array('BuildInfoList' => $BuildInfoList, 'bd_lvl' => $LNG['bd_lvl'], 'bd_next_level' => $LNG['bd_next_level'], 'Metal' => $LNG['Metal'], 'Crystal' => $LNG['Crystal'], 'Deuterium' => $LNG['Deuterium'], 'Norio' => $LNG['Norio'], 'Darkmatter' => $LNG['Darkmatter'], 'bd_dismantle' => $LNG['bd_dismantle'], 'fgf_time' => $LNG['fgf_time'], 'bd_remaining' => $LNG['bd_remaining'], 'bd_jump_gate_action' => $LNG['bd_jump_gate_action'], 'bd_price_for_destroy' => $LNG['bd_price_for_destroy'], 'bd_destroy_time' => $LNG['bd_destroy_time']));
$template->show("buildings_overview.tpl");
}
示例13: ShowMessagesPage
function ShowMessagesPage()
{
global $USER, $PLANET, $CONF, $dpath, $LNG, $db;
$MessCategory = request_var('messcat', 0);
$MessPageMode = request_var('mode', '');
$DeleteWhat = request_var('deletemessages', '');
$Send = request_var('send', 0);
$OwnerID = request_var('id', 0);
$Subject = request_var('subject', '', true);
$MessageType = array(0, 1, 2, 3, 4, 5, 15, 50, 99, 100, 999);
$TitleColor = array(0 => '#FFFF00', 1 => '#FF6699', 2 => '#FF3300', 3 => '#FF9900', 4 => '#773399', 5 => '#009933', 15 => '#6495ed', 50 => '#666600', 99 => '#007070', 100 => '#ABABAB', 999 => '#CCCCCC');
$template = new template();
switch ($MessPageMode) {
case 'write':
$template->page_header();
$template->page_footer();
$OwnerRecord = $db->uniquequery("SELECT a.galaxy, a.system, a.planet, b.username, b.id_planet FROM " . PLANETS . " as a, " . USERS . " as b WHERE b.id = '" . $OwnerID . "' AND a.id = b.id_planet;");
if (!$OwnerRecord) {
$template->message($LNG['mg_error'], false, 0, true);
}
if ($Send) {
$Owner = $OwnerID;
$Message = makebr(request_var('text', '', true));
$From = $USER['username'] . ' [' . $USER['galaxy'] . ':' . $USER['system'] . ':' . $USER['planet'] . ']';
SendSimpleMessage($OwnerID, $USER['id'], '', 1, $From, $Subject, $Message);
exit($LNG['mg_message_send']);
}
$template->assign_vars(array('mg_send_new' => $LNG['mg_send_new'], 'mg_send_to' => $LNG['mg_send_to'], 'mg_send' => $LNG['mg_send'], 'mg_message' => $LNG['mg_message'], 'mg_characters' => $LNG['mg_characters'], 'mg_subject' => $LNG['mg_subject'], 'mg_empty_text' => $LNG['mg_empty_text'], 'subject' => empty($Subject) ? $LNG['mg_no_subject'] : $Subject, 'id' => $OwnerID, 'username' => $OwnerRecord['username'], 'galaxy' => $OwnerRecord['galaxy'], 'system' => $OwnerRecord['system'], 'planet' => $OwnerRecord['planet']));
$template->show("message_send_form.tpl");
break;
default:
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$PlanetRess->SavePlanetToDB();
$template->loadscript('message.js');
$template->page_header();
$template->page_topnav();
$template->page_leftmenu();
$template->page_planetmenu();
$template->page_footer();
$UsrMess = $db->query("SELECT `message_type`, `message_unread` FROM " . MESSAGES . " WHERE `message_owner` = '" . $USER['id'] . "' OR `message_type` = '50';");
$GameOps = $db->query("SELECT `username`, `email` FROM " . USERS . " WHERE `authlevel` != '0' ORDER BY `username` ASC;");
$MessOut = $db->uniquequery("SELECT COUNT(*) as count FROM " . MESSAGES . " WHERE message_sender = '" . $USER['id'] . "';");
while ($Ops = $db->fetch_array($GameOps)) {
$OpsList[] = array('username' => $Ops['username'], 'email' => $Ops['email']);
}
$db->free_result($GameOps);
while ($CurMess = $db->fetch_array($UsrMess)) {
$UnRead[$CurMess['message_type']] += $CurMess['message_unread'];
$TotalMess[$CurMess['message_type']] += 1;
}
$db->free_result($UsrMess);
$UnRead[50] += $USER['new_gmessage'];
$UnRead[100] = is_array($UnRead) ? array_sum($UnRead) : 0;
$TotalMess[100] = is_array($TotalMess) ? array_sum($TotalMess) - $TotalMess[50] : 0;
$TotalMess[999] = $MessOut['count'];
foreach ($TitleColor as $MessageID => $MessageColor) {
$MessageList[$MessageID] = array('color' => $MessageColor, 'unread' => !empty($UnRead[$MessageID]) ? $UnRead[$MessageID] : 0, 'total' => !empty($TotalMess[$MessageID]) ? $TotalMess[$MessageID] : 0, 'lang' => $LNG['mg_type'][$MessageID]);
}
$template->assign_vars(array('MessageList' => $MessageList, 'OpsList' => $OpsList, 'mg_overview' => $LNG['mg_overview'], 'mg_game_operators' => $LNG['mg_game_operators']));
$template->show("message_overview.tpl");
break;
}
}
示例14: ShowFleet3Page
public static function ShowFleet3Page()
{
global $USER, $PLANET, $resource, $pricelist, $reslist, $CONF, $db, $LNG;
include_once ROOT_PATH . 'includes/functions/IsVacationMode.' . PHP_EXT;
$template = new template();
$template->loadscript('flotten.js');
$template->gotoside('?page=fleet');
$template->page_header();
$template->page_topnav();
$template->page_leftmenu();
$template->page_planetmenu();
$template->page_footer();
$mission = request_var('mission', 3);
$galaxy = request_var('galaxy', 0);
$system = request_var('system', 0);
$planet = request_var('planet', 0);
$planettype = request_var('planettype', 0);
$fleet_group = request_var('fleet_group', 0);
$GenFleetSpeed = request_var('speed', 0);
$TransportMetal = round(request_var('metal', 0.0), 0);
$TransportCrystal = round(request_var('crystal', 0.0), 0);
$TransportDeuterium = round(request_var('deuterium', 0.0), 0);
$holdingtime = request_var('holdingtime', 0);
$rawfleetarray = request_var('usedfleet', '', true);
$thisgalaxy = $PLANET['galaxy'];
$thissystem = $PLANET['system'];
$thisplanet = $PLANET['planet'];
$thisplanettype = $PLANET['planet_type'];
if (IsVacationMode($USER)) {
exit($template->message($LNG['fl_vacation_mode_active'], 'game.php?page=overview', 2));
}
if ($_SESSION['db']['user_side'] != 'game.php?page=fleet2') {
parent::GotoFleetPage();
}
if (!($planettype >= 1 || $planettype <= 3)) {
parent::GotoFleetPage();
}
if ($PLANET['galaxy'] == $galaxy && $PLANET['system'] == $system && $PLANET['planet'] == $planet && $PLANET['planet_type'] == $planettype) {
parent::GotoFleetPage();
}
if ($galaxy > MAX_GALAXY_IN_WORLD || $galaxy < 1 || $system > MAX_SYSTEM_IN_GALAXY || $system < 1 || $planet > MAX_PLANET_IN_SYSTEM + 1 || $planet < 1) {
parent::GotoFleetPage();
}
if (empty($mission)) {
parent::GotoFleetPage();
}
if (!is_numeric($TransportMetal) || !is_numeric($TransportCrystal) || !is_numeric($TransportDeuterium)) {
parent::GotoFleetPage();
}
if ($TransportMetal + $TransportCrystal + $TransportDeuterium < 1 && $mission == 3) {
$template->message("<font color=\"lime\"><b>" . $LNG['fl_empty_transport'] . "</b></font>", "game." . PHP_EXT . "?page=fleet", 1);
exit;
}
$ActualFleets = parent::GetCurrentFleets($USER['id']);
if (parent::GetMaxFleetSlots($USER) <= $ActualFleets) {
$template->message($LNG['fl_no_slots'], "game." . PHP_EXT . "?page=fleet", 1);
exit;
}
$fleet_group_mr = 0;
if (!empty($fleet_group) && $mission == 2) {
$aks_count_mr = $db->uniquequery("SELECT COUNT(*) as state FROM " . AKS . " WHERE `id` = '" . $fleet_group . "' AND `eingeladen` LIKE '%" . $USER['id'] . "%';");
if ($aks_count_mr['state'] > 0) {
$fleet_group_mr = $fleet_group;
} else {
$mission = 1;
}
}
$ActualFleets = parent::GetCurrentFleets($USER['id']);
$TargetPlanet = $db->uniquequery("SELECT `id_owner`,`id_level`,`destruyed`,`ally_deposit` FROM " . PLANETS . " WHERE `galaxy` = '" . $db->sql_escape($galaxy) . "' AND `system` = '" . $db->sql_escape($system) . "' AND `planet` = '" . $db->sql_escape($planet) . "' AND `planet_type` = '" . $db->sql_escape($planettype) . "';");
if ($mission != 15 && $mission != 8 && $TargetPlanet["destruyed"] != 0 || $mission != 15 && $mission != 7 && $mission != 8 && empty($TargetPlanet['id_owner'])) {
parent::GotoFleetPage();
}
$MyDBRec = $USER;
$FleetArray = parent::GetFleetArray($rawfleetarray);
if (!is_array($FleetArray)) {
parent::GotoFleetPage();
}
$FleetStorage = 0;
$FleetShipCount = 0;
$fleet_array = "";
$FleetSubQRY = "";
foreach ($FleetArray as $Ship => $Count) {
if ($Count > $PLANET[$resource[$Ship]] || $Count < 0) {
parent::GotoFleetPage();
}
$FleetStorage += $pricelist[$Ship]["capacity"] * $Count;
$FleetShipCount += $Count;
$fleet_array .= $Ship . "," . $Count . ";";
$FleetSubQRY .= "`" . $resource[$Ship] . "` = `" . $resource[$Ship] . "` - '" . floattostring($Count) . "', ";
}
$error = 0;
$fleetmission = $mission;
$YourPlanet = false;
$UsedPlanet = false;
if ($mission == 11) {
$maxexpde = parent::GetCurrentFleets($USER['id'], 11);
if ($maxexpde >= MAX_DM_MISSIONS) {
$template->message("<font color=\"red\"><b>" . $LNG['fl_expedition_fleets_limit'] . "</b></font>", "game." . PHP_EXT . "?page=fleet", 2);
exit;
}
//.........这里部分代码省略.........
示例15: ShowOverviewPage
function ShowOverviewPage()
{
global $CONF, $LNG, $PLANET, $USER, $db, $resource;
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$PlanetRess->SavePlanetToDB();
$template = new template();
$template->getplanets();
$AdminsOnline = $AllPlanets = $Moon = array();
foreach ($template->UserPlanets as $ID => $CPLANET) {
if ($ID == $_SESSION['planet'] || $CPLANET['planet_type'] == 3) {
continue;
}
if (!empty($CPLANET['b_building']) && $CPLANET['b_building'] > TIMESTAMP) {
$Queue = explode(';', $CPLANET['b_building_id']);
$CurrBuild = explode(',', $Queue[0]);
$BuildPlanet = $LNG['tech'][$CurrBuild[0]] . " (" . $CurrBuild[1] . ")<br><span style=\"color:#7F7F7F;\">(" . pretty_time($CurrBuild[3] - TIMESTAMP) . ")</span>";
} else {
$BuildPlanet = $LNG['ov_free'];
}
$AllPlanets[] = array('id' => $CPLANET['id'], 'name' => $CPLANET['name'], 'image' => $CPLANET['image'], 'build' => $BuildPlanet);
}
if ($PLANET['id_luna'] != 0) {
$Moon = $db->uniquequery("SELECT `id`, `name` FROM " . PLANETS . " WHERE `id` = '" . $PLANET['id_luna'] . "';");
}
if (!empty($PLANET['b_building'])) {
$Queue = explode(';', $PLANET['b_building_id']);
$CurrBuild = explode(',', $Queue[0]);
$Build = $LNG['tech'][$CurrBuild[0]] . ' (' . $CurrBuild[1] . ')<br><div id="blc">"' . pretty_time($PLANET['b_building'] - TIMESTAMP) . '</div>';
$template->execscript('BuildTime();');
} else {
$Build = $LNG['ov_free'];
}
$Teamspeak = '';
if ($CONF['ts_modon'] == 1) {
if ($CONF['ts_version'] == 2) {
include_once ROOT_PATH . "includes/libs/teamspeak/class.teamspeak2." . PHP_EXT;
$ts = new cyts();
if ($ts->connect($CONF['ts_server'], $CONF['ts_tcpport'], $CONF['ts_udpport'], $CONF['ts_timeout'])) {
$tsdata = $ts->info_serverInfo();
$tsdata2 = $ts->info_globalInfo();
$ts->disconnect();
$trafges = pretty_number($tsdata2["total_bytessend"] / 1024 / 1024 + $tsdata2["total_bytesreceived"] / 1024 / 1024);
$Teamspeak = sprintf($LNG['ov_teamspeak_v2'], $CONF['ts_server'], $CONF['ts_udpport'], $USER['username'], $tsdata["server_currentusers"], $tsdata["server_maxusers"], $tsdata["server_currentchannels"], $trafges);
} else {
$Teamspeak = $LNG['ov_teamspeak_not_online'];
}
} elseif ($CONF['ts_version'] == 3) {
$ip = $CONF['ts_server'];
$port = $CONF['ts_tcpport'];
$t_port = $CONF['ts_udpport'];
$sid = $CONF['ts_timeout'];
require_once ROOT_PATH . "includes/libs/teamspeak/class.teamspeak3." . PHP_EXT;
$tsAdmin = new ts3admin($ip, $t_port);
if ($tsAdmin->connect()) {
$tsAdmin->selectServer($sid);
#$tsAdmin->login($username, $password); Insert the SA Account Details, if Teamspeak banned you.
$sinfo = $tsAdmin->serverInfo();
$tsAdmin->logout();
$tsAdmin->quit();
$trafges = round($sinfo['connection_bytes_received_total'] / 1024 / 1024 + $sinfo['connection_bytes_sent_total'] / 1024 / 1024, 2);
$Debug = $tsAdmin->getDebugLog();
if ($Debug == "Error while fetching: 'error id=518 msg=not logged in'<br>") {
$Teamspeak = sprintf($LNG['ov_teamspeak_v3'], $ip, $port, $USER['username'], $sinfo['virtualserver_password'], $sinfo['virtualserver_clientsonline'] - 1, $sinfo['virtualserver_maxclients'], $sinfo['virtualserver_channelsonline'], $trafges);
} else {
$Teamspeak = $Debug;
}
} else {
$Teamspeak = $LNG['ov_teamspeak_not_online'];
}
}
}
$OnlineAdmins = $db->query("SELECT `id`,`username` FROM " . USERS . " WHERE `onlinetime` >= '" . (TIMESTAMP - 10 * 60) . "' AND `authlevel` > '0';");
while ($AdminRow = $db->fetch_array($OnlineAdmins)) {
$AdminsOnline[$AdminRow['id']] = $AdminRow['username'];
}
$db->free_result($OnlineAdmins);
$template->loadscript('mbContainer.js');
$template->loadscript('overview.js');
$template->execscript('GetFleets(true);');
$template->page_header();
$template->page_topnav();
$template->page_leftmenu();
$template->page_planetmenu();
$template->page_footer();
$template->assign_vars(array('user_rank' => sprintf($LNG['ov_userrank_info'], pretty_number($USER['total_points']), $LNG['ov_place'], $USER['total_rank'], $USER['total_rank'], $LNG['ov_of'], $CONF['users_amount']), 'is_news' => $CONF['OverviewNewsFrame'], 'news' => makebr($CONF['OverviewNewsText']), 'planetname' => $PLANET['name'], 'planetimage' => $PLANET['image'], 'galaxy' => $PLANET['galaxy'], 'system' => $PLANET['system'], 'planet' => $PLANET['planet'], 'buildtime' => $PLANET['b_building'], 'userid' => $USER['id'], 'username' => $USER['username'], 'build' => $Build, 'Moon' => $Moon, 'AllPlanets' => $AllPlanets, 'AdminsOnline' => $AdminsOnline, 'Teamspeak' => $Teamspeak, 'messages' => $USER['new_message'] > 0 ? $USER['new_message'] == 1 ? $LNG['ov_have_new_message'] : sprintf($LNG['ov_have_new_messages'], pretty_number($USER['new_message'])) : false, 'planet_diameter' => pretty_number($PLANET['diameter']), 'planet_field_current' => $PLANET['field_current'], 'planet_field_max' => CalculateMaxPlanetFields($PLANET), 'planet_temp_min' => $PLANET['temp_min'], 'planet_temp_max' => $PLANET['temp_max'], 'ov_news' => $LNG['ov_news'], 'fcm_moon' => $LNG['fcm_moon'], 'ov_server_time' => $LNG['ov_server_time'], 'ov_planet' => $LNG['ov_planet'], 'ov_planetmenu' => $LNG['ov_planetmenu'], 'ov_diameter' => $LNG['ov_diameter'], 'ov_distance_unit' => $LNG['ov_distance_unit'], 'ov_developed_fields' => $LNG['ov_developed_fields'], 'ov_max_developed_fields' => $LNG['ov_max_developed_fields'], 'ov_fields' => $LNG['ov_fields'], 'ov_temperature' => $LNG['ov_temperature'], 'ov_aprox' => $LNG['ov_aprox'], 'ov_temp_unit' => $LNG['ov_temp_unit'], 'ov_to' => $LNG['ov_to'], 'ov_position' => $LNG['ov_position'], 'ov_points' => $LNG['ov_points'], 'ov_events' => $LNG['ov_events'], 'ov_admins_online' => $LNG['ov_admins_online'], 'ov_no_admins_online' => $LNG['ov_no_admins_online'], 'ov_userbanner' => $LNG['ov_userbanner'], 'ov_teamspeak' => $LNG['ov_teamspeak'], 'ov_your_planet' => $LNG['ov_your_planet'], 'ov_coords' => $LNG['ov_coords'], 'ov_planet_name' => $LNG['ov_planet_name'], 'ov_actions' => $LNG['ov_actions'], 'ov_abandon_planet' => $LNG['ov_abandon_planet'], 'ov_planet_rename' => $LNG['ov_planet_rename'], 'ov_planet_rename_action' => $LNG['ov_planet_rename_action'], 'ov_password' => $LNG['ov_password'], 'ov_with_pass' => $LNG['ov_with_pass'], 'ov_security_confirm' => $LNG['ov_security_confirm'], 'ov_security_request' => $LNG['ov_security_request'], 'ov_delete_planet' => $LNG['ov_delete_planet'], 'ov_planet_abandoned' => $LNG['ov_planet_abandoned'], 'path' => PROTOCOL . $_SERVER['HTTP_HOST'] . HTTP_ROOT));
$template->show("overview_body.tpl");
}