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.Common.php'); |
||
4 | require_once('require/class.Stats.php'); |
||
5 | require_once('require/class.Source.php'); |
||
6 | $begintime = microtime(true); |
||
7 | $Stats = new Stats(); |
||
8 | $Location = new Source(); |
||
9 | $Common = new Common(); |
||
10 | |||
11 | if (isset($_GET['download'])) { |
||
12 | if ($_GET['download'] == "true") |
||
13 | { |
||
14 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
||
15 | } |
||
16 | } |
||
17 | header('Content-Type: text/javascript'); |
||
18 | |||
19 | |||
20 | $polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
||
21 | $output = ''; |
||
22 | if (!empty($polar)) { |
||
23 | $output = '{"type": "FeatureCollection","features": ['; |
||
24 | |||
25 | foreach($polar as $eachpolar) { |
||
26 | $data = json_decode($eachpolar['source_data']); |
||
27 | $name = $eachpolar['source_name']; |
||
28 | $coord = $Location->getLocationInfobySourceName($name); |
||
29 | $output .= '{"type": "Feature","properties": {"name": "'.$name.'","style": {"color": "#D3FFCF", "opacity": 0.5}},"geometry": {"type": "Polygon","coordinates": [['; |
||
30 | View Code Duplication | if (isset($coord[0]['latitude'])) { |
|
31 | $initial_latitude = $coord[0]['latitude']; |
||
32 | $initial_longitude = $coord[0]['longitude']; |
||
33 | } else { |
||
34 | $initial_latitude = $globalCenterLatitude; |
||
35 | $initial_longitude = $globalCenterLongitude; |
||
36 | } |
||
37 | $first = ''; |
||
38 | foreach($data as $value => $key) { |
||
39 | $final_coord = $Common->getCoordfromDistanceBearing($initial_latitude,$initial_longitude,$value*22.5,$key); |
||
40 | if ($first == '') $first = '['.round($final_coord['longitude'],5).','.round($final_coord['latitude'],5).']'; |
||
41 | $output .= '['.$final_coord['longitude'].','.$final_coord['latitude'].'],'; |
||
42 | } |
||
43 | //$output = substr($output, 0, -1); |
||
1 ignored issue
–
show
|
|||
44 | $output .= $first; |
||
45 | $output .= ']]}},'; |
||
46 | } |
||
47 | $output = substr($output, 0, -1); |
||
48 | $output .= ']}'; |
||
49 | } |
||
50 | print $output; |
||
51 | |||
52 | ?> |
||
53 |
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.