@@ -5,11 +5,15 @@ discard block |
||
5 | 5 | $Stats = new Stats(); |
6 | 6 | $title = _("Statistics").' - '._("Most common Aircraft"); |
7 | 7 | |
8 | -if (!isset($filter_name)) $filter_name = ''; |
|
8 | +if (!isset($filter_name)) { |
|
9 | + $filter_name = ''; |
|
10 | +} |
|
9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
10 | 12 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
12 | -} |
|
13 | + if (isset($globalFilter['airline'])) { |
|
14 | + $airline_icao = $globalFilter['airline'][0]; |
|
15 | + } |
|
16 | + } |
|
13 | 17 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
14 | 18 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
15 | 19 | |
@@ -28,9 +32,12 @@ discard block |
||
28 | 32 | $aircraft_data = ''; |
29 | 33 | foreach($aircraft_array as $aircraft_item) |
30 | 34 | { |
31 | - if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
32 | - else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
33 | -} |
|
35 | + if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') { |
|
36 | + $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
37 | + } else { |
|
38 | + $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
39 | + } |
|
40 | + } |
|
34 | 41 | $aircraft_data = substr($aircraft_data, 0, -1); |
35 | 42 | print 'var series = ['.$aircraft_data.'];'; |
36 | 43 | print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
@@ -8,7 +8,9 @@ |
||
8 | 8 | $atcid = filter_input(INPUT_GET,'atcid',FILTER_SANITIZE_NUMBER_INT); |
9 | 9 | $atcident = filter_input(INPUT_GET,'atcident',FILTER_SANITIZE_STRING); |
10 | 10 | $atc_data = $ATC->getById($atcid); |
11 | - if (!isset($atc_data[0])) $atc_data = $ATC->getByIdent($atcident); |
|
11 | + if (!isset($atc_data[0])) { |
|
12 | + $atc_data = $ATC->getByIdent($atcident); |
|
13 | + } |
|
12 | 14 | ?> |
13 | 15 | <div class="alldetails"> |
14 | 16 | <button type="button" class="close">×</button> |
@@ -28,7 +28,9 @@ discard block |
||
28 | 28 | private $openedFiles = []; |
29 | 29 | |
30 | 30 | public function __construct($htgFilesDestination = '', $resolution = 3) { |
31 | - if ($htgFilesDestination == '') $htgFilesDestination = dirname(__FILE__).'/../data/'; |
|
31 | + if ($htgFilesDestination == '') { |
|
32 | + $htgFilesDestination = dirname(__FILE__).'/../data/'; |
|
33 | + } |
|
32 | 34 | $this->htgFilesDestination = $htgFilesDestination; |
33 | 35 | $this->resolution = $resolution; |
34 | 36 | switch ($resolution) { |
@@ -171,16 +173,26 @@ discard block |
||
171 | 173 | $fileName = "N{$N}E{$E}.hgt"; |
172 | 174 | if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) { |
173 | 175 | $Common = new Common(); |
174 | - if ($debug) echo 'Downloading '.$fileName.'.gz ...'; |
|
176 | + if ($debug) { |
|
177 | + echo 'Downloading '.$fileName.'.gz ...'; |
|
178 | + } |
|
175 | 179 | $Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz'); |
176 | 180 | if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz')) { |
177 | - if ($debug) echo "File '{$fileName}.gz' not exists."; |
|
181 | + if ($debug) { |
|
182 | + echo "File '{$fileName}.gz' not exists."; |
|
183 | + } |
|
178 | 184 | return false; |
179 | 185 | } |
180 | - if ($debug) echo 'Done'."\n"; |
|
181 | - if ($debug) echo 'Decompress '.$fileName.' ....'; |
|
186 | + if ($debug) { |
|
187 | + echo 'Done'."\n"; |
|
188 | + } |
|
189 | + if ($debug) { |
|
190 | + echo 'Decompress '.$fileName.' ....'; |
|
191 | + } |
|
182 | 192 | $Common->gunzip($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName); |
183 | - if ($debug) echo 'Done'."\n"; |
|
193 | + if ($debug) { |
|
194 | + echo 'Done'."\n"; |
|
195 | + } |
|
184 | 196 | unlink($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz'); |
185 | 197 | } |
186 | 198 | return true; |
@@ -27,15 +27,21 @@ discard block |
||
27 | 27 | } |
28 | 28 | } |
29 | 29 | } |
30 | -if ($authorize === false) die; |
|
30 | +if ($authorize === false) { |
|
31 | + die; |
|
32 | +} |
|
31 | 33 | |
32 | -if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
34 | +if (isset($globalTracker) && $globalTracker) { |
|
35 | + require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
36 | +} |
|
33 | 37 | if (isset($globalMarine) && $globalMarine) { |
34 | 38 | require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
35 | 39 | require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
36 | 40 | } |
37 | 41 | |
38 | -if (!isset($globalDebug)) $globalDebug = FALSE; |
|
42 | +if (!isset($globalDebug)) { |
|
43 | + $globalDebug = FALSE; |
|
44 | +} |
|
39 | 45 | |
40 | 46 | // Check if schema is at latest version |
41 | 47 | $Connection = new Connection(); |
@@ -45,10 +51,16 @@ discard block |
||
45 | 51 | } |
46 | 52 | |
47 | 53 | if (isset($globalServer) && $globalServer) { |
48 | - if ($globalDebug) echo "Using Server Mode\n"; |
|
54 | + if ($globalDebug) { |
|
55 | + echo "Using Server Mode\n"; |
|
56 | + } |
|
49 | 57 | $SI=new SpotterServer(); |
50 | -} else $SI=new SpotterImport($Connection->db); |
|
51 | -if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db); |
|
58 | +} else { |
|
59 | + $SI=new SpotterImport($Connection->db); |
|
60 | +} |
|
61 | +if (isset($globalTracker) && $globalTracker) { |
|
62 | + $TI = new TrackerImport($Connection->db); |
|
63 | +} |
|
52 | 64 | if (isset($globalMarine) && $globalMarine) { |
53 | 65 | $AIS = new AIS(); |
54 | 66 | $MI = new MarineImport($Connection->db); |
@@ -57,7 +69,9 @@ discard block |
||
57 | 69 | date_default_timezone_set('UTC'); |
58 | 70 | |
59 | 71 | $buffer = ''; |
60 | -if (isset($_POST)) $buffer = $_POST; |
|
72 | +if (isset($_POST)) { |
|
73 | + $buffer = $_POST; |
|
74 | +} |
|
61 | 75 | $data = array(); |
62 | 76 | if (isset($buffer['type_event']) && isset($buffer['lat']) && isset($buffer['lon'])) { |
63 | 77 | $data['ident'] = $buffer['device_id']; |
@@ -68,15 +82,27 @@ discard block |
||
68 | 82 | //$data['heading'] = $buffer['cap']; // Only N/S/E/W |
69 | 83 | $data['datetime'] = date('Y-m-d H:i:s',$buffer['timestamp']); |
70 | 84 | $data['comment'] = ''; |
71 | - if (isset($buffer['battery']) && $buffer['battery'] != '') $data['comment'] .= 'Battery: '.$buffer['battery'].'% '; |
|
85 | + if (isset($buffer['battery']) && $buffer['battery'] != '') { |
|
86 | + $data['comment'] .= 'Battery: '.$buffer['battery'].'% '; |
|
87 | + } |
|
72 | 88 | //if (isset($buffer['snr']) && $buffer['snr'] != '') $data['comment'] .= 'SNR: '.$buffer['snr'].' '; |
73 | - if (isset($buffer['temp']) && $buffer['temp'] != '') $data['comment'] .= 'Temperature: '.$buffer['temp'].'°C '; |
|
74 | - if (isset($buffer['press']) && $buffer['press'] != '') $data['comment'] .= 'Pressure: '.$buffer['press'].'hPa '; |
|
89 | + if (isset($buffer['temp']) && $buffer['temp'] != '') { |
|
90 | + $data['comment'] .= 'Temperature: '.$buffer['temp'].'°C '; |
|
91 | + } |
|
92 | + if (isset($buffer['press']) && $buffer['press'] != '') { |
|
93 | + $data['comment'] .= 'Pressure: '.$buffer['press'].'hPa '; |
|
94 | + } |
|
75 | 95 | $TI->add($data); |
76 | 96 | unset($data); |
77 | 97 | } |
78 | -if (isset($SI)) $SI->checkAll(); |
|
79 | -if (isset($MI)) $MI->checkAll(); |
|
80 | -if (isset($TI)) $TI->checkAll(); |
|
98 | +if (isset($SI)) { |
|
99 | + $SI->checkAll(); |
|
100 | +} |
|
101 | +if (isset($MI)) { |
|
102 | + $MI->checkAll(); |
|
103 | +} |
|
104 | +if (isset($TI)) { |
|
105 | + $TI->checkAll(); |
|
106 | +} |
|
81 | 107 | |
82 | 108 | ?> |
@@ -48,7 +48,9 @@ discard block |
||
48 | 48 | $all_data = $SpotterArchive->getAltitudeSpeedArchiveSpotterDataById($spotter_array[0]['flightaware_id']); |
49 | 49 | if (isset($globalTimezone)) { |
50 | 50 | date_default_timezone_set($globalTimezone); |
51 | - } else date_default_timezone_set('UTC'); |
|
51 | + } else { |
|
52 | + date_default_timezone_set('UTC'); |
|
53 | + } |
|
52 | 54 | |
53 | 55 | if (is_array($all_data) && count($all_data) > 1) { |
54 | 56 | print '<br/>'; |
@@ -327,9 +329,13 @@ discard block |
||
327 | 329 | print '<div>'; |
328 | 330 | if (isset($spotter_item['pilot_id']) && $spotter_item['pilot_id'] != "") |
329 | 331 | { |
330 | - if ($spotter_item['format_source'] == 'whazzup') print '<a href="https://www.ivao.aero/Member.aspx?ID='.$spotter_item['pilot_id'].'">'.$spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')</a>'; |
|
331 | - elseif ($spotter_item['format_source'] == 'vatsimtxt') print '<a href="http://www.vataware.com/pilot/'.$spotter_item['pilot_id'].'">'.$spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')</a>'; |
|
332 | - else print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
332 | + if ($spotter_item['format_source'] == 'whazzup') { |
|
333 | + print '<a href="https://www.ivao.aero/Member.aspx?ID='.$spotter_item['pilot_id'].'">'.$spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')</a>'; |
|
334 | + } elseif ($spotter_item['format_source'] == 'vatsimtxt') { |
|
335 | + print '<a href="http://www.vataware.com/pilot/'.$spotter_item['pilot_id'].'">'.$spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')</a>'; |
|
336 | + } else { |
|
337 | + print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
338 | + } |
|
333 | 339 | } else { |
334 | 340 | if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != "") |
335 | 341 | { |
@@ -118,8 +118,12 @@ discard block |
||
118 | 118 | { |
119 | 119 | $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['ident']); |
120 | 120 | $ident = $spotter_array[0]['ident']; |
121 | - if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
|
122 | - if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
|
121 | + if (isset($spotter_array[0]['latitude'])) { |
|
122 | + $latitude = $spotter_array[0]['latitude']; |
|
123 | + } |
|
124 | + if (isset($spotter_array[0]['longitude'])) { |
|
125 | + $longitude = $spotter_array[0]['longitude']; |
|
126 | + } |
|
123 | 127 | require_once('header.php'); |
124 | 128 | if (isset($globalArchive) && $globalArchive && $type == 'aircraft') { |
125 | 129 | // Requirement for altitude graph |
@@ -127,7 +131,9 @@ discard block |
||
127 | 131 | $all_data = $SpotterArchive->getAltitudeSpeedArchiveSpotterDataById($spotter_array[0]['flightaware_id']); |
128 | 132 | if (isset($globalTimezone)) { |
129 | 133 | date_default_timezone_set($globalTimezone); |
130 | - } else date_default_timezone_set('UTC'); |
|
134 | + } else { |
|
135 | + date_default_timezone_set('UTC'); |
|
136 | + } |
|
131 | 137 | if (is_array($all_data) && count($all_data) > 1) { |
132 | 138 | print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">'; |
133 | 139 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -204,14 +210,22 @@ discard block |
||
204 | 210 | if (isset($spotter_array[0]['airline_icao'])) { |
205 | 211 | print '<div><span class="label">'._("Airline").'</span><a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'">'.$spotter_array[0]['airline_name'].'</a></div>'; |
206 | 212 | } |
207 | - if ($type == 'aircraft') print '<div><span class="label">'._("Flight History").'</span><a href="http://flightaware.com/live/flight/'.$spotter_array[0]['ident'].'" target="_blank">'._("View the Flight History of this callsign").'</a></div>'; |
|
213 | + if ($type == 'aircraft') { |
|
214 | + print '<div><span class="label">'._("Flight History").'</span><a href="http://flightaware.com/live/flight/'.$spotter_array[0]['ident'].'" target="_blank">'._("View the Flight History of this callsign").'</a></div>'; |
|
215 | + } |
|
208 | 216 | print '</div>'; |
209 | 217 | |
210 | - if ($type == 'aircraft') include('ident-sub-menu.php'); |
|
218 | + if ($type == 'aircraft') { |
|
219 | + include('ident-sub-menu.php'); |
|
220 | + } |
|
211 | 221 | print '<div class="table column">'; |
212 | - if ($type == 'aircraft') print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
213 | - elseif ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
214 | - elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
222 | + if ($type == 'aircraft') { |
|
223 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
224 | + } elseif ($type == 'marine') { |
|
225 | + print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
226 | + } elseif ($type == 'tracker') { |
|
227 | + print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
228 | + } |
|
215 | 229 | |
216 | 230 | include('table-output.php'); |
217 | 231 | print '<div class="pagination">'; |
@@ -28,16 +28,25 @@ discard block |
||
28 | 28 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
29 | 29 | //$airline_icao = substr($ident, 0, 3); |
30 | 30 | return $ident; |
31 | - } else return $ident; |
|
32 | - } else return $ident; |
|
31 | + } else { |
|
32 | + return $ident; |
|
33 | + } |
|
34 | + } else { |
|
35 | + return $ident; |
|
36 | + } |
|
33 | 37 | if ($airline_icao == 'AF') { |
34 | - if (filter_var(substr($ident,2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $ident; |
|
35 | - else $icao = 'AFR'.ltrim(substr($ident,2),'0'); |
|
38 | + if (filter_var(substr($ident,2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) { |
|
39 | + $icao = $ident; |
|
40 | + } else { |
|
41 | + $icao = 'AFR'.ltrim(substr($ident,2),'0'); |
|
42 | + } |
|
36 | 43 | } else { |
37 | 44 | $identicao = $Spotter->getAllAirlineInfo($airline_icao); |
38 | 45 | if (isset($identicao[0])) { |
39 | 46 | $icao = $identicao[0]['icao'].ltrim(substr($ident,2),'0'); |
40 | - } else $icao = $ident; |
|
47 | + } else { |
|
48 | + $icao = $ident; |
|
49 | + } |
|
41 | 50 | } |
42 | 51 | return $icao; |
43 | 52 | } |
@@ -55,7 +64,9 @@ discard block |
||
55 | 64 | $sth->closeCursor(); |
56 | 65 | if (count($row) > 0) { |
57 | 66 | return $row['operator_correct']; |
58 | - } else return $ident; |
|
67 | + } else { |
|
68 | + return $ident; |
|
69 | + } |
|
59 | 70 | } |
60 | 71 | |
61 | 72 | public function addOperator($ident,$correct_ident,$source) { |
@@ -84,7 +95,9 @@ discard block |
||
84 | 95 | global $globalTranslationSources, $globalTranslationFetch; |
85 | 96 | //if (!isset($globalTranslationSources)) $globalTranslationSources = array('planefinder'); |
86 | 97 | $globalTranslationSources = array(); |
87 | - if (!isset($globalTranslationFetch)) $globalTranslationFetch = TRUE; |
|
98 | + if (!isset($globalTranslationFetch)) { |
|
99 | + $globalTranslationFetch = TRUE; |
|
100 | + } |
|
88 | 101 | //echo "Check Translation for ".$ident."..."; |
89 | 102 | $correct = $this->getOperator($ident); |
90 | 103 | if ($correct != '' && $correct != $ident) { |
@@ -36,79 +36,126 @@ |
||
36 | 36 | $data['hex'] = trim($line['hex']); |
37 | 37 | if (preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
38 | 38 | $data['datetime'] = $line['datetime']; |
39 | - } else $data['datetime'] = date('Y-m-d H:i:s'); |
|
39 | + } else { |
|
40 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
41 | + } |
|
40 | 42 | if (!isset($line['aircraft_icao'])) { |
41 | 43 | $Spotter = new Spotter(); |
42 | 44 | $aircraft_icao = $Spotter->getAllAircraftType($data['hex']); |
43 | 45 | $Spotter->db = null; |
44 | 46 | if ($aircraft_icao == '' && isset($line['aircraft_type'])) { |
45 | - if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
|
46 | - elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
|
47 | - elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
|
48 | - elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
|
47 | + if ($line['aircraft_type'] == 'PARA_GLIDER') { |
|
48 | + $aircraft_icao = 'GLID'; |
|
49 | + } elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') { |
|
50 | + $aircraft_icao = 'UHEL'; |
|
51 | + } elseif ($line['aircraft_type'] == 'TOW_PLANE') { |
|
52 | + $aircraft_icao = 'TOWPLANE'; |
|
53 | + } elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') { |
|
54 | + $aircraft_icao = 'POWAIRC'; |
|
55 | + } |
|
49 | 56 | } |
50 | 57 | $data['aircraft_icao'] = $aircraft_icao; |
51 | - } else $data['aircraft_icao'] = $line['aircraft_icao']; |
|
58 | + } else { |
|
59 | + $data['aircraft_icao'] = $line['aircraft_icao']; |
|
60 | + } |
|
52 | 61 | //if ($globalDebug) echo "*********** New aircraft hex : ".$data['hex']." ***********\n"; |
53 | 62 | } |
54 | 63 | if (isset($line['registration']) && $line['registration'] != '') { |
55 | 64 | $data['registration'] = $line['registration']; |
56 | - } else $data['registration'] = null; |
|
65 | + } else { |
|
66 | + $data['registration'] = null; |
|
67 | + } |
|
57 | 68 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
58 | 69 | $data['waypoints'] = $line['waypoints']; |
59 | - } else $data['waypoints'] = null; |
|
70 | + } else { |
|
71 | + $data['waypoints'] = null; |
|
72 | + } |
|
60 | 73 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) { |
61 | 74 | $data['ident'] = trim($line['ident']); |
62 | - } else $data['ident'] = null; |
|
75 | + } else { |
|
76 | + $data['ident'] = null; |
|
77 | + } |
|
63 | 78 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '') { |
64 | 79 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
65 | 80 | $data['latitude'] = $line['latitude']; |
66 | - } else $data['latitude'] = null; |
|
81 | + } else { |
|
82 | + $data['latitude'] = null; |
|
83 | + } |
|
67 | 84 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
68 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
85 | + if ($line['longitude'] > 180) { |
|
86 | + $line['longitude'] = $line['longitude'] - 360; |
|
87 | + } |
|
69 | 88 | $data['longitude'] = $line['longitude']; |
70 | - } else $data['longitude'] = null; |
|
89 | + } else { |
|
90 | + $data['longitude'] = null; |
|
91 | + } |
|
71 | 92 | } else { |
72 | 93 | $data['latitude'] = null; |
73 | 94 | $data['longitude'] = null; |
74 | 95 | } |
75 | 96 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
76 | 97 | $data['verticalrate'] = $line['verticalrate']; |
77 | - } else $data['verticalrate'] = null; |
|
98 | + } else { |
|
99 | + $data['verticalrate'] = null; |
|
100 | + } |
|
78 | 101 | if (isset($line['emergency']) && $line['emergency'] != '') { |
79 | 102 | $data['emergency'] = $line['emergency']; |
80 | - } else $data['emergency'] = null; |
|
103 | + } else { |
|
104 | + $data['emergency'] = null; |
|
105 | + } |
|
81 | 106 | if (isset($line['ground']) && $line['ground'] != '') { |
82 | 107 | $data['ground'] = $line['ground']; |
83 | - } else $data['ground'] = null; |
|
108 | + } else { |
|
109 | + $data['ground'] = null; |
|
110 | + } |
|
84 | 111 | if (isset($line['speed']) && $line['speed'] != '') { |
85 | 112 | $data['speed'] = round($line['speed']); |
86 | - } else $data['speed'] = null; |
|
113 | + } else { |
|
114 | + $data['speed'] = null; |
|
115 | + } |
|
87 | 116 | if (isset($line['squawk']) && $line['squawk'] != '') { |
88 | 117 | $data['squawk'] = $line['squawk']; |
89 | - } else $data['squawk'] = null; |
|
118 | + } else { |
|
119 | + $data['squawk'] = null; |
|
120 | + } |
|
90 | 121 | if (isset($line['altitude']) && $line['altitude'] != '') { |
91 | 122 | $data['altitude'] = round($line['altitude']); |
92 | - } else $data['altitude'] = null; |
|
123 | + } else { |
|
124 | + $data['altitude'] = null; |
|
125 | + } |
|
93 | 126 | if (isset($line['heading']) && $line['heading'] != '') { |
94 | 127 | $data['heading'] = round($line['heading']); |
95 | - } else $data['heading'] = null; |
|
128 | + } else { |
|
129 | + $data['heading'] = null; |
|
130 | + } |
|
96 | 131 | if (isset($line['source_name']) && $line['source_name'] != '') { |
97 | 132 | $data['source_name'] = $line['source_name']; |
98 | - } else $data['source_name'] = null; |
|
133 | + } else { |
|
134 | + $data['source_name'] = null; |
|
135 | + } |
|
99 | 136 | if (isset($line['over_country']) && $line['over_country'] != '') { |
100 | 137 | $data['over_country'] = $line['over_country']; |
101 | - } else $data['over_country'] = null; |
|
138 | + } else { |
|
139 | + $data['over_country'] = null; |
|
140 | + } |
|
102 | 141 | if (isset($line['noarchive']) && $line['noarchive']) { |
103 | 142 | $data['noarchive'] = true; |
104 | - } else $data['noarchive'] = false; |
|
143 | + } else { |
|
144 | + $data['noarchive'] = false; |
|
145 | + } |
|
105 | 146 | $data['format_source'] = $line['format_source']; |
106 | - if (isset($line['id_source'])) $id_source = $line['id_source']; |
|
147 | + if (isset($line['id_source'])) { |
|
148 | + $id_source = $line['id_source']; |
|
149 | + } |
|
107 | 150 | if (isset($data['hex'])) { |
108 | 151 | echo '.'; |
109 | 152 | $id_user = $globalServerUserID; |
110 | - if ($id_user == NULL) $id_user = 1; |
|
111 | - if (!isset($id_source)) $id_source = 1; |
|
153 | + if ($id_user == NULL) { |
|
154 | + $id_user = 1; |
|
155 | + } |
|
156 | + if (!isset($id_source)) { |
|
157 | + $id_source = 1; |
|
158 | + } |
|
112 | 159 | $query = 'INSERT INTO spotter_temp (id_user,datetime,hex,ident,latitude,longitude,verticalrate,speed,squawk,altitude,heading,registration,aircraft_icao,waypoints,id_source,noarchive,format_source,source_name,over_country) VALUES (:id_user,:datetime,:hex,:ident,:latitude,:longitude,:verticalrate,:speed,:squawk,:altitude,:heading,:registration,:aircraft_icao,:waypoints,:id_source,:noarchive, :format_source, :source_name, :over_country)'; |
113 | 160 | $query_values = array(':id_user' => $id_user,':datetime' => $data['datetime'],':hex' => $data['hex'],':ident' => $data['ident'],':latitude' => $data['latitude'],':longitude' => $data['longitude'],':verticalrate' => $data['verticalrate'],':speed' => $data['speed'],':squawk' => $data['squawk'],':altitude' => $data['altitude'],':heading' => $data['heading'],':registration' => $data['registration'],':aircraft_icao' => $data['aircraft_icao'],':waypoints' => $data['waypoints'],':id_source' => $id_source,':noarchive' => $data['noarchive'], ':format_source' => $data['format_source'], ':source_name' => $data['source_name'],':over_country' => $data['over_country']); |
114 | 161 | try { |
@@ -15,8 +15,12 @@ discard block |
||
15 | 15 | } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
17 | 17 | $sql_date = $end_date; |
18 | - } else $sql_date = ''; |
|
19 | -} else $sql_date = ''; |
|
18 | + } else { |
|
19 | + $sql_date = ''; |
|
20 | + } |
|
21 | + } else { |
|
22 | + $sql_date = ''; |
|
23 | +} |
|
20 | 24 | |
21 | 25 | if (isset($_GET['highest_altitude'])) { |
22 | 26 | //for altitude manipulation |
@@ -30,8 +34,12 @@ discard block |
||
30 | 34 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
31 | 35 | $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
32 | 36 | $sql_altitude = $start_altitude; |
33 | - } else $sql_altitude = ''; |
|
34 | -} else $sql_altitude = ''; |
|
37 | + } else { |
|
38 | + $sql_altitude = ''; |
|
39 | + } |
|
40 | + } else { |
|
41 | + $sql_altitude = ''; |
|
42 | +} |
|
35 | 43 | |
36 | 44 | //calculuation for the pagination |
37 | 45 | if(!isset($_GET['limit'])) |
@@ -48,7 +56,7 @@ discard block |
||
48 | 56 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
49 | 57 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
50 | 58 | } |
51 | -} else { |
|
59 | +} else { |
|
52 | 60 | $limit_explode = explode(",", $_GET['limit']); |
53 | 61 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
54 | 62 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -66,8 +74,11 @@ discard block |
||
66 | 74 | |
67 | 75 | header('Content-Type: application/json'); |
68 | 76 | |
69 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
70 | -else $sort = ''; |
|
77 | +if (isset($_GET['sort'])) { |
|
78 | + $sort = $_GET['sort']; |
|
79 | +} else { |
|
80 | + $sort = ''; |
|
81 | +} |
|
71 | 82 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
72 | 83 | $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
73 | 84 | $aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |