示例#1
0
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
0
/**
 _  \_/ |\ | /¯¯\ \  / /\    |¯¯) |_¯ \  / /¯¯\ |  |   |´¯|¯` | /¯¯\ |\ |5
 ¯  /¯\ | \| \__/  \/ /--\   |¯¯\ |__  \/  \__/ |__ \_/   |   | \__/ | \|Core.
 * @author: Copyright (C) 2011 by Brayan Narvaez (Prinick) developer of xNova Revolution
 * @link: http://www.xnovarevolution.con.ar

 * @package 2Moons
 * @author Slaver <*****@*****.**>
 * @copyright 2009 Lucky <*****@*****.**> (XGProyecto)
 * @copyright 2011 Slaver <*****@*****.**> (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
0
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
0
 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
0
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
0
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
0
 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
0
 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
0
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
0
 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
0
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'] . '&nbsp;&nbsp;(ID:&nbsp;' . $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'] . '&nbsp;&nbsp;(ID:&nbsp;' . $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'";
        }
        $SQL .= "WHERE ";
        $SQL .= "`username` = '" . $Name . "';";
        $db->query($SQL);
        $template->message($LNG['bo_the_player'] . $Name . $LNG['bo_banned'], '?page=bans');
        exit;
    } elseif (isset($_POST['unban_name'])) {
        $Name = request_var('unban_name', '', true);
        $db->multi_query("DELETE FROM " . BANNED . " WHERE who = '" . $db->sql_escape($Name) . "';UPDATE " . USERS . " SET bana = '0', banaday = '0' WHERE username = '******';");
        $template->message($LNG['bo_the_player2'] . $Name . $LNG['bo_unbanned'], '?page=bans');
        exit;
    }
    $template->assign_vars(array('UserSelect' => $UserSelect, 'bo_ban_player' => $LNG['bo_ban_player'], 'bo_select_title' => $LNG['bo_select_title'], 'bo_order_banned' => $LNG['bo_order_banned'], 'bo_order_id' => $LNG['bo_order_id'], 'bo_order_username' => $LNG['bo_order_username'], 'button_filter' => $LNG['button_filter'], 'button_reset' => $LNG['button_reset'], 'button_deselect' => $LNG['button_deselect'], 'button_submit' => $LNG['button_submit'], 'bo_total_users' => $LNG['bo_total_users'], 'bo_total_banneds' => $LNG['bo_total_banneds'], 'bo_unban_player' => $LNG['bo_unban_player'], 'usercount' => $Users, 'bancount' => $Banneds));
    $template->show('adm/BanPage.tpl');
}
示例#12
0
 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&amp;cmd=insert&amp;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
0
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
0
 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;
         }
     } elseif ($mission == 15) {
         $MaxExpedition = $USER[$resource[124]];
         if ($MaxExpedition == 0) {
             $template->message("<font color=\"red\"><b>" . $LNG['fl_expedition_tech_required'] . "</b></font>", "game." . PHP_EXT . "?page=fleet", 2);
             exit;
         }
         $ExpeditionEnCours = parent::GetCurrentFleets($USER['id'], 15);
         $EnvoiMaxExpedition = floor(sqrt($MaxExpedition));
         if ($ExpeditionEnCours >= $EnvoiMaxExpedition) {
             $template->message("<font color=\"red\"><b>" . $LNG['fl_expedition_fleets_limit'] . "</b></font>", "game." . PHP_EXT . "?page=fleet", 2);
             exit;
         }
     }
     $YourPlanet = isset($TargetPlanet['id_owner']) && $TargetPlanet['id_owner'] == $USER['id'] ? true : false;
     $UsedPlanet = isset($TargetPlanet['id_owner']) ? true : false;
     $HeDBRec = $YourPlanet ? $MyDBRec : GetUserByID($TargetPlanet['id_owner'], array('id', 'onlinetime', 'ally_id', 'urlaubs_modus'));
     if ($HeDBRec['urlaubs_modus'] && $mission != 8) {
         $template->message("<font color=\"lime\"><b>" . $LNG['fl_in_vacation_player'] . "</b></font>", "game." . PHP_EXT . "?page=fleet", 2);
         exit;
     }
     if (!$YourPlanet && ($mission == 1 || $mission == 2 || $mission == 5 || $mission == 6 || $mission == 9)) {
         if ($TargetPlanet['id_level'] > $USER['authlevel'] && $CONF['adm_attack'] == 0) {
             $template->message("<font color=\"red\"><b>" . $LNG['fl_admins_cannot_be_attacked'] . "</b></font>", "game." . PHP_EXT . "?page=fleet", 2);
             exit;
         }
         $UserPoints = $USER;
         $User2Points = $db->uniquequery("SELECT `total_points` FROM " . STATPOINTS . " WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . $HeDBRec['id'] . "';");
         $IsNoobProtec = CheckNoobProtec($UserPoints, $User2Points, $HeDBRec['onlinetime']);
         if ($IsNoobProtec['NoobPlayer']) {
             $template->message("<font color=\"lime\"><b>" . $LNG['fl_week_player'] . "</b></font>", "game." . PHP_EXT . "?page=fleet", 2);
             exit;
         } elseif ($IsNoobProtec['StrongPlayer']) {
             $template->message("<font color=\"red\"><b>" . $LNG['fl_strong_player'] . "</b></font>", "game." . PHP_EXT . "?page=fleet", 2);
             exit;
         }
     }
     if ($mission == 5) {
         if ($TargetPlanet['ally_deposit'] < 1) {
             $template->message("<font color=\"red\"><b>" . $LNG['fl_not_ally_deposit'] . "</b></font>", "game." . PHP_EXT . "?page=fleet", 2);
             exit;
         }
         $buddy = $db->uniquequery("SELECT COUNT(*) as state FROM " . BUDDY . " WHERE `active` = '1' AND (`owner` = '" . $HeDBRec['id'] . "' AND `sender` = '" . $MyDBRec['id'] . "') OR (`owner` = '" . $MyDBRec['id'] . "' AND `sender` = '" . $HeDBRec['id'] . "');");
         if ($HeDBRec['ally_id'] != $MyDBRec['ally_id'] && $buddy['state'] == 0) {
             $template->message("<font color=\"red\"><b>" . $LNG['fl_no_same_alliance'] . "</b></font>", "game." . PHP_EXT . "?page=fleet", 2);
             exit;
         }
     }
     if (parent::CheckUserSpeed() || !array_key_exists($mission, parent::GetAvailableMissions(array('CurrentUser' => $USER, 'galaxy' => $galaxy, 'system' => $system, 'planet' => $planet, 'planettype' => $planettype, 'IsAKS' => $fleet_group, 'Ship' => $FleetArray)))) {
         parent::GotoFleetPage();
     }
     $MaxFleetSpeed = parent::GetFleetMaxSpeed($FleetArray, $USER);
     $SpeedFactor = parent::GetGameSpeedFactor();
     $distance = parent::GetTargetDistance($thisgalaxy, $galaxy, $thissystem, $system, $thisplanet, $planet);
     $duration = parent::GetMissionDuration($GenFleetSpeed, $MaxFleetSpeed, $distance, $SpeedFactor, $USER);
     $consumption = parent::GetFleetConsumption($FleetArray, $duration, $distance, $MaxFleetSpeed, $USER, $SpeedFactor);
     $fleet['start_time'] = $duration + TIMESTAMP;
     if ($mission == 15) {
         $StayDuration = max($holdingtime, 1) * 3600 / $CONF['halt_speed'];
         $StayTime = $fleet['start_time'] + $StayDuration;
     } elseif ($mission == 5) {
         $StayDuration = $holdingtime * 3600;
         $StayTime = $fleet['start_time'] + $StayDuration;
     } elseif ($mission == 11) {
         $StayDuration = 3600 / $CONF['halt_speed'];
         $StayTime = $fleet['start_time'] + $StayDuration;
     } else {
         $StayDuration = 0;
         $StayTime = 0;
     }
     $fleet['end_time'] = $StayDuration + 2 * $duration + TIMESTAMP;
     $FleetStorage -= $consumption;
     $PlanetRess = new ResourceUpdate();
     $PlanetRess->CalcResource();
     $TransportMetal = min($TransportMetal, $PLANET['metal']);
     $TransportCrystal = min($TransportCrystal, $PLANET['crystal']);
     $TransportDeuterium = min($TransportDeuterium, $PLANET['deuterium'] - $consumption);
     $StorageNeeded = $TransportMetal + $TransportCrystal + $TransportDeuterium;
     $StockMetal = $PLANET['metal'];
     $StockCrystal = $PLANET['crystal'];
     $StockDeuterium = $PLANET['deuterium'];
     $StockDeuterium -= $consumption;
     if ($PLANET['deuterium'] < $consumption) {
         $template->message("<font color=\"red\"><b>" . sprintf($LNG['fl_no_enought_deuterium'], $LNG['Deuterium'], pretty_number($consumption - $PLANET['deuterium']), $LNG['Deuterium']) . "</b></font>", "game." . PHP_EXT . "?page=fleet", 2);
         exit;
     }
     if ($StorageNeeded > $FleetStorage) {
         $template->message("<font color=\"red\"><b>" . $LNG['fl_no_enought_cargo_capacity'] . pretty_number($StorageNeeded - $FleetStorage) . "</b></font>", "game." . PHP_EXT . "?page=fleet", 2);
         exit;
     }
     if ($TargetPlanet['id_level'] > $USER['authlevel'] && $CONF['adm_attack'] == 0) {
         $template->message($LNG['fl_admins_cannot_be_attacked'], "game." . PHP_EXT . "?page=fleet", 2);
         exit;
     }
     $PLANET['metal'] -= $TransportMetal;
     $PLANET['crystal'] -= $TransportCrystal;
     $PLANET['deuterium'] -= $TransportDeuterium + $consumption;
     $PlanetRess->SavePlanetToDB();
     if (connection_aborted()) {
         exit;
     }
     if ($fleet_group_mr != 0) {
         $AksStartTime = $db->uniquequery("SELECT MAX(`fleet_start_time`) AS Start FROM " . FLEETS . " WHERE `fleet_group` = '" . $fleet_group_mr . "' AND '" . MAX_FLEETS_PER_ACS . "' > (SELECT COUNT(*) FROM " . FLEETS . " WHERE `fleet_group` = '" . $fleet_group_mr . "');");
         if (isset($AksStartTime)) {
             if ($AksStartTime['Start'] >= $fleet['start_time']) {
                 $fleet['end_time'] += $AksStartTime['Start'] - $fleet['start_time'];
                 $fleet['start_time'] = $AksStartTime['Start'];
             } else {
                 $QryUpdateFleets = "UPDATE " . FLEETS . " SET ";
                 $QryUpdateFleets .= "`fleet_start_time` = '" . $fleet['start_time'] . "', ";
                 $QryUpdateFleets .= "`fleet_end_time` = fleet_end_time + '" . ($fleet['start_time'] - $AksStartTime['Start']) . "' ";
                 $QryUpdateFleets .= "WHERE ";
                 $QryUpdateFleets .= "`fleet_group` = '" . $fleet_group_mr . "';";
                 $db->query($QryUpdateFleets);
                 $fleet['end_time'] += $fleet['start_time'] - $AksStartTime['Start'];
             }
         } else {
             $mission = 1;
         }
     }
     $QryInsertFleet = "LOCK TABLE " . FLEETS . " WRITE, " . PLANETS . " WRITE;\r\n\t\t\t\t\t\t\tINSERT INTO " . FLEETS . " SET \r\n\t\t\t\t\t\t\t`fleet_owner` = '" . $USER['id'] . "', \r\n\t\t\t\t\t\t\t`fleet_mission` = '" . $mission . "',\r\n\t\t\t\t\t\t\t`fleet_amount` = '" . $FleetShipCount . "',\r\n\t\t\t\t\t\t    `fleet_array` = '" . $fleet_array . "',\r\n\t\t\t\t\t\t\t`fleet_start_time` = '" . $fleet['start_time'] . "',\r\n\t\t\t\t\t\t\t`fleet_start_galaxy` = '" . $thisgalaxy . "',\r\n\t\t\t\t\t\t\t`fleet_start_system` = '" . $thissystem . "',\r\n\t\t\t\t\t\t\t`fleet_start_planet` = '" . $thisplanet . "',\r\n\t\t\t\t\t\t\t`fleet_start_type` = '" . $thisplanettype . "',\r\n\t\t\t\t\t\t\t`fleet_end_time` = '" . $fleet['end_time'] . "',\r\n\t\t\t\t\t\t\t`fleet_end_stay` = '" . $StayTime . "',\r\n\t\t\t\t\t\t\t`fleet_end_galaxy` = '" . $galaxy . "',\r\n\t\t\t\t\t\t\t`fleet_end_system` = '" . $system . "',\r\n\t\t\t\t\t\t\t`fleet_end_planet` = '" . $planet . "',\r\n\t\t\t\t\t\t\t`fleet_end_type` = '" . $planettype . "',\r\n\t\t\t\t\t\t\t`fleet_resource_metal` = '" . floattostring($TransportMetal) . "',\r\n\t\t\t\t\t\t\t`fleet_resource_crystal` = '" . floattostring($TransportCrystal) . "',\r\n\t\t\t\t\t\t\t`fleet_resource_deuterium` = '" . floattostring($TransportDeuterium) . "',\r\n\t\t\t\t\t\t\t`fleet_target_owner` = '" . $TargetPlanet['id_owner'] . "',\r\n\t\t\t\t\t\t\t`fleet_group` = '" . $fleet_group_mr . "',\r\n\t\t\t\t\t\t\t`start_time` = '" . TIMESTAMP . "';\r\n\t\t\t\t\t\t\tUPDATE `" . PLANETS . "` SET\r\n\t\t\t\t\t\t\t" . substr($FleetSubQRY, 0, -2) . "\r\n\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t`id` = " . $PLANET['id'] . " LIMIT 1;\r\n\t\t\t\t\t\t\tUNLOCK TABLES;";
     $db->multi_query($QryInsertFleet);
     foreach ($FleetArray as $Ship => $Count) {
         $FleetList[$LNG['tech'][$Ship]] = pretty_number($Count);
     }
     $template->assign_vars(array('mission' => $LNG['type_mission'][$mission], 'distance' => pretty_number($distance), 'consumption' => pretty_number($consumption), 'from' => $thisgalaxy . ":" . $thissystem . ":" . $thisplanet, 'destination' => $galaxy . ":" . $system . ":" . $planet, 'start_time' => date("M D d H:i:s", $fleet['start_time']), 'end_time' => date("M D d H:i:s", $fleet['end_time']), 'speedallsmin' => $MaxFleetSpeed, 'FleetList' => $FleetList, 'fl_fleet_sended' => $LNG['fl_fleet_sended'], 'fl_mission' => $LNG['fl_mission'], 'fl_from' => $LNG['fl_from'], 'fl_destiny' => $LNG['fl_destiny'], 'fl_distance' => $LNG['fl_distance'], 'fl_fleet_speed' => $LNG['fl_fleet_speed'], 'fl_fuel_consumption' => $LNG['fl_fuel_consumption'], 'fl_fromfl_destiny' => $LNG['fl_fromfl_destiny'], 'fl_arrival_time' => $LNG['fl_arrival_time'], 'fl_return_time' => $LNG['fl_return_time'], 'fl_fleet' => $LNG['fl_fleet']));
     $template->show('fleet3_table.tpl');
 }
示例#15
0
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");
}
示例#16
0
function ShowBattleSimPage()
{
    global $USER, $PLANET, $reslist, $pricelist, $LNG, $db, $ExtraDM, $LANG, $CONF;
    $action = request_var('action', '');
    $Slots = request_var('slots', 1);
    if (isset($_REQUEST['im'])) {
        $Array = $_REQUEST['im'];
        foreach ($Array as $ID => $Count) {
            $BattleArray[0][1][$ID] = floattostring($Count);
        }
    } elseif (isset($_REQUEST['battleinput'])) {
        $BattleArray = $_REQUEST['battleinput'];
    } else {
        $BattleArray = array();
    }
    if ($action == 'send') {
        $Counts = array(0, 0);
        foreach ($BattleArray as $BattleSlotID => $BattleSlot) {
            if (isset($BattleSlot[0]) && (array_sum($BattleSlot[0]) > 0 || $BattleSlotID == 0)) {
                $Att = mt_rand(1, 1000);
                $attack[$Att]['fleet'] = array('fleet_start_galaxy' => 1, 'fleet_start_system' => 33, 'fleet_start_planet' => 7, 'fleet_end_galaxy' => 1, 'fleet_end_system' => 33, 'fleet_end_planet' => 7, 'metal' => 0, 'crystal' => 0, 'deuterium' => 0);
                $attack[$Att]['user'] = array('username' => $LNG['bs_atter'] . ' Nr.' . ($BattleSlotID + 1), 'military_tech' => $BattleSlot[0][109], 'defence_tech' => $BattleSlot[0][110], 'shield_tech' => $BattleSlot[0][111], 0, 'dm_defensive' => 0, 'dm_attack' => 0);
                foreach ($BattleSlot[0] as $ID => $Count) {
                    if (!in_array($ID, $reslist['fleet']) || $BattleSlot[0][$ID] <= 0) {
                        unset($BattleSlot[0][$ID]);
                    }
                }
                if ($Counts[0] == 0 && $BattleSlotID != 0) {
                    exit('ERROR');
                }
                $Counts[0] = $Counts[0] + array_sum($BattleSlot[1]);
                $attack[$Att]['detail'] = $BattleSlot[0];
            }
            if (isset($BattleSlot[1]) && (array_sum($BattleSlot[1]) > 0 || $BattleSlotID == 0)) {
                $Def = mt_rand(1, 1000);
                $defense[$Def]['fleet'] = array('fleet_start_galaxy' => 1, 'fleet_start_system' => 33, 'fleet_start_planet' => 7, 'fleet_end_galaxy' => 1, 'fleet_end_system' => 33, 'fleet_end_planet' => 7, 'metal' => 0, 'crystal' => 0, 'deuterium' => 0);
                $defense[$Def]['user'] = array('username' => $LNG['bs_deffer'] . ' Nr.' . ($BattleSlotID + 1), 'military_tech' => $BattleSlot[1][109], 'defence_tech' => $BattleSlot[1][110], 'shield_tech' => $BattleSlot[1][111], 0, 'dm_defensive' => 0, 'dm_attack' => 0);
                foreach ($BattleSlot[1] as $ID => $Count) {
                    if (!in_array($ID, $reslist['fleet']) && !in_array($ID, $reslist['defense'])) {
                        unset($BattleSlot[1][$ID]);
                    }
                }
                if ($Countd[1] == 0 && $BattleSlotID != 0) {
                    exit('ERROR');
                }
                $Countd[1] = $Countd[1] + array_sum($BattleSlot[1]);
                $defense[$Def]['def'] = $BattleSlot[1];
            }
        }
        $LANG->includeLang(array('FLEET'));
        require_once ROOT_PATH . 'includes/classes/missions/calculateAttack.php';
        require_once ROOT_PATH . 'includes/classes/missions/calculateSteal.php';
        require_once ROOT_PATH . 'includes/classes/missions/GenerateReport.php';
        $start = microtime(true);
        $result = calculateAttack($attack, $defense, $CONF['Fleet_Cdr'], $CONF['Defs_Cdr']);
        $totaltime = microtime(true) - $start;
        $steal = $result['won'] == "a" ? calculateSteal($attack, array('metal' => $BattleArray[0][1][1], 'crystal' => $BattleArray[0][1][2], 'deuterium' => $BattleArray[0][1][3]), true) : array('metal' => 0, 'crystal' => 0, 'deuterium' => 0);
        $FleetDebris = $result['debree']['att'][0] + $result['debree']['def'][0] + $result['debree']['att'][1] + $result['debree']['def'][1];
        $StrAttackerUnits = sprintf($LNG['sys_attacker_lostunits'], $result['lost']['att']);
        $StrDefenderUnits = sprintf($LNG['sys_defender_lostunits'], $result['lost']['def']);
        $StrRuins = sprintf($LNG['sys_gcdrunits'], $result['debree']['def'][0] + $result['debree']['att'][0], $LNG['Metal'], $result['debree']['def'][1] + $result['debree']['att'][1], $LNG['Crystal']);
        $DebrisField = $StrAttackerUnits . "<br>" . $StrDefenderUnits . "<br>" . $StrRuins;
        $MoonChance = min(round($FleetDebris / 100000, 0), 20);
        $AllSteal = array_sum($steal);
        $RaportInfo = sprintf($LNG['bs_derbis_raport'], ceil($FleetDebris / $pricelist[219]['capacity']), $LNG['tech'][219], ceil($FleetDebris / $pricelist[209]['capacity']), $LNG['tech'][209]) . "<br>";
        $RaportInfo .= sprintf($LNG['bs_steal_raport'], ceil($AllSteal / $pricelist[202]['capacity']), $LNG['tech'][202], ceil($AllSteal / $pricelist[203]['capacity']), $LNG['tech'][203], ceil($AllSteal / $pricelist[217]['capacity']), $LNG['tech'][217]) . "<br>";
        $INFO['moon']['battlesim'] = $RaportInfo;
        $INFO['steal'] = $steal;
        $INFO['fleet_start_time'] = TIMESTAMP;
        $INFO['moon']['des'] = 0;
        $INFO['moon']['chance'] = $MoonChance;
        $raport = GenerateReport($result, $INFO);
        $rid = md5(microtime(true));
        file_put_contents(ROOT_PATH . 'raports/raport_' . $rid . '.php', '<?php' . "\n" . '$raport = ' . $raport . ';' . "\n" . '?>');
        $SQLQuery = "INSERT INTO " . RW . " SET ";
        $SQLQuery .= "`time` = '" . TIMESTAMP . "', ";
        $SQLQuery .= "`owners` = '" . $USER['id'] . ",0', ";
        $SQLQuery .= "`rid` = '" . $rid . "';";
        $db->query($SQLQuery);
        echo $rid;
        exit;
    }
    $PlanetRess = new ResourceUpdate();
    $PlanetRess->CalcResource();
    $PlanetRess->SavePlanetToDB();
    foreach ($reslist['fleet'] as $ID) {
        $GetFleet[$ID] = $LNG['tech'][$ID];
    }
    foreach ($reslist['defense'] as $ID) {
        if ($ID >= 501) {
            break;
        }
        $GetDef[$ID] = $LNG['tech'][$ID];
    }
    $template = new template();
    $template->loadscript('battlesim.js');
    $template->assign_vars(array('lm_battlesim' => $LNG['lm_battlesim'], 'bs_names' => $LNG['bs_names'], 'bs_atter' => $LNG['bs_atter'], 'bs_deffer' => $LNG['bs_deffer'], 'bs_steal' => $LNG['bs_steal'], 'bs_techno' => $LNG['bs_techno'], 'bs_send' => $LNG['bs_send'], 'bs_cancel' => $LNG['bs_cancel'], 'bs_wait' => $LNG['bs_wait'], 'Metal' => $LNG['Metal'], 'Crystal' => $LNG['Crystal'], 'Deuterium' => $LNG['Deuterium'], 'attack_tech' => $LNG['tech'][109], 'shield_tech' => $LNG['tech'][110], 'tank_tech' => $LNG['tech'][111], 'GetFleet' => $GetFleet, 'GetDef' => $GetDef, 'Slots' => $Slots, 'battleinput' => $BattleArray));
    $template->show("battlesim.tpl");
}
示例#17
0
/**
 *  2Moons
 *  Copyright (C) 2011  Slaver
 *
 * 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 Slaver <*****@*****.**>
 * @copyright 2009 Lucky <*****@*****.**> (XGProyecto)
 * @copyright 2011 Slaver <*****@*****.**> (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/
 */
function ShowTraderPage()
{
    global $USER, $PLANET, $LNG, $db;
    $ress = request_var('ress', '');
    $action = request_var('action', '');
    $metal = round(request_var('metal', 0.0), 0);
    $crystal = round(request_var('crystal', 0.0), 0);
    $deut = round(request_var('deuterium', 0.0), 0);
    $PlanetRess = new ResourceUpdate();
    $template = new template();
    $template->loadscript("trader.js");
    if ($ress != '') {
        switch ($ress) {
            case 'metal':
                if ($action == "trade") {
                    if ($USER['darkmatter'] < DARKMATTER_FOR_TRADER) {
                        $template->message(sprintf($LNG['tr_empty_darkmatter'], $LNG['Darkmatter']), "game.php?page=trader", 1);
                    } elseif ($crystal < 0 || $deut < 0) {
                        $template->message($LNG['tr_only_positive_numbers'], "game.php?page=trader", 1);
                    } else {
                        $trade = $crystal * 2 + $deut * 4;
                        $PlanetRess->CalcResource();
                        if ($PLANET['metal'] > $trade) {
                            $PLANET['metal'] -= $trade;
                            $PLANET['crystal'] += $crystal;
                            $PLANET['deuterium'] += $deut;
                            $USER['darkmatter'] -= DARKMATTER_FOR_TRADER;
                            $template->message($LNG['tr_exchange_done'], "game.php?page=trader", 1);
                        } else {
                            $template->message($LNG['tr_not_enought_metal'], "game.php?page=trader", 1);
                        }
                        $PlanetRess->SavePlanetToDB();
                    }
                } else {
                    $template->assign_vars(array('tr_resource' => $LNG['tr_resource'], 'tr_sell_metal' => $LNG['tr_sell_metal'], 'tr_amount' => $LNG['tr_amount'], 'tr_exchange' => $LNG['tr_exchange'], 'tr_quota_exchange' => $LNG['tr_quota_exchange'], 'Metal' => $LNG['Metal'], 'Crystal' => $LNG['Crystal'], 'Deuterium' => $LNG['Deuterium'], 'mod_ma_res_a' => "2", 'mod_ma_res_b' => "4", 'ress' => $ress));
                    $template->show("trader_metal.tpl");
                }
                break;
            case 'crystal':
                if ($action == "trade") {
                    if ($USER['darkmatter'] < DARKMATTER_FOR_TRADER) {
                        $template->message(sprintf($LNG['tr_empty_darkmatter'], $LNG['Darkmatter']), "game.php?page=trader", 1);
                    } elseif ($metal < 0 || $deut < 0) {
                        $template->message($LNG['tr_only_positive_numbers'], "game.php?page=trader", 1);
                    } else {
                        $trade = $metal * 0.5 + $deut * 2;
                        $PlanetRess->CalcResource();
                        if ($PLANET['crystal'] > $trade) {
                            $PLANET['metal'] += $metal;
                            $PLANET['crystal'] -= $trade;
                            $PLANET['deuterium'] += $deut;
                            $USER['darkmatter'] -= DARKMATTER_FOR_TRADER;
                            $template->message($LNG['tr_exchange_done'], "game.php?page=trader", 1);
                        } else {
                            $template->message($LNG['tr_not_enought_crystal'], "game.php?page=trader", 1);
                        }
                        $PlanetRess->SavePlanetToDB();
                    }
                } else {
                    $template->assign_vars(array('tr_resource' => $LNG['tr_resource'], 'tr_sell_crystal' => $LNG['tr_sell_crystal'], 'tr_amount' => $LNG['tr_amount'], 'tr_exchange' => $LNG['tr_exchange'], 'tr_quota_exchange' => $LNG['tr_quota_exchange'], 'Metal' => $LNG['Metal'], 'Crystal' => $LNG['Crystal'], 'Deuterium' => $LNG['Deuterium'], 'mod_ma_res_a' => "0.5", 'mod_ma_res_b' => "2", 'ress' => $ress));
                    $template->show("trader_crystal.tpl");
                }
                break;
            case 'deuterium':
                if ($action == "trade") {
                    if ($USER['darkmatter'] < DARKMATTER_FOR_TRADER) {
                        $template->message(sprintf($LNG['tr_empty_darkmatter'], $LNG['Darkmatter']), "game.php?page=trader", 1);
                    } elseif ($metal < 0 || $crystal < 0) {
                        message($LNG['tr_only_positive_numbers'], "game.php?page=trader", 1);
                    } else {
                        $trade = $metal * 0.25 + $crystal * 0.5;
                        $PlanetRess->CalcResource();
                        if ($PLANET['deuterium'] > $trade) {
                            $PLANET['metal'] += $metal;
                            $PLANET['crystal'] += $crystal;
                            $PLANET['deuterium'] -= $trade;
                            $USER['darkmatter'] -= DARKMATTER_FOR_TRADER;
                            $template->message($LNG['tr_exchange_done'], "game.php?page=trader", 1);
                        } else {
                            $template->message($LNG['tr_not_enought_deuterium'], "game.php?page=trader", 1);
                        }
                        $PlanetRess->SavePlanetToDB();
                    }
                } else {
                    $template->assign_vars(array('tr_resource' => $LNG['tr_resource'], 'tr_sell_deuterium' => $LNG['tr_sell_deuterium'], 'tr_amount' => $LNG['tr_amount'], 'tr_exchange' => $LNG['tr_exchange'], 'tr_quota_exchange' => $LNG['tr_quota_exchange'], 'Metal' => $LNG['Metal'], 'Crystal' => $LNG['Crystal'], 'Deuterium' => $LNG['Deuterium'], 'mod_ma_res_a' => "0.25", 'mod_ma_res_b' => "0.5", 'ress' => $ress));
                    $template->show("trader_deuterium.tpl");
                }
                break;
        }
    } else {
        $PlanetRess->CalcResource();
        $PlanetRess->SavePlanetToDB();
        $template->assign_vars(array('tr_cost_dm_trader' => sprintf($LNG['tr_cost_dm_trader'], pretty_number(DARKMATTER_FOR_TRADER), $LNG['Darkmatter']), 'tr_call_trader_who_buys' => $LNG['tr_call_trader_who_buys'], 'tr_call_trader' => $LNG['tr_call_trader'], 'tr_exchange_quota' => $LNG['tr_exchange_quota'], 'tr_call_trader_submit' => $LNG['tr_call_trader_submit'], 'Metal' => $LNG['Metal'], 'Crystal' => $LNG['Crystal'], 'Deuterium' => $LNG['Deuterium']));
        $template->show("trader_overview.tpl");
    }
}
示例#18
0
/**
 _  \_/ |\ | /¯¯\ \  / /\    |¯¯) |_¯ \  / /¯¯\ |  |   |´¯|¯` | /¯¯\ |\ |5
 ¯  /¯\ | \| \__/  \/ /--\   |¯¯\ |__  \/  \__/ |__ \_/   |   | \__/ | \|Core.
 * @author: Copyright (C) 2011 by Brayan Narvaez (Prinick) developer of xNova Revolution
 * @link: http://www.xnovarevolution.con.ar

 * @package 2Moons
 * @author Slaver <*****@*****.**>
 * @copyright 2009 Lucky <*****@*****.**> (XGProyecto)
 * @copyright 2011 Slaver <*****@*****.**> (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 ShowPhalanxPage()
{
    global $USER, $PLANET, $LNG, $db, $UNI;
    include_once ROOT_PATH . 'includes/functions/InsertJavaScriptChronoApplet.php';
    include_once ROOT_PATH . 'includes/classes/class.FlyingFleetsTable.php';
    include_once ROOT_PATH . 'includes/classes/class.GalaxyRows.php';
    $FlyingFleetsTable = new FlyingFleetsTable();
    $GalaxyRows = new GalaxyRows();
    $template = new template();
    $template->isPopup(true);
    $template->loadscript('phalanx.js');
    $template->execscript('FleetTime();window.setInterval("FleetTime()", 1000);');
    $PhRange = $GalaxyRows->GetPhalanxRange($PLANET['phalanx']);
    $Galaxy = request_var('galaxy', 0);
    $System = request_var('system', 0);
    $Planet = request_var('planet', 0);
    if ($Galaxy != $PLANET['galaxy'] || $System > $PLANET['system'] + $PhRange || $System < max(1, $PLANET['system'] - $PhRange)) {
        $template->message($LNG['px_out_of_range'], false, 0, true);
        exit;
    }
    if ($PLANET['deuterium'] < 5000) {
        $template->message($LNG['px_no_deuterium'], false, 0, true);
        exit;
    }
    $PLANET['deuterium'] -= 5000;
    $db->query("UPDATE " . PLANETS . " SET `deuterium` = `deuterium` - '5000' WHERE `id` = '" . $PLANET['id'] . "';");
    $TargetInfo = $db->uniquequery("SELECT id, name, id_owner FROM " . PLANETS . " WHERE`universe` = '" . $UNI . "' AND `galaxy` = '" . $Galaxy . "' AND `system` = '" . $System . "' AND `planet` = '" . $Planet . "' AND `planet_type` = '1';");
    if (empty($TargetInfo)) {
        $template->message($LNG['px_out_of_range'], false, 0, true);
        exit;
    }
    $FleetToTarget = $db->query("SELECT * FROM " . FLEETS . " WHERE `fleet_start_id` = '" . $TargetInfo['id'] . "' OR `fleet_end_id` = '" . $TargetInfo['id'] . "' ORDER BY `fleet_start_time`;");
    $fpage = array();
    $FleetData = array();
    $_SESSION['USER']['spy_tech'] = 8;
    while ($FleetRow = $db->fetch_array($FleetToTarget)) {
        $Record++;
        $IsOwner = $FleetRow['fleet_owner'] == $TargetInfo['id_owner'] ? true : false;
        $FleetRow['fleet_resource_metal'] = 0;
        $FleetRow['fleet_resource_crystal'] = 0;
        $FleetRow['fleet_resource_deuterium'] = 0;
        $FleetRow['fleet_resource_norio'] = 0;
        $FleetRow['fleet_resource_darkmatter'] = 0;
        if ($FleetRow['fleet_mess'] == 0 && $FleetRow['fleet_start_time'] > TIMESTAMP) {
            $fpage[$FleetRow['fleet_start_time'] . $FleetRow['fleet_id']] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, $IsOwner, 'fs', $Record);
            $FleetData[$FleetRow['fleet_start_time'] . $FleetRow['fleet_id']] = $fpage[$FleetRow['fleet_start_time'] . $FleetRow['fleet_id']]['fleet_return'];
        }
        if ($FleetRow['fleet_mission'] == 4) {
            continue;
        }
        if ($FleetRow['fleet_mess'] != 1 && $FleetRow['fleet_end_stay'] > TIMESTAMP) {
            $fpage[$FleetRow['fleet_end_stay'] . $FleetRow['fleet_id']] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 2, $IsOwner, 'ft', $Record);
            $FleetData[$FleetRow['fleet_end_stay'] . $FleetRow['fleet_id']] = $fpage[$FleetRow['fleet_end_stay'] . $FleetRow['fleet_id']]['fleet_return'];
        }
        if ($IsOwner == false) {
            continue;
        }
        if ($FleetRow['fleet_end_time'] > TIMESTAMP) {
            $fpage[$FleetRow['fleet_end_time'] . $FleetRow['fleet_id']] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, $IsOwner, 'fe', $Record);
            $FleetData[$FleetRow['fleet_end_time'] . $FleetRow['fleet_id']] = $fpage[$FleetRow['fleet_end_time'] . $FleetRow['fleet_id']]['fleet_return'];
        }
    }
    $_SESSION['USER']['spy_tech'] = $USER['spy_tech'];
    $db->free_result($FleetToTarget);
    if (!empty($fpage)) {
        ksort($fpage);
    }
    $template->assign_vars(array('phl_pl_galaxy' => $Galaxy, 'phl_pl_system' => $System, 'phl_pl_place' => $Planet, 'phl_pl_name' => $TargetInfo['name'], 'fleets' => $fpage, 'FleetData' => json_encode($FleetData), 'px_scan_position' => $LNG['px_scan_position'], 'px_no_fleet' => $LNG['px_no_fleet'], 'px_fleet_movement' => $LNG['px_fleet_movement']));
    $template->show('phalax_body.tpl');
}
示例#19
0
function ShowBanPage()
{
    global $LNG, $USER;
    $ORDER = $_GET['order'] == 'id' ? "id" : "username";
    if ($_GET['view'] == 'bana') {
        $WHEREBANA = "AND `bana` = '1'";
    }
    $UserList = $GLOBALS['DATABASE']->query("SELECT `username`, `id`, `bana` FROM " . USERS . " WHERE `id` != 1 AND `authlevel` <= '" . $USER['authlevel'] . "' AND `universe` = '" . Universe::getEmulated() . "' " . $WHEREBANA . " ORDER BY " . $ORDER . " ASC;");
    $UserSelect = array('List' => '', 'ListBan' => '');
    $Users = 0;
    while ($a = $GLOBALS['DATABASE']->fetch_array($UserList)) {
        $UserSelect['List'] .= '<option value="' . $a['username'] . '">' . $a['username'] . '&nbsp;&nbsp;(ID:&nbsp;' . $a['id'] . ')' . ($a['bana'] == '1' ? $LNG['bo_characters_suus'] : '') . '</option>';
        $Users++;
    }
    $GLOBALS['DATABASE']->free_result($UserList);
    $ORDER2 = $_GET['order2'] == 'id' ? "id" : "username";
    $Banneds = 0;
    $UserListBan = $GLOBALS['DATABASE']->query("SELECT `username`, `id` FROM " . USERS . " WHERE `bana` = '1' AND `universe` = '" . Universe::getEmulated() . "' ORDER BY " . $ORDER2 . " ASC;");
    while ($b = $GLOBALS['DATABASE']->fetch_array($UserListBan)) {
        $UserSelect['ListBan'] .= '<option value="' . $b['username'] . '">' . $b['username'] . '&nbsp;&nbsp;(ID:&nbsp;' . $b['id'] . ')</option>';
        $Banneds++;
    }
    $GLOBALS['DATABASE']->free_result($UserListBan);
    $template = new template();
    $template->loadscript('filterlist.js');
    $Name = HTTP::_GP('ban_name', '', true);
    $BANUSER = $GLOBALS['DATABASE']->getFirstRow("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` = '" . $GLOBALS['DATABASE']->sql_escape($Name) . "' AND u.`universe` = '" . Universe::getEmulated() . "';");
    if (isset($_POST['panel'])) {
        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/resource/images/admin/i.gif" class="tooltip" data-tooltip-content="' . $LNG['bo_bbb_title_4'] . '"></td>';
            $reas = $BANUSER['theme'];
            $timesus = "<tr>\n\t\t\t\t\t<th>" . $LNG['bo_bbb_title_5'] . "</th>\n\t\t\t\t\t<th height=25 colspan=2>" . date($LNG['php_tdformat'], $BANUSER['longer']) . "</th>\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));
    } elseif (isset($_POST['bannow']) && $BANUSER['id'] != 1) {
        $Name = HTTP::_GP('ban_name', '', true);
        $reas = HTTP::_GP('why', '', true);
        $days = HTTP::_GP('days', 0);
        $hour = HTTP::_GP('hour', 0);
        $mins = HTTP::_GP('mins', 0);
        $secs = HTTP::_GP('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 (isset($_POST['permanent'])) {
            $BannedUntil = 2147483647;
        } else {
            $BannedUntil = $BanTime + TIMESTAMP < TIMESTAMP ? TIMESTAMP : TIMESTAMP + $BanTime;
        }
        if ($BANUSER['banaday'] > TIMESTAMP) {
            $SQL = "UPDATE " . BANNED . " SET ";
            $SQL .= "`who` = '" . $Name . "', ";
            $SQL .= "`theme` = '" . $reas . "', ";
            $SQL .= "`time` = '" . TIMESTAMP . "', ";
            $SQL .= "`longer` = '" . $BannedUntil . "', ";
            $SQL .= "`author` = '" . $admin . "', ";
            $SQL .= "`email` = '" . $mail . "' ";
            $SQL .= "WHERE `who2` = '" . $Name . "' AND `universe` = '" . Universe::getEmulated() . "';";
            $GLOBALS['DATABASE']->query($SQL);
        } else {
            $SQL = "INSERT INTO " . BANNED . " SET ";
            $SQL .= "`who` = '" . $Name . "', ";
            $SQL .= "`theme` = '" . $reas . "', ";
            $SQL .= "`time` = '" . TIMESTAMP . "', ";
            $SQL .= "`longer` = '" . $BannedUntil . "', ";
            $SQL .= "`author` = '" . $admin . "', ";
            $SQL .= "`universe` = '" . Universe::getEmulated() . "', ";
            $SQL .= "`email` = '" . $mail . "';";
            $GLOBALS['DATABASE']->query($SQL);
        }
        $SQL = "UPDATE " . USERS . " SET ";
        $SQL .= "`bana` = '1', ";
        $SQL .= "`banaday` = '" . $BannedUntil . "', ";
        $SQL .= isset($_POST['vacat']) ? "`urlaubs_modus` = '1'" : "`urlaubs_modus` = '0'";
        $SQL .= "WHERE ";
        $SQL .= "`username` = '" . $Name . "' AND `universe` = '" . Universe::getEmulated() . "';";
        $GLOBALS['DATABASE']->query($SQL);
        $template->message($LNG['bo_the_player'] . $Name . $LNG['bo_banned'], '?page=bans');
        exit;
    } elseif (isset($_POST['unban_name'])) {
        $Name = HTTP::_GP('unban_name', '', true);
        $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET bana = '0', banaday = '0' WHERE username = '******'DATABASE']->sql_escape($Name) . "' AND `universe` = '" . Universe::getEmulated() . "';");
        #DELETE FROM ".BANNED." WHERE who = '".$GLOBALS['DATABASE']->sql_escape($Name)."' AND `universe` = '".Universe::getEmulated()."';
        $template->message($LNG['bo_the_player2'] . $Name . $LNG['bo_unbanned'], '?page=bans');
        exit;
    }
    $template->assign_vars(array('UserSelect' => $UserSelect, 'usercount' => $Users, 'bancount' => $Banneds));
    $template->show('BanPage.tpl');
}
示例#20
0
 public function __construct()
 {
     global $USER, $PLANET, $dpath, $LNG, $resource, $pricelist, $reslist, $CombatCaps, $ProdGrid, $CONF, $OfficerInfo;
     $BuildID = request_var('gid', 0);
     $template = new template();
     $template->isPopup(true);
     if (in_array($BuildID, $reslist['prod']) && $BuildID != 212) {
         $BuildLevelFactor = 10;
         $BuildTemp = $PLANET['temp_max'];
         $CurrentBuildtLvl = $PLANET[$resource[$BuildID]];
         $BuildEnergy = $USER[$resource[113]];
         /*$BuildLevel     	= ($CurrentBuildtLvl > 0) ? $CurrentBuildtLvl : 1;
         		$Prod[1]         	= (floor(eval($ProdGrid[$BuildID]['formule']['metal'])     * $CONF['resource_multiplier']) * (1 + (TIMESTAMP - $USER[$resource[703]] <= 0) ? ($ExtraDM[703]['add']) : 0));
         		$Prod[2]         	= (floor(eval($ProdGrid[$BuildID]['formule']['crystal'])   * $CONF['resource_multiplier']) * (1 + (TIMESTAMP - $USER[$resource[703]] <= 0) ? ($ExtraDM[703]['add']) : 0));
         		$Prod[7]          	= (floor(eval($ProdGrid[$BuildID]['formule']['norio'])     * $CONF['resource_multiplier']) * (1 + (TIMESTAMP - $USER[$resource[703]] <= 0) ? ($ExtraDM[703]['add']) : 0));
         		$Prod[3]          	= (floor(eval($ProdGrid[$BuildID]['formule']['deuterium']) * $CONF['resource_multiplier']) * (1 + (TIMESTAMP - $USER[$resource[703]] <= 0) ? ($ExtraDM[703]['add']) : 0));
         		$Prod[4] 			= (floor(eval($ProdGrid[$BuildID]['formule']['energy'])    * $CONF['resource_multiplier']) * (1 + (TIMESTAMP - $USER[$resource[704]] <= 0) ? ($ExtraDM[704]['add']) : 0));
         		$Prod[12] 			= (floor(eval($ProdGrid[$BuildID]['formule']['energy'])    * $CONF['resource_multiplier']));*/
         $BuildLevel = max($CurrentBuildtLvl, 1);
         $Prod[1] = round(eval($ProdGrid[$BuildID]['formule']['metal']) * $CONF['resource_multiplier']);
         $Prod[2] = round(eval($ProdGrid[$BuildID]['formule']['crystal']) * $CONF['resource_multiplier']);
         $Prod[7] = round(eval($ProdGrid[$BuildID]['formule']['norio']) * $CONF['resource_multiplier']);
         $Prod[3] = round(eval($ProdGrid[$BuildID]['formule']['deuterium']) * $CONF['resource_multiplier']);
         $Prod[4] = round(eval($ProdGrid[$BuildID]['formule']['energy']) * $CONF['resource_multiplier']);
         $Prod[12] = round(eval($ProdGrid[$BuildID]['formule']['energy']) * $CONF['resource_multiplier']);
         $BuildStartLvl = max($CurrentBuildtLvl - 2, 1);
         $ActualProd = floor($Prod[$BuildID]);
         $ActualNeed = $BuildID != 12 ? floor($Prod[4]) : floor($Prod[3]);
         $ProdFirst = 0;
         for ($BuildLevel = $BuildStartLvl; $BuildLevel < $BuildStartLvl + 15; $BuildLevel++) {
             /*$Prod[1] 	= floor(eval($ProdGrid[$BuildID]['formule']['metal'])     * $CONF['resource_multiplier']);
             		$Prod[2] 	= floor(eval($ProdGrid[$BuildID]['formule']['crystal'])   * $CONF['resource_multiplier']);
             		$Prod[3] 	= floor(eval($ProdGrid[$BuildID]['formule']['deuterium']) * $CONF['resource_multiplier']);
             		$Prod[4] 	= floor(eval($ProdGrid[$BuildID]['formule']['energy'])    * $CONF['resource_multiplier']);
             		$Prod[7] 	= floor(eval($ProdGrid[$BuildID]['formule']['norio'])     * $CONF['resource_multiplier']);
             		$Prod[12] 	= floor(eval($ProdGrid[$BuildID]['formule']['energy'])    * $CONF['resource_multiplier']);*/
             $Prod[1] = round(eval($ProdGrid[$BuildID]['formule']['metal']) * $CONF['resource_multiplier']);
             $Prod[2] = round(eval($ProdGrid[$BuildID]['formule']['crystal']) * $CONF['resource_multiplier']);
             $Prod[3] = round(eval($ProdGrid[$BuildID]['formule']['deuterium']) * $CONF['resource_multiplier']);
             $Prod[7] = round(eval($ProdGrid[$BuildID]['formule']['norio']) * $CONF['resource_multiplier']);
             $Prod[4] = round(eval($ProdGrid[$BuildID]['formule']['energy']) * $CONF['resource_multiplier']);
             $Prod[12] = round(eval($ProdGrid[$BuildID]['formule']['energy']) * $CONF['resource_multiplier']);
             $NeesRess = $BuildID != 12 ? floor($Prod[4]) : floor($Prod[3]);
             $prod = pretty_number(floor($Prod[$BuildID]));
             $prod_diff = colorNumber(pretty_number(floor($Prod[$BuildID] - $ActualProd)));
             $need = colorNumber(pretty_number(floor($NeesRess)));
             $need_diff = colorNumber(pretty_number(floor($NeesRess - $ActualNeed)));
             if ($ProdFirst == 0) {
                 $ProdFirst = floor($Prod[$BuildID]);
             }
             $ProductionTable[] = array('BuildLevel' => $BuildLevel, 'prod' => $prod, 'prod_diff' => $prod_diff, 'need' => $need, 'need_diff' => $need_diff);
         }
     } elseif (in_array($BuildID, $reslist['fleet'])) {
         for ($Type = 200; $Type < 500; $Type++) {
             if ($CombatCaps[$BuildID]['sd'][$Type] > 1) {
                 $RapidFire['to'][$LNG['tech'][$Type]] = $CombatCaps[$BuildID]['sd'][$Type];
             }
             if ($CombatCaps[$Type]['sd'][$BuildID] > 1) {
                 $RapidFire['from'][$LNG['tech'][$Type]] = $CombatCaps[$Type]['sd'][$BuildID];
             }
         }
         $FleetInfo[$LNG['in_struct_pt']] = pretty_number($pricelist[$BuildID]['metal'] + $pricelist[$BuildID]['crystal'] + $pricelist[$BuildID]['norio']);
         $FleetInfo[$LNG['in_shield_pt']] = pretty_number($CombatCaps[$BuildID]['shield']);
         $FleetInfo[$LNG['in_attack_pt']] = pretty_number($CombatCaps[$BuildID]['attack']);
         $FleetInfo[$LNG['in_capacity']] = pretty_number($pricelist[$BuildID]['capacity']);
         $FleetInfo[$LNG['in_base_speed']][] = pretty_number($pricelist[$BuildID]['speed']);
         $FleetInfo[$LNG['in_consumption']][] = pretty_number($pricelist[$BuildID]['consumption']);
         $FleetInfo[$LNG['in_base_speed']][] = pretty_number($pricelist[$BuildID]['speed2']);
         $FleetInfo[$LNG['in_consumption']][] = pretty_number($pricelist[$BuildID]['consumption2']);
     } elseif (in_array($BuildID, $reslist['defense'])) {
         for ($Type = 200; $Type < 500; $Type++) {
             if ($CombatCaps[$BuildID]['sd'][$Type] > 1) {
                 $RapidFire['to'][$LNG['tech'][$Type]] = $CombatCaps[$BuildID]['sd'][$Type];
             }
             if ($CombatCaps[$Type]['sd'][$BuildID] > 1) {
                 $RapidFire['from'][$LNG['tech'][$Type]] = $CombatCaps[$Type]['sd'][$BuildID];
             }
         }
         $FleetInfo[$LNG['in_struct_pt']] = pretty_number($pricelist[$BuildID]['metal'] + $pricelist[$BuildID]['crystal'] + $pricelist[$BuildID]['norio']);
         $FleetInfo[$LNG['in_shield_pt']] = pretty_number($CombatCaps[$BuildID]['shield']);
         $FleetInfo[$LNG['in_attack_pt']] = pretty_number($CombatCaps[$BuildID]['attack']);
     } elseif ($BuildID == 43 && $PLANET[$resource[43]] > 0) {
         $template->loadscript('flotten.js');
         $GateFleetList['jump'] = $this->DoFleetJump();
         $RestString = $this->GetNextJumpWaitTime($PLANET);
         if ($RestString['value'] != 0) {
             include_once ROOT_PATH . 'includes/functions/InsertJavaScriptChronoApplet.php';
             $template->assign_vars(array('gate_time_script' => InsertJavaScriptChronoApplet("Gate", "1", $RestString['value'], true), 'gate_script_go' => InsertJavaScriptChronoApplet("Gate", "1", $RestString['value'], false)));
         }
         $GateFleetList['start_link'] = BuildPlanetAdressLink($PLANET);
         $GateFleetList['moons'] = $this->BuildJumpableMoonCombo($USER, $PLANET);
         $GateFleetList['fleets'] = $this->BuildFleetListRows($PLANET);
     }
     if (in_array($BuildID, $reslist['officier'])) {
         $description = $OfficerInfo[$BuildID]['info'] ? sprintf($LNG['info'][$BuildID]['description'], is_float($OfficerInfo[$BuildID]['info']) ? $OfficerInfo[$BuildID]['info'] * 100 : $OfficerInfo[$BuildID]['info'], $pricelist[$BuildID]['max']) : sprintf($LNG['info'][$BuildID]['description'], $pricelist[$BuildID]['max']);
     } else {
         $description = $LNG['info'][$BuildID]['description'];
     }
     $template->assign_vars(array('id' => $BuildID, 'name' => $LNG['info'][$BuildID]['name'], 'image' => $BuildID, 'description' => $description, 'ProductionTable' => $ProductionTable, 'RapidFire' => $RapidFire, 'Level' => $CurrentBuildtLvl, 'FleetInfo' => $FleetInfo, 'GateFleetList' => $GateFleetList, 'in_jump_gate_jump' => $LNG['in_jump_gate_jump'], 'gate_ship_dispo' => $LNG['in_jump_gate_available'], 'in_level' => $LNG['in_level'], 'in_prod_p_hour' => $LNG['in_prod_p_hour'], 'in_difference' => $LNG['in_difference'], 'in_used_energy' => $LNG['in_used_energy'], 'in_prod_energy' => $LNG['in_prod_energy'], 'in_used_deuter' => $LNG['in_used_deuter'], 'in_rf_again' => $LNG['in_rf_again'], 'in_rf_from' => $LNG['in_rf_from'], 'in_jump_gate_select_ships' => $LNG['in_jump_gate_select_ships'], 'in_jump_gate_start_moon' => $LNG['in_jump_gate_start_moon'], 'in_jump_gate_finish_moon' => $LNG['in_jump_gate_finish_moon'], 'in_jump_gate_wait_time' => $LNG['in_jump_gate_wait_time']));
     $template->show('info_overview.tpl');
 }
示例#21
0
function ShowMessageListPage()
{
    global $db, $LNG;
    $Prev = !empty($_POST['prev']) ? true : false;
    $Next = !empty($_POST['next']) ? true : false;
    $DelSel = !empty($_POST['delsel']) ? true : false;
    $DelDat = !empty($_POST['deldat']) ? true : false;
    $CurrPage = request_var('curr', 1);
    $Selected = request_var('sele', 0);
    $SelType = request_var('type', 1);
    $SelPage = request_var('side', 1);
    $ViewPage = 1;
    if ($Selected != $SelType) {
        $Selected = $SelType;
        $ViewPage = 1;
    } elseif ($CurrPage != $SelPage) {
        $ViewPage = !empty($SelPage) ? $SelPage : 1;
    }
    if ($Selected < 100) {
        $Mess = $db->uniquequery("SELECT COUNT(*) AS `max` FROM " . MESSAGES . " WHERE `message_type` = '" . $Selected . "';");
    } elseif ($Selected == 100) {
        $Mess = $db->uniquequery("SELECT COUNT(*) AS `max` FROM " . MESSAGES . ";");
    }
    $MaxPage = ceil($Mess['max'] / 25);
    if ($Prev == true) {
        $CurrPage -= 1;
        if ($CurrPage >= 1) {
            $ViewPage = $CurrPage;
        } else {
            $ViewPage = 1;
        }
    } elseif ($Next == true && $_POST['page']) {
        $CurrPage += 1;
        if ($CurrPage <= $MaxPage) {
            $ViewPage = $CurrPage;
        } else {
            $ViewPage = $MaxPage;
        }
    }
    if ($_POST['delsel'] && is_array($_POST['sele'])) {
        if ($DelSel == true) {
            foreach ($_POST['sele'] as $MessId => $Value) {
                if ($Value = "on") {
                    $db->query("DELETE FROM " . MESSAGES . " WHERE `message_id` = '" . $MessId . "';");
                }
            }
        }
    }
    if ($DelDat == true && $_POST['deldat'] && $_POST['sele'] >= 1 && is_numeric($_POST['selday']) && is_numeric($_POST['selmonth']) && is_numeric($_POST['selyear'])) {
        $SelDay = $_POST['selday'];
        $SelMonth = $_POST['selmonth'];
        $SelYear = $_POST['selyear'];
        $LimitDate = mktime(0, 0, 0, $SelMonth, $SelDay, $SelYear);
        if ($LimitDate !== false) {
            $db->query("DELETE FROM " . MESSAGES . " WHERE `message_time` <= '" . $LimitDate . "';");
            $db->query("DELETE FROM " . RW . " WHERE `time` <= '" . $LimitDate . "';");
        }
    }
    $data = $MessagesList = array();
    unset($LNG['mg_type'][999]);
    $Selector['type'] = $LNG['mg_type'];
    for ($cPage = 1; $cPage <= $MaxPage; $cPage++) {
        $Selector['pages'][$cPage] = $cPage . '/' . $MaxPage;
    }
    $StartRec = ($ViewPage - 1) * 25;
    if ($Selected < 100) {
        $Messages = $db->query("SELECT u.username, m.* FROM " . MESSAGES . " as m, " . USERS . " as u WHERE `message_type` = '" . $Selected . "' AND m.`message_owner` = u.`id` ORDER BY `message_time` DESC LIMIT " . $StartRec . ",25;");
    } elseif ($Selected == 100) {
        $Messages = $db->query("SELECT u.username, m.* FROM " . MESSAGES . " as m, " . USERS . " as u WHERE m.`message_owner` = u.`id` ORDER BY `message_time` DESC LIMIT " . $StartRec . ",25;");
    }
    while ($row = $db->fetch_array($Messages)) {
        $MessagesList[] = array('id' => $row['message_id'], 'from' => $row['message_from'], 'to' => $row['username'] . ' ' . $LNG['input_id'] . ':' . $row['message_owner'], 'subject' => $row['message_subject'], 'text' => $row['message_text'], 'time' => str_replace(' ', '&nbsp;', date("d/M/y H:i:s", $row['message_time'])));
    }
    $template = new template();
    $template->page_header();
    $template->loadscript('global.js');
    $template->assign_vars(array('Selector' => $Selector, 'ViewPage' => $ViewPage, 'Selected' => $Selected, 'MaxPage' => $MaxPage, 'MessagesList' => $MessagesList, 'ml_page' => $LNG['ml_page'], 'ml_type' => $LNG['ml_type'], 'ml_dlte_since' => $LNG['ml_dlte_since'], 'ml_dlte_selection' => $LNG['ml_dlte_selection'], 'ml_dlte_since_button' => $LNG['ml_dlte_since_button'], 'button_des_se' => $LNG['button_des_se'], 'ml_select_all_messages' => $LNG['ml_select_all_messages'], 'input_id' => $LNG['input_id'], 'ml_date' => $LNG['ml_date'], 'ml_from' => $LNG['ml_from'], 'ml_to' => $LNG['ml_to'], 'ml_subject' => $LNG['ml_subject'], 'ml_content' => $LNG['ml_content']));
    $template->show('adm/MessageList.tpl');
}
示例#22
0
function ShowRightsPage()
{
    global $LNG, $USER;
    $mode = HTTP::_GP('mode', '');
    switch ($mode) {
        case 'rights':
            $template = new template();
            $template->loadscript('filterlist.js');
            if ($_POST) {
                $id = HTTP::_GP('id_1', 0);
                if ($USER['id'] != ROOT_USER && $id == ROOT_USER) {
                    $template->message($LNG['ad_authlevel_error_3'], '?page=rights&mode=rights&sid=' . session_id());
                    exit;
                }
                if (!isset($_POST['rights'])) {
                    $_POST['rights'] = array();
                }
                if ($_POST['action'] == 'send') {
                    $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET `rights` = '" . serialize(array_map('intval', $_POST['rights'])) . "' WHERE `id` = '" . $id . "';");
                }
                $Rights = $GLOBALS['DATABASE']->getFirstRow("SELECT rights FROM " . USERS . " WHERE `id` = '" . $id . "';");
                if (($Rights['rights'] = unserialize($Rights['rights'])) === false) {
                    $Rights['rights'] = array();
                }
                $Files = array_map('prepare', array_diff(scandir('includes/pages/adm/'), array('.', '..', '.svn', 'index.html', '.htaccess', 'ShowIndexPage.php', 'ShowOverviewPage.php', 'ShowMenuPage.php', 'ShowTopnavPage.php')));
                $template->assign_vars(array('Files' => $Files, 'Rights' => $Rights['rights'], 'id' => $id, 'yesorno' => $LNG['one_is_yes'], 'ad_authlevel_title' => $LNG['ad_authlevel_title'], 'button_submit' => $LNG['button_submit'], 'sid' => session_id()));
                $template->show('ModerrationRightsPostPage.tpl');
                exit;
            }
            if ($_GET['get'] == 'adm') {
                $WHEREUSERS = "AND `authlevel` = '" . AUTH_ADM . "'";
            } elseif ($_GET['get'] == 'ope') {
                $WHEREUSERS = "AND `authlevel` = '" . AUTH_OPS . "'";
            } elseif ($_GET['get'] == 'mod') {
                $WHEREUSERS = "AND `authlevel` = '" . AUTH_MOD . "'";
            } elseif ($_GET['get'] == 'pla') {
                $WHEREUSERS = "AND `authlevel` = '" . AUTH_USR . "'";
            }
            $QueryUsers = $GLOBALS['DATABASE']->query("SELECT `id`, `username`, `authlevel` FROM " . USERS . " WHERE `universe` = '" . Universe::getEmulated() . "'" . $WHEREUSERS . ";");
            $UserList = "";
            while ($List = $GLOBALS['DATABASE']->fetch_array($QueryUsers)) {
                $UserList .= '<option value="' . $List['id'] . '">' . $List['username'] . '&nbsp;&nbsp;(' . $LNG['rank'][$List['authlevel']] . ')</option>';
            }
            $template->assign_vars(array('Selector' => array(0 => $LNG['rank'][0], 1 => $LNG['rank'][1], 2 => $LNG['rank'][2], 3 => $LNG['rank'][3]), 'UserList' => $UserList, 'ad_authlevel_title' => $LNG['ad_authlevel_title'], 'bo_select_title' => $LNG['bo_select_title'], 'button_submit' => $LNG['button_submit'], 'button_deselect' => $LNG['button_deselect'], 'button_filter' => $LNG['button_filter'], 'ad_authlevel_insert_id' => $LNG['ad_authlevel_insert_id'], 'ad_authlevel_auth' => $LNG['ad_authlevel_auth'], 'ad_authlevel_aa' => $LNG['ad_authlevel_aa'], 'ad_authlevel_oo' => $LNG['ad_authlevel_oo'], 'ad_authlevel_mm' => $LNG['ad_authlevel_mm'], 'ad_authlevel_jj' => $LNG['ad_authlevel_jj'], 'ad_authlevel_tt' => $LNG['ad_authlevel_tt'], 'sid' => session_id()));
            $template->show('ModerrationRightsPage.tpl');
            break;
        case 'users':
            $template = new template();
            $template->loadscript('filterlist.js');
            if ($_POST) {
                $id = HTTP::_GP('id_1', 0);
                $authlevel = HTTP::_GP('authlevel', 0);
                if ($id == 0) {
                    $id = HTTP::_GP('id_2', 0);
                }
                if ($USER['id'] != ROOT_USER && $id == ROOT_USER) {
                    $template->message($LNG['ad_authlevel_error_3'], '?page=rights&mode=users&sid=' . session_id());
                    exit;
                }
                $GLOBALS['DATABASE']->multi_query("UPDATE " . USERS . " SET `authlevel` = '" . HTTP::_GP('authlevel', 0) . "' WHERE `id` = '" . $id . "';");
                $template->message($LNG['ad_authlevel_succes'], '?page=rights&mode=users&sid=' . session_id());
                exit;
            }
            if ($_GET['get'] == 'adm') {
                $WHEREUSERS = "AND `authlevel` = '" . AUTH_ADM . "'";
            } elseif ($_GET['get'] == 'ope') {
                $WHEREUSERS = "AND `authlevel` = '" . AUTH_OPS . "'";
            } elseif ($_GET['get'] == 'mod') {
                $WHEREUSERS = "AND `authlevel` = '" . AUTH_MOD . "'";
            } elseif ($_GET['get'] == 'pla') {
                $WHEREUSERS = "AND `authlevel` = '" . AUTH_USR . "'";
            }
            $QueryUsers = $GLOBALS['DATABASE']->query("SELECT `id`, `username`, `authlevel` FROM " . USERS . " WHERE `universe` = '" . Universe::getEmulated() . "'" . $WHEREUSERS . ";");
            $UserList = "";
            while ($List = $GLOBALS['DATABASE']->fetch_array($QueryUsers)) {
                $UserList .= '<option value="' . $List['id'] . '">' . $List['username'] . '&nbsp;&nbsp;(' . $LNG['rank'][$List['authlevel']] . ')</option>';
            }
            $template->assign_vars(array('Selector' => array(0 => $LNG['rank'][0], 1 => $LNG['rank'][1], 2 => $LNG['rank'][2], 3 => $LNG['rank'][3]), 'UserList' => $UserList, 'ad_authlevel_title' => $LNG['ad_authlevel_title'], 'bo_select_title' => $LNG['bo_select_title'], 'button_submit' => $LNG['button_submit'], 'button_deselect' => $LNG['button_deselect'], 'button_filter' => $LNG['button_filter'], 'ad_authlevel_insert_id' => $LNG['ad_authlevel_insert_id'], 'ad_authlevel_auth' => $LNG['ad_authlevel_auth'], 'ad_authlevel_aa' => $LNG['ad_authlevel_aa'], 'ad_authlevel_oo' => $LNG['ad_authlevel_oo'], 'ad_authlevel_mm' => $LNG['ad_authlevel_mm'], 'ad_authlevel_jj' => $LNG['ad_authlevel_jj'], 'ad_authlevel_tt' => $LNG['ad_authlevel_tt'], 'sid' => session_id()));
            $template->show('ModerrationUsersPage.tpl');
            break;
    }
}
示例#23
0
 public function DefensesBuildingPage()
 {
     global $USER, $PLANET, $LNG, $resource, $dpath, $reslist;
     include_once ROOT_PATH . 'includes/functions/IsTechnologieAccessible.php';
     include_once ROOT_PATH . 'includes/functions/GetElementPrice.php';
     $template = new template();
     if ($PLANET[$resource[21]] == 0) {
         $template->message($LNG['bd_shipyard_required']);
         exit;
     }
     $fmenge = $_POST['fmenge'];
     $cancel = request_var('auftr', range(0, MAX_FLEET_OR_DEFS_IN_BUILD - 1));
     $action = request_var('action', '');
     $PlanetRess = new ResourceUpdate();
     $PlanetRess->CalcResource();
     $NotBuilding = true;
     if (!empty($PLANET['b_building_id'])) {
         $CurrentQueue = $PLANET['b_building_id'];
         $QueueArray = explode(";", $CurrentQueue);
         for ($i = 0; $i < count($QueueArray); $i++) {
             $ListIDArray = explode(",", $QueueArray[$i]);
             if ($ListIDArray[0] == 21 || $ListIDArray[0] == 15) {
                 $NotBuilding = false;
                 break;
             }
         }
     }
     if (isset($fmenge) && $NotBuilding == true && $USER['urlaubs_modus'] == 0) {
         $ebuild = explode(";", $PLANET['b_hangar_id']);
         if (count($ebuild) - 1 >= MAX_FLEET_OR_DEFS_IN_BUILD) {
             $template->message(sprintf($LNG['bd_max_builds'], MAX_FLEET_OR_DEFS_IN_BUILD), "?page=buildings&mode=fleet", 3);
             exit;
         }
         $Missiles[502] = $PLANET[$resource[502]];
         $Missiles[503] = $PLANET[$resource[503]];
         $SiloSize = $PLANET[$resource[44]];
         $MaxMissiles = $SiloSize * 10;
         $BuildQueue = $PLANET['b_hangar_id'];
         $BuildArray = explode(";", $BuildQueue);
         for ($QElement = 0; $QElement < count($BuildArray); $QElement++) {
             $ElmentArray = explode(",", $BuildArray[$QElement]);
             if (isset($Missiles[$ElmentArray[0]])) {
                 $Missiles[$ElmentArray[0]] += $ElmentArray[1];
             }
         }
         foreach ($fmenge as $Element => $Count) {
             if (empty($Count) || !in_array($Element, $reslist['defense'])) {
                 continue;
             }
             $Count = is_numeric($Count) ? $Count : 0;
             $Count = max(min($Count, MAX_FLEET_OR_DEFS_PER_ROW), 0);
             $MaxElements = $this->GetMaxConstructibleElements($Element);
             if (empty($Element) || empty($Count) || empty($MaxElements) || !IsTechnologieAccessible($USER, $PLANET, $Element)) {
                 continue;
             }
             if ($Element == 502 || $Element == 503) {
                 $ActuMissiles = $Missiles[502] + 2 * $Missiles[503];
                 $MissilesSpace = $MaxMissiles - $ActuMissiles;
                 $Count = $Element == 502 ? min($Count, $MissilesSpace) : min($Count, floor($MissilesSpace / 2));
                 $Count = min($Count, $MaxElements);
                 $Missiles[$Element] += $Count;
             } elseif (in_array($Element, $reslist['one'])) {
                 $Count = $PLANET[$resource[$Element]] == 0 && strpos($PLANET['b_hangar_id'], $Element . ',') === false ? 1 : 0;
             } else {
                 $Count = min($Count, $MaxElements);
             }
             if ($Count < 1) {
                 continue;
             }
             $Ressource = $this->GetElementRessources($Element, $Count);
             $PLANET['metal'] -= $Ressource['metal'];
             $PLANET['crystal'] -= $Ressource['crystal'];
             $PLANET['deuterium'] -= $Ressource['deuterium'];
             $PLANET['norio'] -= $Ressource['norio'];
             $USER['darkmatter'] -= $Ressource['darkmatter'];
             $PLANET['b_hangar_id'] .= $Element . ',' . floattostring($Count) . ';';
         }
     }
     if ($action == "delete" && is_array($cancel) && $USER['urlaubs_modus'] == 0) {
         $this->CancelAuftr($cancel);
     }
     $PlanetRess->SavePlanetToDB();
     foreach ($reslist['defense'] as $Element) {
         if (!IsTechnologieAccessible($USER, $PLANET, $Element)) {
             continue;
         }
         $DefenseList[] = array('id' => $Element, 'name' => $LNG['tech'][$Element], 'descriptions' => $LNG['res']['descriptions'][$Element], 'price' => GetElementPrice($USER, $PLANET, $Element, false), 'restprice' => $this->GetRestPrice($Element), 'time' => pretty_time(GetBuildingTime($USER, $PLANET, $Element)), 'IsAvailable' => IsElementBuyable($USER, $PLANET, $Element, false), 'GetMaxAmount' => floattostring($this->GetMaxConstructibleElements($Element)), 'Available' => pretty_number($PLANET[$resource[$Element]]), 'AlreadyBuild' => in_array($Element, $reslist['one']) && (strpos($PLANET['b_hangar_id'], $Element . ",") !== false || $PLANET[$resource[$Element]] != 0) ? true : false);
     }
     $Buildlist = array();
     if (!empty($PLANET['b_hangar_id'])) {
         $ElementQueue = explode(';', $PLANET['b_hangar_id']);
         $Shipyard = array();
         $QueueTime = 0;
         foreach ($ElementQueue as $ElementLine => $Element) {
             if (empty($Element)) {
                 continue;
             }
             $Element = explode(',', $Element);
             $ElementTime = GetBuildingTime($USER, $PLANET, $Element[0]);
             $QueueTime += $ElementTime * $Element[1];
             $Shipyard[] = array($LNG['tech'][$Element[0]], $Element[1], $ElementTime);
         }
         $template->loadscript('bcmath.js');
         $template->loadscript('shipyard.js');
         $template->execscript('ShipyardInit();');
         $Buildlist = array('Queue' => $Shipyard, 'b_hangar_id_plus' => $PLANET['b_hangar'], 'pretty_time_b_hangar' => pretty_time(max($QueueTime - $PLANET['b_hangar'], 0)));
     }
     $template->assign_vars(array('DefenseList' => $DefenseList, 'NotBuilding' => $NotBuilding, 'bd_available' => $LNG['bd_available'], 'bd_remaining' => $LNG['bd_remaining'], 'fgf_time' => $LNG['fgf_time'], 'bd_build_ships' => $LNG['bd_build_ships'], 'bd_building_shipyard' => $LNG['bd_building_shipyard'], 'bd_protection_shield_only_one' => $LNG['bd_protection_shield_only_one'], 'bd_cancel_warning' => $LNG['bd_cancel_warning'], 'bd_cancel_send' => $LNG['bd_cancel_send'], 'bd_operating' => $LNG['bd_operating'], 'bd_actual_production' => $LNG['bd_actual_production'], 'BuildList' => json_encode($Buildlist), 'maxlength' => strlen(MAX_FLEET_OR_DEFS_PER_ROW)));
     $template->show("shipyard_defense.tpl");
 }
示例#24
0
function ShowAccountDataPage()
{
    global $USER, $reslist, $resource, $LNG;
    $template = new template();
    $id_u = HTTP::_GP('id_u', 0);
    if (!empty($id_u)) {
        $OnlyQueryLogin = $GLOBALS['DATABASE']->getFirstRow("SELECT `id`, `authlevel` FROM " . USERS . " WHERE `id` = '" . $id_u . "' AND `universe` = '" . $_SESSION['adminuni'] . "';");
        if (!isset($OnlyQueryLogin)) {
            exit($template->message($LNG['ac_username_doesnt'], '?page=accoutdata'));
        } else {
            foreach (array_merge($reslist['officier'], $reslist['tech']) as $ID) {
                $SpecifyItemsUQ .= "u.`" . $resource[$ID] . "`,";
            }
            // COMIENZA SAQUEO DE DATOS DE LA TABLA DE USUARIOS
            $SpecifyItemsU = "u.id,u.username,u.email,u.email_2,u.authlevel,u.id_planet,u.galaxy,u.system,u.planet,u.user_lastip,u.ip_at_reg,u.darkmatter,u.register_time,u.onlinetime,u.urlaubs_modus,u.\n\t\t\t urlaubs_until,u.ally_id,a.ally_name," . $SpecifyItemsUQ . "\n\t\t\t u.ally_register_time,u.ally_rank_id,u.bana,u.banaday";
            $UserQuery = $GLOBALS['DATABASE']->getFirstRow("SELECT " . $SpecifyItemsU . " FROM " . USERS . " as u LEFT JOIN " . SESSION . " as s ON s.userID = u.id LEFT JOIN " . ALLIANCE . " a ON a.id = u.ally_id WHERE u.`id` = '" . $id_u . "';");
            $reg_time = _date($LNG['php_tdformat'], $UserQuery['register_time'], $USER['timezone']);
            $onlinetime = _date($LNG['php_tdformat'], $UserQuery['onlinetime'], $USER['timezone']);
            $id = $UserQuery['id'];
            $nombre = $UserQuery['username'];
            $email_1 = $UserQuery['email'];
            $email_2 = $UserQuery['email_2'];
            $ip = $UserQuery['ip_at_reg'];
            $ip2 = $UserQuery['user_lastip'];
            $id_p = $UserQuery['id_planet'];
            $g = $UserQuery['galaxy'];
            $s = $UserQuery['system'];
            $p = $UserQuery['planet'];
            $info = $UserQuery['user_ua'];
            $alianza = $UserQuery['ally_name'];
            $nivel = $LNG['rank'][$UserQuery['authlevel']];
            $vacas = $LNG['one_is_yes'][$UserQuery['urlaubs_modus']];
            $suspen = $LNG['one_is_yes'][$UserQuery['bana']];
            $mo = "<a title=\"" . pretty_number($UserQuery['darkmatter']) . "\">" . shortly_number($UserQuery['darkmatter']) . "</a>";
            foreach ($reslist['officier'] as $ID) {
                $officier[] = $ID;
            }
            foreach ($reslist['tech'] as $ID) {
                $techno[] = $ID;
            }
            $techoffi = "";
            for ($i = 0; $i < max(count($reslist['officier']), count($reslist['tech'])); $i++) {
                $techoffi .= isset($techno[$i]) ? "<tr><td>" . $LNG['tech'][$techno[$i]] . ": <font color=aqua>" . $UserQuery[$resource[$techno[$i]]] . "</font></td>" : "<tr><td>&nbsp;</td>";
                $techoffi .= isset($officier[$i]) ? "<td>" . $LNG['tech'][$officier[$i]] . ": <font color=aqua>" . $UserQuery[$resource[$officier[$i]]] . "</font></td></tr>" : "<td>&nbsp;</td></tr>";
            }
            if ($UserQuery['bana'] != 0) {
                $mas = '<a ref="#" onclick="$(\'#banned\').slideToggle();return false"> ' . $LNG['ac_more'] . '</a>';
                $BannedQuery = $GLOBALS['DATABASE']->getFirstRow("SELECT theme,time,longer,author FROM " . BANNED . " WHERE `who` = '" . $UserQuery['username'] . "';");
                $sus_longer = _date($LNG['php_tdformat'], $BannedQuery['longer'], $USER['timezone']);
                $sus_time = _date($LNG['php_tdformat'], $BannedQuery['time'], $USER['timezone']);
                $sus_reason = $BannedQuery['theme'];
                $sus_author = $BannedQuery['author'];
            }
            // COMIENZA EL SAQUEO DE DATOS DE LA TABLA DE PUNTAJE
            $SpecifyItemsS = "tech_count,defs_count,fleet_count,build_count,build_points,tech_points,defs_points,fleet_points,tech_rank,build_rank,defs_rank,fleet_rank,total_points,\n\t\t\tstat_type";
            $StatQuery = $GLOBALS['DATABASE']->getFirstRow("SELECT " . $SpecifyItemsS . " FROM " . STATPOINTS . " WHERE `id_owner` = '" . $id_u . "' AND `stat_type` = '1';");
            $count_tecno = pretty_number($StatQuery['tech_count']);
            $count_def = pretty_number($StatQuery['defs_count']);
            $count_fleet = pretty_number($StatQuery['fleet_count']);
            $count_builds = pretty_number($StatQuery['build_count']);
            $point_builds = pretty_number($StatQuery['build_points']);
            $point_tecno = pretty_number($StatQuery['tech_points']);
            $point_def = pretty_number($StatQuery['defs_points']);
            $point_fleet = pretty_number($StatQuery['fleet_points']);
            $ranking_tecno = $StatQuery['tech_rank'];
            $ranking_builds = $StatQuery['build_rank'];
            $ranking_def = $StatQuery['defs_rank'];
            $ranking_fleet = $StatQuery['fleet_rank'];
            $total_points = pretty_number($StatQuery['total_points']);
            // COMIENZA EL SAQUEO DE DATOS DE LA ALIANZA
            $AliID = $UserQuery['ally_id'];
            if ($alianza == 0 && $AliID == 0) {
                $alianza = $LNG['ac_no_ally'];
                $AllianceHave = "<span class=\"no_moon\"><img src=\"./styles/resource/images/admin/arrowright.png\" width=\"16\" height=\"10\"/> \n\t\t\t\t\t\t\t" . $LNG['ac_alliance'] . "&nbsp;" . $LNG['ac_no_alliance'] . "</span>";
            } elseif ($alianza != NULL && $AliID != 0) {
                include_once 'includes/functions/BBCode.php';
                $AllianceHave = '<a href="#" onclick="$(\'#alianza\').slideToggle();return false" class="link">
							<img src="./styles/resource/images/admin/arrowright.png" width="16" height="10"> ' . $LNG['ac_alliance'] . '</a>';
                $SpecifyItemsA = "ally_owner,id,ally_tag,ally_name,ally_web,ally_description,ally_text,ally_request,ally_image,ally_members,ally_register_time";
                $AllianceQuery = $GLOBALS['DATABASE']->getFirstRow("SELECT " . $SpecifyItemsA . " FROM " . ALLIANCE . " WHERE `ally_name` = '" . $alianza . "';");
                $alianza = $alianza;
                $id_ali = " (" . $LNG['ac_ali_idid'] . "&nbsp;" . $AliID . ")";
                $id_aliz = $AllianceQuery['id'];
                $tag = $AllianceQuery['ally_tag'];
                $ali_nom = $AllianceQuery['ally_name'];
                $ali_cant = $AllianceQuery['ally_members'];
                $ally_register_time = _date($LNG['php_tdformat'], $AllianceQuery['ally_register_time'], $USER['timezone']);
                $ali_lider = $AllianceQuery['ally_owner'];
                $ali_web = $AllianceQuery['ally_web'] != NULL ? "<a href=" . $AllianceQuery['ally_web'] . " target=_blank>" . $AllianceQuery['ally_web'] . "</a>" : $LNG['ac_no_web'];
                if ($AllianceQuery['ally_description'] != NULL) {
                    $ali_ext2 = bbcode($AllianceQuery['ally_description']);
                    $ali_ext = "<a href=\"#\" rel=\"toggle[externo]\">" . $LNG['ac_view_text_ext'] . "</a>";
                } else {
                    $ali_ext = $LNG['ac_no_text_ext'];
                }
                if ($AllianceQuery['ally_text'] != NULL) {
                    $ali_int2 = bbcode($AllianceQuery['ally_text']);
                    $ali_int = "<a href=\"#\" rel=\"toggle[interno]\">" . $LNG['ac_view_text_int'] . "</a>";
                } else {
                    $ali_int = $LNG['ac_no_text_int'];
                }
                if ($AllianceQuery['ally_request'] != NULL) {
                    $ali_sol2 = bbcode($AllianceQuery['ally_request']);
                    $ali_sol = "<a href=\"#\" rel=\"toggle[solicitud]\">" . $LNG['ac_view_text_sol'] . "</a>";
                } else {
                    $ali_sol = $LNG['ac_no_text_sol'];
                }
                if ($AllianceQuery['ally_image'] != NULL) {
                    $ali_logo2 = $AllianceQuery['ally_image'];
                    $ali_logo = "<a href=\"#\" rel=\"toggle[imagen]\">" . $LNG['ac_view_image2'] . "</a>";
                } else {
                    $ali_logo = $LNG['ac_no_img'];
                }
                $SearchLeader = $GLOBALS['DATABASE']->getFirstRow("SELECT `username` FROM " . USERS . " WHERE `id` = '" . $ali_lider . "';");
                $ali_lider = $SearchLeader['username'];
                $StatQueryAlly = $GLOBALS['DATABASE']->getFirstRow("SELECT " . $SpecifyItemsS . " FROM " . STATPOINTS . " WHERE `id_owner` = '" . $ali_lider . "' AND `stat_type` = '2';");
                $count_tecno_ali = pretty_number($StatQueryAlly['tech_count']);
                $count_def_ali = pretty_number($StatQueryAlly['defs_count']);
                $count_fleet_ali = pretty_number($StatQueryAlly['fleet_count']);
                $count_builds_ali = pretty_number($StatQueryAlly['build_count']);
                $point_builds_ali = pretty_number($StatQueryAlly['build_points']);
                $point_tecno_ali = pretty_number($StatQueryAlly['tech_points']);
                $point_def_ali = pretty_number($StatQueryAlly['defs_points']);
                $point_fleet_ali = pretty_number($StatQueryAlly['fleet_points']);
                $ranking_tecno_ali = pretty_number($StatQueryAlly['tech_rank']);
                $ranking_builds_ali = pretty_number($StatQueryAlly['build_rank']);
                $ranking_def_ali = pretty_number($StatQueryAlly['defs_rank']);
                $ranking_fleet_ali = pretty_number($StatQueryAlly['fleet_rank']);
                $total_points_ali = pretty_number($StatQueryAlly['total_points']);
            }
            foreach (array_merge($reslist['fleet'], $reslist['build'], $reslist['defense']) as $ID) {
                $SpecifyItemsPQ .= "`" . $resource[$ID] . "`,";
                $RES[$resource[$ID]] = "<tr><td width=\"150\">" . $LNG['tech'][$ID] . "</td>";
            }
            $names = "<tr><th class=\"center\" width=\"150\">&nbsp;</th>";
            // COMIENZA EL SAQUEO DE DATOS DE LOS PLANETAS
            $SpecifyItemsP = "planet_type,id,name,galaxy,system,planet,destruyed,diameter,field_current,field_max,temp_min,temp_max,metal,crystal,deuterium,energy," . $SpecifyItemsPQ . "energy_used";
            $PlanetsQuery = $GLOBALS['DATABASE']->query("SELECT " . $SpecifyItemsP . " FROM " . PLANETS . " WHERE `id_owner` = '" . $id_u . "';");
            while ($PlanetsWhile = $GLOBALS['DATABASE']->fetch_array($PlanetsQuery)) {
                if ($PlanetsWhile['planet_type'] == 3) {
                    $Planettt = $PlanetsWhile['name'] . "&nbsp;(" . $LNG['ac_moon'] . ")<br><font color=aqua>[" . $PlanetsWhile['galaxy'] . ":" . $PlanetsWhile['system'] . ":" . $PlanetsWhile['planet'] . "]</font>";
                    $MoonZ = 0;
                    $Moons = $PlanetsWhile['name'] . "&nbsp;(" . $LNG['ac_moon'] . ")<br><font color=aqua>[" . $PlanetsWhile['galaxy'] . ":" . $PlanetsWhile['system'] . ":" . $PlanetsWhile['planet'] . "]</font>";
                    $MoonZ++;
                } else {
                    $Planettt = $PlanetsWhile['name'] . "<br><font color=aqua>[" . $PlanetsWhile['galaxy'] . ":" . $PlanetsWhile['system'] . ":" . $PlanetsWhile['planet'] . "]</font>";
                }
                if ($PlanetsWhile["destruyed"] == 0) {
                    $planets_moons .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . $Planettt . "</td>\n\t\t\t\t\t\t<td>" . $PlanetsWhile['id'] . "</td>\n\t\t\t\t\t\t<td>" . pretty_number($PlanetsWhile['diameter']) . "</td>\n\t\t\t\t\t\t<td>" . pretty_number($PlanetsWhile['field_current']) . " / " . pretty_number(CalculateMaxPlanetFields($PlanetsWhile)) . " (" . pretty_number($PlanetsWhile['field_current']) . " / " . pretty_number($PlanetsWhile['field_max']) . ")</td>\n\t\t\t\t\t\t<td>" . pretty_number($PlanetsWhile['temp_min']) . " / " . pretty_number($PlanetsWhile['temp_max']) . "</td>" . (allowedTo('ShowQuickEditorPage') ? "<td><a href=\"javascript:openEdit('" . $PlanetsWhile['id'] . "', 'planet');\" border=\"0\"><img src=\"./styles/resource/images/admin/GO.png\" title=" . $LNG['se_search_edit'] . "></a></td>" : "") . "</tr>";
                    $SumOfEnergy = $PlanetsWhile['energy'] + $PlanetsWhile['energy_used'];
                    if ($SumOfEnergy < 0) {
                        $Color = "<font color=#FF6600>" . shortly_number($SumOfEnergy) . "</font>";
                    } elseif ($SumOfEnergy > 0) {
                        $Color = "<font color=lime>" . shortly_number($SumOfEnergy) . "</font>";
                    } else {
                        $Color = shortly_number($SumOfEnergy);
                    }
                    $resources .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . $Planettt . "</td>\n\t\t\t\t\t\t<td><a title=\"" . pretty_number($PlanetsWhile['metal']) . "\">" . shortly_number($PlanetsWhile['metal']) . "</a></td>\n\t\t\t\t\t\t<td><a title=\"" . pretty_number($PlanetsWhile['crystal']) . "\">" . shortly_number($PlanetsWhile['crystal']) . "</a></td>\n\t\t\t\t\t\t<td><a title=\"" . pretty_number($PlanetsWhile['deuterium']) . "\">" . shortly_number($PlanetsWhile['deuterium']) . "</a></td>\n\t\t\t\t\t\t<td><a title=\"" . pretty_number($SumOfEnergy) . "\">" . $Color . "</a>/<a title=\"" . pretty_number($PlanetsWhile['energy']) . "\">" . shortly_number($PlanetsWhile['energy']) . "</a></td>\n\t\t\t\t\t</tr>";
                    $names .= "<th class=\"center\" width=\"60\">" . $Planettt . "</th>";
                    foreach (array_merge($reslist['fleet'], $reslist['build'], $reslist['defense']) as $ID) {
                        $RES[$resource[$ID]] .= "<td width=\"60\"><a title=\"" . pretty_number($PlanetsWhile[$resource[$ID]]) . "\">" . shortly_number($PlanetsWhile[$resource[$ID]]) . "</a></td>";
                    }
                    $MoonHave = $MoonZ != 0 ? '<a href="#" onclick="$(\'#especiales\').slideToggle();return false" class="link"><img src="./styles/resource/images/admin/arrowright.png" width="16" height="10"/> ' . $LNG['moon_build'] . "</a>" : "<span class=\"no_moon\"><img src=\"./styles/resource/images/admin/arrowright.png\" width=\"16\" height=\"10\"/>" . $LNG['moon_build'] . "&nbsp;" . $LNG['ac_moons_no'] . "</span>";
                }
                $DestruyeD = 0;
                if ($PlanetsWhile["destruyed"] > 0) {
                    $destroyed .= "\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>" . $PlanetsWhile['name'] . "</td>\n\t\t\t\t\t\t\t<td>" . $PlanetsWhile['id'] . "</td>\n\t\t\t\t\t\t\t<td>[" . $PlanetsWhile['galaxy'] . ":" . $PlanetsWhile['system'] . ":" . $PlanetsWhile['planet'] . "]</td>\n\t\t\t\t\t\t\t<td>" . date("d-m-Y   H:i:s", $PlanetsWhile['destruyed']) . "</td>\n\t\t\t\t\t\t</tr>";
                    $DestruyeD++;
                }
            }
            $names .= "</tr>";
            foreach (array_merge($reslist['fleet'], $reslist['build'], $reslist['defense']) as $ID) {
                $RES[$resource[$ID]] .= "</tr>";
            }
            foreach ($reslist['build'] as $ID) {
                $build .= $RES[$resource[$ID]];
            }
            foreach ($reslist['fleet'] as $ID) {
                $fleet .= $RES[$resource[$ID]];
            }
            foreach ($reslist['defense'] as $ID) {
                $defense .= $RES[$resource[$ID]];
            }
            $template->assign_vars(array('DestruyeD' => $DestruyeD, 'destroyed' => $destroyed, 'resources' => $resources, 'mo' => $mo, 'names' => $names, 'build' => $build, 'fleet' => $fleet, 'defense' => $defense, 'planets_moons' => $planets_moons, 'ali_lider' => $ali_lider, 'AllianceHave' => $AllianceHave, 'point_tecno' => $point_tecno, 'count_tecno' => $count_tecno, 'ranking_tecno' => $ranking_tecno, 'defenses_title' => $defenses_title, 'point_def' => $point_def, 'count_def' => $count_def, 'ranking_def' => $ranking_def, 'point_fleet' => $point_fleet, 'count_fleet' => $count_fleet, 'ranking_fleet' => $ranking_fleet, 'point_builds' => $point_builds, 'count_builds' => $count_builds, 'ranking_builds' => $ranking_builds, 'total_points' => $total_points, 'point_tecno_ali' => $point_tecno_ali, 'count_tecno_ali' => $count_tecno_ali, 'ranking_tecno_ali' => $ranking_tecno_ali, 'point_def_ali' => $point_def_ali, 'count_def_ali' => $count_def_ali, 'ranking_def_ali' => $ranking_def_ali, 'point_fleet_ali' => $point_fleet_ali, 'count_fleet_ali' => $count_fleet_ali, 'ranking_fleet_ali' => $ranking_fleet_ali, 'point_builds_ali' => $point_builds_ali, 'count_builds_ali' => $count_builds_ali, 'ranking_builds_ali' => $ranking_builds_ali, 'total_points_ali' => $total_points_ali, 'input_id' => $input_id, 'id_aliz' => $id_aliz, 'tag' => $tag, 'ali_nom' => $ali_nom, 'ali_ext' => $ali_ext, 'ali_ext' => $ali_ext2, 'ali_int' => $ali_int, 'ali_int' => $ali_int2, 'ali_sol2' => $ali_sol2, 'ali_sol' => $ali_sol, 'ali_logo' => $ali_logo, 'ali_logo2' => $ali_logo2, 'ali_web' => $ali_web, 'ally_register_time' => $ally_register_time, 'ali_cant' => $ali_cant, 'alianza' => $alianza, 'input_id' => $input_id, 'id' => $id, 'nombre' => $nombre, 'nivel' => $nivel, 'vacas' => $vacas, 'suspen' => $suspen, 'mas' => $mas, 'id_ali' => $id_ali, 'ip' => $ip, 'ip2' => $ip2, 'ipcheck' => true, 'reg_time' => $reg_time, 'onlinetime' => $onlinetime, 'id_p' => $id_p, 'g' => $g, 's' => $s, 'p' => $p, 'info' => $info, 'email_1' => $email_1, 'email_2' => $email_2, 'sus_time' => $sus_time, 'sus_longer' => $sus_longer, 'sus_reason' => $sus_reason, 'sus_author' => $sus_author, 'techoffi' => $techoffi, 'canedit' => allowedTo('ShowQuickEditorPage'), 'buildings_title' => $LNG['buildings_title'], 'buildings_title' => $LNG['buildings_title'], 'researchs_title	' => $LNG['researchs_title'], 'ships_title' => $LNG['ships_title'], 'defenses_title' => $LNG['defenses_title'], 'ac_recent_destroyed_planets' => $LNG['ac_recent_destroyed_planets'], 'ac_isnodestruyed' => $LNG['ac_isnodestruyed'], 'ac_note_k' => $LNG['ac_note_k'], 'ac_leyend' => $LNG['ac_leyend'], 'ac_account_data' => $LNG['ac_account_data'], 'ac_name' => $LNG['ac_name'], 'ac_mail' => $LNG['ac_mail'], 'ac_perm_mail' => $LNG['ac_perm_mail'], 'ac_auth_level' => $LNG['ac_auth_level'], 'ac_on_vacation' => $LNG['ac_on_vacation'], 'ac_banned' => $LNG['ac_banned'], 'ac_alliance' => $LNG['ac_alliance'], 'ac_reg_ip' => $LNG['ac_reg_ip'], 'ac_last_ip' => $LNG['ac_last_ip'], 'ac_checkip_title' => $LNG['ac_checkip_title'], 'ac_register_time' => $LNG['ac_register_time'], 'ac_act_time' => $LNG['ac_act_time'], 'ac_home_planet_id' => $LNG['ac_home_planet_id'], 'ac_home_planet_coord' => $LNG['ac_home_planet_coord'], 'ac_user_system' => $LNG['ac_user_system'], 'ac_ranking' => $LNG['ac_ranking'], 'ac_see_ranking' => $LNG['ac_see_ranking'], 'ac_user_ranking' => $LNG['ac_user_ranking'], 'ac_points_count' => $LNG['ac_points_count'], 'ac_ranking' => $LNG['ac_ranking'], 'ac_total_points' => $LNG['ac_total_points'], 'ac_suspended_title' => $LNG['ac_suspended_title'], 'ac_suspended_time' => $LNG['ac_suspended_time'], 'ac_suspended_longer' => $LNG['ac_suspended_longer'], 'ac_suspended_reason' => $LNG['ac_suspended_reason'], 'ac_suspended_autor' => $LNG['ac_suspended_autor'], 'ac_info_ally' => $LNG['ac_info_ally'], 'ac_leader' => $LNG['ac_leader'], 'ac_tag' => $LNG['ac_tag'], 'ac_name_ali' => $LNG['ac_name_ali'], 'ac_ext_text		' => $LNG['ac_ext_text'], 'ac_int_text' => $LNG['ac_int_text'], 'ac_sol_text' => $LNG['ac_sol_text'], 'ac_image' => $LNG['ac_image'], 'ac_ally_web' => $LNG['ac_ally_web'], 'ac_total_members' => $LNG['ac_total_members'], 'ac_ranking' => $LNG['ac_ranking'], 'ac_see_ranking' => $LNG['ac_see_ranking'], 'ac_view_image' => $LNG['ac_view_image'], 'ac_urlnow' => $LNG['ac_urlnow'], 'ac_ally_ranking' => $LNG['ac_ally_ranking'], 'ac_points_count' => $LNG['ac_points_count'], 'ac_ranking' => $LNG['ac_ranking'], 'ac_total_points' => $LNG['ac_total_points'], 'ac_id_names_coords' => $LNG['ac_id_names_coords'], 'ac_name' => $LNG['ac_name'], 'ac_diameter' => $LNG['ac_diameter'], 'ac_fields' => $LNG['ac_fields'], 'ac_temperature' => $LNG['ac_temperature'], 'se_search_edit' => $LNG['se_search_edit'], 'resources_title' => $LNG['resources_title'], 'ac_name' => $LNG['ac_name'], 'Metal' => $LNG['tech'][901], 'Crystal' => $LNG['tech'][902], 'Deuterium' => $LNG['tech'][903], 'Energy' => $LNG['tech'][911], 'Darkmatter' => $LNG['tech'][921], 'buildings_title' => $LNG['buildings_title'], 'ships_title' => $LNG['ships_title'], 'defenses_title' => $LNG['defenses_title'], 'ac_officier_research' => $LNG['ac_officier_research'], 'researchs_title' => $LNG['researchs_title'], 'officiers_title' => $LNG['officiers_title'], 'ac_name' => $LNG['ac_name'], 'input_id' => $LNG['input_id'], 'ac_coords' => $LNG['ac_coords'], 'ac_time_destruyed' => $LNG['ac_time_destruyed']));
            $template->show('AccountDataPageDetail.tpl');
        }
        exit;
    }
    $Userlist = "";
    $UserWhileLogin = $GLOBALS['DATABASE']->query("SELECT `id`, `username`, `authlevel` FROM " . USERS . " WHERE `authlevel` <= '" . $USER['authlevel'] . "' AND `universe` = '" . $_SESSION['adminuni'] . "' ORDER BY `username` ASC;");
    while ($UserList = $GLOBALS['DATABASE']->fetch_array($UserWhileLogin)) {
        $Userlist .= "<option value=\"" . $UserList['id'] . "\">" . $UserList['username'] . "&nbsp;&nbsp;(" . $LNG['rank'][$UserList['authlevel']] . ")</option>";
    }
    $template->loadscript('filterlist.js');
    $template->assign_vars(array('Userlist' => $Userlist, 'ac_enter_user_id' => $LNG['ac_enter_user_id'], 'bo_select_title' => $LNG['bo_select_title'], 'button_filter' => $LNG['button_filter'], 'button_deselect' => $LNG['button_deselect'], 'ac_select_id_num' => $LNG['ac_select_id_num'], 'button_submit' => $LNG['button_submit']));
    $template->show('AccountDataPageIntro.tpl');
}
示例#25
0
 public function __construct()
 {
     global $PLANET, $USER, $LNG, $resource, $reslist, $CONF, $db, $pricelist, $OfficerInfo;
     include_once ROOT_PATH . 'includes/functions/IsTechnologieAccessible.php';
     include_once ROOT_PATH . 'includes/functions/GetElementPrice.php';
     $template = new template();
     if ($PLANET[$resource[31]] == 0) {
         $template->message($LNG['bd_lab_required']);
         exit;
     }
     $bContinue = $this->CheckLabSettingsInQueue($PLANET) ? true : false;
     $TheCommand = request_var('cmd', '');
     $Element = request_var('tech', 0);
     $ListID = request_var('listid', 0);
     $PlanetRess = new ResourceUpdate();
     $PLANET[$resource[31] . '_inter'] = $PlanetRess->CheckAndGetLabLevel($USER, $PLANET);
     $PlanetRess->CalcResource();
     if (!empty($Element) && $bContinue && $USER['urlaubs_modus'] == 0 && ($USER[$resource[$Element]] < $pricelist[$Element]['max'] && IsTechnologieAccessible($USER, $PLANET, $Element) && in_array($Element, $reslist['tech'])) || $TheCommand == "cancel" || $TheCommand == "remove") {
         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();
     $ScriptInfo = array();
     $TechQueue = $this->ShowTechQueue();
     foreach ($reslist['tech'] as $ID => $Element) {
         if (!IsTechnologieAccessible($USER, $PLANET, $Element)) {
             continue;
         }
         $CanBeDone = IsElementBuyable($USER, $PLANET, $Element);
         if (isset($pricelist[$Element]['max']) && $USER[$resource[$Element]] >= $pricelist[$Element]['max']) {
             $TechnoLink = "<font color=\"#FF0000\">" . $LNG['bd_maxlevel'] . "</font>";
         } elseif (MAX_RESEACH_QUEUE_SIZE > 1) {
             $LevelToDo = 1 + $USER[$resource[$Element]];
             $TechnoLink = $CanBeDone && $bContinue ? "<a href=\"game.php?page=buildings&amp;mode=research&amp;cmd=insert&amp;tech=" . $Element . "\"><font color=\"#00FF00\">" . ($USER['b_tech_id'] != 0 ? $LNG['bd_add_to_list'] : $LNG['bd_research'] . ($LevelToDo == 1 ? "" : "<br>" . $LNG['bd_lvl'] . " " . $LevelToDo)) . "</font></a>" : "<font color=\"#FF0000\">" . $LNG['bd_research'] . ($LevelToDo == 1 ? "" : "<br>" . $LNG['bd_lvl'] . " " . $LevelToDo) . "</font>";
             if ($USER['b_tech_id'] != 0) {
                 $template->loadscript('researchlist.js');
                 $template->execscript('ReBuildView();Techlist();');
                 $ScriptInfo = array('bd_cancel' => $LNG['bd_cancel'], 'bd_continue' => $LNG['bd_continue'], 'bd_finished' => $LNG['bd_finished'], 'build' => $TechQueue);
             }
         } else {
             if ($USER['b_tech_id'] == 0) {
                 $LevelToDo = 1 + $USER[$resource[$Element]];
                 $TechnoLink = $CanBeDone && $bContinue ? "<a href=\"game.php?page=buildings&amp;mode=research&amp;cmd=insert&amp;tech=" . $Element . "\"><font color=\"#00FF00\">" . $LNG['bd_research'] . ($LevelToDo == 1 ? "" : "<br>" . $LNG['bd_lvl'] . " " . $LevelToDo) . "</font></a>" : "<font color=\"#FF0000\">" . $LNG['bd_research'] . ($LevelToDo == 1 ? "" : "<br>" . $LNG['bd_lvl'] . " " . $LevelToDo) . "</font>";
             } else {
                 if ($USER['b_tech_id'] == $Element) {
                     $template->loadscript('research.js');
                     if ($USER['b_tech_planet'] == $PLANET['id']) {
                         $ScriptInfo = array('tech_time' => $USER['b_tech'], 'tech_name' => '', 'game_name' => $CONF['game_name'], 'tech_lang' => $LNG['tech'][$USER['b_tech_id']], 'tech_home' => $USER['b_tech_planet'], 'tech_id' => $USER['b_tech_id'], 'bd_cancel' => $LNG['bd_cancel'], 'bd_ready' => $LNG['bd_ready'], 'bd_continue' => $LNG['bd_continue']);
                     } else {
                         $ScriptInfo = array('tech_time' => $USER['b_tech'], 'tech_name' => $LNG['bd_on'] . '<br>' . $TechQueue['planet'], 'tech_home' => $USER['b_tech_planet'], 'tech_id' => $USER['b_tech_id'], 'game_name' => $CONF['game_name'], 'tech_lang' => $LNG['tech'][$USER['b_tech_id']], 'bd_cancel' => $LNG['bd_cancel'], 'bd_ready' => $LNG['bd_ready'], 'bd_continue' => $LNG['bd_continue']);
                     }
                     $TechnoLink = '<div id="research"></div>';
                 } else {
                     $TechnoLink = '<center>-</center>';
                 }
             }
         }
         $ResearchList[] = array('id' => $Element, 'maxinfo' => isset($pricelist[$Element]['max']) && $pricelist[$Element]['max'] != 255 ? sprintf($LNG['bd_max_lvl'], $pricelist[$Element]['max']) : '', 'name' => $LNG['tech'][$Element], 'descr' => $LNG['res']['descriptions'][$Element], 'price' => GetElementPrice($USER, $PLANET, $Element), 'time' => pretty_time(GetBuildingTime($USER, $PLANET, $Element)), 'restprice' => $this->GetRestPrice($Element), 'elvl' => $Element == 106 ? $USER['rpg_espion'] * $OfficerInfo[610]['info'] . " (" . $LNG['tech'][610] . ")" : ($Element == 108 ? $USER['rpg_commandant'] * $OfficerInfo[611]['info'] . " (" . $LNG['tech'][611] . ")" : false), 'lvl' => $USER[$resource[$Element]], 'link' => $TechnoLink, 'oldlink' => MAX_RESEACH_QUEUE_SIZE == 1, 'queue' => $TechQueue);
     }
     $template->assign_vars(array('ResearchList' => $ResearchList, 'IsLabinBuild' => !$bContinue, 'ScriptInfo' => json_encode($ScriptInfo), 'bd_building_lab' => $LNG['bd_building_lab'], 'bd_remaining' => $LNG['bd_remaining'], 'bd_lvl' => $LNG['bd_lvl'], 'fgf_time' => $LNG['fgf_time']));
     $template->show('buildings_research.tpl');
 }
示例#26
0
function ShowBanPage()
{
    global $LNG, $USER;
    $ORDER = $_GET['order'] == 'id' ? "id" : "username";
    if ($_GET['view'] == 'bana') {
        $WHEREBANA = "AND `bana` = '1'";
    }
    $UserList = $GLOBALS['DATABASE']->query("SELECT `username`, `id`, `bana` FROM " . USERS . " WHERE `id` != 1 AND `authlevel` <= '" . $USER['authlevel'] . "' AND `universe` = '1' " . $WHEREBANA . " ORDER BY " . $ORDER . " ASC;");
    $UserSelect = array('List' => '', 'ListBan' => '');
    $Users = 0;
    while ($a = $GLOBALS['DATABASE']->fetch_array($UserList)) {
        $UserSelect['List'] .= '<option value="' . $a['username'] . '">' . $a['username'] . '&nbsp;&nbsp;(ID:&nbsp;' . $a['id'] . ')' . ($a['bana'] == '1' ? $LNG['bo_characters_suus'] : '') . '</option>';
        $Users++;
    }
    $GLOBALS['DATABASE']->free_result($UserList);
    $ORDER2 = $_GET['order2'] == 'id' ? "id" : "username";
    $Banneds = 0;
    $UserListBan = $GLOBALS['DATABASE']->query("SELECT `username`, `id` FROM " . USERS . " WHERE `bana` = '1' AND `universe` = '1' ORDER BY " . $ORDER2 . " ASC;");
    while ($b = $GLOBALS['DATABASE']->fetch_array($UserListBan)) {
        $UserSelect['ListBan'] .= '<option value="' . $b['username'] . '">' . $b['username'] . '&nbsp;&nbsp;(ID:&nbsp;' . $b['id'] . ')</option>';
        $Banneds++;
    }
    $GLOBALS['DATABASE']->free_result($UserListBan);
    $template = new template();
    $template->loadscript('filterlist.js');
    if (isset($_POST['panel'])) {
        $Name = HTTP::_GP('ban_name', '', true);
        $BANUSER = $GLOBALS['DATABASE']->getFirstRow("SELECT b.theme, b.longer, u.id, u.urlaubs_modus, u.timezone, u.banaday, u.username, u.email FROM " . USERS . " as u LEFT JOIN " . BANNED . " as b ON u.`username` = b.`who` WHERE u.`username` = '" . $GLOBALS['DATABASE']->sql_escape($Name) . "' AND u.`universe` = '1';");
        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/resource/images/admin/i.gif" class="tooltip" data-tooltip-content="' . $LNG['bo_bbb_title_4'] . '"></td>';
            $reas = $BANUSER['theme'];
            $timesus = "<tr>\n\t\t\t\t\t<th>" . $LNG['bo_bbb_title_5'] . "</th>\n\t\t\t\t\t<th height=25 colspan=2>" . date($LNG['php_tdformat'], $BANUSER['longer']) . "</th>\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));
    } elseif (isset($_POST['bannow']) && $BANUSER['id'] != 1) {
        $Name = HTTP::_GP('ban_name', '', true);
        $reas = HTTP::_GP('why', '', true);
        $days = HTTP::_GP('days', 0);
        $hour = HTTP::_GP('hour', 0);
        $mins = HTTP::_GP('mins', 0);
        $secs = HTTP::_GP('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 (isset($_POST['permanent'])) {
            $BannedUntil = 2147483647;
        } else {
            $BannedUntil = $BanTime + TIMESTAMP < TIMESTAMP ? TIMESTAMP : TIMESTAMP + $BanTime;
        }
        if ($BANUSER['banaday'] > TIMESTAMP) {
            $SQL = "UPDATE " . BANNED . " SET ";
            $SQL .= "`who` = '" . $Name . "', ";
            $SQL .= "`theme` = '" . $reas . "', ";
            $SQL .= "`time` = '" . TIMESTAMP . "', ";
            $SQL .= "`longer` = '" . $BannedUntil . "', ";
            $SQL .= "`author` = '" . $admin . "', ";
            $SQL .= "`email` = '" . $mail . "' ";
            $SQL .= "WHERE `who2` = '" . $Name . "' AND `universe` = '1';";
            $GLOBALS['DATABASE']->query($SQL);
        } else {
            $SQL = "INSERT INTO " . BANNED . " SET ";
            $SQL .= "`who` = '" . $Name . "', ";
            $SQL .= "`theme` = '" . $reas . "', ";
            $SQL .= "`time` = '" . TIMESTAMP . "', ";
            $SQL .= "`longer` = '" . $BannedUntil . "', ";
            $SQL .= "`author` = '" . $admin . "', ";
            $SQL .= "`universe` = '1', ";
            $SQL .= "`email` = '" . $mail . "';";
            $GLOBALS['DATABASE']->query($SQL);
        }
        $SQL = "UPDATE " . USERS . " SET ";
        $SQL .= "`bana` = '1', ";
        $SQL .= "`banaday` = '" . $BannedUntil . "', ";
        $SQL .= isset($_POST['vacat']) ? "`urlaubs_modus` = '1'" : "`urlaubs_modus` = '0'";
        $SQL .= "WHERE ";
        $SQL .= "`username` = '" . $Name . "' AND `universe` = '1';";
        $GLOVERS = $GLOBALS['DATABASE']->query("SELECT `email`, `username` FROM " . USERS . " WHERE `username` = '" . $GLOBALS['DATABASE']->sql_escape($Name) . "' AND `universe` = '1';");
        while ($UserData = $GLOBALS['DATABASE']->fetch_array($GLOVERS)) {
            $timeofban = _date($LNG['php_tdformat'], $BannedUntil, $UserData['timezone']);
            require_once 'includes/functions/BBCode.php';
            require 'includes/classes/Mail.class.php';
            if (isset($_POST['permanent'])) {
                $pmMessage = "Hello " . $UserData['username'] . ",<br> Your Dark-Space: Empire account is permanently suspended for the following reason: " . $reas . ".<br> You might still open a forum thread if you want to resolve your ban issue: <a href=http://forum.dark-space.org/index.php?/forum/17-locked-account/>Click here</a><br><br> Regards<br>The Development Team.";
            } else {
                $pmMessage = "Hello " . $UserData['username'] . ",<br> Your Dark-Space: Empire account account is suspended for the following reason: " . $reas . " until '" . $timeofban . "'.<br> You might still open a forum thread if you want to resolve your ban issue: <a href=http://forum.dark-space.org/index.php?/forum/17-locked-account/>Click here</a><br><br> Regards<br>The Development Team.";
            }
            $sendMessage = str_replace('{USERNAME}', $UserData['username'], $pmMessage);
            // Dans le cas où nos lignes comportent plus de 70 caractères, nous les coupons en utilisant wordwrap()
            $to = $UserData['email'];
            $headers = 'MIME-Version: 1.0' . "\r\n";
            $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
            $headers .= 'From: support@dark-space.org' . "\r\n";
            $headers .= 'Reply-To: support@dark-space.org' . "\r\n";
            mail($to, 'Your account is suspended', $sendMessage, $headers);
        }
        $GLOBALS['DATABASE']->query($SQL);
        $template->message($LNG['bo_the_player'] . $Name . $LNG['bo_banned'], '?page=bans');
        exit;
    } elseif (isset($_POST['unban_name'])) {
        $Name = HTTP::_GP('unban_name', '', true);
        $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET bana = '0', banaday = '0' WHERE username = '******'DATABASE']->sql_escape($Name) . "' AND `universe` = '1';");
        #DELETE FROM ".BANNED." WHERE who = '".$GLOBALS['DATABASE']->sql_escape($Name)."' AND `universe` = '1';
        $template->message($LNG['bo_the_player2'] . $Name . $LNG['bo_unbanned'], '?page=bans');
        exit;
    }
    $template->assign_vars(array('UserSelect' => $UserSelect, 'usercount' => $Users, 'bancount' => $Banneds));
    $template->show('BanPage.tpl');
}
示例#27
0
 public function __construct()
 {
     global $PLANET, $USER, $LNG, $resource, $reslist, $CONF, $db, $pricelist;
     include_once ROOT_PATH . 'includes/functions/IsTechnologieAccessible.' . PHP_EXT;
     include_once ROOT_PATH . 'includes/functions/GetElementPrice.' . PHP_EXT;
     $template = new template();
     $template->page_header();
     $template->page_topnav();
     $template->page_leftmenu();
     $template->page_planetmenu();
     $template->page_footer();
     if ($PLANET[$resource[31]] == 0) {
         $template->message($LNG['bd_lab_required']);
         exit;
     }
     $bContinue = $this->CheckLabSettingsInQueue($PLANET) ? true : false;
     $PLANET[$resource[31] . '_inter'] = $this->CheckAndGetLabLevel($USER, $PLANET);
     $TheCommand = request_var('cmd', '');
     $Element = request_var('tech', 0);
     $PlanetRess = new ResourceUpdate();
     if ($USER['urlaubs_modus'] == 0 && !empty($TheCommand) && $bContinue) {
         switch ($TheCommand) {
             case 'cancel':
                 if (empty($USER['b_tech'])) {
                     break;
                 }
                 $costs = GetBuildingPrice($USER, $PLANET, $USER['b_tech_id']);
                 if ($PLANET['id'] == $USER['b_tech_planet']) {
                     $PLANET['metal'] += $costs['metal'];
                     $PLANET['crystal'] += $costs['crystal'];
                     $PLANET['deuterium'] += $costs['deuterium'];
                 } else {
                     $db->query("UPDATE " . PLANETS . " SET `metal` = `metal` + '" . $costs['metal'] . "', `crystal` = `crystal` + '" . $costs['crystal'] . "', `deuterium` = `deuterium` + '" . $costs['deuterium'] . "' WHERE `id` = '" . $USER['b_tech_planet'] . "';");
                 }
                 $USER['darkmatter'] += $costs['darkmatter'];
                 $USER['b_tech_id'] = 0;
                 $USER['b_tech'] = 0;
                 $USER['b_tech_planet'] = 0;
                 break;
             case 'search':
                 if (!empty($USER['b_tech']) || empty($Element) || !in_array($Element, $reslist['tech']) || $USER[$resource[$Element]] >= $pricelist[$Element]['max'] || !IsTechnologieAccessible($USER, $PLANET, $Element) || !IsElementBuyable($USER, $PLANET, $Element)) {
                     break;
                 }
                 $costs = GetBuildingPrice($USER, $PLANET, $Element);
                 $PLANET['metal'] -= $costs['metal'];
                 $PLANET['crystal'] -= $costs['crystal'];
                 $PLANET['deuterium'] -= $costs['deuterium'];
                 $USER['darkmatter'] -= $costs['darkmatter'];
                 $USER['b_tech_id'] = $Element;
                 $USER['b_tech'] = TIMESTAMP + GetBuildingTime($USER, $PLANET, $Element);
                 $USER['b_tech_planet'] = $PLANET['id'];
                 break;
         }
     }
     $PlanetRess->CalcResource();
     $PlanetRess->SavePlanetToDB();
     $ScriptInfo = array();
     foreach ($reslist['tech'] as $ID => $Element) {
         if (IsTechnologieAccessible($USER, $PLANET, $Element)) {
             $CanBeDone = IsElementBuyable($USER, $PLANET, $Element);
             if (isset($pricelist[$Element]['max']) && $USER[$resource[$Element]] >= $pricelist[$Element]['max']) {
                 $TechnoLink = "<font color=\"#FF0000\">" . $LNG['bd_maxlevel'] . "</font>";
             } elseif ($USER['b_tech_id'] == 0) {
                 $LevelToDo = 1 + $USER[$resource[$Element]];
                 if ($CanBeDone && $this->CheckLabSettingsInQueue($PLANET)) {
                     $TechnoLink = "<a href=\"game.php?page=buildings&amp;mode=research&amp;cmd=search&amp;tech=" . $Element . "\"><font color=\"#00FF00\">" . $LNG['bd_research'] . ($LevelToDo == 1 ? "" : "<br>" . $LNG['bd_lvl'] . " " . $LevelToDo) . "</font></a>";
                 } else {
                     $TechnoLink = "<font color=\"#FF0000\">" . $LNG['bd_research'] . ($LevelToDo == 1 ? "" : "<br>" . $LNG['bd_lvl'] . " " . $LevelToDo) . "</font>";
                 }
             } else {
                 if ($USER['b_tech_id'] == $Element) {
                     if ($USER['b_tech_planet'] == $PLANET['id']) {
                         $template->loadscript('research.js');
                         $ScriptInfo = array('tech_time' => $USER['b_tech'], 'tech_name' => '', 'game_name' => $CONF['game_name'], 'tech_lang' => $LNG['tech'][$USER['b_tech_id']], 'tech_home' => $USER['b_tech_planet'], 'tech_id' => $USER['b_tech_id'], 'bd_cancel' => $LNG['bd_cancel'], 'bd_ready' => $LNG['bd_ready'], 'bd_continue' => $LNG['bd_continue']);
                     } else {
                         $THEPLANET = $db->uniquequery("SELECT `name` FROM " . PLANETS . " WHERE `id` = '" . $USER['b_tech_planet'] . "';");
                         $template->loadscript('research.js');
                         $ScriptInfo = array('tech_time' => $USER['b_tech'], 'tech_name' => $LNG['bd_on'] . '<br>' . $THEPLANET['name'], 'tech_home' => $USER['b_tech_planet'], 'tech_id' => $USER['b_tech_id'], 'game_name' => $CONF['game_name'], 'tech_lang' => $LNG['tech'][$USER['b_tech_id']], 'bd_cancel' => $LNG['bd_cancel'], 'bd_ready' => $LNG['bd_ready'], 'bd_continue' => $LNG['bd_continue']);
                     }
                     $TechnoLink = '<div id="research"></div>';
                 } else {
                     $TechnoLink = '<center>-</center>';
                 }
             }
             $ResearchList[] = array('id' => $Element, 'maxinfo' => isset($pricelist[$Element]['max']) && $pricelist[$Element]['max'] != 255 ? sprintf($LNG['bd_max_lvl'], $pricelist[$Element]['max']) : '', 'name' => $LNG['tech'][$Element], 'descr' => $LNG['res']['descriptions'][$Element], 'price' => GetElementPrice($USER, $PLANET, $Element), 'time' => pretty_time(GetBuildingTime($USER, $PLANET, $Element)), 'restprice' => $this->GetRestPrice($Element), 'elvl' => $Element == 106 ? $USER['rpg_espion'] * ESPION . " (" . $LNG['tech'][610] . ")" : ($Element == 108 ? $USER['rpg_commandant'] * COMMANDANT . " (" . $LNG['tech'][611] . ")" : false), 'lvl' => $USER[$resource[$Element]], 'link' => $TechnoLink);
         }
     }
     $template->assign_vars(array('ResearchList' => $ResearchList, 'IsLabinBuild' => !$bContinue, 'ScriptInfo' => json_encode($ScriptInfo), 'bd_building_lab' => $LNG['bd_building_lab'], 'bd_remaining' => $LNG['bd_remaining'], 'bd_lvl' => $LNG['bd_lvl'], 'fgf_time' => $LNG['fgf_time']));
     $template->show('buildings_research.tpl');
 }
示例#28
0
function DisplayUpdates()
{
    global $LNG;
    $Patchlevel = getVersion();
    $template = new template();
    $template->loadscript('update.js');
    $template->assign_vars(array('up_submit' => $LNG['up_submit'], 'up_version' => $LNG['up_version'], 'up_revision' => $LNG['up_revision'], 'up_add' => $LNG['up_add'], 'up_edit' => $LNG['up_edit'], 'up_del' => $LNG['up_del'], 'ml_from' => $LNG['ml_from'], 'up_aktuelle_updates' => $LNG['up_aktuelle_updates'], 'up_momentane_version' => $LNG['up_momentane_version'], 'up_alte_updates' => $LNG['up_alte_updates'], 'up_download' => $LNG['up_download_patch_files'], 'version' => implode('.', $Patchlevel), 'RevList' => json_encode(GetLogs(isset($_REQUEST['history']) ? 0 : $Patchlevel[2])), 'Rev' => $Patchlevel[2], 'canDownload' => function_exists('gzcompress')));
    $template->show('UpdatePage.tpl');
}
示例#29
0
function ShowConfigUniPage()
{
    global $LNG;
    $config = Config::get(Universe::getEmulated());
    if (!empty($_POST)) {
        $config_before = array('noobprotectiontime' => $config->noobprotectiontime, 'noobprotectionmulti' => $config->noobprotectionmulti, 'noobprotection' => $config->noobprotection, 'Defs_Cdr' => $config->Defs_Cdr, 'Fleet_Cdr' => $config->Fleet_Cdr, 'game_disable' => $config->game_disable, 'close_reason' => $config->close_reason, 'OverviewNewsFrame' => $config->OverviewNewsFrame, 'reg_closed' => $config->reg_closed, 'OverviewNewsText' => $config->OverviewNewsText, 'uni_name' => $config->uni_name, 'forum_url' => $config->forum_url, 'game_speed' => $config->game_speed, 'fleet_speed' => $config->fleet_speed, 'resource_multiplier' => $config->resource_multiplier, 'halt_speed' => $config->halt_speed, 'energySpeed' => $config->energySpeed, 'initial_fields' => $config->initial_fields, 'metal_basic_income' => $config->metal_basic_income, 'crystal_basic_income' => $config->crystal_basic_income, 'deuterium_basic_income' => $config->deuterium_basic_income, 'debug' => $config->debug, 'adm_attack' => $config->adm_attack, 'lang' => $config->lang, 'min_build_time' => $config->min_build_time, 'user_valid' => $config->user_valid, 'trade_charge' => $config->trade_charge, 'trade_allowed_ships' => $config->trade_allowed_ships, 'game_name' => $config->game_name, 'capaktiv' => $config->capaktiv, 'capprivate' => $config->capprivate, 'cappublic' => $config->cappublic, 'max_galaxy' => $config->max_galaxy, 'max_system' => $config->max_system, 'max_planets' => $config->max_planets, 'min_player_planets' => $config->min_player_planets, 'planets_tech' => $config->planets_tech, 'planets_officier' => $config->planets_officier, 'planets_per_tech' => $config->planets_per_tech, 'planet_factor' => $config->planet_factor, 'max_elements_build' => $config->max_elements_build, 'max_elements_tech' => $config->max_elements_tech, 'max_elements_ships' => $config->max_elements_ships, 'max_overflow' => $config->max_overflow, 'moon_factor' => $config->moon_factor, 'moon_chance' => $config->moon_chance, 'darkmatter_cost_trader' => $config->darkmatter_cost_trader, 'factor_university' => $config->factor_university, 'max_fleets_per_acs' => $config->max_fleets_per_acs, 'vmode_min_time' => $config->vmode_min_time, 'gate_wait_time' => $config->gate_wait_time, 'metal_start' => $config->metal_start, 'crystal_start' => $config->crystal_start, 'deuterium_start' => $config->deuterium_start, 'darkmatter_start' => $config->darkmatter_start, 'debris_moon' => $config->debris_moon, 'deuterium_cost_galaxy' => $config->deuterium_cost_galaxy, 'ref_active' => $config->ref_active, 'ref_bonus' => $config->ref_bonus, 'ref_minpoints' => $config->ref_minpoints, 'ref_max_referals' => $config->ref_max_referals, 'silo_factor' => $config->silo_factor, 'max_dm_missions' => $config->max_dm_missions, 'alliance_create_min_points' => $config->alliance_create_min_points, 'max_fleet_per_build' => $config->max_fleet_per_build);
        $game_disable = isset($_POST['closed']) && $_POST['closed'] == 'on' ? 1 : 0;
        $noobprotection = isset($_POST['noobprotection']) && $_POST['noobprotection'] == 'on' ? 1 : 0;
        $debug = isset($_POST['debug']) && $_POST['debug'] == 'on' ? 1 : 0;
        $adm_attack = isset($_POST['adm_attack']) && $_POST['adm_attack'] == 'on' ? 1 : 0;
        $OverviewNewsFrame = isset($_POST['newsframe']) && $_POST['newsframe'] == 'on' ? 1 : 0;
        $reg_closed = isset($_POST['reg_closed']) && $_POST['reg_closed'] == 'on' ? 1 : 0;
        $user_valid = isset($_POST['user_valid']) && $_POST['user_valid'] == 'on' ? 1 : 0;
        $debris_moon = isset($_POST['debris_moon']) && $_POST['debris_moon'] == 'on' ? 1 : 0;
        $ref_active = isset($_POST['ref_active']) && $_POST['ref_active'] == 'on' ? 1 : 0;
        $OverviewNewsText = $_POST['NewsText'];
        $close_reason = HTTP::_GP('close_reason', '', true);
        $uni_name = HTTP::_GP('uni_name', '', true);
        $forum_url = HTTP::_GP('forum_url', '', true);
        $game_speed = 2500 * HTTP::_GP('game_speed', 0.0);
        $fleet_speed = 2500 * HTTP::_GP('fleet_speed', 0.0);
        $resource_multiplier = HTTP::_GP('resource_multiplier', 0.0);
        $halt_speed = HTTP::_GP('halt_speed', 0.0);
        $energySpeed = HTTP::_GP('energySpeed', 0.0);
        $initial_fields = HTTP::_GP('initial_fields', 0);
        $metal_basic_income = HTTP::_GP('metal_basic_income', 0);
        $crystal_basic_income = HTTP::_GP('crystal_basic_income', 0);
        $deuterium_basic_income = HTTP::_GP('deuterium_basic_income', 0);
        $lang = HTTP::_GP('lang', '');
        $Defs_Cdr = HTTP::_GP('Defs_Cdr', 0);
        $Fleet_Cdr = HTTP::_GP('Fleet_Cdr', 0);
        $noobprotectiontime = HTTP::_GP('noobprotectiontime', 0);
        $noobprotectionmulti = HTTP::_GP('noobprotectionmulti', 0);
        $min_build_time = HTTP::_GP('min_build_time', 0);
        $trade_allowed_ships = HTTP::_GP('trade_allowed_ships', '');
        $trade_charge = HTTP::_GP('trade_charge', 0.0);
        $max_galaxy = HTTP::_GP('max_galaxy', 0);
        $max_system = HTTP::_GP('max_system', 0);
        $max_planets = HTTP::_GP('max_planets', 0);
        $min_player_planets = HTTP::_GP('min_player_planets', 0);
        $planets_tech = HTTP::_GP('planets_tech', 0);
        $planets_officier = HTTP::_GP('planets_officier', 0);
        $planets_per_tech = HTTP::_GP('planets_per_tech', 0.0);
        $planet_factor = HTTP::_GP('planet_factor', 0.0);
        $max_elements_build = HTTP::_GP('max_elements_build', 0);
        $max_elements_tech = HTTP::_GP('max_elements_tech', 0);
        $max_elements_ships = HTTP::_GP('max_elements_ships', 0);
        $max_overflow = HTTP::_GP('max_overflow', 0);
        $moon_factor = HTTP::_GP('moon_factor', 0.0);
        $moon_chance = HTTP::_GP('moon_chance', 0);
        $darkmatter_cost_trader = HTTP::_GP('darkmatter_cost_trader', 0);
        $factor_university = HTTP::_GP('factor_university', 0);
        $max_fleets_per_acs = HTTP::_GP('max_fleets_per_acs', 0);
        $vmode_min_time = HTTP::_GP('vmode_min_time', 0);
        $gate_wait_time = HTTP::_GP('gate_wait_time', 0);
        $metal_start = HTTP::_GP('metal_start', 0);
        $crystal_start = HTTP::_GP('crystal_start', 0);
        $deuterium_start = HTTP::_GP('deuterium_start', 0);
        $darkmatter_start = HTTP::_GP('darkmatter_start', 0);
        $deuterium_cost_galaxy = HTTP::_GP('deuterium_cost_galaxy', 0);
        $max_fleet_per_build = max(0, round(HTTP::_GP('max_fleet_per_build', 0.0)));
        $ref_bonus = HTTP::_GP('ref_bonus', 0);
        $ref_minpoints = HTTP::_GP('ref_minpoints', 0);
        $silo_factor = HTTP::_GP('silo_factor', 0);
        $ref_max_referals = HTTP::_GP('ref_max_referals', 0);
        $max_dm_missions = HTTP::_GP('max_dm_missions', 1);
        $alliance_create_min_points = HTTP::_GP('alliance_create_min_points', 0);
        $config_after = array('noobprotectiontime' => $noobprotectiontime, 'noobprotectionmulti' => $noobprotectionmulti, 'noobprotection' => $noobprotection, 'Defs_Cdr' => $Defs_Cdr, 'Fleet_Cdr' => $Fleet_Cdr, 'game_disable' => $game_disable, 'close_reason' => $close_reason, 'OverviewNewsFrame' => $OverviewNewsFrame, 'reg_closed' => $reg_closed, 'OverviewNewsText' => $OverviewNewsText, 'uni_name' => $uni_name, 'forum_url' => $forum_url, 'game_speed' => $game_speed, 'fleet_speed' => $fleet_speed, 'resource_multiplier' => $resource_multiplier, 'halt_speed' => $halt_speed, 'energySpeed' => $energySpeed, 'initial_fields' => $initial_fields, 'metal_basic_income' => $metal_basic_income, 'crystal_basic_income' => $crystal_basic_income, 'deuterium_basic_income' => $deuterium_basic_income, 'debug' => $debug, 'adm_attack' => $adm_attack, 'lang' => $lang, 'min_build_time' => $min_build_time, 'user_valid' => $user_valid, 'trade_charge' => $trade_charge, 'trade_allowed_ships' => $trade_allowed_ships, 'max_galaxy' => $max_galaxy, 'max_system' => $max_system, 'max_planets' => $max_planets, 'min_player_planets' => $min_player_planets, 'planets_tech' => $planets_tech, 'planets_officier' => $planets_officier, 'planets_per_tech' => $planets_per_tech, 'planet_factor' => $planet_factor, 'max_elements_build' => $max_elements_build, 'max_elements_tech' => $max_elements_tech, 'max_elements_ships' => $max_elements_ships, 'max_overflow' => $max_overflow, 'moon_factor' => $moon_factor, 'moon_chance' => $moon_chance, 'darkmatter_cost_trader' => $darkmatter_cost_trader, 'factor_university' => $factor_university, 'max_fleets_per_acs' => $max_fleets_per_acs, 'vmode_min_time' => $vmode_min_time, 'gate_wait_time' => $gate_wait_time, 'metal_start' => $metal_start, 'crystal_start' => $crystal_start, 'deuterium_start' => $deuterium_start, 'darkmatter_start' => $darkmatter_start, 'debris_moon' => $debris_moon, 'deuterium_cost_galaxy' => $deuterium_cost_galaxy, 'ref_active' => $ref_active, 'ref_bonus' => $ref_bonus, 'ref_minpoints' => $ref_minpoints, 'ref_max_referals' => $ref_max_referals, 'silo_factor' => $silo_factor, 'max_dm_missions' => $max_dm_missions, 'alliance_create_min_points' => $alliance_create_min_points, 'max_fleet_per_build' => $max_fleet_per_build);
        foreach ($config_after as $key => $value) {
            $config->{$key} = $value;
        }
        $config->save();
        $LOG = new Log(3);
        $LOG->target = 1;
        $LOG->old = $config_before;
        $LOG->new = $config_after;
        $LOG->save();
        if ($config->adm_attack == 0) {
            $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET `authattack` = '0' WHERE `universe` = '" . Universe::getEmulated() . "';");
        }
    }
    $template = new template();
    $template->loadscript('../base/jquery.autosize-min.js');
    $template->execscript('$(\'textarea\').autosize();');
    $template->assign_vars(array('se_server_parameters' => $LNG['se_server_parameters'], 'se_game_name' => $LNG['se_game_name'], 'se_uni_name' => $LNG['se_uni_name'], 'se_cookie_advert' => $LNG['se_cookie_advert'], 'se_lang' => $LNG['se_lang'], 'se_general_speed' => $LNG['se_general_speed'], 'se_fleet_speed' => $LNG['se_fleet_speed'], 'se_energy_speed' => $LNG['se_energy_speed'], 'se_halt_speed' => $LNG['se_halt_speed'], 'se_normal_speed' => $LNG['se_normal_speed'], 'se_normal_speed_fleet' => $LNG['se_normal_speed_fleet'], 'se_resources_producion_speed' => $LNG['se_resources_producion_speed'], 'se_normal_speed_resoruces' => $LNG['se_normal_speed_resoruces'], 'se_normal_speed_halt' => $LNG['se_normal_speed_halt'], 'se_forum_link' => $LNG['se_forum_link'], 'se_server_op_close' => $LNG['se_server_op_close'], 'se_server_status_message' => $LNG['se_server_status_message'], 'se_server_planet_parameters' => $LNG['se_server_planet_parameters'], 'se_initial_fields' => $LNG['se_initial_fields'], 'se_metal_production' => $LNG['se_metal_production'], 'se_admin_protection' => $LNG['se_admin_protection'], 'se_crystal_production' => $LNG['se_crystal_production'], 'se_deuterium_production' => $LNG['se_deuterium_production'], 'se_several_parameters' => $LNG['se_several_parameters'], 'se_min_build_time' => $LNG['se_min_build_time'], 'se_reg_closed' => $LNG['se_reg_closed'], 'se_verfiy_mail' => $LNG['se_verfiy_mail'], 'se_min_build_time_info' => $LNG['se_min_build_time_info'], 'se_verfiy_mail_info' => $LNG['se_verfiy_mail_info'], 'se_fields' => $LNG['se_fields'], 'se_per_hour' => $LNG['se_per_hour'], 'se_debug_mode' => $LNG['se_debug_mode'], 'se_title_admins_protection' => $LNG['se_title_admins_protection'], 'se_debug_message' => $LNG['se_debug_message'], 'se_ships_cdr_message' => $LNG['se_ships_cdr_message'], 'se_def_cdr_message' => $LNG['se_def_cdr_message'], 'se_ships_cdr' => $LNG['se_ships_cdr'], 'se_def_cdr' => $LNG['se_def_cdr'], 'se_noob_protect' => $LNG['se_noob_protect'], 'se_noob_protect3' => $LNG['se_noob_protect3'], 'se_noob_protect2' => $LNG['se_noob_protect2'], 'se_noob_protect_e2' => $LNG['se_noob_protect_e2'], 'se_noob_protect_e3' => $LNG['se_noob_protect_e3'], 'se_trader_head' => $LNG['se_trader_head'], 'se_trader_ships' => $LNG['se_trader_ships'], 'se_trader_charge' => $LNG['se_trader_charge'], 'se_news_head' => $LNG['se_news_head'], 'se_news_active' => $LNG['se_news_active'], 'se_news_info' => $LNG['se_news_info'], 'se_news' => $LNG['se_news'], 'se_news_limit' => $LNG['se_news_limit'], 'se_recaptcha_head' => $LNG['se_recaptcha_head'], 'se_recaptcha_active' => $LNG['se_recaptcha_active'], 'se_recaptcha_desc' => $LNG['se_recaptcha_desc'], 'se_recaptcha_public' => $LNG['se_recaptcha_public'], 'se_recaptcha_private' => $LNG['se_recaptcha_private'], 'se_smtp' => $LNG['se_smtp'], 'se_mail_active' => $LNG['se_mail_active'], 'se_mail_use' => $LNG['se_mail_use'], 'se_smail_path' => $LNG['se_smail_path'], 'se_smtp_info' => $LNG['se_smtp_info'], 'se_smtp_host' => $LNG['se_smtp_host'], 'se_smtp_host_info' => $LNG['se_smtp_host_info'], 'se_smtp_ssl' => $LNG['se_smtp_ssl'], 'se_smtp_ssl_info' => $LNG['se_smtp_ssl_info'], 'se_smtp_port' => $LNG['se_smtp_port'], 'se_smtp_port_info' => $LNG['se_smtp_port_info'], 'se_smtp_user' => $LNG['se_smtp_user'], 'se_smtp_pass' => $LNG['se_smtp_pass'], 'se_smtp_sendmail' => $LNG['se_smtp_sendmail'], 'se_smtp_sendmail_info' => $LNG['se_smtp_sendmail_info'], 'se_google' => $LNG['se_google'], 'se_google_active' => $LNG['se_google_active'], 'se_google_info' => $LNG['se_google_info'], 'se_google_key' => $LNG['se_google_key'], 'se_google_key_info' => $LNG['se_google_key_info'], 'se_save_parameters' => $LNG['se_save_parameters'], 'se_max_galaxy' => $LNG['se_max_galaxy'], 'se_max_galaxy_info' => $LNG['se_max_galaxy_info'], 'se_max_system' => $LNG['se_max_system'], 'se_max_system_info' => $LNG['se_max_system_info'], 'se_max_planets' => $LNG['se_max_planets'], 'se_max_planets_info' => $LNG['se_max_planets_info'], 'se_min_player_planets' => $LNG['se_min_player_planets'], 'se_max_player_planets_info' => $LNG['se_max_player_planets_info'], 'se_max_player_planets' => $LNG['se_max_player_planets'], 'se_min_player_planets_info' => $LNG['se_min_player_planets_info'], 'se_planet_factor' => $LNG['se_planet_factor'], 'se_planet_factor_info' => $LNG['se_planet_factor_info'], 'se_max_elements_build' => $LNG['se_max_elements_build'], 'se_max_elements_build_info' => $LNG['se_max_elements_build_info'], 'se_max_elements_tech' => $LNG['se_max_elements_tech'], 'se_max_elements_tech_info' => $LNG['se_max_elements_tech_info'], 'se_max_elements_ships' => $LNG['se_max_elements_ships'], 'se_max_elements_ships_info' => $LNG['se_max_elements_ships_info'], 'se_max_fleet_per_build' => $LNG['se_max_fleet_per_build'], 'se_max_fleet_per_build_info' => $LNG['se_max_fleet_per_build_info'], 'se_max_overflow' => $LNG['se_max_overflow'], 'se_max_overflow_info' => $LNG['se_max_overflow_info'], 'se_moon_factor' => $LNG['se_moon_factor'], 'se_moon_factor_info' => $LNG['se_moon_factor_info'], 'se_moon_chance' => $LNG['se_moon_chance'], 'se_moon_chance_info' => $LNG['se_moon_chance_info'], 'se_darkmatter_cost_trader' => $LNG['se_darkmatter_cost_trader'], 'se_darkmatter_cost_trader_info' => $LNG['se_darkmatter_cost_trader_info'], 'se_factor_university' => $LNG['se_factor_university'], 'se_factor_university_info' => $LNG['se_factor_university_info'], 'se_max_fleets_per_acs' => $LNG['se_max_fleets_per_acs'], 'se_max_fleets_per_acs_info' => $LNG['se_max_fleets_per_acs_info'], 'se_vmode_min_time' => $LNG['se_vmode_min_time'], 'se_vmode_min_time_info' => $LNG['se_vmode_min_time_info'], 'se_gate_wait_time' => $LNG['se_gate_wait_time'], 'se_gate_wait_time_info' => $LNG['se_gate_wait_time_info'], 'se_metal_start' => $LNG['se_metal_start'], 'se_metal_start_info' => $LNG['se_metal_start_info'], 'se_crystal_start' => $LNG['se_crystal_start'], 'se_crystal_start_info' => $LNG['se_crystal_start_info'], 'se_deuterium_start' => $LNG['se_deuterium_start'], 'se_deuterium_start_info' => $LNG['se_deuterium_start_info'], 'se_darkmatter_start' => $LNG['se_darkmatter_start'], 'se_darkmatter_start_info' => $LNG['se_darkmatter_start_info'], 'se_debris_moon' => $LNG['se_debris_moon'], 'se_debris_moon_info' => $LNG['se_debris_moon_info'], 'se_deuterium_cost_galaxy' => $LNG['se_deuterium_cost_galaxy'], 'se_deuterium_cost_galaxy_info' => $LNG['se_deuterium_cost_galaxy_info'], 'se_buildlist' => $LNG['se_buildlist'], 'Deuterium' => $LNG['tech'][903], 'Darkmatter' => $LNG['tech'][921], 'se_ref' => $LNG['se_ref'], 'se_ref_active' => $LNG['se_ref_active'], 'se_ref_active_info' => $LNG['se_ref_active_info'], 'se_ref_max_referals' => $LNG['se_ref_max_referals'], 'se_ref_max_referals_info' => $LNG['se_ref_max_referals_info'], 'se_ref_bonus' => $LNG['se_ref_bonus'], 'se_ref_bonus_info' => $LNG['se_ref_bonus_info'], 'se_ref_minpoints' => $LNG['se_ref_minpoints'], 'se_ref_minpoints_info' => $LNG['se_ref_minpoints_info'], 'se_silo_factor' => $LNG['se_silo_factor'], 'se_silo_factor_info' => $LNG['se_silo_factor_info'], 'se_max_dm_missions' => $LNG['se_max_dm_missions'], 'se_alliance_create_min_points' => $LNG['se_alliance_create_min_points'], 'game_name' => $config->game_name, 'uni_name' => $config->uni_name, 'game_speed' => $config->game_speed / 2500, 'fleet_speed' => $config->fleet_speed / 2500, 'resource_multiplier' => $config->resource_multiplier, 'halt_speed' => $config->halt_speed, 'energySpeed' => $config->energySpeed, 'forum_url' => $config->forum_url, 'initial_fields' => $config->initial_fields, 'metal_basic_income' => $config->metal_basic_income, 'crystal_basic_income' => $config->crystal_basic_income, 'deuterium_basic_income' => $config->deuterium_basic_income, 'game_disable' => $config->game_disable, 'close_reason' => $config->close_reason, 'debug' => $config->debug, 'adm_attack' => $config->adm_attack, 'defenses' => $config->Defs_Cdr, 'shiips' => $config->Fleet_Cdr, 'noobprot' => $config->noobprotection, 'noobprot2' => $config->noobprotectiontime, 'noobprot3' => $config->noobprotectionmulti, '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, 'user_valid' => $config->user_valid, 'newsframe' => $config->OverviewNewsFrame, 'reg_closed' => $config->reg_closed, 'NewsTextVal' => $config->OverviewNewsText, 'capprivate' => $config->capprivate, 'cappublic' => $config->cappublic, 'capaktiv' => $config->capaktiv, 'min_build_time' => $config->min_build_time, 'trade_allowed_ships' => $config->trade_allowed_ships, 'trade_charge' => $config->trade_charge, 'Selector' => array('langs' => $LNG->getAllowedLangs(false), 'mail' => $LNG['se_mail_sel'], 'encry' => array('' => $LNG['se_smtp_ssl_1'], 'ssl' => $LNG['se_smtp_ssl_2'], 'tls' => $LNG['se_smtp_ssl_3'])), 'lang' => $config->lang, 'max_galaxy' => $config->max_galaxy, 'max_system' => $config->max_system, 'max_planets' => $config->max_planets, 'min_player_planets' => $config->min_player_planets, 'planets_tech' => $config->planets_tech, 'planets_officier' => $config->planets_officier, 'planets_per_tech' => $config->planets_per_tech, 'planet_factor' => $config->planet_factor, 'max_elements_build' => $config->max_elements_build, 'max_elements_tech' => $config->max_elements_tech, 'max_elements_ships' => $config->max_elements_ships, 'max_fleet_per_build' => $config->max_fleet_per_build, 'max_overflow' => $config->max_overflow, 'moon_factor' => $config->moon_factor, 'moon_chance' => $config->moon_chance, 'darkmatter_cost_trader' => $config->darkmatter_cost_trader, 'factor_university' => $config->factor_university, 'max_fleets_per_acs' => $config->max_fleets_per_acs, 'vmode_min_time' => $config->vmode_min_time, 'gate_wait_time' => $config->gate_wait_time, 'metal_start' => $config->metal_start, 'crystal_start' => $config->crystal_start, 'deuterium_start' => $config->deuterium_start, 'darkmatter_start' => $config->darkmatter_start, 'debris_moon' => $config->debris_moon, 'deuterium_cost_galaxy' => $config->deuterium_cost_galaxy, 'ref_active' => $config->ref_active, 'ref_bonus' => $config->ref_bonus, 'ref_minpoints' => $config->ref_minpoints, 'ref_max_referals' => $config->ref_max_referals, 'silo_factor' => $config->silo_factor, 'max_dm_missions' => $config->max_dm_missions, 'alliance_create_min_points' => $config->alliance_create_min_points));
    $template->show('ConfigBodyUni.tpl');
}