supernova-ws /
SuperNova
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * phalanx.php |
||
| 5 | * |
||
| 6 | * 2.0 copyright (c) 2009-2011 by Gorlum for http://supernova.ws |
||
| 7 | [!] Full rewrote using SN functions |
||
| 8 | * 1.2 - Security checks & tests by Gorlum for http://supernova.ws |
||
| 9 | * @version 1.1 |
||
| 10 | * @original made by ???? |
||
| 11 | * @copyright 2008 by Pada for XNova.project.es |
||
| 12 | */ |
||
| 13 | |||
| 14 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
||
| 15 | |||
| 16 | lng_include('overview'); |
||
| 17 | lng_include('universe'); |
||
| 18 | |||
| 19 | $sensorLevel = mrc_get_level($user, $planetrow, STRUC_MOON_PHALANX); |
||
| 20 | if (!intval($sensorLevel)) { |
||
| 21 | message ($lang['phalanx_nosensoravailable'], $lang['tech'][STRUC_MOON_PHALANX], '', 3); |
||
| 22 | } |
||
| 23 | |||
| 24 | if ($planetrow['planet_type'] != PT_MOON) { |
||
| 25 | message ($lang['phalanx_onlyformoons'], $lang['tech'][STRUC_MOON_PHALANX], '', 3); |
||
| 26 | } |
||
| 27 | |||
| 28 | $scan_galaxy = sys_get_param_int('galaxy'); |
||
| 29 | $scan_system = sys_get_param_int('system'); |
||
| 30 | $scan_planet = sys_get_param_int('planet'); |
||
| 31 | $scan_planet_type = 1; // sys_get_param_int('planettype'); |
||
|
0 ignored issues
–
show
|
|||
| 32 | $id = sys_get_param_id('id'); |
||
| 33 | |||
| 34 | $source_galaxy = $planetrow['galaxy']; |
||
| 35 | $source_system = $planetrow['system']; |
||
| 36 | $source_planet = $planetrow['planet']; |
||
| 37 | |||
| 38 | $sensorRange = GetPhalanxRange($sensorLevel); |
||
| 39 | |||
| 40 | $system_distance = abs($source_system - $scan_system); |
||
| 41 | if($system_distance > $sensorRange || $scan_galaxy != $source_galaxy) |
||
| 42 | { |
||
| 43 | message ($lang['phalanx_rangeerror'], $lang['tech'][STRUC_MOON_PHALANX], '', 3); |
||
| 44 | } |
||
| 45 | |||
| 46 | $cost = $sensorLevel * 1000; |
||
| 47 | |||
| 48 | if ($planetrow['deuterium'] < $cost) |
||
| 49 | { |
||
| 50 | message($lang['phalanx_nodeuterium'], "phalanx", '', 3); |
||
| 51 | } |
||
| 52 | |||
| 53 | $planet_scanned = DBStaticPlanet::db_planet_by_gspt($scan_galaxy, $scan_system, $scan_planet, $scan_planet_type); |
||
| 54 | if(!$planet_scanned['id']) |
||
| 55 | { |
||
| 56 | message($lang['phalanx_planet_not_exists'], $lang['tech'][STRUC_MOON_PHALANX], '', 3); |
||
| 57 | } |
||
| 58 | |||
| 59 | if($planet_scanned['destruyed']) |
||
| 60 | { |
||
| 61 | message ($lang['phalanx_planet_destroyed'], $lang['tech'][STRUC_MOON_PHALANX], '', 3); |
||
| 62 | } |
||
| 63 | |||
| 64 | DBStaticPlanet::db_planet_set_by_id($user['current_planet'], "deuterium = deuterium - {$cost}"); |
||
| 65 | |||
| 66 | $template = gettemplate('planet_fleet_list', true); |
||
| 67 | |||
| 68 | $fleet_list = fleet_and_missiles_list_by_coordinates($planet_scanned, true); |
||
| 69 | $fleets = flt_parse_fleets_to_events($fleet_list, $planet_scanned); |
||
| 70 | //int_get_missile_to_planet("SELECT * FROM `{{iraks}}` WHERE fleet_end_galaxy = {$scan_galaxy} AND fleet_end_system = {$scan_system} AND fleet_end_planet = {$scan_planet};"); |
||
| 71 | tpl_assign_fleet($template, $fleets); |
||
| 72 | |||
| 73 | display($template, $lang['tech'][STRUC_MOON_PHALANX], false, '', false, false); |
||
| 74 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.