These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | require_once('require/class.Connection.php'); |
||
3 | require_once('require/class.Language.php'); |
||
4 | require_once('require/class.Source.php'); |
||
5 | $Source = new Source(); |
||
6 | |||
7 | if (isset($_GET['sourceid'])) { |
||
8 | $sourceid = filter_input(INPUT_GET,'sourceid',FILTER_SANITIZE_NUMBER_INT); |
||
9 | $source_data = $Source->getLocationInfoById($sourceid); |
||
10 | if (isset($source_data[0])) { |
||
11 | ?> |
||
12 | <div class="alldetails"> |
||
13 | <button type="button" class="close">×</button> |
||
14 | <?php |
||
15 | $spotter_item = $source_data[0]; |
||
16 | |||
17 | date_default_timezone_set('UTC'); |
||
18 | |||
19 | print '<div class="top">'; |
||
20 | if ($spotter_item['name'] != '') print '<div class="right"><div class="callsign-details"><div class="callsign">'.$spotter_item['name'].'</div>'; |
||
21 | elseif ($spotter_item['location_id'] != 0) print '<div class="right"><div class="callsign-details"><div class="callsign">'.$spotter_item['location_id'].'</div>'; |
||
22 | elseif ($spotter_item['type'] == 'lightning') print '<div class="right"><div class="callsign-details"><div class="callsign">'._("Lightning").'</div>'; |
||
23 | elseif ($spotter_item['type'] == 'wx') print '<div class="right"><div class="callsign-details"><div class="callsign">'._("Weather Station").'</div>'; |
||
24 | elseif ($spotter_item['type'] == 'fires') print '<div class="right"><div class="callsign-details"><div class="callsign">'._("Fire").'</div>'; |
||
25 | else print '<div class="right"><div class="callsign-details"><div class="callsign"></div>'; |
||
26 | print '</div>'; |
||
27 | |||
28 | print '</div></div>'; |
||
29 | print '<div class="details"><div class="mobile airports"><div class="airport">'; |
||
30 | print '</div></div>'; |
||
31 | |||
32 | if ($spotter_item['type'] != 'fires' && $spotter_item['type'] != 'lightning') { |
||
33 | print '<div>'; |
||
34 | print '<span>'._("Altitude").'</span>'; |
||
35 | print $spotter_item['altitude']; |
||
36 | print '</div>'; |
||
37 | } |
||
38 | |||
39 | print '<div><span>'._("Last Seen").'</span>'; |
||
40 | print $spotter_item['last_seen'].' UTC'; |
||
41 | print '</div>'; |
||
42 | |||
43 | if ($spotter_item['city'] != '') print '<div><span>'._("City").'</span>'.$spotter_item['city'].'</div>'; |
||
44 | if ($spotter_item['country'] !='') print '<div><span>'._("Country").'</span>'.$spotter_item['country'].'</div>'; |
||
45 | print '<div><span>'._("Coordinates").'</span>'.round($spotter_item['latitude'],4).', '.round($spotter_item['longitude'],4).'</div>'; |
||
46 | /* |
||
47 | if ($spotter_item['atc_range'] > 0) { |
||
48 | print '<div><span>'._("Range").'</span>'; |
||
49 | print $spotter_item['atc_range']; |
||
50 | print '</div>'; |
||
51 | } |
||
52 | */ |
||
53 | if ($spotter_item['type'] == 'wx') { |
||
54 | $weather = json_decode($spotter_item['description'],true); |
||
55 | //print_r($weather); |
||
56 | if (isset($weather['temp'])) print '<div><span>'._("Temperature").'</span>'.$weather['temp'].'°C</div>'; |
||
57 | if (isset($weather['pressure'])) print '<div><span>'._("Pressure").'</span>'.$weather['pressure'].'hPa</div>'; |
||
58 | if (isset($weather['wind_gust'])) print '<div><span>'._("Wind Gust").'</span>'.$weather['wind_gust'].' km/h</div>'; |
||
59 | if (isset($weather['humidity'])) print '<div><span>'._("Humidity").'</span>'.$weather['humidity'].'%</div>'; |
||
60 | if (isset($weather['rain'])) print '<div><span>'._("Rain").'</span>'.$weather['rain'].' mm</div>'; |
||
61 | if (isset($weather['precipitation'])) print '<div><span>'._("Precipitation 24H").'</span>'.$weather['precipitation'].' mm</div>'; |
||
62 | if (isset($weather['precipitation24h'])) print '<div><span>'._("Precipitation Today").'</span>'.$weather['precipitation24h'].' mm</div>'; |
||
63 | $spotter_item['description'] = $weather['comment']; |
||
64 | } elseif ($spotter_item['type'] == 'fires') { |
||
0 ignored issues
–
show
|
|||
65 | //print_r(json_decode($spotter_item['description'],true)); |
||
66 | } |
||
67 | print '</div>'; |
||
68 | if ($spotter_item['type'] != 'wx' && $spotter_item['type'] != 'fires') { |
||
69 | if ($spotter_item['description'] != '') { |
||
70 | print '<div class="notamtext"><span>'._("Info").'</span>'; |
||
71 | print $spotter_item['description']; |
||
72 | print '</div>'; |
||
73 | } |
||
74 | } |
||
75 | |||
76 | |||
77 | print '</div>'; |
||
78 | } |
||
79 | print '</div>'; |
||
80 | } |
||
81 | ?> |
This check looks for the bodies of
elseif
statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.These
elseif
bodies can be removed. If you have an empty elseif but statements in theelse
branch, consider inverting the condition.