Completed
Push — trunk ( 433e05...76e427 )
by SuperNova.WS
06:21
created

phalanx.php (1 issue)

Labels
Severity
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
use Planet\DBStaticPlanet;
15
16
include('common.' . substr(strrchr(__FILE__, '.'), 1));
17
18
lng_include('overview');
19
lng_include('universe');
20
21
$sensorLevel = mrc_get_level($user, $planetrow, STRUC_MOON_PHALANX);
22
if (!intval($sensorLevel)) {
23
  messageBox ($lang['phalanx_nosensoravailable'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
24
}
25
26
if ($planetrow['planet_type'] != PT_MOON) {
27
  messageBox ($lang['phalanx_onlyformoons'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
28
}
29
30
$scan_galaxy  = sys_get_param_int('galaxy');
31
$scan_system  = sys_get_param_int('system');
32
$scan_planet  = sys_get_param_int('planet');
33
$scan_planet_type  = 1; // sys_get_param_int('planettype');
34
$id = sys_get_param_id('id');
35
36
$source_galaxy = $planetrow['galaxy'];
37
$source_system = $planetrow['system'];
38
$source_planet = $planetrow['planet'];
39
40
$sensorRange = GetPhalanxRange($sensorLevel);
41
42
$system_distance = abs($source_system - $scan_system);
43
if($system_distance > $sensorRange || $scan_galaxy != $source_galaxy)
44
{
45
  messageBox ($lang['phalanx_rangeerror'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
46
}
47
48
$cost = $sensorLevel * 1000;
49
50
if ($planetrow['deuterium'] < $cost)
51
{
52
  messageBox($lang['phalanx_nodeuterium'], "phalanx", '', 3);
53
}
54
55
$planet_scanned = DBStaticPlanet::db_planet_by_gspt($scan_galaxy, $scan_system, $scan_planet, $scan_planet_type);
56
if(!$planet_scanned['id'])
57
{
58
  messageBox($lang['phalanx_planet_not_exists'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
59
}
60
61
if($planet_scanned['destruyed'])
62
{
63
  messageBox ($lang['phalanx_planet_destroyed'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
64
}
65
66
DBStaticPlanet::db_planet_set_by_id($user['current_planet'], "deuterium = deuterium - {$cost}");
67
68
$template = gettemplate('planet_fleet_list', true);
69
70
$fleet_list = fleet_and_missiles_list_by_coordinates($planet_scanned, true);
0 ignored issues
show
$planet_scanned of type false is incompatible with the type array expected by parameter $coordinates of fleet_and_missiles_list_by_coordinates(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

70
$fleet_list = fleet_and_missiles_list_by_coordinates(/** @scrutinizer ignore-type */ $planet_scanned, true);
Loading history...
71
$fleets = flt_parse_fleets_to_events($fleet_list, $planet_scanned);
72
tpl_assign_fleet($template, $fleets);
73
74
$template->assign_vars(array(
75
  'MENU' => false,
76
  'NAVBAR' => false,
77
));
78
79
display($template, $lang['tech'][STRUC_MOON_PHALANX]);
80