Example #1
0
 function show()
 {
     global $PLANET, $LNG, $resource;
     $this->initTemplate();
     $this->setWindow('popup');
     $this->tplObj->loadscript('phalanx.js');
     $Galaxy = HTTP::_GP('galaxy', 0);
     $System = HTTP::_GP('system', 0);
     $Planet = HTTP::_GP('planet', 0);
     if (!$this->allowPhalanx($Galaxy, $System)) {
         $this->printMessage($LNG['px_out_of_range']);
     }
     if ($PLANET[$resource[903]] < PHALANX_DEUTERIUM) {
         $this->printMessage($LNG['px_no_deuterium']);
     }
     $db = Database::get();
     $sql = "UPDATE %%PLANETS%% SET deuterium = deuterium - :phalanxDeuterium WHERE id = :planetID;";
     $db->update($sql, array(':phalanxDeuterium' => PHALANX_DEUTERIUM, ':planetID' => $PLANET['id']));
     $sql = "SELECT id, name, id_owner FROM %%PLANETS%% WHERE universe = :universe\n\t\tAND galaxy = :galaxy AND system = :system AND planet = :planet AND :type;";
     $TargetInfo = $db->selectSingle($sql, array(':universe' => Universe::current(), ':galaxy' => $Galaxy, ':system' => $System, ':planet' => $Planet, ':type' => 1));
     if (empty($TargetInfo)) {
         $this->printMessage($LNG['px_out_of_range']);
     }
     require 'includes/classes/class.FlyingFleetsTable.php';
     $fleetTableObj = new FlyingFleetsTable();
     $fleetTableObj->setPhalanxMode();
     $fleetTableObj->setUser($TargetInfo['id_owner']);
     $fleetTableObj->setPlanet($TargetInfo['id']);
     $fleetTable = $fleetTableObj->renderTable();
     $this->assign(array('galaxy' => $Galaxy, 'system' => $System, 'planet' => $Planet, 'name' => $TargetInfo['name'], 'fleetTable' => $fleetTable));
     $this->display('page.phalanx.default.tpl');
 }
Example #2
0
 function show()
 {
     global $USER, $PLANET, $LNG, $UNI, $resource;
     require_once 'includes/classes/class.FlyingFleetsTable.php';
     $FlyingFleetsTable = new FlyingFleetsTable();
     $this->initTemplate();
     $this->setWindow('popup');
     $this->tplObj->loadscript('phalanx.js');
     $Galaxy = HTTP::_GP('galaxy', 0);
     $System = HTTP::_GP('system', 0);
     $Planet = HTTP::_GP('planet', 0);
     if (!$this->allowPhalanx($Galaxy, $System)) {
         $this->printMessage($LNG['px_out_of_range']);
     }
     if ($PLANET[$resource[903]] < PHALANX_DEUTERIUM) {
         $this->printMessage($LNG['px_no_deuterium']);
     }
     $GLOBALS['DATABASE']->query("UPDATE " . PLANETS . " SET `deuterium` = `deuterium` - " . PHALANX_DEUTERIUM . " WHERE `id` = '" . $PLANET['id'] . "';");
     $TargetInfo = $GLOBALS['DATABASE']->getFirstRow("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)) {
         $this->printMessage($LNG['px_out_of_range']);
     }
     require_once 'includes/classes/class.FlyingFleetsTable.php';
     $fleetTableObj = new FlyingFleetsTable();
     $fleetTableObj->setPhalanxMode();
     $fleetTableObj->setUser($TargetInfo['id_owner']);
     $fleetTableObj->setPlanet($TargetInfo['id']);
     $fleetTable = $fleetTableObj->renderTable();
     $this->tplObj->assign_vars(array('galaxy' => $Galaxy, 'system' => $System, 'planet' => $Planet, 'name' => $TargetInfo['name'], 'fleetTable' => $fleetTable));
     $this->display('page.phalanx.default.tpl');
 }
 private function GetFleets()
 {
     global $USER, $PLANET;
     require 'includes/classes/class.FlyingFleetsTable.php';
     $fleetTableObj = new FlyingFleetsTable();
     $fleetTableObj->setUser($USER['id']);
     $fleetTableObj->setPlanet($PLANET['id']);
     return $fleetTableObj->renderTable();
 }
Example #4
0
function ShowFlyingFleetPage()
{
    global $LNG, $db;
    $id = request_var('id', 0);
    if (!empty($id)) {
        $db->query("UPDATE " . FLEETS . " SET `fleet_busy` = '" . request_var('lock', 0) . "' WHERE `fleet_id` = '" . $id . "' AND `fleet_universe` = '" . $_SESSION['adminuni'] . "';;");
    }
    $FlyingFleetsTable = new FlyingFleetsTable();
    $template = new template();
    $template->assign_vars(array('FleetList' => $FlyingFleetsTable->BuildFlyingFleetTable(), 'ff_id' => $LNG['ff_id'], 'ff_ammount' => $LNG['ff_ammount'], 'ff_mission' => $LNG['ff_mission'], 'ff_beginning' => $LNG['ff_beginning'], 'ff_departure' => $LNG['ff_departure'], 'ff_departure_hour' => $LNG['ff_departure_hour'], 'ff_objective' => $LNG['ff_objective'], 'ff_arrival' => $LNG['ff_arrival'], 'ff_arrival_hour' => $LNG['ff_arrival_hour'], 'ff_hold_position' => $LNG['ff_hold_position'], 'ff_lock' => $LNG['ff_lock'], 'ff_no_fleets' => $LNG['ff_no_fleets']));
    $template->show('adm/FlyingFleetPage.tpl');
}
Example #5
0
function ShowFleetAdmin($user)
{
    global $lang, $svn_root, $phpEx, $displays;
    include $svn_root . 'includes/functions/classes/class.FlyingFleetsTable.' . $phpEx;
    if ($user['authlevel'] < 1) {
        die($displays->message($lang['not_enough_permissions']));
    }
    $displays->assignContent("adm/fleet_body");
    $FlyingFleetsTable = new FlyingFleetsTable();
    $flota = $FlyingFleetsTable->BuildFlyingFleetTable();
    $displays->assign('flt_table', $flota["flt_table"]);
    $displays->display();
}
Example #6
0
function ShowPhalanxPage($CurrentUser, $CurrentPlanet)
{
    global $xgp_root, $phpEx, $lang;
    include_once $xgp_root . 'includes/functions/InsertJavaScriptChronoApplet.' . $phpEx;
    include_once $xgp_root . 'includes/classes/class.FlyingFleetsTable.' . $phpEx;
    include_once $xgp_root . 'includes/classes/class.GalaxyRows.' . $phpEx;
    $FlyingFleetsTable = new FlyingFleetsTable();
    $GalaxyRows = new GalaxyRows();
    $parse = $lang;
    $radar_menzil_min = $CurrentPlanet['system'] - $GalaxyRows->GetPhalanxRange($CurrentPlanet['phalanx']);
    $radar_menzil_max = $CurrentPlanet['system'] + $GalaxyRows->GetPhalanxRange($CurrentPlanet['phalanx']);
    if ($radar_menzil_min < 1) {
        $radar_menzil_min = 1;
    }
    if ($radar_menzil_max > MAX_SYSTEM_IN_GALAXY) {
        $radar_menzil_max = MAX_SYSTEM_IN_GALAXY;
    }
    if (intval($_GET["system"]) < $radar_menzil_min or intval($_GET["system"]) > $radar_menzil_max) {
        $DoScan = false;
    }
    if ($CurrentPlanet['planet_type'] == 3) {
        $parse['phl_pl_galaxy'] = $CurrentPlanet['galaxy'];
        $parse['phl_pl_system'] = $CurrentPlanet['system'];
        $parse['phl_pl_place'] = $CurrentPlanet['planet'];
        $parse['phl_pl_name'] = $CurrentUser['username'];
        if ($CurrentPlanet['deuterium'] > 10000) {
            doquery("UPDATE {{table}} SET `deuterium` = `deuterium` - '10000' WHERE `id` = '" . $CurrentUser['current_planet'] . "';", 'planets');
            $parse['phl_er_deuter'] = "";
            $DoScan = true;
        } else {
            $parse['phl_er_deuter'] = $lang['px_no_deuterium'];
            $DoScan = false;
        }
        if ($DoScan == true) {
            $Galaxy = intval($_GET["galaxy"]);
            $System = intval($_GET["system"]);
            $Planet = intval($_GET["planet"]);
            $PlType = intval($_GET["planettype"]);
            if ($PlType == 1) {
            } else {
                die(header("Location: game.php?page=galaxy"));
            }
            $TargetInfo = doquery("SELECT * FROM {{table}} WHERE `galaxy` = '" . $Galaxy . "' AND `system` = '" . $System . "' AND `planet` = '" . $Planet . "' AND `planet_type` = '" . $PlType . "';", 'planets', true);
            $TargetName = $TargetInfo['name'];
            $QryLookFleets = "SELECT * ";
            $QryLookFleets .= "FROM {{table}} ";
            $QryLookFleets .= "WHERE ( ( ";
            $QryLookFleets .= "`fleet_start_galaxy` = '" . $Galaxy . "' AND ";
            $QryLookFleets .= "`fleet_start_system` = '" . $System . "' AND ";
            $QryLookFleets .= "`fleet_start_planet` = '" . $Planet . "' AND ";
            $QryLookFleets .= "`fleet_start_type` = '" . $PlType . "' ";
            $QryLookFleets .= ") OR ( ";
            $QryLookFleets .= "`fleet_end_galaxy` = '" . $Galaxy . "' AND ";
            $QryLookFleets .= "`fleet_end_system` = '" . $System . "' AND ";
            $QryLookFleets .= "`fleet_end_planet` = '" . $Planet . "' AND ";
            $QryLookFleets .= "`fleet_end_type` = '" . $PlType . "' ";
            $QryLookFleets .= ") ) ";
            $QryLookFleets .= "ORDER BY `fleet_start_time`;";
            $FleetToTarget = doquery($QryLookFleets, 'fleets');
            if (mysql_num_rows($FleetToTarget) != 0) {
                while ($FleetRow = mysql_fetch_array($FleetToTarget)) {
                    $Record++;
                    $StartTime = $FleetRow['fleet_start_time'];
                    $StayTime = $FleetRow['fleet_end_stay'];
                    $EndTime = $FleetRow['fleet_end_time'];
                    if ($FleetRow['fleet_owner'] == $TargetInfo['id_owner']) {
                        $FleetType = true;
                    } else {
                        $FleetType = false;
                    }
                    $FleetRow['fleet_resource_metal'] = 0;
                    $FleetRow['fleet_resource_crystal'] = 0;
                    $FleetRow['fleet_resource_deuterium'] = 0;
                    $Label = "fs";
                    if ($StartTime > time()) {
                        $fpage[$StartTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, $FleetType, $Label, $Record);
                    }
                    if ($FleetRow['fleet_mission'] != 4) {
                        $Label = "ft";
                        if ($StayTime > time()) {
                            $fpage[$StayTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, $FleetType, $Label, $Record);
                        }
                        if ($FleetType == true) {
                            $Label = "fe";
                            if ($EndTime > time()) {
                                $fpage[$EndTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 2, $FleetType, $Label, $Record);
                            }
                        }
                    }
                }
            }
            if (count($fpage) > 0) {
                ksort($fpage);
                foreach ($fpage as $FleetTime => $FleetContent) {
                    $Fleets .= $FleetContent . "\n";
                }
            }
        }
        $parse['phl_fleets_table'] = $Fleets;
    } else {
        header("location:game.php?page=overview");
    }
    return display(parsetemplate(gettemplate('galaxy/phalanx_body'), $parse), false, '', false, false);
}
Example #7
0
<?php

define('INSIDE', true);
define('INSTALL', false);
define('IN_ADMIN', true);
$svn_root = './../';
include $svn_root . 'extension.inc.php';
include $svn_root . 'common.' . $phpEx;
include $svn_root . 'includes/functions/classes/class.FlyingFleetsTable.' . $phpEx;
if ($user['authlevel'] < 1) {
    die($displays->message($lang['not_enough_permissions']));
}
//$parse				= $lang;
$FlyingFleetsTable = new FlyingFleetsTable();
$parse['flt_table'] = $FlyingFleetsTable->BuildFlyingFleetTable();
display(parsetemplate(gettemplate('adm/fleet_body'), $parse), false, '', true, false);
Example #8
0
include_once ROOT_PATH . 'extension.inc';
include_once ROOT_PATH . 'common.' . PHP_EXT;
$SESSION = new Session();
if (!$SESSION->IsUserLogin() || $CONF['game_disable'] == 0 && $_SESSION['authlevel'] == 0) {
    exit(json_encode(array()));
}
includeLang('INGAME');
$action = request_var('action', '');
switch ($action) {
    case 'getfleets':
        includeLang('TECH');
        $OwnFleets = $db->query("SELECT DISTINCT * FROM " . FLEETS . " WHERE `fleet_owner` = '" . $_SESSION['id'] . "' OR `fleet_target_owner` = '" . $_SESSION['id'] . "';");
        $Record = 0;
        if ($db->num_rows($OwnFleets) > 0) {
            require_once ROOT_PATH . 'includes/classes/class.FlyingFleetsTable.' . PHP_EXT;
            $FlyingFleetsTable = new FlyingFleetsTable();
        }
        $ACSDone = array();
        $FleetData = array();
        while ($FleetRow = $db->fetch_array($OwnFleets)) {
            $Record++;
            $IsOwner = $FleetRow['fleet_owner'] == $_SESSION['id'] ? true : false;
            if ($FleetRow['fleet_mess'] == 0 && $FleetRow['fleet_start_time'] > TIMESTAMP && ($FleetRow['fleet_group'] == 0 || !in_array($FleetRow['fleet_group'], $ACSDone))) {
                $ACSDone[] = $FleetRow['fleet_group'];
                $FleetData[$FleetRow['fleet_start_time'] . $FleetRow['fleet_id']] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, $IsOwner, 'fs', $Record, true);
            }
            if ($FleetRow['fleet_mission'] == 10 || $FleetRow['fleet_mission'] == 4 && $FleetRow['fleet_mess'] == 0) {
                continue;
            }
            if ($FleetRow['fleet_mess'] != 1 && $FleetRow['fleet_end_stay'] > TIMESTAMP) {
                $FleetData[$FleetRow['fleet_end_stay'] . $FleetRow['fleet_id']] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 2, $IsOwner, 'ft', $Record);
Example #9
0
function ShowOverviewPage($CurrentUser, $CurrentPlanet)
{
    global $xgp_root, $phpEx, $dpath, $game_config, $lang, $planetrow, $user;
    include_once $xgp_root . 'includes/functions/InsertJavaScriptChronoApplet.' . $phpEx;
    include_once $xgp_root . 'includes/classes/class.FlyingFleetsTable.' . $phpEx;
    $FlyingFleetsTable = new FlyingFleetsTable();
    $lunarow = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '" . intval($CurrentPlanet['id_owner']) . "' AND `galaxy` = '" . intval($CurrentPlanet['galaxy']) . "' AND `system` = '" . intval($CurrentPlanet['system']) . "' AND  `planet` = '" . intval($CurrentPlanet['planet']) . "' AND `planet_type`='3'", 'planets', true);
    if (empty($lunarow)) {
        unset($lunarow);
    }
    CheckPlanetUsedFields($lunarow);
    $parse = $lang;
    $parse['planet_id'] = $CurrentPlanet['id'];
    $parse['planet_name'] = $CurrentPlanet['name'];
    $parse['galaxy_galaxy'] = $CurrentPlanet['galaxy'];
    $parse['galaxy_system'] = $CurrentPlanet['system'];
    $parse['galaxy_planet'] = $CurrentPlanet['planet'];
    switch ($_GET['mode']) {
        case 'renameplanet':
            if ($_POST['action'] == $lang['ov_planet_rename_action']) {
                $newname = mysql_escape_string(strip_tags(trim($_POST['newname'])));
                if (preg_match("/[^A-z0-9_\\- ]/", $newname) == 1) {
                    message($lang['ov_newname_error'], "game.php?page=overview&mode=renameplanet", 2);
                }
                if ($newname != "") {
                    doquery("UPDATE {{table}} SET `name` = '" . $newname . "' WHERE `id` = '" . intval($CurrentUser['current_planet']) . "' LIMIT 1;", "planets");
                }
            } elseif ($_POST['action'] == $lang['ov_abandon_planet']) {
                return display(parsetemplate(gettemplate('overview/overview_deleteplanet'), $parse));
            } elseif (intval($_POST['kolonieloeschen']) == 1 && intval($_POST['deleteid']) == $CurrentUser['current_planet']) {
                $filokontrol = doquery("SELECT * FROM {{table}} WHERE fleet_owner = '" . intval($user['id']) . "' AND fleet_start_galaxy='" . intval($CurrentPlanet['galaxy']) . "' AND fleet_start_system='" . intval($CurrentPlanet['system']) . "' AND fleet_start_planet='" . intval($CurrentPlanet['planet']) . "'", 'fleets');
                while ($satir = mysql_fetch_array($filokontrol)) {
                    $kendifilo = $satir['fleet_owner'];
                    $digerfilo = $satir['fleet_target_owner'];
                    $harabeyeri = $satir['fleet_end_type'];
                    $mess = $satir['fleet_mess'];
                }
                $filokontrol = doquery("SELECT * FROM {{table}} WHERE fleet_target_owner = '" . intval($user['id']) . "' AND fleet_end_galaxy='" . intval($CurrentPlanet['galaxy']) . "' AND fleet_end_system='" . intval($CurrentPlanet['system']) . "' AND fleet_end_planet='" . intval($CurrentPlanet['planet']) . "'", 'fleets');
                while ($satir = mysql_fetch_array($filokontrol)) {
                    $kendifilo = $satir['fleet_owner'];
                    $digerfilo = $satir['fleet_target_owner'];
                    $gezoay = $satir['fleet_end_type'];
                    $mess = $satir['fleet_mess'];
                }
                if ($kendifilo > 0) {
                    message($lang['ov_abandon_planet_not_possible'], 'game.php?page=overview&mode=renameplanet');
                } elseif ($digerfilo > 0 && $mess < 1 && $gezoay != 2) {
                    message($lang['ov_abandon_planet_not_possible'], 'game.php?page=overview&mode=renameplanet');
                } else {
                    if (md5($_POST['pw']) == $CurrentUser["password"] && $CurrentUser['id_planet'] != $CurrentUser['current_planet']) {
                        doquery("UPDATE {{table}} SET `destruyed` = '" . (time() + 86400) . "' WHERE `id` = '" . intval($CurrentUser['current_planet']) . "' LIMIT 1;", 'planets');
                        doquery("UPDATE {{table}} SET `current_planet` = `id_planet` WHERE `id` = '" . intval($CurrentUser['id']) . "' LIMIT 1", "users");
                        doquery("DELETE FROM {{table}} WHERE `galaxy` = '" . intval($CurrentPlanet['galaxy']) . "' AND `system` = '" . intval($CurrentPlanet['system']) . "' AND `planet` = '" . intval($CurrentPlanet['planet']) . "' AND `planet_type` = 3;", 'planets');
                        message($lang['ov_planet_abandoned'], 'game.php?page=overview&mode=renameplanet');
                    } elseif ($CurrentUser['id_planet'] == $CurrentUser["current_planet"]) {
                        message($lang['ov_principal_planet_cant_abanone'], 'game.php?page=overview&mode=renameplanet');
                    } else {
                        message($lang['ov_wrong_pass'], 'game.php?page=overview&mode=renameplanet');
                    }
                }
            }
            return display(parsetemplate(gettemplate('overview/overview_renameplanet'), $parse));
            break;
        default:
            if ($CurrentUser['new_message'] != 0) {
                $Have_new_message .= "<tr>";
                if ($CurrentUser['new_message'] == 1) {
                    $Have_new_message .= "<th colspan=4><a href=game.{$phpEx}?page=messages>" . $lang['ov_have_new_message'] . "</a></th>";
                } elseif ($CurrentUser['new_message'] > 1) {
                    $Have_new_message .= "<th colspan=4><a href=game.{$phpEx}?page=messages>";
                    $Have_new_message .= str_replace('%m', pretty_number($CurrentUser['new_message']), $lang['ov_have_new_messages']);
                    $Have_new_message .= "</a></th>";
                }
                $Have_new_message .= "</tr>";
            }
            $OwnFleets = doquery("SELECT * FROM {{table}} WHERE `fleet_owner` = '" . intval($CurrentUser['id']) . "';", 'fleets');
            $Record = 0;
            while ($FleetRow = mysql_fetch_array($OwnFleets)) {
                $Record++;
                $StartTime = $FleetRow['fleet_start_time'];
                $StayTime = $FleetRow['fleet_end_stay'];
                $EndTime = $FleetRow['fleet_end_time'];
                /////// // ### LUCKY , CODES ARE BELOW
                $hedefgalaksi = $FleetRow['fleet_end_galaxy'];
                $hedefsistem = $FleetRow['fleet_end_system'];
                $hedefgezegen = $FleetRow['fleet_end_planet'];
                $mess = $FleetRow['fleet_mess'];
                $filogrubu = $FleetRow['fleet_group'];
                $id = $FleetRow['fleet_id'];
                //////
                $Label = "fs";
                if ($StartTime > time()) {
                    $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, true, $Label, $Record);
                }
                if ($FleetRow['fleet_mission'] != 4 && $FleetRow['fleet_mission'] != 10) {
                    $Label = "ft";
                    if ($StayTime > time()) {
                        $fpage[$StayTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, true, $Label, $Record);
                    }
                    $Label = "fe";
                    if ($EndTime > time()) {
                        $fpage[$EndTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 2, true, $Label, $Record);
                    }
                }
                /**fix fleet table return by jstar**/
                if ($FleetRow['fleet_mission'] == 4 && $StartTime < time() && $EndTime > time()) {
                    $fpage[$EndTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 2, true, "fjstar", $Record);
                }
                /**end fix**/
            }
            mysql_free_result($OwnFleets);
            //iss ye katilan filo////////////////////////////////////
            // ### LUCKY , CODES ARE BELOW
            $dostfilo = doquery("SELECT * FROM {{table}} WHERE `fleet_end_galaxy` = '" . intval($hedefgalaksi) . "' AND `fleet_end_system` = '" . intval($hedefsistem) . "' AND `fleet_end_planet` = '" . intval($hedefgezegen) . "' AND `fleet_group` = '" . intval($filogrubu) . "';", 'fleets');
            $Record1 = 0;
            while ($FleetRow = mysql_fetch_array($dostfilo)) {
                $StartTime = $FleetRow['fleet_start_time'];
                $StayTime = $FleetRow['fleet_end_stay'];
                $EndTime = $FleetRow['fleet_end_time'];
                ///////
                $hedefgalaksi = $FleetRow['fleet_end_galaxy'];
                $hedefsistem = $FleetRow['fleet_end_system'];
                $hedefgezegen = $FleetRow['fleet_end_planet'];
                $mess = $FleetRow['fleet_mess'];
                $filogrubu = $FleetRow['fleet_group'];
                $id = $FleetRow['fleet_id'];
                ///////
                if ($FleetRow['fleet_mission'] == 2 && $FleetRow['fleet_owner'] != $CurrentUser['id']) {
                    $Record1++;
                    //		if (($FleetRow['fleet_mission'] == 2) ){
                    if ($mess > 0) {
                        $StartTime = "";
                    } else {
                        $StartTime = $FleetRow['fleet_start_time'];
                    }
                    if ($StartTime > time()) {
                        $Label = "ofs";
                        $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, false, $Label, $Record1);
                    }
                    //	}
                }
                ///""
                if ($FleetRow['fleet_mission'] == 1 && $FleetRow['fleet_owner'] != $CurrentUser['id'] && $filogrubu > 0) {
                    $Record++;
                    if ($mess > 0) {
                        $StartTime = "";
                    } else {
                        $StartTime = $FleetRow['fleet_start_time'];
                    }
                    if ($StartTime > time()) {
                        $Label = "ofs";
                        $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, false, $Label, $Record);
                    }
                }
            }
            mysql_free_result($dostfilo);
            //
            //////////////////////////////////////////////////
            $OtherFleets = doquery("SELECT * FROM {{table}} WHERE `fleet_target_owner` = '" . intval($CurrentUser['id']) . "';", 'fleets');
            $Record = 2000;
            while ($FleetRow = mysql_fetch_array($OtherFleets)) {
                if ($FleetRow['fleet_owner'] != $CurrentUser['id']) {
                    if ($FleetRow['fleet_mission'] != 8) {
                        $Record++;
                        $StartTime = $FleetRow['fleet_start_time'];
                        $StayTime = $FleetRow['fleet_end_stay'];
                        $id = $FleetRow['fleet_id'];
                        if ($StartTime > time()) {
                            $Label = "ofs";
                            $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, false, $Label, $Record);
                        }
                        if ($FleetRow['fleet_mission'] == 5) {
                            $Label = "oft";
                            if ($StayTime > time()) {
                                $fpage[$StayTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, false, $Label, $Record);
                            }
                        }
                    }
                }
            }
            mysql_free_result($OtherFleets);
            $planets_query = doquery("SELECT * FROM `{{table}}` WHERE id_owner='" . intval($CurrentUser['id']) . "' AND `destruyed` = 0", "planets");
            $Colone = 1;
            $AllPlanets = "<tr>";
            while ($CurrentUserPlanet = mysql_fetch_array($planets_query)) {
                if ($CurrentUserPlanet["id"] != $CurrentUser["current_planet"] && $CurrentUserPlanet['planet_type'] != 3) {
                    $Coloneshow++;
                    $AllPlanets .= "<th>" . $CurrentUserPlanet['name'] . "<br>";
                    $AllPlanets .= "<a href=\"game.php?page=overview&cp=" . $CurrentUserPlanet['id'] . "&re=0\" title=\"" . $CurrentUserPlanet['name'] . "\"><img src=\"" . $dpath . "planeten/small/s_" . $CurrentUserPlanet['image'] . ".jpg\" height=\"50\" width=\"50\"></a><br>";
                    $AllPlanets .= "<center>";
                    if ($CurrentUserPlanet['b_building'] != 0) {
                        UpdatePlanetBatimentQueueList($CurrentUserPlanet, $CurrentUser);
                        if ($CurrentUserPlanet['b_building'] != 0) {
                            $BuildQueue = $CurrentUserPlanet['b_building_id'];
                            $QueueArray = explode(";", $BuildQueue);
                            $CurrentBuild = explode(",", $QueueArray[0]);
                            $BuildElement = $CurrentBuild[0];
                            $BuildLevel = $CurrentBuild[1];
                            $BuildRestTime = pretty_time($CurrentBuild[3] - time());
                            $AllPlanets .= '' . $lang['tech'][$BuildElement] . ' (' . $BuildLevel . ')';
                            $AllPlanets .= "<br><font color=\"#7f7f7f\">(" . $BuildRestTime . ")</font>";
                        } else {
                            CheckPlanetUsedFields($CurrentUserPlanet);
                            $AllPlanets .= $lang['ov_free'];
                        }
                    } else {
                        $AllPlanets .= $lang['ov_free'];
                    }
                    $AllPlanets .= "</center></th>";
                    if ($Colone <= 1) {
                        $Colone++;
                    } else {
                        $AllPlanets .= "</tr><tr>";
                        $Colone = 1;
                    }
                }
            }
            mysql_free_result($planets_query);
            $AllPlanets .= "</tr>";
            if ($lunarow['id'] != 0 && $lunarow['destruyed'] != 1 && $CurrentPlanet['planet_type'] != 3) {
                if ($CurrentPlanet['planet_type'] == 1 or $lunarow['id'] != 0) {
                    $moon = doquery("SELECT `id`,`name`,`image` FROM {{table}} WHERE `galaxy` = '" . intval($CurrentPlanet['galaxy']) . "' AND `system` = '" . intval($CurrentPlanet['system']) . "' AND `planet` = '" . intval($CurrentPlanet['planet']) . "' AND `planet_type` = '3'", 'planets', true);
                    $parse['moon_img'] = "<a href=\"game.php?page=overview&cp=" . $moon['id'] . "&re=0\" title=\"" . $moon['name'] . "\"><img src=\"" . $dpath . "planeten/" . $moon['image'] . ".jpg\" height=\"50\" width=\"50\"></a>";
                    $parse['moon'] = $moon['name'] . " (" . $lang['fcm_moon'] . ")";
                } else {
                    $parse['moon_img'] = "";
                    $parse['moon'] = "";
                }
            } else {
                $parse['moon_img'] = "";
                $parse['moon'] = "";
            }
            $parse['planet_diameter'] = pretty_number($CurrentPlanet['diameter']);
            $parse['planet_field_current'] = $CurrentPlanet['field_current'];
            $parse['planet_field_max'] = CalculateMaxPlanetFields($CurrentPlanet);
            $parse['planet_temp_min'] = $CurrentPlanet['temp_min'];
            $parse['planet_temp_max'] = $CurrentPlanet['temp_max'];
            $StatRecord = doquery("SELECT `total_rank`,`total_points` FROM `{{table}}` WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . intval($CurrentUser['id']) . "';", 'statpoints', true);
            $parse['user_username'] = $CurrentUser['username'];
            if (count($fpage) > 0) {
                ksort($fpage);
                foreach ($fpage as $time => $content) {
                    $flotten .= $content . "\n";
                }
            }
            if ($CurrentPlanet['b_building'] != 0) {
                include $xgp_root . 'includes/functions/InsertBuildListScript.' . $phpEx;
                UpdatePlanetBatimentQueueList($planetrow, $user);
                if ($CurrentPlanet['b_building'] != 0) {
                    $BuildQueue = explode(";", $CurrentPlanet['b_building_id']);
                    $CurrBuild = explode(",", $BuildQueue[0]);
                    $RestTime = $CurrentPlanet['b_building'] - time();
                    $PlanetID = $CurrentPlanet['id'];
                    $Build = InsertBuildListScript("overview");
                    $Build .= $lang['tech'][$CurrBuild[0]] . ' (' . $CurrBuild[1] . ')';
                    $Build .= "<br /><div id=\"blc\" class=\"z\">" . pretty_time($RestTime) . "</div>";
                    $Build .= "\n<script language=\"JavaScript\">";
                    $Build .= "\n\tpp = \"" . $RestTime . "\";\n";
                    $Build .= "\n\tpk = \"" . 1 . "\";\n";
                    $Build .= "\n\tpm = \"cancel\";\n";
                    $Build .= "\n\tpl = \"" . $PlanetID . "\";\n";
                    $Build .= "\n\tt();\n";
                    $Build .= "\n</script>\n";
                    $parse['building'] = $Build;
                } else {
                    $parse['building'] = $lang['ov_free'];
                }
            } else {
                $parse['building'] = $lang['ov_free'];
            }
            $parse['fleet_list'] = $flotten;
            $parse['Have_new_message'] = $Have_new_message;
            $parse['planet_image'] = $CurrentPlanet['image'];
            $parse['anothers_planets'] = $AllPlanets;
            $parse["dpath"] = $dpath;
            if ($game_config['stat'] == 0) {
                $parse['user_rank'] = pretty_number($StatRecord['total_points']) . " (" . $lang['ov_place'] . " <a href=\"game.php?page=statistics&range=" . $StatRecord['total_rank'] . "\">" . $StatRecord['total_rank'] . "</a> " . $lang['ov_of'] . " " . $game_config['users_amount'] . ")";
            } elseif ($game_config['stat'] == 1 && $CurrentUser['authlevel'] < $game_config['stat_level']) {
                $parse['user_rank'] = pretty_number($StatRecord['total_points']) . " (" . $lang['ov_place'] . " <a href=\"game.php?page=statistics&range=" . $StatRecord['total_rank'] . "\">" . $StatRecord['total_rank'] . "</a> " . $lang['ov_of'] . " " . $game_config['users_amount'] . ")";
            } else {
                $parse['user_rank'] = "-";
            }
            $parse['date_time'] = date("D M j H:i:s", time());
            return display(parsetemplate(gettemplate('overview/overview_body'), $parse));
            break;
    }
}
Example #10
0
 private function homeAlliance()
 {
     global $USER, $UNI, $LNG;
     require_once 'includes/functions/BBCode.php';
     if ($this->allianceData['ally_owner'] == $USER['id']) {
         $rankName = $this->allianceData['ally_owner_range'] != '' ? $this->allianceData['ally_owner_range'] : $LNG['al_founder_rank_text'];
     } elseif ($USER['ally_rank_id'] != 0) {
         $rankName = $GLOBALS['DATABASE']->getFirstCell("SELECT rankName FROM " . ALLIANCE_RANK . " WHERE rankID = " . $USER['ally_rank_id'] . ";");
     }
     if (empty($rankName)) {
         $rankName = $LNG['al_new_member_rank_text'];
     }
     $StatsData = $GLOBALS['DATABASE']->getFirstRow("SELECT SUM(wons) as wons, SUM(loos) as loos, SUM(draws) as draws, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tSUM(kbmetal) as kbmetal, SUM(kbcrystal) as kbcrystal, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tSUM(lostunits) as lostunits, SUM(desunits) as desunits \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS . " WHERE ally_id = " . $this->allianceData['id'] . ";");
     $StatsDataBis = $GLOBALS['DATABASE']->getFirstRow("SELECT total_rank, total_points FROM uni1_statpoints WHERE id_owner = " . $this->allianceData['id'] . " AND stat_type = '2';");
     $allyCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM uni1_alliance WHERE id > '0';");
     $ApplyCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . ALLIANCE_REQUEST . " WHERE allianceID = " . $this->allianceData['id'] . ";");
     $ally_events = array();
     if (!empty($this->allianceData['ally_events'])) {
         $sql = "\n\t\t\tSELECT\n\t\t\t\t`id`,\n\t\t\t\t`username`\n\t\t\tFROM\n\t\t\t\t`" . USERS . "`\n\t\t\tWHERE\n\t\t\t\t`ally_id` = " . $this->allianceData['id'] . ";";
         $result = $GLOBALS['DATABASE']->query($sql);
         require_once 'includes/classes/class.FlyingFleetsTable.php';
         $FlyingFleetsTable = new FlyingFleetsTable();
         $this->tplObj->loadscript('overview.js');
         while ($row = $result->fetch_assoc()) {
             $FlyingFleetsTable->setUser($row['id']);
             $FlyingFleetsTable->setMissions($this->allianceData['ally_events']);
             $ally_events[$row['username']] = $FlyingFleetsTable->renderTable();
         }
         $ally_events = array_filter($ally_events);
     }
     $defcontext = '';
     if ($this->allianceData['defcon'] == 5) {
         $defcontext = 'Normal preparation in peacetime';
     } elseif ($this->allianceData['defcon'] == 4) {
         $defcontext = 'Normal preparation, but increased and enhanced information security measures';
         //vert
     } elseif ($this->allianceData['defcon'] == 3) {
         $defcontext = 'Increased preparation of forces beyond the normal preparation';
         //jaune
     } elseif ($this->allianceData['defcon'] == 2) {
         $defcontext = 'Further increase in the preparation of forces, but less than the maximum preparation';
         //oramnge
     } elseif ($this->allianceData['defcon'] == 1) {
         $defcontext = 'State of War: Maximum forces Preparation';
         //rouge
     }
     $this->tplObj->assign_vars(array('DiploInfo' => $this->getDiplomatic(), 'ally_web' => $this->allianceData['ally_web'], 'ally_tag' => $this->allianceData['ally_tag'], 'ally_members' => $this->allianceData['ally_members'], 'defcon' => $this->allianceData['defcon'], 'ally_max_members' => $this->allianceData['ally_members'], 'ally_name' => $this->allianceData['ally_name'], 'ally_image' => $this->allianceData['ally_image'], 'ally_description' => bbcode($this->allianceData['ally_description']), 'ally_text' => bbcode($this->allianceData['ally_text']), 'rankName' => $rankName, 'defcontext' => $defcontext, 'requests' => sprintf($LNG['al_new_requests'], $ApplyCount), 'applyCount' => $ApplyCount, 'allyCount' => $allyCount, 'total_rank' => $StatsDataBis['total_rank'], 'total_points' => pretty_number($StatsDataBis['total_points']), 'total_points_average' => pretty_number(round($StatsDataBis['total_points'] / $this->allianceData['ally_members'])), 'totalfight' => $StatsData['wons'] + $StatsData['loos'] + $StatsData['draws'], 'fightwon' => $StatsData['wons'], 'fightlose' => $StatsData['loos'], 'fightdraw' => $StatsData['draws'], 'unitsshot' => pretty_number($StatsData['desunits']), 'unitslose' => pretty_number($StatsData['lostunits']), 'dermetal' => pretty_number($StatsData['kbmetal']), 'dercrystal' => pretty_number($StatsData['kbcrystal']), 'isOwner' => $this->allianceData['ally_owner'] == $USER['id'], 'ally_owner' => $this->getUsername($this->allianceData['ally_owner']), 'ally_owner2' => $this->allianceData['ally_owner'], 'ally_events' => $ally_events, 'recruit_on' => $this->allianceData['ally_request_notallow'] == 1 ? '<span class="rouge">No</span>' : '<span class="vert">Yes</span>', 'ally_register_time' => str_replace(' ', '&nbsp;', _date($LNG['php_tdformat'], $this->allianceData['ally_register_time']), $USER['timezone'])));
     $this->display('page.alliance.home.tpl');
 }
 private function homeAlliance()
 {
     global $USER, $UNI, $LNG, $ALLIANCE;
     require_once 'includes/functions/BBCode.php';
     if ($this->allianceData['ally_owner'] == $USER['id']) {
         $rankName = $this->allianceData['ally_owner_range'] != '' ? $this->allianceData['ally_owner_range'] : $LNG['al_founder_rank_text'];
     } elseif ($USER['ally_rank_id'] != 0) {
         $rankName = $GLOBALS['DATABASE']->getFirstCell("SELECT rankName FROM " . ALLIANCE_RANK . " WHERE rankID = " . $USER['ally_rank_id'] . ";");
     }
     if (empty($rankName)) {
         $rankName = $LNG['al_new_member_rank_text'];
     }
     $StatsData = $GLOBALS['DATABASE']->getFirstRow("SELECT SUM(wons) as wons, SUM(loos) as loos, SUM(draws) as draws, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tSUM(kbmetal) as kbmetal, SUM(kbcrystal) as kbcrystal, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tSUM(lostunits) as lostunits, SUM(desunits) as desunits \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS . " WHERE ally_id = " . $this->allianceData['id'] . ";");
     $ApplyCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . ALLIANCE_REQUEST . " WHERE allianceID = " . $this->allianceData['id'] . ";");
     $ally_events = array();
     if (!empty($this->allianceData['ally_events'])) {
         $sql = "\n\t\t\tSELECT\n\t\t\t\t`id`,\n\t\t\t\t`username`\n\t\t\tFROM\n\t\t\t\t`" . USERS . "`\n\t\t\tWHERE\n\t\t\t\t`ally_id` = " . $this->allianceData['id'] . ";";
         $result = $GLOBALS['DATABASE']->query($sql);
         require_once 'includes/classes/class.FlyingFleetsTable.php';
         $FlyingFleetsTable = new FlyingFleetsTable();
         $this->tplObj->loadscript('overview.js');
         while ($row = $result->fetch_assoc()) {
             $FlyingFleetsTable->setUser($row['id']);
             $FlyingFleetsTable->setMissions($this->allianceData['ally_events']);
             $ally_events[$row['username']] = $FlyingFleetsTable->renderTable();
         }
         $ally_events = array_filter($ally_events);
     }
     $this->tplObj->assign_vars(array('DiploInfo' => $this->getDiplomatic(), 'ally_web' => $this->allianceData['ally_web'], 'ally_tag' => $this->allianceData['ally_tag'], 'ally_members' => $this->allianceData['ally_members'], 'ally_max_members' => $this->allianceData['ally_members'], 'ally_name' => $this->allianceData['ally_name'], 'ally_image' => $this->allianceData['ally_image'], 'ally_description' => bbcode($this->allianceData['ally_description']), 'ally_text' => bbcode($this->allianceData['ally_text']), 'rankName' => $rankName, 'requests' => sprintf($LNG['al_new_requests'], $ApplyCount), 'applyCount' => $ApplyCount, 'totalfight' => $StatsData['wons'] + $StatsData['loos'] + $StatsData['draws'], 'fightwon' => $StatsData['wons'], 'fightlose' => $StatsData['loos'], 'fightdraw' => $StatsData['draws'], 'unitsshot' => pretty_number($StatsData['desunits']), 'unitslose' => pretty_number($StatsData['lostunits']), 'dermetal' => pretty_number($StatsData['kbmetal']), 'dercrystal' => pretty_number($StatsData['kbcrystal']), 'isOwner' => $this->allianceData['ally_owner'] == $USER['id'], 'ally_events' => $ally_events, 'fraction' => $this->allianceData['fraction'], 'points' => $this->allianceData['alliance_points'], 'Durchschnitt' => $this->allianceData['alliance_points'] / $this->allianceData['ally_members']));
     $this->display('page.alliance.home.tpl');
 }
Example #12
0
function ShowPhalanxPage($CurrentUser, &$CurrentPlanet)
{
    global $svn_root, $phpEx, $lang, $db, $displays;
    include_once $svn_root . 'includes/functions/InsertJavaScriptChronoApplet.' . $phpEx;
    include_once $svn_root . 'includes/functions/classes/class.FlyingFleetsTable.' . $phpEx;
    $FlyingFleetsTable = new FlyingFleetsTable();
    //$parse	= $lang;
    $displays->assignContent('galaxy/phalanx_body');
    if ($CurrentPlanet['planet_type'] == 3) {
        $parse['phl_pl_galaxy'] = $CurrentPlanet['galaxy'];
        $parse['phl_pl_system'] = $CurrentPlanet['system'];
        $parse['phl_pl_place'] = $CurrentPlanet['planet'];
        $parse['phl_pl_name'] = $CurrentUser['username'];
        if ($CurrentPlanet['deuterium'] > 10000) {
            $CurrentPlanet['deuterium'] -= 10000;
            $parse['phl_er_deuter'] = "";
            $DoScan = true;
        } else {
            $parse['phl_er_deuter'] = $lang['px_no_deuterium'];
            $DoScan = false;
        }
        if ($DoScan == true) {
            $Galaxy = $_GET["galaxy"];
            $System = $_GET["system"];
            $Planet = $_GET["planet"];
            $PlType = $_GET["planettype"];
            $TargetInfo = $db->query("SELECT * FROM {{table}} WHERE `galaxy` = '" . $Galaxy . "' AND `system` = '" . $System . "' AND `planet` = '" . $Planet . "' AND `planet_type` = '" . $PlType . "';", 'planets', true);
            $TargetName = $TargetInfo['name'];
            $QryLookFleets = "SELECT * ";
            $QryLookFleets .= "FROM {{table}} ";
            $QryLookFleets .= "WHERE ( ( ";
            $QryLookFleets .= "`fleet_start_galaxy` = '" . $Galaxy . "' AND ";
            $QryLookFleets .= "`fleet_start_system` = '" . $System . "' AND ";
            $QryLookFleets .= "`fleet_start_planet` = '" . $Planet . "' AND ";
            $QryLookFleets .= "`fleet_start_type` = '" . $PlType . "' ";
            $QryLookFleets .= ") OR ( ";
            $QryLookFleets .= "`fleet_end_galaxy` = '" . $Galaxy . "' AND ";
            $QryLookFleets .= "`fleet_end_system` = '" . $System . "' AND ";
            $QryLookFleets .= "`fleet_end_planet` = '" . $Planet . "' AND ";
            $QryLookFleets .= "`fleet_end_type` = '" . $PlType . "' ";
            $QryLookFleets .= ") ) ";
            $QryLookFleets .= "ORDER BY `fleet_start_time`;";
            $FleetToTarget = $db->query($QryLookFleets, 'fleets');
            if (mysql_num_rows($FleetToTarget) != 0) {
                while ($FleetRow = mysql_fetch_array($FleetToTarget)) {
                    $Record++;
                    $StartTime = $FleetRow['fleet_start_time'];
                    $StayTime = $FleetRow['fleet_end_stay'];
                    $EndTime = $FleetRow['fleet_end_time'];
                    if ($FleetRow['fleet_owner'] == $TargetInfo['id_owner']) {
                        $FleetType = true;
                    } else {
                        $FleetType = false;
                    }
                    $FleetRow['fleet_resource_metal'] = 0;
                    $FleetRow['fleet_resource_crystal'] = 0;
                    $FleetRow['fleet_resource_deuterium'] = 0;
                    $Label = "fs";
                    if ($StartTime > time()) {
                        $fpage[$StartTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, $FleetType, $Label, $Record);
                    }
                    if ($FleetRow['fleet_mission'] != 4) {
                        $Label = "ft";
                        if ($StayTime > time()) {
                            $fpage[$StayTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, $FleetType, $Label, $Record);
                        }
                        if ($FleetType == true) {
                            $Label = "fe";
                            if ($EndTime > time()) {
                                $fpage[$EndTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 2, $FleetType, $Label, $Record);
                            }
                        }
                    }
                }
            }
            if (count($fpage) > 0) {
                ksort($fpage);
                foreach ($fpage as $FleetTime => $FleetContent) {
                    $Fleets .= $FleetContent . "\n";
                }
            }
        }
        $parse['phl_fleets_table'] = $Fleets;
        foreach ($parse as $key => $value) {
            $displays->assign($key, $value);
        }
    } else {
        header("location:game.php?page=overview");
    }
    $displays->display();
}
Example #13
0
function ShowOverviewPage($CurrentUser, $CurrentPlanet)
{
    global $svn_root, $phpEx, $dpath, $db, $lang, $planetrow, $users, $displays;
    $displays->assignContent('overview/overview');
    include_once $svn_root . 'includes/functions/InsertJavaScriptChronoApplet.' . $phpEx;
    include_once $svn_root . 'includes/functions/classes/class.FlyingFleetsTable.' . $phpEx;
    $FlyingFleetsTable = new FlyingFleetsTable();
    $lunarow = $db->query("SELECT `id`,`name`,`image`,`destruyed` FROM {{table}}\r\n\t\t\t   WHERE `id_owner` = '" . $CurrentPlanet['id_owner'] . "'\r\n\t\t\t   AND `galaxy` = '" . $CurrentPlanet['galaxy'] . "'\r\n\t\t\t   AND `system` = '" . $CurrentPlanet['system'] . "'\r\n\t\t\t   AND `planet` = '" . $CurrentPlanet['planet'] . "'\r\n\t\t\t   AND `planet_type`= '3';", 'planets', true);
    if (empty($lunarow)) {
        unset($lunarow);
    }
    CheckPlanetUsedFields($lunarow);
    $parse['planet_id'] = $CurrentPlanet['id'];
    $parse['planet_name'] = $CurrentPlanet['name'];
    $parse['galaxy_galaxy'] = $CurrentPlanet['galaxy'];
    $parse['galaxy_system'] = $CurrentPlanet['system'];
    $parse['galaxy_planet'] = $CurrentPlanet['planet'];
    switch ($_GET['mode']) {
        case 'renameplanet':
            if ($_POST['newname']) {
                $parse['planet_name'] = mysql_escape_string(strip_tags(trim($_POST['newname'])));
            }
            foreach ($parse as $name => $trans) {
                $displays->assignGlobal($name, $trans);
            }
            if ($_POST['action'] == $lang['ov_planet_rename_action']) {
                $newname = mysql_escape_string(strip_tags(trim($_POST['newname'])));
                if (preg_match("/[^A-z0-9_\\- ]/", $newname) == 1) {
                    $displays->message($lang['ov_newname_error'], "game.php?page=overview&mode=renameplanet", 2);
                }
                if ($newname != "") {
                    $db->query("UPDATE {{table}} SET `name` = '" . $newname . "' WHERE `id` = '" . $CurrentUser['current_planet'] . "' LIMIT 1;", "planets");
                }
            } elseif ($_POST['action'] == $lang['ov_abandon_planet']) {
                $displays->newblock('deleted');
            } elseif ($_POST['kolonieloeschen'] == 1 && intval($_POST['deleteid']) == $CurrentUser['current_planet']) {
                if (md5($_POST['pw']) == $CurrentUser["password"] && $CurrentUser['id_planet'] != $CurrentUser['current_planet']) {
                    $db->query("UPDATE {{table}} SET `destruyed` = '" . (time() + 86400) . "'\r\n\t\t\t\t\t\tWHERE `id` = '" . mysql_real_escape_string($CurrentUser['current_planet']) . "' LIMIT 1;", 'planets');
                    $db->query("UPDATE {{table}} SET `current_planet` = `id_planet`\r\n\t\t\t\t\t\tWHERE `id` = '" . mysql_real_escape_string($CurrentUser['id']) . "' LIMIT 1", "users");
                    $db->query("DELETE FROM {{table}}\r\n\t\t\t\t\t\tWHERE `galaxy` = '" . $CurrentPlanet['galaxy'] . "'\r\n\t\t\t\t\t\tAND `system` = '" . $CurrentPlanet['system'] . "'\r\n\t\t\t\t\t\tAND `planet` = '" . $CurrentPlanet['planet'] . "'\r\n\t\t\t\t\t\tAND `planet_type` = 3;", 'planets');
                    $db->query("UPDATE {{table}} SET `id_luna` = '0'\r\n\t\t\t\t\t\tWHERE `galaxy` = '" . $CurrentPlanet['galaxy'] . "'\r\n\t\t\t\t\t\tAND `system` = '" . $CurrentPlanet['system'] . "'\r\n\t\t\t\t\t\tAND `planet` = '" . $CurrentPlanet['planet'] . "';", 'galaxy');
                    $displays->message($lang['ov_planet_abandoned'], 'game.php?page=overview&mode=renameplanet');
                } elseif ($CurrentUser['id_planet'] == $CurrentUser["current_planet"]) {
                    $displays->message($lang['ov_principal_planet_cant_abanone'], 'game.php?page=overview&mode=renameplanet');
                } else {
                    $displays->message($lang['ov_wrong_pass'], 'game.php?page=overview&mode=renameplanet');
                }
            }
            $displays->newblock('renameplanet');
            break;
        default:
            $displays->newblock('overview');
            if ($CurrentUser["db_deaktjava"] == "1") {
                $parse["delete"] = "<tr><th colspan=4 ><h1>" . $lang["deleted"] . gmdate("j-m-y  H:i:s", $CurrentUser["db_time"]) . "</h1></th></tr>";
            }
            $noticias = explode(";;", $db->game_config["information"]);
            if ($noticias[0] == 1) {
                $displays->newblock('noticias');
                $new = nl2br(stripslashes($noticias[1]));
                $new = str_replace(":name:", $CurrentUser['username'], $new);
                $new = str_replace(":server:", $db->game_config['game_name'], $new);
                $displays->assign('news', $new);
            }
            $OwnFleets = $db->query("SELECT * FROM {{table}} WHERE `fleet_owner` = '" . $CurrentUser['id'] . "';", 'fleets');
            $Record = 0;
            $fpage = array();
            while ($FleetRow = mysql_fetch_array($OwnFleets)) {
                $Record++;
                $StartTime = $FleetRow['fleet_start_time'];
                $StayTime = $FleetRow['fleet_end_stay'];
                $EndTime = $FleetRow['fleet_end_time'];
                $Label = "fs";
                if ($StartTime > time()) {
                    $fpage[$StartTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, true, $Label, $Record);
                }
                if ($FleetRow['fleet_mission'] != 4 && $FleetRow['fleet_mission'] != 10) {
                    $Label = "ft";
                    if ($StayTime > time()) {
                        $fpage[$StayTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, true, $Label, $Record);
                    }
                    $Label = "fe";
                    if ($EndTime > time()) {
                        $fpage[$EndTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 2, true, $Label, $Record);
                    }
                }
            }
            $OtherFleets = $db->query("SELECT * FROM {{table}} WHERE `fleet_target_owner` = '" . $CurrentUser['id'] . "';", 'fleets');
            $Record = 2000;
            while ($FleetRow = mysql_fetch_array($OtherFleets)) {
                if ($FleetRow['fleet_owner'] != $CurrentUser['id']) {
                    if ($FleetRow['fleet_mission'] != 8) {
                        $Record++;
                        $StartTime = $FleetRow['fleet_start_time'];
                        $StayTime = $FleetRow['fleet_end_stay'];
                        if ($StartTime > time()) {
                            $Label = "ofs";
                            $fpage[$StartTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, false, $Label, $Record);
                        }
                        if ($FleetRow['fleet_mission'] == 5) {
                            $Label = "oft";
                            if ($StayTime > time()) {
                                $fpage[$StayTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, false, $Label, $Record);
                            }
                        }
                    }
                }
            }
            mysql_free_result($OtherFleets);
            $planets_query = $db->query("SELECT * FROM `{{table}}` WHERE id_owner='{$CurrentUser['id']}' AND `destruyed` = 0", "planets");
            $Colone = 1;
            $PlanetaQueInv = array();
            while ($CurrentUserPlanet = mysql_fetch_array($planets_query)) {
                if ($CurrentUserPlanet["b_tech"] != 0) {
                    $PlanetaQueInv['b_tech'] = $CurrentUserPlanet["b_tech"];
                    $PlanetaQueInv['b_tech_id'] = $CurrentUserPlanet["b_tech_id"];
                    $PlanetaQueInv['name'] = $CurrentUserPlanet["name"];
                    $PlanetaQueInv['id'] = $CurrentUserPlanet["id"];
                }
                if ($CurrentUserPlanet["id"] != $CurrentUser["current_planet"] && $CurrentUserPlanet['planet_type'] != 3) {
                    $Coloneshow++;
                    $AllPlanets .= "<th>" . $CurrentUserPlanet['name'] . "<br>";
                    $AllPlanets .= "<a href=\"game.php?page=overview&cp=" . $CurrentUserPlanet['id'] . "&re=0\" title=\"" . $CurrentUserPlanet['name'] . "\"><img src=\"" . $dpath . "planeten/small/s_" . $CurrentUserPlanet['image'] . ".jpg\" height=\"20\" width=\"20\"></a><br>";
                    $AllPlanets .= "<center>";
                    if ($CurrentUserPlanet['b_building'] != 0) {
                        UpdatePlanetBatimentQueueList($CurrentUserPlanet, $CurrentUser);
                        if ($CurrentUserPlanet['b_building'] != 0) {
                            $BuildQueue = $CurrentUserPlanet['b_building_id'];
                            $QueueArray = explode(";", $BuildQueue);
                            $CurrentBuild = explode(",", $QueueArray[0]);
                            $BuildElement = $CurrentBuild[0];
                            $BuildLevel = $CurrentBuild[1];
                            $BuildRestTime = pretty_time($CurrentBuild[3] - time());
                            $AllPlanets .= '' . $lang['tech'][$BuildElement] . ' (' . $BuildLevel . ')';
                            $AllPlanets .= "<br><font color=\"#7f7f7f\">(" . $BuildRestTime . ")</font>";
                        } else {
                            CheckPlanetUsedFields($CurrentUserPlanet);
                            $AllPlanets .= $lang['ov_free'];
                        }
                    } else {
                        $AllPlanets .= $lang['ov_free'];
                    }
                    $AllPlanets .= "</center></th>";
                    if ($Coloneshow % 6 == 0) {
                        $AllPlanets .= "</tr><tr>";
                    }
                }
            }
            if ($lunarow['id'] != 0 && $lunarow['destruyed'] != 0 && $CurrentPlanet['planet_type'] != 3) {
                if ($CurrentPlanet['planet_type'] == 1 or $lunarow['id'] != 0) {
                    $displays->newblock('moon');
                    $displays->assign('moon_img', "<a href=\"game.php?page=overview&cp=" . $lunarow['id'] . "&re=0\" title=\"" . $lunarow['name'] . "\"><img src=\"" . $dpath . "planeten/small/s_" . $lunarow['image'] . ".png\" height=\"50\" width=\"50\"></a>");
                    $displays->assign('moon', $lunarow['name'] . " (" . $lang['fcm_moon'] . ")");
                }
            }
            $parse['planet_diameter'] = pretty_number($CurrentPlanet['diameter']);
            $parse['planet_field_current'] = $CurrentPlanet['field_current'];
            $parse['planet_field_max'] = CalculateMaxPlanetFields($CurrentPlanet);
            $parse['planet_temp_min'] = $CurrentPlanet['temp_min'];
            $parse['planet_temp_max'] = $CurrentPlanet['temp_max'];
            $parse['user_username'] = $CurrentUser['username'];
            if (count($fpage) > 0) {
                $flotten = "";
                ksort($fpage);
                foreach ($fpage as $time => $content) {
                    $flotten .= $content . "\n";
                }
            }
            if ($CurrentPlanet['b_building'] != 0) {
                include $svn_root . 'includes/functions/InsertBuildListScript.' . $phpEx;
                UpdatePlanetBatimentQueueList($planetrow, $users->user);
                if ($CurrentPlanet['b_building'] != 0) {
                    $BuildQueue = explode(";", $CurrentPlanet['b_building_id']);
                    $CurrBuild = explode(",", $BuildQueue[0]);
                    $RestTime = $CurrentPlanet['b_building'] - time();
                    $PlanetID = $CurrentPlanet['id'];
                    $Build = InsertBuildListScript("buildings");
                    $Build .= "<table>";
                    $Build .= "    <tr>";
                    $Build .= "        <th colspan=\"2\">" . $lang['tech'][$CurrBuild[0]] . "</th>";
                    $Build .= "    </tr>";
                    $Build .= "    <tr>";
                    $Build .= "        <th class='anything' align=\"center\" style=\"background-image: url(" . $dpath . "gebaeude/" . $CurrBuild[0] . ".gif);background-repeat:no-repeat;width:60px; height:60;\"   valign=\"middle\"></th>";
                    $Build .= "        <th class='anything'>" . $lang['pr_subiendo'] . " <span style=\"color:#FF8C00;\">Nivel " . $CurrBuild[1] . "</span><br />";
                    $Build .= "            " . $lang['pr_duracion'] . ":<div id=\"blc\" class=\"z\" style=\"color:yellow;\">" . pretty_time($RestTime) . "</div>";
                    $Build .= "        </th>";
                    $Build .= "    </tr>";
                    $Build .= "</Table>";
                    $Build .= "\n<script language=\"JavaScript\">";
                    $Build .= "\n\tpp = \"" . $RestTime . "\";\n";
                    $Build .= "\n\tpk = \"" . 1 . "\";\n";
                    $Build .= "\n\tpm = \"cancel\";\n";
                    $Build .= "\n\tpl = \"" . $PlanetID . "\";\n";
                    $Build .= "\n\tt();\n";
                    $Build .= "\n</script>\n";
                    $parse['building'] = $Build;
                } else {
                    $parse['building'] = $lang['ov_free'];
                }
            } else {
                $parse['building'] = $lang['ov_free'];
            }
            if ($PlanetaQueInv['b_tech'] != 0 && $PlanetaQueInv['b_tech_id']) {
                global $resource;
                include $svn_root . 'includes/functions/InsertTechListScript.' . $phpEx;
                UpdatePlanetBatimentQueueList($planetrow, $users->user);
                $NvlActual = $CurrentUser[$resource[$PlanetaQueInv['b_tech_id']]] + 1;
                $RestTime = $PlanetaQueInv['b_tech'] - time();
                $PlanetID = $PlanetaQueInv['id'];
                $NomPlaneta = "";
                if ($PlanetaQueInv['name'] != $CurrentPlanet['name']) {
                    $NomPlaneta = " de " . $PlanetaQueInv['name'];
                }
                $Tech = InsertTechListScript("buildings&mode=research", $NomPlaneta);
                $Tech .= "<table>";
                $Tech .= "    <tr>";
                $Tech .= "        <th colspan=\"2\">" . $lang['tech'][$PlanetaQueInv['b_tech_id']] . "</th>";
                $Tech .= "    </tr>";
                $Tech .= "    <tr>";
                $Tech .= "        <th class='anything' align=\"center\" style=\"background-image: url(" . $dpath . "gebaeude/" . $PlanetaQueInv['b_tech_id'] . ".gif);background-repeat:no-repeat;width:60px; height:60;\" valign=\"middle\"></th>";
                $Tech .= "        <th class='anything'>" . $lang['pr_investigando'] . " <span style=\"color:#FF8C00;\">Nivel " . $NvlActual . "</span><br />";
                $Tech .= "            " . $lang['pr_duracion'] . ":<div id=\"tec_blc\" class=\"z\" style=\"color:yellow;\">" . pretty_time($RestTime) . "</div>";
                $Tech .= "        </th>";
                $Tech .= "    </tr>";
                $Tech .= "</Table>";
                $Tech .= "\n<script language=\"JavaScript\">";
                $Tech .= "\n    tec_pp = \"" . $RestTime . "\";\n";
                $Tech .= "\n    tec_pk = \"" . 1 . "\";\n";
                $Tech .= "\n    tec_pm = \"cancel\";\n";
                $Tech .= "\n    tec_pl = \"" . $PlanetaQueInv['b_tech_id'] . "\";\n";
                $Tech .= "\n    tec_t();\n";
                $Tech .= "\n</script>\n";
                unset($resource);
                $parse['tech_en_proceso'] .= $Tech;
            } else {
                $parse['tech_en_proceso'] = $lang['ov_free'];
            }
            if ($CurrentPlanet['b_hangar'] != 0) {
                include $svn_root . 'includes/functions/InsertHangarListScript.' . $phpEx;
                UpdatePlanetBatimentQueueList($planetrow, $users->user);
                $BuildQueue = explode(";", $CurrentPlanet['b_hangar_id']);
                $CurrBuild = explode(",", $BuildQueue[0]);
                $RealTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $CurrBuild[0]);
                $QueueTime = $RealTime * $CurrBuild[1];
                $RestTime = $QueueTime - $CurrentPlanet['b_hangar'];
                $PlanetID = $CurrentPlanet['id'];
                $Hangar = InsertHangarListScript("fleet");
                $Hangar .= "<table>";
                $Hangar .= "    <tr>";
                $Hangar .= "        <th colspan=\"2\">" . $lang['tech'][$CurrBuild[0]] . "</th>";
                $Hangar .= "    </tr>";
                $Hangar .= "    <tr>";
                $Hangar .= "        <th class='anything' align=\"center\" style=\"background-image: url(" . $dpath . "gebaeude/" . $CurrBuild[0] . ".gif);background-repeat:no-repeat;width:60px; height:60;\" valign=\"middle\"><br />";
                $Hangar .= "        </th>";
                $Hangar .= "        <th class='anything'>" . $lang['pr_tiempo_prod'] . "<br />";
                $Hangar .= "            <div id=\"han_blc\" class=\"z\" style=\"color:yellow;\">" . pretty_time($RestTime) . "</div>";
                $Hangar .= "        </th>";
                $Hangar .= "    </tr>";
                $Hangar .= "</Table>";
                $Hangar .= "\n<script language=\"JavaScript\">";
                $Hangar .= "\n    han_pp = \"" . $RestTime . "\";\n";
                $Hangar .= "\n    han_pk = \"" . 1 . "\";\n";
                $Hangar .= "\n    han_pm = \"cancel\";\n";
                $Hangar .= "\n    han_pl = \"" . $PlanetID . "\";\n";
                $Hangar .= "\n    han_t();\n";
                $Hangar .= "\n</script>\n";
                $parse['hangar_en_proceso'] .= $Hangar;
            } else {
                $parse['hangar_en_proceso'] = $lang['ov_free'];
            }
            // Usuarios conectados
            $OnlineUsers = $db->query("SELECT COUNT(DISTINCT id) as count FROM {{table}} WHERE onlinetime>='" . (time() - 15 * 60) . "'", 'users', 'true');
            $parse['NumberMembersOnline'] = $OnlineUsers['count'];
            $parse['id'] = $CurrentPlanet['id'];
            $parse['fleet_list'] = $flotten;
            $parse['planet_image'] = $CurrentPlanet['image'];
            if (isset($AllPlanets)) {
                $displays->newblock('anothers_planets');
                $displays->assign('anothers_planets', $AllPlanets);
            }
            $parse["dpath"] = $dpath;
            if ($db->game_config['stat'] == 0) {
                $parse['user_rank'] = pretty_number($users->user['total_points']) . " (" . $lang['ov_place'] . " <a href=\"game.php?page=statistics&range=" . $users->user['total_rank'] . "\">" . $users->user['total_rank'] . "</a> " . $lang['ov_of'] . " " . $db->game_config['users_amount'] . ")";
            } elseif ($db->game_config['stat'] == 1 && $CurrentUser['authlevel'] < $db->game_config['stat_level']) {
                $parse['user_rank'] = pretty_number($users->user['total_points']) . " (" . $lang['ov_place'] . " <a href=\"game.php?page=statistics&range=" . $users->user['total_rank'] . "\">" . $users->user['total_rank'] . "</a> " . $lang['ov_of'] . " " . $db->game_config['users_amount'] . ")";
            } else {
                $parse['user_rank'] = "-";
            }
            setlocale(LC_ALL, 'es_ES.UTF-8/UTF-8');
            $parse['date_time'] = strftime("Hoy es %A, %e de %B de %Y, son las %H:%M:%S", time());
            //$url=explode("game.php",$_SERVER[HTTP_REFERER]);
            $url = dirname("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) . "/";
            $parse['refer'] = '' . $url . 'index.php?ref=' . $users->user['username'] . '';
            $displays->gotoBlock('overview');
            foreach ($parse as $name => $trans) {
                $displays->assign($name, $trans);
            }
            break;
    }
    $displays->display("Overview");
}
Example #14
0
function ShowOverviewPage($CurrentUser, $CurrentPlanet)
{
    global $xgp_root, $phpEx, $dpath, $game_config, $lang, $planetrow, $user, $resource;
    include_once $xgp_root . 'includes/functions/InsertJavaScriptChronoApplet.' . $phpEx;
    include_once $xgp_root . 'includes/classes/class.FlyingFleetsTable.' . $phpEx;
    include_once $xgp_root . 'includes/functions/CheckPlanetUsedFields.' . $phpEx;
    $FlyingFleetsTable = new FlyingFleetsTable();
    $lunarow = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '" . intval($CurrentPlanet['id_owner']) . "' AND `galaxy` = '" . intval($CurrentPlanet['galaxy']) . "' AND `system` = '" . intval($CurrentPlanet['system']) . "' AND  `planet` = '" . intval($CurrentPlanet['planet']) . "' AND `planet_type`='3'", 'planets', true);
    if (empty($lunarow)) {
        unset($lunarow);
    }
    CheckPlanetUsedFields($lunarow);
    $parse = $lang;
    $parse['id'] = $user['id'];
    $parse['planet_id'] = $CurrentPlanet['id'];
    $parse['planet_name'] = $CurrentPlanet['name'];
    $parse['galaxy_galaxy'] = $CurrentPlanet['galaxy'];
    $parse['galaxy_system'] = $CurrentPlanet['system'];
    $parse['galaxy_planet'] = $CurrentPlanet['planet'];
    $parse['dpath'] = $dpath;
    $parse['avatar'] = $user['avatar'];
    $QueryStat = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '" . $CurrentUser['id'] . "' AND `stat_type` = '1'", "statpoints", true);
    $parse['puntos_defensa'] = pretty_number($QueryStat['defs_count']);
    $parse['puntos_edificios'] = pretty_number($QueryStat['build_points']);
    $parse['puntos_naves'] = pretty_number($QueryStat['fleet_count']);
    $parse['puntos_investigaciones'] = pretty_number($QueryStat['tech_count']);
    $StatRecord = doquery("SELECT `total_rank`,`total_points`,`defs_rank`,`build_rank`,`fleet_rank`,`tech_rank` FROM `{{table}}` WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . $CurrentUser['id'] . "';", 'statpoints', true);
    $parse['top_defensa'] = $StatRecord['defs_rank'];
    $parse['top_edificios'] = $StatRecord['build_rank'];
    $parse['top_naves'] = $StatRecord['fleet_rank'];
    $parse['top_investigaciones'] = $StatRecord['tech_rank'];
    switch ($_GET['mode']) {
        case 'renameplanet':
            if ($_POST['action'] == $lang['ov_planet_rename_action']) {
                $newname = mysql_escape_string(strip_tags(trim($_POST['newname'])));
                if (preg_match("/[^A-z0-9_\\- ]/", $newname) == 1) {
                    message($lang['ov_newname_error'], "game.php?page=overview&mode=renameplanet", 2);
                }
                if ($newname != "") {
                    doquery("UPDATE {{table}} SET `name` = '" . $newname . "' WHERE `id` = '" . intval($CurrentUser['current_planet']) . "' LIMIT 1;", "planets");
                }
            } elseif ($_POST['action'] == $lang['ov_abandon_planet']) {
                return display(parsetemplate(gettemplate('overview/overview_deleteplanet'), $parse));
            } elseif (intval($_POST['kolonieloeschen']) == 1 && intval($_POST['deleteid']) == $CurrentUser['current_planet']) {
                $filokontrol = doquery("SELECT * FROM {{table}} WHERE fleet_owner = '" . intval($user['id']) . "' AND fleet_start_galaxy='" . intval($CurrentPlanet['galaxy']) . "' AND fleet_start_system='" . intval($CurrentPlanet['system']) . "' AND fleet_start_planet='" . intval($CurrentPlanet['planet']) . "'", 'fleets');
                while ($satir = mysql_fetch_array($filokontrol)) {
                    $kendifilo = $satir['fleet_owner'];
                    $digerfilo = $satir['fleet_target_owner'];
                    $harabeyeri = $satir['fleet_end_type'];
                    $mess = $satir['fleet_mess'];
                }
                $filokontrol = doquery("SELECT * FROM {{table}} WHERE fleet_target_owner = '" . intval($user['id']) . "' AND fleet_end_galaxy='" . intval($CurrentPlanet['galaxy']) . "' AND fleet_end_system='" . intval($CurrentPlanet['system']) . "' AND fleet_end_planet='" . intval($CurrentPlanet['planet']) . "'", 'fleets');
                while ($satir = mysql_fetch_array($filokontrol)) {
                    $kendifilo = $satir['fleet_owner'];
                    $digerfilo = $satir['fleet_target_owner'];
                    $gezoay = $satir['fleet_end_type'];
                    $mess = $satir['fleet_mess'];
                }
                if ($kendifilo > 0) {
                    message($lang['ov_abandon_planet_not_possible'], 'game.php?page=overview&mode=renameplanet');
                } elseif ($digerfilo > 0 && $mess < 1 && $gezoay != 2) {
                    message($lang['ov_abandon_planet_not_possible'], 'game.php?page=overview&mode=renameplanet');
                } else {
                    if (md5($_POST['pw']) == $CurrentUser["password"] && $CurrentUser['id_planet'] != $CurrentUser['current_planet']) {
                        doquery("UPDATE {{table}} SET `destruyed` = '" . (time() + 86400) . "' WHERE `id` = '" . intval($CurrentUser['current_planet']) . "' LIMIT 1;", 'planets');
                        doquery("UPDATE {{table}} SET `current_planet` = `id_planet` WHERE `id` = '" . intval($CurrentUser['id']) . "' LIMIT 1", "users");
                        doquery("DELETE FROM {{table}} WHERE `galaxy` = '" . intval($CurrentPlanet['galaxy']) . "' AND `system` = '" . intval($CurrentPlanet['system']) . "' AND `planet` = '" . intval($CurrentPlanet['planet']) . "' AND `planet_type` = 3;", 'planets');
                        message($lang['ov_planet_abandoned'], 'game.php?page=overview&mode=renameplanet');
                    } elseif ($CurrentUser['id_planet'] == $CurrentUser["current_planet"]) {
                        message($lang['ov_principal_planet_cant_abanone'], 'game.php?page=overview&mode=renameplanet');
                    } else {
                        message($lang['ov_wrong_pass'], 'game.php?page=overview&mode=renameplanet');
                    }
                }
            }
            return display(parsetemplate(gettemplate('overview/overview_renameplanet'), $parse));
            break;
        default:
            $CONSULTA = doquery("SELECT metal,crystal FROM {{table}} WHERE galaxy = '" . $CurrentPlanet['galaxy'] . "' AND system = '" . $CurrentPlanet['system'] . "' AND planet = '" . $CurrentPlanet['planet'] . "'", "galaxy", true);
            $parse['metal_debris'] = pretty_number($CONSULTA['metal']);
            $parse['crystal_debris'] = pretty_number($CONSULTA['crystal']);
            if ($CurrentPlanet['recycler'] != 0 && ($CONSULTA['metal'] != 0 || $CONSULTA['crystal'] != 0)) {
                $parse['get_link'] = " (<a href=\"game.php?page=galaxy&mode=8&g=" . $CurrentPlanet['galaxy'] . "&s=" . $CurrentPlanet['system'] . "&p=" . $CurrentPlanet['planet'] . "&t=2\"> DF </a>)";
            } else {
                $parse['get_link'] = '';
            }
            if ($CurrentUser['new_message'] != 0) {
                $Have_new_message .= "<tr>";
                if ($CurrentUser['new_message'] == 1) {
                    $Have_new_message .= "<th colspan=4><a href=game.{$phpEx}?page=messages>" . $lang['ov_have_new_message'] . "</a></th>";
                } elseif ($CurrentUser['new_message'] > 1) {
                    $Have_new_message .= "<th colspan=4><a href=game.{$phpEx}?page=messages>";
                    $Have_new_message .= str_replace('%m', pretty_number($CurrentUser['new_message']), $lang['ov_have_new_messages']);
                    $Have_new_message .= "</a></th>";
                }
                $Have_new_message .= "</tr>";
            }
            $OwnFleets = doquery("SELECT * FROM {{table}} WHERE `fleet_owner` = '" . intval($CurrentUser['id']) . "';", 'fleets');
            $Record = 0;
            while ($FleetRow = mysql_fetch_array($OwnFleets)) {
                $Record++;
                $StartTime = $FleetRow['fleet_start_time'];
                $StayTime = $FleetRow['fleet_end_stay'];
                $EndTime = $FleetRow['fleet_end_time'];
                /////// // ### LUCKY , CODES ARE BELOW
                $hedefgalaksi = $FleetRow['fleet_end_galaxy'];
                $hedefsistem = $FleetRow['fleet_end_system'];
                $hedefgezegen = $FleetRow['fleet_end_planet'];
                $mess = $FleetRow['fleet_mess'];
                $filogrubu = $FleetRow['fleet_group'];
                $id = $FleetRow['fleet_id'];
                //////
                $Label = "fs";
                if ($StartTime > time()) {
                    $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, true, $Label, $Record);
                }
                if ($FleetRow['fleet_mission'] != 4 && $FleetRow['fleet_mission'] != 10) {
                    $Label = "ft";
                    if ($StayTime > time()) {
                        $fpage[$StayTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, true, $Label, $Record);
                    }
                    $Label = "fe";
                    if ($EndTime > time()) {
                        $fpage[$EndTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 2, true, $Label, $Record);
                    }
                }
                /**fix fleet table return by jstar**/
                if ($FleetRow['fleet_mission'] == 4 && $StartTime < time() && $EndTime > time()) {
                    $fpage[$EndTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 2, true, "fjstar", $Record);
                }
                /**end fix**/
            }
            mysql_free_result($OwnFleets);
            //iss ye katilan filo////////////////////////////////////
            // ### LUCKY , CODES ARE BELOW
            $dostfilo = doquery("SELECT * FROM {{table}} WHERE `fleet_end_galaxy` = '" . intval($hedefgalaksi) . "' AND `fleet_end_system` = '" . intval($hedefsistem) . "' AND `fleet_end_planet` = '" . intval($hedefgezegen) . "' AND `fleet_group` = '" . intval($filogrubu) . "';", 'fleets');
            $Record1 = 0;
            while ($FleetRow = mysql_fetch_array($dostfilo)) {
                $StartTime = $FleetRow['fleet_start_time'];
                $StayTime = $FleetRow['fleet_end_stay'];
                $EndTime = $FleetRow['fleet_end_time'];
                ///////
                $hedefgalaksi = $FleetRow['fleet_end_galaxy'];
                $hedefsistem = $FleetRow['fleet_end_system'];
                $hedefgezegen = $FleetRow['fleet_end_planet'];
                $mess = $FleetRow['fleet_mess'];
                $filogrubu = $FleetRow['fleet_group'];
                $id = $FleetRow['fleet_id'];
                ///////
                if ($FleetRow['fleet_mission'] == 2 && $FleetRow['fleet_owner'] != $CurrentUser['id']) {
                    $Record1++;
                    //		if (($FleetRow['fleet_mission'] == 2) ){
                    if ($mess > 0) {
                        $StartTime = "";
                    } else {
                        $StartTime = $FleetRow['fleet_start_time'];
                    }
                    if ($StartTime > time()) {
                        $Label = "ofs";
                        $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, false, $Label, $Record1);
                    }
                    //	}
                }
                ///""
                if ($FleetRow['fleet_mission'] == 1 && $FleetRow['fleet_owner'] != $CurrentUser['id'] && $filogrubu > 0) {
                    $Record++;
                    if ($mess > 0) {
                        $StartTime = "";
                    } else {
                        $StartTime = $FleetRow['fleet_start_time'];
                    }
                    if ($StartTime > time()) {
                        $Label = "ofs";
                        $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, false, $Label, $Record);
                    }
                }
            }
            mysql_free_result($dostfilo);
            //
            //////////////////////////////////////////////////
            //nome da aliança
            $ally_id = $user['ally_id'];
            if ($ally_id) {
                $allydata = doquery("SELECT `ally_name` FROM {{table}} WHERE `id` = '" . $ally_id . "'", "alliance", true);
                if ($allydata['ally_name'] != '') {
                    $parse['ally_name'] = $allydata['ally_name'];
                } else {
                    $parse['ally_name'] = "You dont have any alliance";
                }
            } else {
                $parse['ally_name'] = "You dont have any alliance";
            }
            //////////////////////////////////////////////////
            //Administración overview
            $OnlineAdmins = doquery("SELECT * FROM {{table}} WHERE onlinetime>='" . (time() - 10 * 60) . "' AND authlevel>=1", 'users');
            if ($OnlineAdmins) {
                $parse['OnlineAdmins'] = "";
                while ($oas = mysql_fetch_array($OnlineAdmins)) {
                    $parse['OnlineAdmins'] .= "<a href=\"game.php?page=messages&mode=write&id=" . $oas['id'] . "\" >" . $oas['username'] . "</a>&nbsp;&bull;&nbsp;";
                }
                if ($parse['OnlineAdmins'] == "") {
                    $parse['OnlineAdmins'] = "--";
                }
            }
            //Administración overview
            $OtherFleets = doquery("SELECT * FROM {{table}} WHERE `fleet_target_owner` = '" . intval($CurrentUser['id']) . "';", 'fleets');
            $Record = 2000;
            while ($FleetRow = mysql_fetch_array($OtherFleets)) {
                if ($FleetRow['fleet_owner'] != $CurrentUser['id']) {
                    if ($FleetRow['fleet_mission'] != 8) {
                        $Record++;
                        $StartTime = $FleetRow['fleet_start_time'];
                        $StayTime = $FleetRow['fleet_end_stay'];
                        $id = $FleetRow['fleet_id'];
                        if ($StartTime > time()) {
                            $Label = "ofs";
                            $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, false, $Label, $Record);
                        }
                        if ($FleetRow['fleet_mission'] == 5) {
                            $Label = "oft";
                            if ($StayTime > time()) {
                                $fpage[$StayTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, false, $Label, $Record);
                            }
                        }
                    }
                }
            }
            mysql_free_result($OtherFleets);
            $planets_query = doquery("SELECT * FROM `{{table}}` WHERE id_owner='" . intval($CurrentUser['id']) . "' AND `destruyed` = 0", "planets");
            $Colone = 1;
            $AllPlanets = "<tr>";
            while ($CurrentUserPlanet = mysql_fetch_array($planets_query)) {
                if ($CurrentUserPlanet["id"] != $CurrentUser["current_planet"] && $CurrentUserPlanet['planet_type'] != 3) {
                    $Coloneshow++;
                    $AllPlanets .= "<th>" . $CurrentUserPlanet['name'] . "<br>";
                    $AllPlanets .= "<a href=\"game.php?page=overview&cp=" . $CurrentUserPlanet['id'] . "&re=0\" title=\"" . $CurrentUserPlanet['name'] . "\"><img src=\"" . $dpath . "planeten/small/s_" . $CurrentUserPlanet['image'] . ".jpg\" height=\"50\" width=\"50\"></a><br>";
                    $AllPlanets .= "<center>";
                    if ($CurrentUserPlanet['b_building'] != 0) {
                        UpdatePlanetBatimentQueueList($CurrentUserPlanet, $CurrentUser);
                        if ($CurrentUserPlanet['b_building'] != 0) {
                            $BuildQueue = $CurrentUserPlanet['b_building_id'];
                            $QueueArray = explode(";", $BuildQueue);
                            $CurrentBuild = explode(",", $QueueArray[0]);
                            $BuildElement = $CurrentBuild[0];
                            $BuildLevel = $CurrentBuild[1];
                            $BuildRestTime = pretty_time($CurrentBuild[3] - time());
                            $AllPlanets .= '' . $lang['tech'][$BuildElement] . ' (' . $BuildLevel . ')';
                            $AllPlanets .= "<br><font color=\"#7f7f7f\">(" . $BuildRestTime . ")</font>";
                        } else {
                            CheckPlanetUsedFields($CurrentUserPlanet);
                            $AllPlanets .= $lang['ov_free'];
                        }
                    } else {
                        $AllPlanets .= $lang['ov_free'];
                    }
                    $AllPlanets .= "</center></th>";
                    if ($Colone <= 9) {
                        $Colone++;
                    } else {
                        $AllPlanets .= "</tr><tr>";
                        $Colone = 0;
                    }
                }
            }
            mysql_free_result($planets_query);
            $AllPlanets .= "</tr>";
            if ($game_config['OverviewNewsFrame'] == '1') {
                $parse['NewsFrame'] = "<tr>" . $lang['ov_news_title'] . "<th colspan=\"4\">" . stripslashes($game_config['OverviewNewsText']) . "</th></tr>";
            }
            if ($lunarow['id'] != 0 && $lunarow['destruyed'] != 1 && $CurrentPlanet['planet_type'] != 3) {
                if ($CurrentPlanet['planet_type'] == 1 or $lunarow['id'] != 0) {
                    $moon = doquery("SELECT `id`,`name`,`image` FROM {{table}} WHERE `galaxy` = '" . intval($CurrentPlanet['galaxy']) . "' AND `system` = '" . intval($CurrentPlanet['system']) . "' AND `planet` = '" . intval($CurrentPlanet['planet']) . "' AND `planet_type` = '3'", 'planets', true);
                    $parse['moon_img'] = "<a href=\"game.php?page=overview&cp=" . $moon['id'] . "&re=0\" title=\"" . $moon['name'] . "\"><img src=\"" . $dpath . "planeten/" . $moon['image'] . ".jpg\" height=\"50\" width=\"50\"></a>";
                    $parse['moon'] = $moon['name'] . " (" . $lang['fcm_moon'] . ")";
                } else {
                    $parse['moon_img'] = "";
                    $parse['moon'] = "";
                }
            } else {
                $parse['moon_img'] = "";
                $parse['moon'] = "";
            }
            $parse['planet_diameter'] = pretty_number($CurrentPlanet['diameter']);
            $parse['planet_field_current'] = $CurrentPlanet['field_current'];
            $parse['planet_field_max'] = CalculateMaxPlanetFields($CurrentPlanet);
            $parse['planet_temp_min'] = $CurrentPlanet['temp_min'];
            $parse['planet_temp_max'] = $CurrentPlanet['temp_max'];
            // Gouvernement
            $staatsform = $user['staatsform'];
            if ($staatsform == 2) {
                $parse['STAATSFORM_LINK'] = "\r\n<tr><center>\r\n    <th colspan=\"2\">Forma de gobierno:</th>\r\n    <th colspan=\"2\"><a href=\"game.php?page=gouv\" accesskey=\"d\" style=\"font-size:100%\">" . $lang['demokratie'] . "</a></th>\r\n</tr>";
            } elseif ($staatsform == 3) {
                $parse['STAATSFORM_LINK'] = "\r\n<tr><center>\r\n    <th colspan=\"2\">Forma de gobierno:</th>\r\n    <th colspan=\"2\"><a href=\"game.php?page=gouv\" accesskey=\"d\" style=\"font-size:100%\">" . $lang['monarchie'] . "</a></th>\r\n</tr>";
            } elseif ($staatsform == 4) {
                $parse['STAATSFORM_LINK'] = "\r\n<tr><center>\r\n    <th colspan=\"2\">Forma de gobierno:</th>\r\n    <th colspan=\"2\"><a href=\"game.php?page=gouv\" accesskey=\"d\" style=\"font-size:100%\">" . $lang['diktatur'] . "</a></th>\r\n</tr>";
            } elseif ($staatsform == 5) {
                $parse['STAATSFORM_LINK'] = "\r\n<tr><center>\r\n    <th colspan=\"2\">Forma de gobierno:</th>\r\n    <th colspan=\"2\"><a href=\"game.php?page=gouv\" accesskey=\"d\" style=\"font-size:100%\">" . $lang['imperialisme'] . "</a></th>\r\n</tr>";
            } elseif ($staatsform == 6) {
                $parse['STAATSFORM_LINK'] = "\r\n<tr><center>\r\n    <th colspan=\"2\">Forma de gobierno:</th>\r\n    <th colspan=\"2\"><a href=\"game.php?page=gouv\" accesskey=\"d\" style=\"font-size:100%\">" . $lang['aristocratie'] . "</a></th>\r\n</tr>";
            } else {
                $parse['STAATSFORM_LINK'] = "\r\n<tr><center>\r\n    <th colspan=\"2\">Forma de gobierno:</th>\r\n    <th colspan=\"2\"><a href=\"game.php?page=gouv\" accesskey=\"d\" style=\"font-size:100%\">" . $lang['barbarisch'] . "</a></th>\r\n</tr>";
            }
            if ($user['humano'] == 1) {
                $parse['race'] = 'Raza: Humano';
                $parse['imgrace'] = 'images/human.gif';
            } else {
                if ($user['vampiro'] == 1) {
                    $parse['race'] = 'Raza: Vampiro';
                    $parse['imgrace'] = 'images/vampiro.gif';
                } else {
                    if ($user['lobo'] == 1) {
                        $parse['race'] = 'Raza : Lobo';
                        $parse['imgrace'] = 'images/lobo.gif';
                    } else {
                        if ($user['asgard'] == 1) {
                            $parse['race'] = 'Raza : Asgard';
                            $parse['imgrace'] = 'images/asgard.gif';
                        }
                    }
                }
            }
            $StatRecord = doquery("SELECT `total_rank`,`total_points` FROM `{{table}}` WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . intval($CurrentUser['id']) . "';", 'statpoints', true);
            $parse['user_username'] = $CurrentUser['username'];
            if (count($fpage) > 0) {
                ksort($fpage);
                foreach ($fpage as $time => $content) {
                    $flotten .= $content . "\n";
                }
            }
            // **** INICIA MOD {MOSTRAR TECNOLOGIA EN PROCESO EN VISTA GENERAL} ****
            if ($CurrentPlanet['b_building'] != 0) {
                include $xgp_root . 'includes/functions/InsertBuildListScript.' . $phpEx;
                UpdatePlanetBatimentQueueList($planetrow, $user);
                if ($CurrentPlanet['b_building'] != 0) {
                    $BuildQueue = explode(";", $CurrentPlanet['b_building_id']);
                    $CurrBuild = explode(",", $BuildQueue[0]);
                    $RestTime = $CurrentPlanet['b_building'] - time();
                    $PlanetID = $CurrentPlanet['id'];
                    $Build = InsertBuildListScript("buildings");
                    $Build .= "<table>";
                    $Build .= "    <tr>";
                    $Build .= "        <td colspan=\"2\">" . $lang['tech'][$CurrBuild[0]] . "</td>";
                    $Build .= "    </tr>";
                    $Build .= "    <tr>";
                    $Build .= "        <td align=\"center\" valign=\"middle\"><img src=\"" . $dpath . "gebaeude/" . $CurrBuild[0] . ".gif\" width=\"40\" height=\"40\"></td>";
                    $Build .= "        <td>" . $lang['pr_subiendo'] . " <span style=\"color:#FF8C00;\">Nivel " . $CurrBuild[1] . "</span><br />";
                    $Build .= "            " . $lang['pr_duracion'] . ":<div id=\"blc\" class=\"z\" style=\"color:yellow;\">" . pretty_time($RestTime) . "</div>";
                    $Build .= "        </td>";
                    $Build .= "    </tr>";
                    $Build .= "</Table>";
                    $Build .= "\n<script language=\"JavaScript\">";
                    $Build .= "\n    pp = \"" . $RestTime . "\";\n";
                    $Build .= "\n    pk = \"" . 1 . "\";\n";
                    $Build .= "\n    pm = \"cancel\";\n";
                    $Build .= "\n    pl = \"" . $PlanetID . "\";\n";
                    $Build .= "\n    t();\n";
                    $Build .= "\n</script>\n";
                    $parse['building'] = $Build;
                } else {
                    $parse['building'] = $lang['ov_free'];
                }
            } else {
                $parse['building'] = $lang['ov_free'];
            }
            $PlanetaQueInv = doquery("SELECT id, name, b_tech, b_tech_id FROM `{{table}}` WHERE `id_owner` = '" . $CurrentUser['id'] . "' AND `b_tech` != '0';", 'planets', true);
            if ($PlanetaQueInv['b_tech'] != 0) {
                include $xgp_root . 'includes/functions/InsertTechListScript.' . $phpEx;
                UpdatePlanetBatimentQueueList($planetrow, $user);
                $NvlActual = $CurrentUser[$resource[$PlanetaQueInv['b_tech_id']]] + 1;
                $RestTime = $PlanetaQueInv['b_tech'] - time();
                $PlanetID = $PlanetaQueInv['id'];
                $NomPlaneta = "";
                if ($PlanetaQueInv['name'] != $CurrentPlanet['name']) {
                    $NomPlaneta = " de " . $PlanetaQueInv['name'];
                }
                $Tech = InsertTechListScript("buildings", $NomPlaneta);
                $Tech .= "<table>";
                $Tech .= "    <tr>";
                $Tech .= "        <td colspan=\"2\">" . $lang['tech'][$PlanetaQueInv['b_tech_id']] . "</td>";
                $Tech .= "    </tr>";
                $Tech .= "    <tr>";
                $Tech .= "        <td align=\"center\" valign=\"middle\"><img src=\"" . $dpath . "gebaeude/" . $PlanetaQueInv['b_tech_id'] . ".gif\" width=\"40\" height=\"40\"></td>";
                $Tech .= "        <td>" . $lang['pr_investigando'] . " <span style=\"color:#FF8C00;\">Nivel " . $NvlActual . "</span><br />";
                $Tech .= "            " . $lang['pr_duracion'] . ":<div id=\"tec_blc\" class=\"z\" style=\"color:yellow;\">" . pretty_time($RestTime) . "</div>";
                $Tech .= "        </td>";
                $Tech .= "    </tr>";
                $Tech .= "</Table>";
                $Tech .= "\n<script language=\"JavaScript\">";
                $Tech .= "\n    tec_pp = \"" . $RestTime . "\";\n";
                $Tech .= "\n    tec_pk = \"" . 1 . "\";\n";
                $Tech .= "\n    tec_pm = \"cancel\";\n";
                $Tech .= "\n    tec_pl = \"" . $PlanetaQueInv['b_tech_id'] . "\";\n";
                $Tech .= "\n    tec_t();\n";
                $Tech .= "\n</script>\n";
                $parse['tech_en_proceso'] .= $Tech;
            } else {
                $parse['tech_en_proceso'] = $lang['ov_free'];
            }
            if ($CurrentPlanet['b_hangar'] != 0) {
                include $xgp_root . 'includes/functions/InsertHangarListScript.' . $phpEx;
                UpdatePlanetBatimentQueueList($planetrow, $user);
                $BuildQueue = explode(";", $CurrentPlanet['b_hangar_id']);
                $CurrBuild = explode(",", $BuildQueue[0]);
                $RealTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $CurrBuild[0]);
                $QueueTime = $RealTime * $CurrBuild[1];
                $RestTime = $QueueTime - $CurrentPlanet['b_hangar'];
                $PlanetID = $CurrentPlanet['id'];
                $Hangar = InsertHangarListScript("overview");
                $Hangar .= "<table>";
                $Hangar .= "    <tr>";
                $Hangar .= "        <td colspan=\"2\">" . $lang['tech'][$CurrBuild[0]] . "</td>";
                $Hangar .= "    </tr>";
                $Hangar .= "    <tr>";
                $Hangar .= "        <td align=\"center\" valign=\"middle\"><img src=\"" . $dpath . "gebaeude/" . $CurrBuild[0] . ".gif\" width=\"40\" height=\"40\"><br />";
                $Hangar .= "        </td>";
                $Hangar .= "        <td>" . $lang['pr_tiempo_prod'] . "<br />";
                $Hangar .= "            <div id=\"han_blc\" class=\"z\" style=\"color:yellow;\">" . pretty_time($RestTime) . "</div>";
                $Hangar .= "        </td>";
                $Hangar .= "    </tr>";
                $Hangar .= "</Table>";
                $Hangar .= "\n<script language=\"JavaScript\">";
                $Hangar .= "\n    han_pp = \"" . $RestTime . "\";\n";
                $Hangar .= "\n    han_pk = \"" . 1 . "\";\n";
                $Hangar .= "\n    han_pm = \"cancel\";\n";
                $Hangar .= "\n    han_pl = \"" . $PlanetID . "\";\n";
                $Hangar .= "\n    han_t();\n";
                $Hangar .= "\n</script>\n";
                $parse['hangar_en_proceso'] .= $Hangar;
            } else {
                $parse['hangar_en_proceso'] = $lang['ov_free'];
            }
            $parse['overview_produccion'] = parsetemplate(gettemplate('overview/overview_produccion'), $parse);
            // **** FIN MOD {MOSTRAR TECNOLOGIA EN PROCESO EN VISTA GENERAL} ****
            $parse['fleet_list'] = $flotten;
            $parse['Have_new_message'] = $Have_new_message;
            $parse['planet_image'] = $CurrentPlanet['image'];
            $parse['anothers_planets'] = $AllPlanets;
            $parse["dpath"] = $dpath;
            if ($game_config['stat'] == 0) {
                $parse['user_rank'] = pretty_number($StatRecord['total_points']) . " (" . $lang['ov_place'] . " <a href=\"game.php?page=statistics&range=" . $StatRecord['total_rank'] . "\">" . $StatRecord['total_rank'] . "</a> " . $lang['ov_of'] . " " . $game_config['users_amount'] . ")";
            } elseif ($game_config['stat'] == 1 && $CurrentUser['authlevel'] < $game_config['stat_level']) {
                $parse['user_rank'] = pretty_number($StatRecord['total_points']) . " (" . $lang['ov_place'] . " <a href=\"game.php?page=statistics&range=" . $StatRecord['total_rank'] . "\">" . $StatRecord['total_rank'] . "</a> " . $lang['ov_of'] . " " . $game_config['users_amount'] . ")";
            } else {
                $parse['user_rank'] = "-";
            }
            $parse['date_time'] = date("D M j H:i:s", time());
            // Rajout d'une barre pourcentage
            // Calcul du pourcentage de remplissage
            $parse['case_pourcentage'] = floor($planetrow["field_current"] / CalculateMaxPlanetFields($planetrow) * 100) . $lang['o/o'];
            // Barre de remplissage
            $parse['case_barre'] = floor($planetrow["field_current"] / CalculateMaxPlanetFields($planetrow) * 101) * 4.1;
            // Couleur de la barre de remplissage
            if ($parse['case_barre'] > 100 * 4.0) {
                $parse['case_barre'] = 400;
                $parse['case_barre_barcolor'] = '#C00000';
            } elseif ($parse['case_barre'] > 80 * 4.0) {
                $parse['case_barre_barcolor'] = '#C0C000';
            } else {
                $parse['case_barre_barcolor'] = '#00C000';
            }
            if ($StatRecord['total_points'] >= 0 && $StatRecord['total_points'] < 100000) {
                $parse['rankgame'] = "Soldado";
                $parse['rankimg'] = "rank1.gif";
            } elseif ($StatRecord['total_points'] >= 100000 && $StatRecord['total_points'] < 250000) {
                $parse['rankgame'] = "Cabo Cazador";
                $parse['rankimg'] = "rank2.gif";
            } elseif ($StatRecord['total_points'] >= 250000 && $StatRecord['total_points'] < 500000) {
                $parse['rankgame'] = "Sargento Cazador";
                $parse['rankimg'] = "rank3.gif";
            } elseif ($StatRecord['total_points'] >= 500000 && $StatRecord['total_points'] < 1000000) {
                $parse['rankgame'] = "Teniente de Crucero";
                $parse['rankimg'] = "rank4.gif";
            } elseif ($StatRecord['total_points'] >= 1000000 && $StatRecord['total_points'] < 2500000) {
                $parse['rankgame'] = "Capitán Destructor";
                $parse['rankimg'] = "rank5.gif";
            } elseif ($StatRecord['total_points'] >= 2500000 && $StatRecord['total_points'] < 5000000) {
                $parse['rankgame'] = "Almirante Acorazado";
                $parse['rankimg'] = "rank6.gif";
            } elseif ($StatRecord['total_points'] >= 5000000 && $StatRecord['total_points'] < 10000000) {
                $parse['rankgame'] = "General Estrella";
                $parse['rankimg'] = "rank7.gif";
            } elseif ($StatRecord['total_points'] >= 10000000 && $StatRecord['total_points'] < 25000000) {
                $parse['rankgame'] = "General Supernova";
                $parse['rankimg'] = "rank8.gif";
            } elseif ($StatRecord['total_points'] >= 25000000 && $StatRecord['total_points'] < 50000000) {
                $parse['rankgame'] = "General de Flota";
                $parse['rankimg'] = "rank9.gif";
            } elseif ($StatRecord['total_points'] >= 50000000 && $StatRecord['total_points'] < 100000000) {
                $parse['rankgame'] = "General Interestelar";
                $parse['rankimg'] = "rank10.gif";
            } elseif ($StatRecord['total_points'] >= 100000000 && $StatRecord['total_points'] < 500000000) {
                $parse['rankgame'] = "Cónsul General";
                $parse['rankimg'] = "rank11.gif";
            } elseif ($StatRecord['total_points'] >= 500000000) {
                $parse['rankgame'] = "Emperador";
                $parse['rankimg'] = "rank12.gif";
            }
            return display(parsetemplate(gettemplate('overview/overview_body'), $parse));
            break;
    }
}
 private function homeAlliance()
 {
     global $USER, $LNG;
     require 'includes/classes/BBCode.class.php';
     $db = Database::get();
     if ($this->allianceData['ally_owner'] == $USER['id']) {
         $rankName = $this->allianceData['ally_owner_range'] != '' ? $this->allianceData['ally_owner_range'] : $LNG['al_founder_rank_text'];
     } elseif ($USER['ally_rank_id'] != 0) {
         $sql = "SELECT rankName FROM &&ALLIANCE_RANK&& WHERE rankID = :UserRankID;";
         $rankName = $db->selectSingle($sql, array(':UserRankID' => $USER['ally_rank_id']), 'rankName');
     }
     if (empty($rankName)) {
         $rankName = $LNG['al_new_member_rank_text'];
     }
     $sql = "SELECT SUM(wons) as wons, SUM(loos) as loos, SUM(draws) as draws, SUM(kbmetal) as kbmetal, SUM(kbcrystal) as kbcrystal, SUM(lostunits) as lostunits, SUM(desunits) as desunits FROM %%USERS%% WHERE ally_id = :AllianceID;";
     $statisticResult = $db->selectSingle($sql, array(':AllianceID' => $this->allianceData['id']));
     $sql = "SELECT COUNT(*) as count FROM %%ALLIANCE_REQUEST%% WHERE allianceId = :AllianceID;";
     $ApplyCount = $db->selectSingle($sql, array(':AllianceID' => $this->allianceData['id']), 'count');
     $ally_events = array();
     if (!empty($this->allianceData['ally_events'])) {
         $sql = "SELECT id, username FROM %%USERS%% WHERE ally_id = :AllianceID;";
         $result = $db->select($sql, array(':AllianceID' => $this->allianceData['id']));
         require_once 'includes/classes/class.FlyingFleetsTable.php';
         $FlyingFleetsTable = new FlyingFleetsTable();
         $this->tplObj->loadscript('overview.js');
         foreach ($result as $row) {
             $FlyingFleetsTable->setUser($row['id']);
             $FlyingFleetsTable->setMissions($this->allianceData['ally_events']);
             $ally_events[$row['username']] = $FlyingFleetsTable->renderTable();
         }
         $ally_events = array_filter($ally_events);
     }
     $this->assign(array('DiploInfo' => $this->getDiplomatic(), 'ally_web' => $this->allianceData['ally_web'], 'ally_tag' => $this->allianceData['ally_tag'], 'ally_members' => $this->allianceData['ally_members'], 'ally_max_members' => $this->allianceData['ally_members'], 'ally_name' => $this->allianceData['ally_name'], 'ally_image' => $this->allianceData['ally_image'], 'ally_description' => BBCode::parse($this->allianceData['ally_description']), 'ally_text' => BBCode::parse($this->allianceData['ally_text']), 'rankName' => $rankName, 'requests' => sprintf($LNG['al_new_requests'], $ApplyCount), 'applyCount' => $ApplyCount, 'totalfight' => $statisticResult['wons'] + $statisticResult['loos'] + $statisticResult['draws'], 'fightwon' => $statisticResult['wons'], 'fightlose' => $statisticResult['loos'], 'fightdraw' => $statisticResult['draws'], 'unitsshot' => pretty_number($statisticResult['desunits']), 'unitslose' => pretty_number($statisticResult['lostunits']), 'dermetal' => pretty_number($statisticResult['kbmetal']), 'dercrystal' => pretty_number($statisticResult['kbcrystal']), 'isOwner' => $this->allianceData['ally_owner'] == $USER['id'], 'ally_events' => $ally_events));
     $this->display('page.alliance.home.tpl');
 }
Example #16
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');
}
Example #17
0
function ShowOverviewPage($CurrentUser, $CurrentPlanet)
{
    global $xgp_root, $phpEx, $dpath, $game_config, $lang, $planetrow, $user, $resource;
    include_once $xgp_root . 'includes/functions/InsertJavaScriptChronoApplet.' . $phpEx;
    include_once $xgp_root . 'includes/classes/class.FlyingFleetsTable.' . $phpEx;
    $FlyingFleetsTable = new FlyingFleetsTable();
    $lunarow = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '" . $CurrentPlanet['id_owner'] . "' AND `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `planet` = '" . $CurrentPlanet['planet'] . "' AND `planet_type`='3'", 'planets', true);
    if (empty($lunarow)) {
        unset($lunarow);
    }
    CheckPlanetUsedFields($lunarow);
    $parse = $lang;
    $parse['planet_id'] = $CurrentPlanet['id'];
    $parse['planet_name'] = $CurrentPlanet['name'];
    $parse['galaxy_galaxy'] = $CurrentPlanet['galaxy'];
    $parse['galaxy_system'] = $CurrentPlanet['system'];
    $parse['galaxy_planet'] = $CurrentPlanet['planet'];
    $parse['dpath'] = $dpath;
    $parse['avatar'] = $user['avatar'];
    $online_users = doquery("SELECT COUNT(DISTINCT(id)) as `onlinenow` FROM {{table}} WHERE `onlinetime` > '" . (time() - 15 * 60) . "';", 'users', true);
    $parse['online_users'] = $online_users['onlinenow'];
    $QueryStat = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '" . $CurrentUser['id'] . "' AND `stat_type` = '1'", "statpoints", true);
    $parse['puntos_defensa'] = pretty_number($QueryStat['defs_count']);
    $parse['puntos_edificios'] = pretty_number($QueryStat['build_points']);
    $parse['puntos_naves'] = pretty_number($QueryStat['fleet_count']);
    $parse['puntos_investigaciones'] = pretty_number($QueryStat['tech_count']);
    $StatRecord = doquery("SELECT `total_rank`,`total_points`,`defs_rank`,`build_rank`,`fleet_rank`,`tech_rank` FROM `{{table}}` WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . $CurrentUser['id'] . "';", 'statpoints', true);
    $parse['top_defensa'] = $StatRecord['defs_rank'];
    $parse['top_edificios'] = $StatRecord['build_rank'];
    $parse['top_naves'] = $StatRecord['fleet_rank'];
    $parse['top_investigaciones'] = $StatRecord['tech_rank'];
    $parse['top_total'] = $StatRecord['total_rank'];
    $parse['ally_name'] = $ally_name;
    $parse['ally_tag'] = $ally_tag;
    if ($Level > 0) {
        $parse['admin_link'] = "<tr><td><div align=\"center\"><a href=\"javascript:top.location.href='adm/index.php'\"> <font color=\"lime\">" . $lang['lm_administration'] . "</font></a></div></td></tr>";
    } else {
        $parse['admin_link'] = "";
    }
    switch ($_GET['mode']) {
        case 'renameplanet':
            if ($_POST['action'] == $lang['ov_planet_rename_action']) {
                $newname = mysql_escape_string(strip_tags(trim($_POST['newname'])));
                if (preg_match("/[^A-z0-9_\\- ]/", $newname) == 1) {
                    message($lang['ov_newname_error'], "game.php?page=overview&mode=renameplanet", 2);
                }
                if ($newname != "") {
                    doquery("UPDATE {{table}} SET `name` = '" . $newname . "' WHERE `id` = '" . $CurrentUser['current_planet'] . "' LIMIT 1;", "planets");
                }
            } elseif ($_POST['action'] == $lang['ov_abandon_planet']) {
                return display(parsetemplate(gettemplate('overview/overview_deleteplanet'), $parse));
            } elseif ($_POST['kolonieloeschen'] == 1 && intval($_POST['deleteid']) == $CurrentUser['current_planet']) {
                $filokontrol = doquery("SELECT * FROM {{table}} WHERE fleet_owner = '{$user['id']}' AND fleet_start_galaxy='{$CurrentPlanet['galaxy']}' AND fleet_start_system='{$CurrentPlanet['system']}' AND fleet_start_planet='{$CurrentPlanet['planet']}'", 'fleets');
                while ($satir = mysql_fetch_array($filokontrol)) {
                    $kendifilo = $satir['fleet_owner'];
                    $digerfilo = $satir['fleet_target_owner'];
                    $harabeyeri = $satir['fleet_end_type'];
                    $mess = $satir['fleet_mess'];
                }
                $filokontrol = doquery("SELECT * FROM {{table}} WHERE fleet_target_owner = '{$user['id']}' AND fleet_end_galaxy='{$CurrentPlanet['galaxy']}' AND fleet_end_system='{$CurrentPlanet['system']}' AND fleet_end_planet='{$CurrentPlanet['planet']}'", 'fleets');
                while ($satir = mysql_fetch_array($filokontrol)) {
                    $kendifilo = $satir['fleet_owner'];
                    $digerfilo = $satir['fleet_target_owner'];
                    $gezoay = $satir['fleet_end_type'];
                    $mess = $satir['fleet_mess'];
                }
                if ($kendifilo > 0) {
                    message($lang['ov_abandon_planet_not_possible'], 'game.php?page=overview&mode=renameplanet');
                } elseif ($digerfilo > 0 && $mess < 1 && $gezoay != 2) {
                    message($lang['ov_abandon_planet_not_possible'], 'game.php?page=overview&mode=renameplanet');
                } else {
                    if (md5($_POST['pw']) == $CurrentUser["password"] && $CurrentUser['id_planet'] != $CurrentUser['current_planet']) {
                        doquery("UPDATE {{table}} SET `destruyed` = '" . (time() + 86400) . "' WHERE `id` = '" . mysql_real_escape_string($CurrentUser['current_planet']) . "' LIMIT 1;", 'planets');
                        doquery("UPDATE {{table}} SET `current_planet` = `id_planet` WHERE `id` = '" . mysql_real_escape_string($CurrentUser['id']) . "' LIMIT 1", "users");
                        doquery("DELETE FROM {{table}} WHERE `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `planet` = '" . $CurrentPlanet['planet'] . "' AND `planet_type` = 3;", 'planets');
                        message($lang['ov_planet_abandoned'], 'game.php?page=overview&mode=renameplanet');
                    } elseif ($CurrentUser['id_planet'] == $CurrentUser["current_planet"]) {
                        message($lang['ov_principal_planet_cant_abanone'], 'game.php?page=overview&mode=renameplanet');
                    } else {
                        message($lang['ov_wrong_pass'], 'game.php?page=overview&mode=renameplanet');
                    }
                }
            }
            return display(parsetemplate(gettemplate('overview/overview_renameplanet'), $parse));
            break;
        default:
            if ($StatRecord['total_points'] >= 0 && $StatRecord['total_points'] < 100000) {
                $parse['rankgame'] = "Soldado";
                $parse['rankimg'] = "rank1.gif";
            } elseif ($StatRecord['total_points'] >= 100000 && $StatRecord['total_points'] < 250000) {
                $parse['rankgame'] = "Cabo Cazador";
                $parse['rankimg'] = "rank2.gif";
            } elseif ($StatRecord['total_points'] >= 250000 && $StatRecord['total_points'] < 500000) {
                $parse['rankgame'] = "Sargento Cazador";
                $parse['rankimg'] = "rank3.gif";
            } elseif ($StatRecord['total_points'] >= 500000 && $StatRecord['total_points'] < 1000000) {
                $parse['rankgame'] = "Teniente de Crucero";
                $parse['rankimg'] = "rank4.gif";
            } elseif ($StatRecord['total_points'] >= 1000000 && $StatRecord['total_points'] < 2500000) {
                $parse['rankgame'] = "Capitán Destructor";
                $parse['rankimg'] = "rank5.gif";
            } elseif ($StatRecord['total_points'] >= 2500000 && $StatRecord['total_points'] < 5000000) {
                $parse['rankgame'] = "Almirante Acorazado";
                $parse['rankimg'] = "rank6.gif";
            } elseif ($StatRecord['total_points'] >= 5000000 && $StatRecord['total_points'] < 10000000) {
                $parse['rankgame'] = "General Estrella";
                $parse['rankimg'] = "rank7.gif";
            } elseif ($StatRecord['total_points'] >= 10000000 && $StatRecord['total_points'] < 25000000) {
                $parse['rankgame'] = "General Supernova";
                $parse['rankimg'] = "rank8.gif";
            } elseif ($StatRecord['total_points'] >= 25000000 && $StatRecord['total_points'] < 50000000) {
                $parse['rankgame'] = "General de Flota";
                $parse['rankimg'] = "rank9.gif";
            } elseif ($StatRecord['total_points'] >= 50000000 && $StatRecord['total_points'] < 100000000) {
                $parse['rankgame'] = "General Interestelar";
                $parse['rankimg'] = "rank10.gif";
            } elseif ($StatRecord['total_points'] >= 100000000 && $StatRecord['total_points'] < 500000000) {
                $parse['rankgame'] = "Cónsul General";
                $parse['rankimg'] = "rank11.gif";
            } elseif ($StatRecord['total_points'] >= 500000000) {
                $parse['rankgame'] = "Emperador";
                $parse['rankimg'] = "rank12.gif";
            }
            if ($CurrentPlanet['planet'] >= 1 && $CurrentPlanet['planet'] < 4) {
                $parse['type_of_planet'] = "Desertico";
            } elseif ($CurrentPlanet['planet'] >= 4 && $CurrentPlanet['planet'] < 7) {
                $parse['type_of_planet'] = "Jungla";
            } elseif ($CurrentPlanet['planet'] >= 7 && $CurrentPlanet['planet'] < 10) {
                $parse['type_of_planet'] = "Gaseoso";
            } elseif ($CurrentPlanet['planet'] >= 10 && $CurrentPlanet['planet'] < 13) {
                $parse['type_of_planet'] = "Acuatico";
            } elseif ($CurrentPlanet['planet'] >= 13) {
                $parse['type_of_planet'] = "Congelado";
            }
            $CONSULTA = doquery("SELECT metal,crystal,darkmatter FROM {{table}} WHERE galaxy = '" . $CurrentPlanet['galaxy'] . "' AND system = '" . $CurrentPlanet['system'] . "' AND planet = '" . $CurrentPlanet['planet'] . "'", "galaxy", true);
            $parse['metal_debris'] = pretty_number($CONSULTA['metal']);
            $parse['crystal_debris'] = pretty_number($CONSULTA['crystal']);
            $parse['darkmatter_debris'] = pretty_number($CONSULTA['darkmatter']);
            if ($CurrentPlanet['recycler'] != 0 && ($CONSULTA['metal'] != 0 || $CONSULTA['crystal'] != 0 || $CONSULTA['darkmatter'] != 0)) {
                $parse['get_link'] = " (<a href=\"game.php?page=galaxy&mode=8&g=" . $CurrentPlanet['galaxy'] . "&s=" . $CurrentPlanet['system'] . "&p=" . $CurrentPlanet['planet'] . "&t=2\">asdasd</a>)";
            } else {
                $parse['get_link'] = '';
            }
            if ($CurrentUser['new_message'] != 0) {
                $Have_new_message .= "<tr>";
                if ($CurrentUser['new_message'] == 1) {
                    $Have_new_message .= "<th colspan=4><a href=game.{$phpEx}?page=messages>" . $lang['ov_have_new_message'] . "</a></th>";
                } elseif ($CurrentUser['new_message'] > 1) {
                    $Have_new_message .= "<th colspan=4><a href=game.{$phpEx}?page=messages>";
                    $Have_new_message .= str_replace('%m', pretty_number($CurrentUser['new_message']), $lang['ov_have_new_messages']);
                    $Have_new_message .= "</a></th>";
                }
                $Have_new_message .= "</tr>";
            }
            $OwnFleets = doquery("SELECT * FROM {{table}} WHERE `fleet_owner` = '" . $CurrentUser['id'] . "';", 'fleets');
            $Record = 0;
            while ($FleetRow = mysql_fetch_array($OwnFleets)) {
                $Record++;
                $StartTime = $FleetRow['fleet_start_time'];
                $StayTime = $FleetRow['fleet_end_stay'];
                $id = $FleetRow['fleet_id'];
                $EndTime = $FleetRow['fleet_end_time'];
                /////// // ### LUCKY , CODES ARE BELOW
                $hedefgalaksi = $FleetRow['fleet_end_galaxy'];
                $hedefsistem = $FleetRow['fleet_end_system'];
                $hedefgezegen = $FleetRow['fleet_end_planet'];
                $mess = $FleetRow['fleet_mess'];
                $filogrubu = $FleetRow['fleet_group'];
                $id = $FleetRow['fleet_id'];
                //////
                $Label = "fs";
                if ($StartTime > time()) {
                    $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, true, $Label, $Record);
                }
                if ($FleetRow['fleet_mission'] != 4 && $FleetRow['fleet_mission'] != 10) {
                    $Label = "ft";
                    if ($StayTime > time()) {
                        $fpage[$StayTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, true, $Label, $Record);
                    }
                    $Label = "fe";
                    if ($EndTime > time()) {
                        $fpage[$EndTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 2, true, $Label, $Record);
                    }
                }
            }
            mysql_free_result($OwnFleets);
            //iss ye katilan filo////////////////////////////////////
            // ### LUCKY , CODES ARE BELOW
            $dostfilo = doquery("SELECT * FROM {{table}} WHERE `fleet_end_galaxy` = '" . $hedefgalaksi . "' AND `fleet_end_system` = '" . $hedefsistem . "' AND `fleet_end_planet` = '" . $hedefgezegen . "' AND `fleet_group` = '" . $filogrubu . "';", 'fleets');
            $Record1 = 0;
            while ($FleetRow = mysql_fetch_array($dostfilo)) {
                $StartTime = $FleetRow['fleet_start_time'];
                $StayTime = $FleetRow['fleet_end_stay'];
                $id = $FleetRow['fleet_id'];
                $EndTime = $FleetRow['fleet_end_time'];
                ///////
                $hedefgalaksi = $FleetRow['fleet_end_galaxy'];
                $hedefsistem = $FleetRow['fleet_end_system'];
                $hedefgezegen = $FleetRow['fleet_end_planet'];
                $mess = $FleetRow['fleet_mess'];
                $filogrubu = $FleetRow['fleet_group'];
                $id = $FleetRow['fleet_id'];
                ///////
                if ($FleetRow['fleet_mission'] == 2 && $FleetRow['fleet_owner'] != $CurrentUser['id']) {
                    $Record1++;
                    // if (($FleetRow['fleet_mission'] == 2) ){
                    if ($mess > 0) {
                        $StartTime = "";
                    } else {
                        $StartTime = $FleetRow['fleet_start_time'];
                    }
                    if ($StartTime > time()) {
                        $Label = "ofs";
                        $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, false, $Label, $Record1);
                    }
                    // }
                }
                ///""
                if ($FleetRow['fleet_mission'] == 1 && $FleetRow['fleet_owner'] != $CurrentUser['id'] && $filogrubu > 0) {
                    $Record++;
                    if ($mess > 0) {
                        $StartTime = "";
                    } else {
                        $StartTime = $FleetRow['fleet_start_time'];
                    }
                    if ($StartTime > time()) {
                        $Label = "ofs";
                        $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, false, $Label, $Record);
                    }
                }
            }
            mysql_free_result($dostfilo);
            //
            //////////////////////////////////////////////////
            $OtherFleets = doquery("SELECT * FROM {{table}} WHERE `fleet_target_owner` = '" . $CurrentUser['id'] . "';", 'fleets');
            $Record = 2000;
            while ($FleetRow = mysql_fetch_array($OtherFleets)) {
                if ($FleetRow['fleet_owner'] != $CurrentUser['id']) {
                    if ($FleetRow['fleet_mission'] != 8) {
                        $Record++;
                        $StartTime = $FleetRow['fleet_start_time'];
                        $StayTime = $FleetRow['fleet_end_stay'];
                        if ($StartTime > time()) {
                            $Label = "ofs";
                            $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, false, $Label, $Record);
                        }
                        if ($FleetRow['fleet_mission'] == 5) {
                            $Label = "oft";
                            if ($StayTime > time()) {
                                $fpage[$StayTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, false, $Label, $Record);
                            }
                        }
                    }
                }
            }
            mysql_free_result($OtherFleets);
            $planets_query = doquery("SELECT * FROM `{{table}}` WHERE id_owner='{$CurrentUser['id']}' AND `destruyed` = 0", "planets");
            $Colone = 1;
            $AllPlanets = "<tr>";
            while ($CurrentUserPlanet = mysql_fetch_array($planets_query)) {
                if ($CurrentUserPlanet["id"] != $CurrentUser["current_planet"] && $CurrentUserPlanet['planet_type'] != 3) {
                    $Coloneshow++;
                    $AllPlanets .= "<th width='80'>" . $CurrentUserPlanet['name'] . "<br>";
                    $AllPlanets .= "<a href=\"game.php?page=overview&cp=" . $CurrentUserPlanet['id'] . "&re=0\" title=\"" . $CurrentUserPlanet['name'] . "\"><img src=\"" . $dpath . "planeten/small/s_" . $CurrentUserPlanet['image'] . ".gif\" height=\"50\" width=\"50\"></a><br>";
                    $AllPlanets .= "<center>";
                    if ($CurrentUserPlanet['b_building'] != 0) {
                        UpdatePlanetBatimentQueueList($CurrentUserPlanet, $CurrentUser);
                        if ($CurrentUserPlanet['b_building'] != 0) {
                            $BuildQueue = $CurrentUserPlanet['b_building_id'];
                            $QueueArray = explode(";", $BuildQueue);
                            $CurrentBuild = explode(",", $QueueArray[0]);
                            $BuildElement = $CurrentBuild[0];
                            $BuildLevel = $CurrentBuild[1];
                            $BuildRestTime = pretty_time($CurrentBuild[3] - time());
                            $AllPlanets .= '' . $lang['tech'][$BuildElement] . ' (' . $BuildLevel . ')';
                            $AllPlanets .= "<br><font color=\"#7f7f7f\">(" . $BuildRestTime . ")</font>";
                        } else {
                            CheckPlanetUsedFields($CurrentUserPlanet);
                            $AllPlanets .= $lang['ov_free'];
                        }
                    } else {
                        $AllPlanets .= $lang['ov_free'];
                    }
                    $AllPlanets .= "</center></th>";
                    if ($Colone <= 5) {
                        $Colone++;
                    } else {
                        $AllPlanets .= "</tr><tr>";
                        $Colone = 1;
                    }
                }
            }
            mysql_free_result($planets_query);
            $AllPlanets .= "</tr>";
            if ($game_config['OverviewNewsFrame'] == '1') {
                $parse['NewsFrame'] = "<tr>" . $lang['ov_news_title'] . "<th colspan=\"4\">" . stripslashes($game_config['OverviewNewsText']) . "</th></tr>";
            }
            if ($lunarow['id'] != 0 && $lunarow['destruyed'] != 1 && $CurrentPlanet['planet_type'] != 3) {
                if ($CurrentPlanet['planet_type'] == 1 or $lunarow['id'] != 0) {
                    $moon = doquery("SELECT `id`,`name`,`image` FROM {{table}} WHERE `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `planet` = '" . $CurrentPlanet['planet'] . "' AND `planet_type` = '3'", 'planets', true);
                    $parse['moon_img'] = "<a href=\"game.php?page=overview&cp=" . $moon['id'] . "&re=0\" title=\"" . $moon['name'] . "\"><img src=\"" . $dpath . "planeten/small/s_" . $moon['image'] . ".png\" height=\"90\" width=\"90\"></a>";
                    $parse['moon'] = $moon['name'] . "";
                } else {
                    $parse['moon_img'] = "";
                    $parse['moon'] = "";
                }
            } elseif ($CurrentPlanet['planet_type'] == 3) {
                $moon = doquery("SELECT `id`,`name`,`image` FROM {{table}} WHERE `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `planet` = '" . $CurrentPlanet['planet'] . "' AND `planet_type` = '1'", 'planets', true);
                $parse['moon_img'] = "<a href=\"game.php?page=overview&cp=" . $moon['id'] . "&re=0\" title=\"" . $moon['name'] . "\"><img src=\"" . $dpath . "planeten/small/s_" . $moon['image'] . ".gif\" height=\"120\" width=\"120\"></a>";
                $parse['moon'] = $moon['name'] . "";
            } else {
                $parse['moon_img'] = "";
                $parse['moon'] = "";
            }
            $parse['planet_diameter'] = pretty_number($CurrentPlanet['diameter']);
            $parse['planet_field_current'] = $CurrentPlanet['field_current'];
            $parse['planet_field_max'] = CalculateMaxPlanetFields($CurrentPlanet);
            $parse['planet_temp_min'] = $CurrentPlanet['temp_min'];
            $parse['planet_temp_max'] = $CurrentPlanet['temp_max'];
            $StatRecord = doquery("SELECT `total_rank`,`total_points` FROM `{{table}}` WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . $CurrentUser['id'] . "';", 'statpoints', true);
            $parse['user_username'] = $CurrentUser['username'];
            if (count($fpage) > 0) {
                ksort($fpage);
                foreach ($fpage as $time => $content) {
                    $flotten .= $content . "\n";
                }
            }
            // **** INICIA MOD {MOSTRAR TECNOLOGIA EN PROCESO EN VISTA GENERAL} ****
            if ($CurrentPlanet['b_building'] != 0) {
                include $xgp_root . 'includes/functions/InsertBuildListScript.' . $phpEx;
                UpdatePlanetBatimentQueueList($planetrow, $user);
                if ($CurrentPlanet['b_building'] != 0) {
                    $BuildQueue = explode(";", $CurrentPlanet['b_building_id']);
                    $CurrBuild = explode(",", $BuildQueue[0]);
                    $RestTime = $CurrentPlanet['b_building'] - time();
                    $PlanetID = $CurrentPlanet['id'];
                    $Build = InsertBuildListScript("buildings");
                    $Build .= "<table>";
                    $Build .= " <tr>";
                    $Build .= " <td colspan=\"2\">" . $lang['tech'][$CurrBuild[0]] . "</td>";
                    $Build .= " </tr>";
                    $Build .= " <tr>";
                    $Build .= " <td align=\"center\" valign=\"middle\"><img src=\"" . $dpath . "gebaeude/" . $CurrBuild[0] . ".gif\" width=\"40\" height=\"40\"></td>";
                    $Build .= " <td>" . $lang['pr_subiendo'] . " <span style=\"color:#FF8C00;\">Nivel " . $CurrBuild[1] . "</span><br />";
                    $Build .= " " . $lang['pr_duracion'] . ":<div id=\"blc\" class=\"z\" style=\"color:yellow;\">" . pretty_time($RestTime) . "</div>";
                    $Build .= " </td>";
                    $Build .= " </tr>";
                    $Build .= "</Table>";
                    $Build .= "\n<script language=\"JavaScript\">";
                    $Build .= "\n pp = \"" . $RestTime . "\";\n";
                    $Build .= "\n pk = \"" . 1 . "\";\n";
                    $Build .= "\n pm = \"cancel\";\n";
                    $Build .= "\n pl = \"" . $PlanetID . "\";\n";
                    $Build .= "\n t();\n";
                    $Build .= "\n</script>\n";
                    $parse['building'] = $Build;
                } else {
                    $parse['building'] = $lang['ov_free'];
                }
            } else {
                $parse['building'] = $lang['ov_free'];
            }
            $PlanetaQueInv = doquery("SELECT id, name, b_tech, b_tech_id FROM `{{table}}` WHERE `id_owner` = '" . $CurrentUser['id'] . "' AND `b_tech` != '0';", 'planets', true);
            if ($PlanetaQueInv['b_tech'] != 0) {
                include $xgp_root . 'includes/functions/InsertTechListScript.' . $phpEx;
                UpdatePlanetBatimentQueueList($planetrow, $user);
                $NvlActual = $CurrentUser[$resource[$PlanetaQueInv['b_tech_id']]] + 1;
                $RestTime = $PlanetaQueInv['b_tech'] - time();
                $PlanetID = $PlanetaQueInv['id'];
                $NomPlaneta = "";
                if ($PlanetaQueInv['name'] != $CurrentPlanet['name']) {
                    $NomPlaneta = " de " . $PlanetaQueInv['name'];
                }
                $Tech = InsertTechListScript("buildings", $NomPlaneta);
                $Tech .= "<table>";
                $Tech .= " <tr>";
                $Tech .= " <td colspan=\"2\">" . $lang['tech'][$PlanetaQueInv['b_tech_id']] . "</td>";
                $Tech .= " </tr>";
                $Tech .= " <tr>";
                $Tech .= " <td align=\"center\" valign=\"middle\"><img src=\"" . $dpath . "gebaeude/" . $PlanetaQueInv['b_tech_id'] . ".gif\" width=\"40\" height=\"40\"></td>";
                $Tech .= " <td>" . $lang['pr_investigando'] . " <span style=\"color:#FF8C00;\">Nivel " . $NvlActual . "</span><br />";
                $Tech .= " " . $lang['pr_duracion'] . ":<div id=\"tec_blc\" class=\"z\" style=\"color:yellow;\">" . pretty_time($RestTime) . "</div>";
                $Tech .= " </td>";
                $Tech .= " </tr>";
                $Tech .= "</Table>";
                $Tech .= "\n<script language=\"JavaScript\">";
                $Tech .= "\n tec_pp = \"" . $RestTime . "\";\n";
                $Tech .= "\n tec_pk = \"" . 1 . "\";\n";
                $Tech .= "\n tec_pm = \"cancel\";\n";
                $Tech .= "\n tec_pl = \"" . $PlanetaQueInv['b_tech_id'] . "\";\n";
                $Tech .= "\n tec_t();\n";
                $Tech .= "\n</script>\n";
                $parse['tech_en_proceso'] .= $Tech;
            } else {
                $parse['tech_en_proceso'] = $lang['ov_tfree'];
            }
            if ($CurrentPlanet['b_hangar'] != 0) {
                include $xgp_root . 'includes/functions/InsertHangarListScript.' . $phpEx;
                UpdatePlanetBatimentQueueList($planetrow, $user);
                $BuildQueue = explode(";", $CurrentPlanet['b_hangar_id']);
                $CurrBuild = explode(",", $BuildQueue[0]);
                $RealTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $CurrBuild[0]);
                $QueueTime = $RealTime * $CurrBuild[1];
                $RestTime = $QueueTime - $CurrentPlanet['b_hangar'];
                $PlanetID = $CurrentPlanet['id'];
                $Hangar = InsertHangarListScript("overview");
                $Hangar .= "<table>";
                $Hangar .= " <tr>";
                $Hangar .= " <td colspan=\"2\">" . $lang['tech'][$CurrBuild[0]] . "</td>";
                $Hangar .= " </tr>";
                $Hangar .= " <tr>";
                $Hangar .= " <td align=\"center\" valign=\"middle\"><img src=\"" . $dpath . "gebaeude/" . $CurrBuild[0] . ".gif\" width=\"40\" height=\"40\"><br />";
                $Hangar .= " </td>";
                $Hangar .= " <td>" . $lang['pr_tiempo_prod'] . "<br />";
                $Hangar .= " <div id=\"han_blc\" class=\"z\" style=\"color:yellow;\">" . pretty_time($RestTime) . "</div>";
                $Hangar .= " </td>";
                $Hangar .= " </tr>";
                $Hangar .= "</Table>";
                $Hangar .= "\n<script language=\"JavaScript\">";
                $Hangar .= "\n han_pp = \"" . $RestTime . "\";\n";
                $Hangar .= "\n han_pk = \"" . 1 . "\";\n";
                $Hangar .= "\n han_pm = \"cancel\";\n";
                $Hangar .= "\n han_pl = \"" . $PlanetID . "\";\n";
                $Hangar .= "\n han_t();\n";
                $Hangar .= "\n</script>\n";
                $parse['hangar_en_proceso'] .= $Hangar;
            } else {
                $parse['hangar_en_proceso'] = $lang['ov_hree'];
            }
            $parse['overview_produccion'] = parsetemplate(gettemplate('overview/overview_produccion'), $parse);
            // **** FIN MOD {MOSTRAR TECNOLOGIA EN PROCESO EN VISTA GENERAL} ****
            $parse['fleet_list'] = $flotten;
            $parse['Have_new_message'] = $Have_new_message;
            $parse['planet_image'] = $CurrentPlanet['image'];
            $parse['anothers_planets'] = $AllPlanets;
            $parse["dpath"] = $dpath;
            if ($game_config['stat'] == 0) {
                $parse['user_rank'] = pretty_number($StatRecord['total_points']) . " (" . $lang['ov_place'] . " <a href=\"game.php?page=statistics&range=" . $StatRecord['total_rank'] . "\">" . $StatRecord['total_rank'] . "</a> " . $lang['ov_of'] . " " . $game_config['users_amount'] . ")";
            } elseif ($game_config['stat'] == 1 && $CurrentUser['authlevel'] < $game_config['stat_level']) {
                $parse['user_rank'] = pretty_number($StatRecord['total_points']) . " (" . $lang['ov_place'] . " <a href=\"game.php?page=statistics&range=" . $StatRecord['total_rank'] . "\">" . $StatRecord['total_rank'] . "</a> " . $lang['ov_of'] . " " . $game_config['users_amount'] . ")";
            } else {
                $parse['user_rank'] = "-";
            }
            setlocale(LC_ALL, 'es_ES');
            $parse['date_time'] = date("D M j H:i:s", time());
            if ($Level > 0) {
                $parse['admin_link'] = "<tr><td><div align=\"center\"><a href=\"javascript:top.location.href='adm/index.php'\"> <font color=\"lime\">" . $lang['lm_administration'] . "</font></a></div></td></tr>";
            } else {
                $parse['admin_link'] = "";
            }
            if ($user["new_message"] != 0) {
                $color = "color=\"red\"";
            } else {
                $color = "color=\"white\"";
            }
            $parse["new_message"] = ' (<font size="1px" ' . $color . ' > ' . $user["new_message"] . ' </font>)';
            return display(parsetemplate(gettemplate('overview/overview_body'), $parse));
            break;
    }
}
Example #18
0
function ShowOverviewPage($CurrentUser, $CurrentPlanet)
{
    global $xgp_root, $phpEx, $dpath, $game_config, $lang, $planetrow, $user;
    include_once $xgp_root . 'includes/functions/InsertJavaScriptChronoApplet.' . $phpEx;
    include_once $xgp_root . 'includes/classes/class.FlyingFleetsTable.' . $phpEx;
    $parse = $lang;
    $FlyingFleetsTable = new FlyingFleetsTable();
    $lunarow = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '" . $CurrentPlanet['id_owner'] . "' AND `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `lunapos` = '" . $CurrentPlanet['planet'] . "';", 'lunas', true);
    CheckPlanetUsedFields($lunarow);
    $parse['planet_id'] = $CurrentPlanet['id'];
    $parse['planet_name'] = $CurrentPlanet['name'];
    $parse['galaxy_galaxy'] = $CurrentPlanet['galaxy'];
    $parse['galaxy_system'] = $CurrentPlanet['system'];
    $parse['galaxy_planet'] = $CurrentPlanet['planet'];
    switch ($_GET['mode']) {
        case 'renameplanet':
            if ($_POST['action'] == $lang['ov_planet_rename_action']) {
                $newname = mysql_escape_string(strip_tags(trim($_POST['newname'])));
                if (preg_match("/[^A-z0-9_\\- ]/", $newname) == 1) {
                    message($lang['ov_newname_error'], "game.php?page=overview&mode=renameplanet", 2);
                }
                if ($newname != "") {
                    doquery("UPDATE {{table}} SET `name` = '" . $newname . "' WHERE `id` = '" . $CurrentUser['current_planet'] . "' LIMIT 1;", "planets");
                    if ($CurrentPlanet['planet_type'] == 3) {
                        doquery("UPDATE {{table}} SET `name` = '" . $newname . "' WHERE `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `lunapos` = '" . $CurrentPlanet['planet'] . "' LIMIT 1;", "lunas");
                    }
                }
            } elseif ($_POST['action'] == $lang['ov_abandon_planet']) {
                return display(parsetemplate(gettemplate('overview/overview_deleteplanet'), $parse));
            } elseif ($_POST['kolonieloeschen'] == 1 && intval($_POST['deleteid']) == $CurrentUser['current_planet']) {
                if (md5($_POST['pw']) == $CurrentUser["password"] && $CurrentUser['id_planet'] != $CurrentUser['current_planet']) {
                    doquery("UPDATE {{table}} SET `destruyed` = '" . (time() + 86400) . "' WHERE `id` = '" . mysql_real_escape_string($CurrentUser['current_planet']) . "' LIMIT 1;", 'planets');
                    doquery("UPDATE {{table}} SET `current_planet` = `id_planet` WHERE `id` = '" . mysql_real_escape_string($CurrentUser['id']) . "' LIMIT 1", "users");
                    doquery("DELETE FROM {{table}} WHERE `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `planet` = '" . $CurrentPlanet['planet'] . "' AND `planet_type` = 3;", 'planets');
                    doquery("DELETE FROM {{table}} WHERE `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `lunapos` = '" . $CurrentPlanet['planet'] . "';", 'lunas');
                    message($lang['ov_planet_abandoned'], 'game.php?page=overview&mode=renameplanet');
                } elseif ($CurrentUser['id_planet'] == $CurrentUser["current_planet"]) {
                    message($lang['ov_principal_planet_cant_abanone'], 'game.php?page=overview&mode=renameplanet');
                } else {
                    message($lang['ov_wrong_pass'], 'game.php?page=overview&mode=renameplanet');
                }
            }
            return display(parsetemplate(gettemplate('overview/overview_renameplanet'), $parse));
            break;
        default:
            if ($game_config['ts_modon'] == 1) {
                include_once $xgp_root . 'includes/classes/class.cyts.' . $phpEx;
                $ts = new cyts();
                if ($ts->connect($game_config['ts_server'], $game_config['ts_tcpport'], $game_config['ts_udpport'], $game_config['ts_timeout'])) {
                    $tsdata = $ts->info_serverInfo();
                    $tsdata2 = $ts->info_globalInfo();
                    $maxusers = $tsdata["server_maxusers"];
                    $useronline = $tsdata["server_currentusers"];
                    $channels = $tsdata["server_currentchannels"];
                    $seconds = $tsdata["server_uptime"];
                    $os = $tsdata2["total_server_platform"];
                    $version = $tsdata2["total_server_version"];
                    $trafin = round($tsdata2["total_bytesreceived"] / 1024 / 1024, 2);
                    $trafout = round($tsdata2["total_bytessend"] / 1024 / 1024, 2);
                    $trafges = $trafin + $trafout;
                    $parse['ov_ts'] = "<tr><th>Teamspeak</th><th colspan=\"3\"><a href=\"teamspeak://" . $game_config['ts_server'] . ":" . $game_config['ts_udpport'] . "?username="******"\" alt=\"Teamspeak Connect\" name=\"Teamspeak Connect\">Connect</a> &bull; Online: " . $useronline . "/" . $maxusers . " &bull; Channels: " . $channels . " &bull; Traffic IN: " . $trafin . " MB &bull; Traffic Out: " . $trafout . " MB &bull; Traffic ges.: " . $trafges . " MB</th></tr>";
                } else {
                    $parse['ov_ts'] = "<tr><th>Teamspeak</th><th colspan=\"3\">Server zurzeit nicht erreichbar. Wir bitten um verst&auml;ndnis.</th></tr>";
                }
            }
            $OnlineAdmins = doquery("SELECT * FROM {{table}} WHERE onlinetime>='" . (time() - 10 * 60) . "' AND authlevel > 1", 'users');
            if ($OnlineAdmins) {
                $AdminsNr = 1;
                $parse['OnlineAdmins'] = "";
                while ($oas = mysql_fetch_array($OnlineAdmins)) {
                    if ($AdminsNr == 1) {
                        $parse['OnlineAdmins'] .= "<a href=\"game.php?page=messages&mode=write&id=" . $oas['id'] . "\" >" . $oas['username'] . "</a>";
                    } else {
                        $parse['OnlineAdmins'] .= "&nbsp;&bull;&nbsp;<a href=\"game.php?page=messages&mode=write&id=" . $oas['id'] . "\" >" . $oas['username'] . "</a>";
                    }
                    $AdminsNr++;
                }
            } else {
                $parse['OnlineAdmins'] = "-";
            }
            if ($CurrentUser['new_message'] != 0) {
                $Have_new_message .= "<tr>";
                if ($CurrentUser['new_message'] == 1) {
                    $Have_new_message .= "<th colspan=4><a href=game.{$phpEx}?page=messages>" . $lang['ov_have_new_message'] . "</a></th>";
                } elseif ($CurrentUser['new_message'] > 1) {
                    $Have_new_message .= "<th colspan=4><a href=game.{$phpEx}?page=messages>";
                    $Have_new_message .= str_replace('%m', pretty_number($CurrentUser['new_message']), $lang['ov_have_new_messages']);
                    $Have_new_message .= "</a></th>";
                }
                $Have_new_message .= "</tr>";
            }
            $OwnFleets = doquery("SELECT * FROM {{table}} WHERE `fleet_owner` = '" . $CurrentUser['id'] . "';", 'fleets');
            $Record = 0;
            while ($FleetRow = mysql_fetch_array($OwnFleets)) {
                $Record++;
                $StartTime = $FleetRow['fleet_start_time'];
                $StayTime = $FleetRow['fleet_end_stay'];
                $EndTime = $FleetRow['fleet_end_time'];
                $Label = "fs";
                if ($StartTime > time()) {
                    $fpage[$StartTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, true, $Label, $Record);
                }
                if ($FleetRow['fleet_mission'] != 4 && $FleetRow['fleet_mission'] != 10) {
                    $Label = "ft";
                    if ($StayTime > time()) {
                        $fpage[$StayTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, true, $Label, $Record);
                    }
                    $Label = "fe";
                    if ($EndTime > time()) {
                        $fpage[$EndTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 2, true, $Label, $Record);
                    }
                }
            }
            $OtherFleets = doquery("SELECT * FROM {{table}} WHERE `fleet_target_owner` = '" . $CurrentUser['id'] . "';", 'fleets');
            $Record = 2000;
            while ($FleetRow = mysql_fetch_array($OtherFleets)) {
                if ($FleetRow['fleet_owner'] != $CurrentUser['id']) {
                    if ($FleetRow['fleet_mission'] != 8) {
                        $Record++;
                        $StartTime = $FleetRow['fleet_start_time'];
                        $StayTime = $FleetRow['fleet_end_stay'];
                        if ($StartTime > time()) {
                            $Label = "ofs";
                            $fpage[$StartTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, false, $Label, $Record);
                        }
                        if ($FleetRow['fleet_mission'] == 5) {
                            $Label = "oft";
                            if ($StayTime > time()) {
                                $fpage[$StayTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, false, $Label, $Record);
                            }
                        }
                    }
                }
            }
            $planets_query = doquery("SELECT * FROM `{{table}}` WHERE id_owner='{$CurrentUser['id']}' AND `destruyed` = 0", "planets");
            $Colone = 1;
            $AllPlanets = "<tr>";
            if ($game_config['OverviewNewsFrame'] == '1') {
                $parse['NewsFrame'] = "<tr><th>" . $lang['ov_news_title'] . "</th><th colspan=\"3\">" . stripslashes($game_config['OverviewNewsText']) . "</th></tr>";
            }
            while ($CurrentUserPlanet = mysql_fetch_array($planets_query)) {
                if ($CurrentUserPlanet["id"] != $CurrentUser["current_planet"] && $CurrentUserPlanet['planet_type'] != 3) {
                    $Coloneshow++;
                    $AllPlanets .= "<th>" . $CurrentUserPlanet['name'] . "<br>";
                    $AllPlanets .= "<a href=\"game.php?page=overview&cp=" . $CurrentUserPlanet['id'] . "&re=0\" title=\"" . $CurrentUserPlanet['name'] . "\"><img src=\"" . $dpath . "planeten/small/s_" . $CurrentUserPlanet['image'] . ".jpg\" height=\"50\" width=\"50\"></a><br>";
                    $AllPlanets .= "<center>";
                    if ($CurrentUserPlanet['b_building'] != 0) {
                        UpdatePlanetBatimentQueueList($CurrentUserPlanet, $CurrentUser);
                        if ($CurrentUserPlanet['b_building'] != 0) {
                            $BuildQueue = $CurrentUserPlanet['b_building_id'];
                            $QueueArray = explode(";", $BuildQueue);
                            $CurrentBuild = explode(",", $QueueArray[0]);
                            $BuildElement = $CurrentBuild[0];
                            $BuildLevel = $CurrentBuild[1];
                            $BuildRestTime = pretty_time($CurrentBuild[3] - time());
                            $AllPlanets .= '' . $lang['tech'][$BuildElement] . ' (' . $BuildLevel . ')';
                            $AllPlanets .= "<br><font color=\"#7f7f7f\">(" . $BuildRestTime . ")</font>";
                        } else {
                            CheckPlanetUsedFields($CurrentUserPlanet);
                            $AllPlanets .= $lang['ov_free'];
                        }
                    } else {
                        $AllPlanets .= $lang['ov_free'];
                    }
                    $AllPlanets .= "</center></th>";
                    if ($Colone <= 1) {
                        $Colone++;
                    } else {
                        $AllPlanets .= "</tr><tr>";
                        $Colone = 1;
                    }
                }
            }
            $AllPlanets .= "</tr>";
            if ($lunarow['id'] != 0 && $lunarow['destruyed'] != 1 && $CurrentPlanet['planet_type'] != 3) {
                if ($CurrentPlanet['planet_type'] == 1 or $lunarow['id'] != 0) {
                    $moon = doquery("SELECT `id`,`name`,`image` FROM {{table}} WHERE `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `planet` = '" . $CurrentPlanet['planet'] . "' AND `planet_type` = '3'", 'planets', true);
                    $parse['moon_img'] = "<a href=\"game.php?page=overview&cp=" . $moon['id'] . "&re=0\" title=\"" . $moon['name'] . "\"><img src=\"" . $dpath . "planeten/" . $moon['image'] . ".jpg\" height=\"50\" width=\"50\"></a>";
                    $parse['moon'] = $moon['name'] . " (" . $lang['fcm_moon'] . ")";
                } else {
                    $parse['moon_img'] = "";
                    $parse['moon'] = "";
                }
            } else {
                $parse['moon_img'] = "";
                $parse['moon'] = "";
            }
            $parse['planet_diameter'] = pretty_number($CurrentPlanet['diameter']);
            $parse['planet_field_current'] = $CurrentPlanet['field_current'];
            $parse['planet_field_max'] = CalculateMaxPlanetFields($CurrentPlanet);
            $parse['planet_temp_min'] = $CurrentPlanet['temp_min'];
            $parse['planet_temp_max'] = $CurrentPlanet['temp_max'];
            $StatRecord = doquery("SELECT `total_rank`,`total_points` FROM `{{table}}` WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . $CurrentUser['id'] . "';", 'statpoints', true);
            $parse['user_username'] = $CurrentUser['username'];
            if (count($fpage) > 0) {
                ksort($fpage);
                foreach ($fpage as $time => $content) {
                    $flotten .= $content . "\n";
                }
            }
            if ($CurrentPlanet['b_building'] != 0) {
                include $xgp_root . 'includes/functions/InsertBuildListScript.' . $phpEx;
                UpdatePlanetBatimentQueueList($planetrow, $user);
                if ($CurrentPlanet['b_building'] != 0) {
                    $BuildQueue = explode(";", $CurrentPlanet['b_building_id']);
                    $CurrBuild = explode(",", $BuildQueue[0]);
                    $RestTime = $CurrentPlanet['b_building'] - time();
                    $PlanetID = $CurrentPlanet['id'];
                    $Build = InsertBuildListScript("overview");
                    $Build .= $lang['tech'][$CurrBuild[0]] . ' (' . $CurrBuild[1] . ')';
                    $Build .= "<br /><div id=\"blc\" class=\"z\">" . pretty_time($RestTime) . "</div>";
                    $Build .= "\n<script language=\"JavaScript\">";
                    $Build .= "\n\tpp = \"" . $RestTime . "\";\n";
                    $Build .= "\n\tpk = \"" . 1 . "\";\n";
                    $Build .= "\n\tpm = \"cancel\";\n";
                    $Build .= "\n\tpl = \"" . $PlanetID . "\";\n";
                    $Build .= "\n\tt();\n";
                    $Build .= "\n</script>\n";
                    $parse['building'] = $Build;
                } else {
                    $parse['building'] = $lang['ov_free'];
                }
            } else {
                $parse['building'] = $lang['ov_free'];
            }
            $parse['fleet_list'] = $flotten;
            $parse['Have_new_message'] = $Have_new_message;
            $parse['planet_image'] = $CurrentPlanet['image'];
            $parse['anothers_planets'] = $AllPlanets;
            $parse["dpath"] = $dpath;
            if ($game_config['stat'] == 0) {
                $parse['user_rank'] = pretty_number($StatRecord['total_points']) . " (" . $lang['ov_place'] . " <a href=\"game.php?page=statistics&range=" . $StatRecord['total_rank'] . "\">" . $StatRecord['total_rank'] . "</a> " . $lang['ov_of'] . " " . $game_config['users_amount'] . ")";
            } elseif ($game_config['stat'] == 1 && $CurrentUser['authlevel'] < $game_config['stat_level']) {
                $parse['user_rank'] = pretty_number($StatRecord['total_points']) . " (" . $lang['ov_place'] . " <a href=\"game.php?page=statistics&range=" . $StatRecord['total_rank'] . "\">" . $StatRecord['total_rank'] . "</a> " . $lang['ov_of'] . " " . $game_config['users_amount'] . ")";
            } else {
                $parse['user_rank'] = "-";
            }
            $parse['date_time'] = date("D M j H:i:s", time());
            return display(parsetemplate(gettemplate('overview/overview_body'), $parse));
            break;
    }
}