$system = $_POST['system']; $galaxy = $_POST['galaxy']; if ($_POST['galaxyLeft']) { $galaxy = $galaxy - 1; } elseif ($_POST['galaxyRight']) { $galaxy = $galaxy + 1; } if ($_POST['systemLeft']) { $system = $system - 1; } elseif ($_POST['systemRight']) { $system = $system + 1; } } else { if ($_GET) { $_GET['galaxy'] = cleanNumeric($_GET['galaxy']); $_GET['system'] = cleanNumeric($_GET['system']); $system = $_GET['system']; $galaxy = $_GET['galaxy']; } } if ($galaxy < 1 or !$galaxy) { $galaxy = 1; } if ($galaxy > MAX_GALAXY_IN_WORLD) { $galaxy = MAX_GALAXY_IN_WORLD; } if ($system < 1 or !$system) { $system = 1; } if ($system > MAX_SYSTEM_IN_GALAXY) { $system = MAX_SYSTEM_IN_GALAXY;
public function ShowGalaxyPage($user, &$planetrow) { global $phpEx, $resource, $displays, $db, $noobs; if ($planetrow["deuterium"] < 9000) { $displays->message("No tienes suficientemente deuterio para viajar por la galaxia", "Galaxia"); } $planetrow["deuterium"] -= 9000; $displays->assignContent('/galaxy/galaxy_body_new'); $noobs = new proteccion_noob(); $noobs->prin = $user["total_points"]; $noobs->mission = 1; $CurrentSystem = $planetrow['system']; $CurrentGalaxy = $planetrow['galaxy']; $MaxFleet = $db->query("SELECT * FROM {{table}} WHERE `fleet_owner` = '" . $user['id'] . "'", 'fleets'); $MaxFleetCount = mysql_num_rows($MaxFleet); $this->FleetMax = 1 + $user[$resource["108"]] + $user[$resource["611"]] * 3; $this->CurrentMIP = $planetrow['interplanetary_misil']; $this->CurrentRC = $planetrow['recycler']; $this->CurrentSP = $planetrow['spy_sonde']; $this->HavePhalanx = $planetrow['phalanx']; $this->CurrentSystem = $planetrow['system']; $this->CurrentGalaxy = $planetrow['galaxy']; $this->CurrentPlanet = $planetrow['planet']; $this->CurrentPlanet_type = $planetrow['planet_type']; $this->CanDestroy = $planetrow[$resource[213]] + $planetrow[$resource[214]]; // USELESS YET, NEEDED FOR MIPS I THINK if ($_POST or $_GET['galaxy'] or $_GET['system']) { if ($_POST) { // PREVENT NO-NUMERIC VALUES $_POST['galaxy'] = cleanNumeric($_POST['galaxy']); $_POST['system'] = cleanNumeric($_POST['system']); $system = $_POST['system']; $galaxy = $_POST['galaxy']; if ($_POST['galaxyLeft']) { $galaxy = $galaxy - 1; } elseif ($_POST['galaxyRight']) { $galaxy = $galaxy + 1; } if ($_POST['systemLeft']) { $system = $system - 1; } elseif ($_POST['systemRight']) { $system = $system + 1; } } else { if ($_GET) { $_GET['galaxy'] = cleanNumeric($_GET['galaxy']); $_GET['system'] = cleanNumeric($_GET['system']); $system = $_GET['system']; $galaxy = $_GET['galaxy']; } } if ($galaxy < 1 or !$galaxy) { $galaxy = 1; } if ($galaxy > MAX_GALAXY_IN_WORLD) { $galaxy = MAX_GALAXY_IN_WORLD; } if ($system < 1 or !$system) { $system = 1; } if ($system > MAX_SYSTEM_IN_GALAXY) { $system = MAX_SYSTEM_IN_GALAXY; } } $position[galaxy] = empty($galaxy) ? $this->CurrentGalaxy : $galaxy; $position[system] = empty($system) ? $this->CurrentSystem : $system; $position[planet] = empty($planet) ? $this->CurrentPlanet : $planet; $position[planet_type] = empty($planet_type) ? $this->CurrentPlanet_type : $planet_type; // MOVEMENT BLOCK $displays->newBlock("movement"); foreach ($position as $name => $trans) { $displays->assign($name, $trans); } if ($_GET["mode"] == "2") { $displays->newBlock("misiles"); foreach ($_GET as $name => $trans) { $displays->assign($name, $trans); } } // SHORT DEFINITION $g = $position[galaxy]; $s = $position[system]; if (!$g || !$s) { header("location: game.php?page=overview"); } // GALAXY TABLE BLOCK // PREPARE THE $galaxy:$system $lang['Solar_system_at'] = $lang['Solar_system'] . " " . $g . ":" . $s; // PLANET INFORMATION $sql = "SELECT\r\n l.temp_min, l.diameter, l.name as moon_name,\r\n g.*, g.metal as debris_metal, g.crystal as debris_crystal, g.planet as planetpos,\r\n p.*, p.name as planet_name,\r\n u.*,\r\n s.total_points, s.total_rank,\r\n a.ally_tag, a.ally_name, a.ally_web, a.ally_members\r\n FROM {{table}}planets as p\r\n\r\n LEFT JOIN {{table}}galaxy as g ON g.id_planet = p.id\r\n LEFT JOIN {{table}}users as u ON u.id = p.id_owner\r\n LEFT JOIN {{table}}alliance as a ON a.id = u.ally_id\r\n LEFT JOIN {{table}}planets as l ON l.id = g.id_luna AND l.planet_type = 3\r\n LEFT JOIN {{table}}statpoints as s ON s.id_owner = u.id AND stat_type = 1 AND stat_code = 1\r\n\r\n WHERE\r\n g.galaxy = {$g} AND g.system = {$s}\r\n ORDER BY g.planet ASC"; $rs = $db->query($sql, ''); if ($temprow = mysql_fetch_assoc($rs)) { do { $planetsrow[$temprow[planetpos]] = $temprow; } while ($temprow = mysql_fetch_assoc($rs)); } // PLANETS LIST BLOCK for ($i = 1; $i < 1 + MAX_PLANET_IN_SYSTEM; $i++) { $displays->newBlock("planets"); if ($planetsrow[$i]) { // PLANET NUMER :/ $displays->assign("i", $i); // PLANET IMAGE TOOLTIP $planet = $this->_TooltipPlanet($planetsrow[$i], $g, $s, $i, 1); $displays->assign("planet", $planet); // MOON TOOLTIP if ($planetsrow[$i][id_luna]) { $moon = $this->_TooltipMoon($planetsrow[$i], $g, $s, $i, 3); $displays->assign("moon", $moon); unset($moon); } // PLANET STATUS $planet_status = $this->_TooltipPlanetStatus($planetsrow[$i], $g, $s, $i, 1); $displays->assign("planet_status", $planet_status); // DEBRIS FIELD if ($planetsrow[$i][debris_metal] > 0 or $planetsrow[$i][debris_crystal] > 0) { $debris = $this->_TooltipDebris($planetsrow[$i], $g, $s, $i, 2); $debristotal = round($planetsrow[$i][debris_metal] + $planetsrow[$i][debris_crystal]); if ($debristotal >= 100000) { $debris_class = "debris_small"; } if ($debristotal >= 1000000) { $debris_class = "debris_medium"; } if ($debristotal >= 10000000) { $debris_class = "debris_large"; } $displays->assign("debris", $debris); $displays->assign("debris_class", $debris_class); } // USER INFO $user_info = $this->_TooltipUser($planetsrow[$i], $g, $s, $i, 0); $displays->assign("user_info", $user_info); // ALLIANCE INFO if ($planetsrow[$i][ally_id]) { $ally_info = $this->_TooltipAlliance($planetsrow[$i], $g, $s, $i, 0); $displays->assign("ally_info", $ally_info); } // ACTIONS $actions = $this->_TooltipActions($planetsrow[$i], $g, $s, $i, 0); $displays->assign("actions", $actions); } else { $is = "<a href=\"game.php?page=fleet&galaxy={$g}&system={$s}&planet={$i}&planettype=1&target_mission=7\">{$i}</a>"; $displays->assign("i", $is); } } $replace[fleet_count] = $MaxFleetCount; $replace[fleet_max] = $this->FleetMax; $replace[Recyclers] = pretty_number($this->CurrentRC); $replace[SpyProbes] = pretty_number($this->CurrentSP); $replace[CurrentMIP] = pretty_number($this->CurrentMIP); $replace[this_galaxy] = $planetrow['galaxy']; $replace[this_system] = $planetrow['system']; $replace[this_planet] = $planetrow['planet']; $replace[this_planet_type] = $planetrow['planet_type']; $replace[PHP_SELF] = $_SERVER['PHP_SELF']; $replace[ajaxscript] = $this->InsertGalaxyScripts(); $displays->gotoBlock("_ROOT"); if (is_array($replace)) { foreach ($replace as $k => $v) { $displays->assign($k, $v); } } $displays->display('Galaxia'); }