@@ -4,10 +4,15 @@ discard block |
||
4 | 4 | |
5 | 5 | setcookie("MapFormat",'2d'); |
6 | 6 | |
7 | -if (!isset($globalOpenWeatherMapKey)) $globalOpenWeatherMapKey = ''; |
|
7 | +if (!isset($globalOpenWeatherMapKey)) { |
|
8 | + $globalOpenWeatherMapKey = ''; |
|
9 | +} |
|
8 | 10 | // Compressed GeoJson is used if true |
9 | -if (!isset($globalJsonCompress)) $compress = true; |
|
10 | -else $compress = $globalJsonCompress; |
|
11 | +if (!isset($globalJsonCompress)) { |
|
12 | + $compress = true; |
|
13 | +} else { |
|
14 | + $compress = $globalJsonCompress; |
|
15 | +} |
|
11 | 16 | if (isset($_GET['archive'])) { |
12 | 17 | $archive = true; |
13 | 18 | //$archiveupdatetime = 50; |
@@ -18,8 +23,11 @@ discard block |
||
18 | 23 | //$lastupd = round(($_GET['enddate']-$_GET['begindate'])/(($_GET['during']*60)/10)); |
19 | 24 | //$lastupd = 20; |
20 | 25 | $lastupd = $_GET['archivespeed']*$archiveupdatetime; |
21 | - if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate']; |
|
22 | - else $enddate = time(); |
|
26 | + if (isset($_GET['enddate']) && $_GET['enddate'] != '') { |
|
27 | + $enddate = $_GET['enddate']; |
|
28 | + } else { |
|
29 | + $enddate = time(); |
|
30 | + } |
|
23 | 31 | setcookie("archive_begin",$begindate); |
24 | 32 | setcookie("archive_end",$enddate); |
25 | 33 | setcookie("archive_update",$lastupd); |
@@ -106,7 +114,17 @@ discard block |
||
106 | 114 | } |
107 | 115 | |
108 | 116 | //create the map |
109 | - map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) print $latitude; else print $globalCenterLatitude; ?>,<?php if (isset($longitude)) print $longitude; else print $globalCenterLongitude; ?>], zoom); |
|
117 | + map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) { |
|
118 | + print $latitude; |
|
119 | +} else { |
|
120 | + print $globalCenterLatitude; |
|
121 | +} |
|
122 | +?>,<?php if (isset($longitude)) { |
|
123 | + print $longitude; |
|
124 | +} else { |
|
125 | + print $globalCenterLongitude; |
|
126 | +} |
|
127 | +?>], zoom); |
|
110 | 128 | <?php |
111 | 129 | } else { |
112 | 130 | ?> |
@@ -119,9 +137,19 @@ discard block |
||
119 | 137 | || navigator.userAgent.match(/BlackBerry/i) |
120 | 138 | || navigator.userAgent.match(/Windows Phone/i)) |
121 | 139 | { |
122 | - var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom-1; else print '8'; ?>; |
|
140 | + var zoom = <?php if (isset($globalLiveZoom)) { |
|
141 | + print $globalLiveZoom-1; |
|
142 | +} else { |
|
143 | + print '8'; |
|
144 | +} |
|
145 | +?>; |
|
123 | 146 | } else { |
124 | - var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>; |
|
147 | + var zoom = <?php if (isset($globalLiveZoom)) { |
|
148 | + print $globalLiveZoom; |
|
149 | +} else { |
|
150 | + print '9'; |
|
151 | +} |
|
152 | +?>; |
|
125 | 153 | } |
126 | 154 | |
127 | 155 | //create the map |
@@ -146,16 +174,27 @@ discard block |
||
146 | 174 | bounds = L.latLngBounds(southWest,northEast); |
147 | 175 | //a few title layers |
148 | 176 | <?php |
149 | - if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType']; |
|
150 | - else $MapType = $globalMapProvider; |
|
177 | + if (isset($_COOKIE['MapType'])) { |
|
178 | + $MapType = $_COOKIE['MapType']; |
|
179 | + } else { |
|
180 | + $MapType = $globalMapProvider; |
|
181 | + } |
|
151 | 182 | |
152 | 183 | if ($MapType == 'Mapbox') { |
153 | - if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId; |
|
154 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
155 | -?> |
|
184 | + if ($_COOKIE['MapTypeId'] == 'default') { |
|
185 | + $MapBoxId = $globalMapboxId; |
|
186 | + } else { |
|
187 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
188 | + } |
|
189 | + ?> |
|
156 | 190 | L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', { |
157 | 191 | maxZoom: 18, |
158 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
192 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
193 | + print 'false'; |
|
194 | +} else { |
|
195 | + print 'true'; |
|
196 | +} |
|
197 | +?>, |
|
159 | 198 | attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' + |
160 | 199 | '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + |
161 | 200 | 'Imagery © <a href="http://mapbox.com">Mapbox</a>', |
@@ -167,7 +206,12 @@ discard block |
||
167 | 206 | ?> |
168 | 207 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
169 | 208 | maxZoom: 18, |
170 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
209 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
210 | + print 'false'; |
|
211 | +} else { |
|
212 | + print 'true'; |
|
213 | +} |
|
214 | +?>, |
|
171 | 215 | attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' + |
172 | 216 | '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>' |
173 | 217 | }).addTo(map); |
@@ -213,20 +257,26 @@ discard block |
||
213 | 257 | map.addLayer(yandexLayer); |
214 | 258 | <?php |
215 | 259 | } elseif ($MapType == 'Bing-Aerial') { |
216 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
217 | -?> |
|
260 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
261 | + setcookie('MapType','OpenStreetMap'); |
|
262 | + } |
|
263 | + ?> |
|
218 | 264 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'}); |
219 | 265 | map.addLayer(bingLayer); |
220 | 266 | <?php |
221 | 267 | } elseif ($MapType == 'Bing-Hybrid') { |
222 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
223 | -?> |
|
268 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
269 | + setcookie('MapType','OpenStreetMap'); |
|
270 | + } |
|
271 | + ?> |
|
224 | 272 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'}); |
225 | 273 | map.addLayer(bingLayer); |
226 | 274 | <?php |
227 | 275 | } elseif ($MapType == 'Bing-Road') { |
228 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
229 | -?> |
|
276 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
277 | + setcookie('MapType','OpenStreetMap'); |
|
278 | + } |
|
279 | + ?> |
|
230 | 280 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'}); |
231 | 281 | map.addLayer(bingLayer); |
232 | 282 | <?php |
@@ -249,9 +299,24 @@ discard block |
||
249 | 299 | $customid = $MapType; |
250 | 300 | ?> |
251 | 301 | L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', { |
252 | - maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>, |
|
253 | - minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>, |
|
254 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
302 | + maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) { |
|
303 | + print $globalMapCustomLayer[$customid]['maxZoom']; |
|
304 | +} else { |
|
305 | + print '18'; |
|
306 | +} |
|
307 | +?>, |
|
308 | + minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) { |
|
309 | + print $globalMapCustomLayer[$customid]['minZoom']; |
|
310 | +} else { |
|
311 | + print '0'; |
|
312 | +} |
|
313 | +?>, |
|
314 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
315 | + print 'false'; |
|
316 | +} else { |
|
317 | + print 'true'; |
|
318 | +} |
|
319 | +?>, |
|
255 | 320 | attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
256 | 321 | }).addTo(map); |
257 | 322 | |
@@ -285,7 +350,12 @@ discard block |
||
285 | 350 | } |
286 | 351 | } elseif ($globalBounding == 'circle') { |
287 | 352 | ?> |
288 | - var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{ |
|
353 | + var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) { |
|
354 | + print $globalBoundingCircleSize; |
|
355 | +} else { |
|
356 | + print '70000'; |
|
357 | +} |
|
358 | +?>,{ |
|
289 | 359 | color: '#92C7D1', |
290 | 360 | fillColor: '#92C7D1', |
291 | 361 | fillOpacity: 0.3, |
@@ -382,7 +452,12 @@ discard block |
||
382 | 452 | //} |
383 | 453 | }); |
384 | 454 | update_locationsLayer(); |
385 | -setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
455 | +setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) { |
|
456 | + print $globalMapRefresh*1000*2; |
|
457 | +} else { |
|
458 | + print '60000'; |
|
459 | +} |
|
460 | +?>); |
|
386 | 461 | |
387 | 462 | <?php |
388 | 463 | // Add support for custom json via $globalMapJson |
@@ -184,17 +184,23 @@ discard block |
||
184 | 184 | |
185 | 185 | /* Check that end was found and body has at least one byte. */ |
186 | 186 | if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) { |
187 | - if ($globalDebug) echo '!!! APRS invalid : '.$input."\n"; |
|
187 | + if ($globalDebug) { |
|
188 | + echo '!!! APRS invalid : '.$input."\n"; |
|
189 | + } |
|
188 | 190 | return false; |
189 | 191 | } |
190 | 192 | |
191 | - if ($debug) echo 'input : '.$input."\n"; |
|
193 | + if ($debug) { |
|
194 | + echo 'input : '.$input."\n"; |
|
195 | + } |
|
192 | 196 | /* Save header and body. */ |
193 | 197 | $body = substr($input,$splitpos+1,$input_len); |
194 | 198 | $body_len = strlen($body); |
195 | 199 | $header = substr($input,0,$splitpos); |
196 | 200 | //$header_len = strlen($header); |
197 | - if ($debug) echo 'header : '.$header."\n"; |
|
201 | + if ($debug) { |
|
202 | + echo 'header : '.$header."\n"; |
|
203 | + } |
|
198 | 204 | |
199 | 205 | /* Parse source, target and path. */ |
200 | 206 | //FLRDF0A52>APRS,qAS,LSTB |
@@ -208,11 +214,15 @@ discard block |
||
208 | 214 | $result['format_source'] = 'famaprs'; |
209 | 215 | $result['source_type'] = 'ais'; |
210 | 216 | } else { |
211 | - if ($debug) echo 'ident : '.$ident."\n"; |
|
217 | + if ($debug) { |
|
218 | + echo 'ident : '.$ident."\n"; |
|
219 | + } |
|
212 | 220 | $result['ident'] = $ident; |
213 | 221 | } |
214 | 222 | } else { |
215 | - if ($debug) 'No ident'."\n"; |
|
223 | + if ($debug) { |
|
224 | + 'No ident'."\n"; |
|
225 | + } |
|
216 | 226 | return false; |
217 | 227 | } |
218 | 228 | $elements = explode(',',$all_elements); |
@@ -223,7 +233,9 @@ discard block |
||
223 | 233 | //echo "ok"; |
224 | 234 | //if ($element == 'TCPIP*') return false; |
225 | 235 | } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) { |
226 | - if ($debug) echo 'element : '.$element."\n"; |
|
236 | + if ($debug) { |
|
237 | + echo 'element : '.$element."\n"; |
|
238 | + } |
|
227 | 239 | return false; |
228 | 240 | } |
229 | 241 | /* |
@@ -236,13 +248,17 @@ discard block |
||
236 | 248 | } |
237 | 249 | |
238 | 250 | $type = substr($body,0,1); |
239 | - if ($debug) echo 'type : '.$type."\n"; |
|
251 | + if ($debug) { |
|
252 | + echo 'type : '.$type."\n"; |
|
253 | + } |
|
240 | 254 | if ($type == ';') { |
241 | 255 | if (isset($result['source_type']) && $result['source_type'] == 'modes') { |
242 | 256 | $result['address'] = trim(substr($body,1,9)); |
243 | 257 | } elseif (isset($result['source_type']) && $result['source_type'] == 'ais') { |
244 | 258 | $result['mmsi'] = trim(substr($body,1,9)); |
245 | - } else $result['ident'] = trim(substr($body,1,9)); |
|
259 | + } else { |
|
260 | + $result['ident'] = trim(substr($body,1,9)); |
|
261 | + } |
|
246 | 262 | } elseif ($type == ',') { |
247 | 263 | // Invalid data or test data |
248 | 264 | return false; |
@@ -311,7 +327,9 @@ discard block |
||
311 | 327 | //$symbol_table = $matches[4]; |
312 | 328 | $lat = intval($lat_deg); |
313 | 329 | $lon = intval($lon_deg); |
314 | - if ($lat > 89 || $lon > 179) return false; |
|
330 | + if ($lat > 89 || $lon > 179) { |
|
331 | + return false; |
|
332 | + } |
|
315 | 333 | |
316 | 334 | /* |
317 | 335 | $tmp_5b = str_replace('.','',$lat_min); |
@@ -321,8 +339,12 @@ discard block |
||
321 | 339 | */ |
322 | 340 | $latitude = $lat + floatval($lat_min)/60; |
323 | 341 | $longitude = $lon + floatval($lon_min)/60; |
324 | - if ($sind == 'S') $latitude = 0-$latitude; |
|
325 | - if ($wind == 'W') $longitude = 0-$longitude; |
|
342 | + if ($sind == 'S') { |
|
343 | + $latitude = 0-$latitude; |
|
344 | + } |
|
345 | + if ($wind == 'W') { |
|
346 | + $longitude = 0-$longitude; |
|
347 | + } |
|
326 | 348 | $result['latitude'] = $latitude; |
327 | 349 | $result['longitude'] = $longitude; |
328 | 350 | $body_parse = substr($body_parse,18); |
@@ -350,8 +372,11 @@ discard block |
||
350 | 372 | //echo 'find'."\n"; |
351 | 373 | $body_split = str_split($body_parse); |
352 | 374 | $symbol_code = $body_split[0]; |
353 | - if (!isset($symbolll) || $symbolll == '/') $symbol_code = '/'.$symbol_code; |
|
354 | - else $symbol_code = '\\'.$symbol_code; |
|
375 | + if (!isset($symbolll) || $symbolll == '/') { |
|
376 | + $symbol_code = '/'.$symbol_code; |
|
377 | + } else { |
|
378 | + $symbol_code = '\\'.$symbol_code; |
|
379 | + } |
|
355 | 380 | //' |
356 | 381 | //} |
357 | 382 | //echo $body_parse; |
@@ -360,7 +385,9 @@ discard block |
||
360 | 385 | $body_parse = substr($body_parse,1); |
361 | 386 | $body_parse_len = strlen($body_parse); |
362 | 387 | $result['symbol_code'] = $symbol_code; |
363 | - if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code]; |
|
388 | + if (isset($this->symbols[$symbol_code])) { |
|
389 | + $result['symbol'] = $this->symbols[$symbol_code]; |
|
390 | + } |
|
364 | 391 | if ($symbol_code != '_') { |
365 | 392 | } |
366 | 393 | //$body_parse = substr($body_parse,1); |
@@ -371,7 +398,9 @@ discard block |
||
371 | 398 | if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) { |
372 | 399 | $course = substr($body_parse,0,3); |
373 | 400 | $tmp_s = intval($course); |
374 | - if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course); |
|
401 | + if ($tmp_s >= 1 && $tmp_s <= 360) { |
|
402 | + $result['heading'] = intval($course); |
|
403 | + } |
|
375 | 404 | $speed = substr($body_parse,4,3); |
376 | 405 | if ($speed != '...') { |
377 | 406 | //$result['speed'] = round($speed*1.852); |
@@ -412,10 +441,16 @@ discard block |
||
412 | 441 | $lat_off = (($dao_split[1])-48.0)*0.001/60.0; |
413 | 442 | $lon_off = (($dao_split[2])-48.0)*0.001/60.0; |
414 | 443 | |
415 | - if ($result['latitude'] < 0) $result['latitude'] -= $lat_off; |
|
416 | - else $result['latitude'] += $lat_off; |
|
417 | - if ($result['longitude'] < 0) $result['longitude'] -= $lon_off; |
|
418 | - else $result['longitude'] += $lon_off; |
|
444 | + if ($result['latitude'] < 0) { |
|
445 | + $result['latitude'] -= $lat_off; |
|
446 | + } else { |
|
447 | + $result['latitude'] += $lat_off; |
|
448 | + } |
|
449 | + if ($result['longitude'] < 0) { |
|
450 | + $result['longitude'] -= $lon_off; |
|
451 | + } else { |
|
452 | + $result['longitude'] += $lon_off; |
|
453 | + } |
|
419 | 454 | } |
420 | 455 | |
421 | 456 | $body_parse = substr($body_parse,6); |
@@ -457,27 +492,48 @@ discard block |
||
457 | 492 | $address = substr($id,2); |
458 | 493 | //print_r($matches); |
459 | 494 | $addressType = (intval(substr($id,0,2),16))&3; |
460 | - if ($addressType == 0) $result['addresstype'] = "RANDOM"; |
|
461 | - elseif ($addressType == 1) $result['addresstype'] = "ICAO"; |
|
462 | - elseif ($addressType == 2) $result['addresstype'] = "FLARM"; |
|
463 | - elseif ($addressType == 3) $result['addresstype'] = "OGN"; |
|
495 | + if ($addressType == 0) { |
|
496 | + $result['addresstype'] = "RANDOM"; |
|
497 | + } elseif ($addressType == 1) { |
|
498 | + $result['addresstype'] = "ICAO"; |
|
499 | + } elseif ($addressType == 2) { |
|
500 | + $result['addresstype'] = "FLARM"; |
|
501 | + } elseif ($addressType == 3) { |
|
502 | + $result['addresstype'] = "OGN"; |
|
503 | + } |
|
464 | 504 | $aircraftType = $this->urshift(((intval(substr($id,0,2),16)) & 0b1111100),2); |
465 | 505 | $result['aircrafttype_code'] = $aircraftType; |
466 | - if ($aircraftType == 0) $result['aircrafttype'] = "UNKNOWN"; |
|
467 | - elseif ($aircraftType == 1) $result['aircrafttype'] = "GLIDER"; |
|
468 | - elseif ($aircraftType == 2) $result['aircrafttype'] = "TOW_PLANE"; |
|
469 | - elseif ($aircraftType == 3) $result['aircrafttype'] = "HELICOPTER_ROTORCRAFT"; |
|
470 | - elseif ($aircraftType == 4) $result['aircrafttype'] = "PARACHUTE"; |
|
471 | - elseif ($aircraftType == 5) $result['aircrafttype'] = "DROP_PLANE"; |
|
472 | - elseif ($aircraftType == 6) $result['aircrafttype'] = "HANG_GLIDER"; |
|
473 | - elseif ($aircraftType == 7) $result['aircrafttype'] = "PARA_GLIDER"; |
|
474 | - elseif ($aircraftType == 8) $result['aircrafttype'] = "POWERED_AIRCRAFT"; |
|
475 | - elseif ($aircraftType == 9) $result['aircrafttype'] = "JET_AIRCRAFT"; |
|
476 | - elseif ($aircraftType == 10) $result['aircrafttype'] = "UFO"; |
|
477 | - elseif ($aircraftType == 11) $result['aircrafttype'] = "BALLOON"; |
|
478 | - elseif ($aircraftType == 12) $result['aircrafttype'] = "AIRSHIP"; |
|
479 | - elseif ($aircraftType == 13) $result['aircrafttype'] = "UAV"; |
|
480 | - elseif ($aircraftType == 15) $result['aircrafttype'] = "STATIC_OBJECT"; |
|
506 | + if ($aircraftType == 0) { |
|
507 | + $result['aircrafttype'] = "UNKNOWN"; |
|
508 | + } elseif ($aircraftType == 1) { |
|
509 | + $result['aircrafttype'] = "GLIDER"; |
|
510 | + } elseif ($aircraftType == 2) { |
|
511 | + $result['aircrafttype'] = "TOW_PLANE"; |
|
512 | + } elseif ($aircraftType == 3) { |
|
513 | + $result['aircrafttype'] = "HELICOPTER_ROTORCRAFT"; |
|
514 | + } elseif ($aircraftType == 4) { |
|
515 | + $result['aircrafttype'] = "PARACHUTE"; |
|
516 | + } elseif ($aircraftType == 5) { |
|
517 | + $result['aircrafttype'] = "DROP_PLANE"; |
|
518 | + } elseif ($aircraftType == 6) { |
|
519 | + $result['aircrafttype'] = "HANG_GLIDER"; |
|
520 | + } elseif ($aircraftType == 7) { |
|
521 | + $result['aircrafttype'] = "PARA_GLIDER"; |
|
522 | + } elseif ($aircraftType == 8) { |
|
523 | + $result['aircrafttype'] = "POWERED_AIRCRAFT"; |
|
524 | + } elseif ($aircraftType == 9) { |
|
525 | + $result['aircrafttype'] = "JET_AIRCRAFT"; |
|
526 | + } elseif ($aircraftType == 10) { |
|
527 | + $result['aircrafttype'] = "UFO"; |
|
528 | + } elseif ($aircraftType == 11) { |
|
529 | + $result['aircrafttype'] = "BALLOON"; |
|
530 | + } elseif ($aircraftType == 12) { |
|
531 | + $result['aircrafttype'] = "AIRSHIP"; |
|
532 | + } elseif ($aircraftType == 13) { |
|
533 | + $result['aircrafttype'] = "UAV"; |
|
534 | + } elseif ($aircraftType == 15) { |
|
535 | + $result['aircrafttype'] = "STATIC_OBJECT"; |
|
536 | + } |
|
481 | 537 | $stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0; |
482 | 538 | $result['stealth'] = $stealth; |
483 | 539 | $result['address'] = $address; |
@@ -517,79 +573,183 @@ discard block |
||
517 | 573 | //g012t088r000p000P000h38b10110 |
518 | 574 | //g011t086r000p000P000h29b10198 |
519 | 575 | if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
520 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
521 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
522 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
523 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
524 | - if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
525 | - if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
|
526 | - if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1); |
|
576 | + if ($matches[1] != '...') { |
|
577 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
578 | + } |
|
579 | + if ($matches[2] != '...') { |
|
580 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
581 | + } |
|
582 | + if ($matches[3] != '...') { |
|
583 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
584 | + } |
|
585 | + if ($matches[4] != '...') { |
|
586 | + $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
587 | + } |
|
588 | + if ($matches[5] != '...') { |
|
589 | + $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
590 | + } |
|
591 | + if ($matches[6] != '...') { |
|
592 | + $result['humidity'] = intval($matches[6]); |
|
593 | + } |
|
594 | + if ($matches[7] != '...') { |
|
595 | + $result['pressure'] = round((intval($matches[7])/10),1); |
|
596 | + } |
|
527 | 597 | $body_parse = substr($body_parse,strlen($matches[0])); |
528 | 598 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
529 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
530 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
531 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
532 | - if ($matches[5] != '...') $result['precipitation'] = round((intval($matches[5])/100)*25.1,1); |
|
533 | - if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
534 | - if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
|
535 | - if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1); |
|
599 | + if ($matches[1] != '...') { |
|
600 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
601 | + } |
|
602 | + if ($matches[2] != '...') { |
|
603 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
604 | + } |
|
605 | + if ($matches[3] != '...') { |
|
606 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
607 | + } |
|
608 | + if ($matches[5] != '...') { |
|
609 | + $result['precipitation'] = round((intval($matches[5])/100)*25.1,1); |
|
610 | + } |
|
611 | + if ($matches[4] != '...') { |
|
612 | + $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
613 | + } |
|
614 | + if ($matches[6] != '...') { |
|
615 | + $result['humidity'] = intval($matches[6]); |
|
616 | + } |
|
617 | + if ($matches[7] != '...') { |
|
618 | + $result['pressure'] = round((intval($matches[7])/10),1); |
|
619 | + } |
|
536 | 620 | $body_parse = substr($body_parse,strlen($matches[0])); |
537 | 621 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
538 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
539 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
540 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
541 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
542 | - if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
543 | - if ($matches[7] != '...') $result['humidity'] = intval($matches[7]); |
|
544 | - if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1); |
|
622 | + if ($matches[1] != '...') { |
|
623 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
624 | + } |
|
625 | + if ($matches[2] != '...') { |
|
626 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
627 | + } |
|
628 | + if ($matches[3] != '...') { |
|
629 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
630 | + } |
|
631 | + if ($matches[4] != '...') { |
|
632 | + $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
633 | + } |
|
634 | + if ($matches[5] != '...') { |
|
635 | + $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
636 | + } |
|
637 | + if ($matches[7] != '...') { |
|
638 | + $result['humidity'] = intval($matches[7]); |
|
639 | + } |
|
640 | + if ($matches[6] != '...') { |
|
641 | + $result['pressure'] = round((intval($matches[6])/10),1); |
|
642 | + } |
|
545 | 643 | $body_parse = substr($body_parse,strlen($matches[0])); |
546 | 644 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
547 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
548 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
549 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
550 | - if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
551 | - if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
|
552 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
645 | + if ($matches[1] != '...') { |
|
646 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
647 | + } |
|
648 | + if ($matches[2] != '...') { |
|
649 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
650 | + } |
|
651 | + if ($matches[3] != '...') { |
|
652 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
653 | + } |
|
654 | + if ($matches[4] != '...') { |
|
655 | + $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
656 | + } |
|
657 | + if ($matches[6] != '...') { |
|
658 | + $result['humidity'] = intval($matches[6]); |
|
659 | + } |
|
660 | + if ($matches[5] != '...') { |
|
661 | + $result['pressure'] = round((intval($matches[5])/10),1); |
|
662 | + } |
|
553 | 663 | $body_parse = substr($body_parse,strlen($matches[0])); |
554 | 664 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
555 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
556 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
557 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
558 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
559 | - if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
|
560 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
665 | + if ($matches[1] != '...') { |
|
666 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
667 | + } |
|
668 | + if ($matches[2] != '...') { |
|
669 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
670 | + } |
|
671 | + if ($matches[3] != '...') { |
|
672 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
673 | + } |
|
674 | + if ($matches[4] != '...') { |
|
675 | + $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
676 | + } |
|
677 | + if ($matches[6] != '...') { |
|
678 | + $result['humidity'] = intval($matches[6]); |
|
679 | + } |
|
680 | + if ($matches[5] != '...') { |
|
681 | + $result['pressure'] = round((intval($matches[5])/10),1); |
|
682 | + } |
|
561 | 683 | $body_parse = substr($body_parse,strlen($matches[0])); |
562 | 684 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
563 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
564 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
565 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
566 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
567 | - if ($matches[5] != '...') $result['humidity'] = intval($matches[5]); |
|
568 | - if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1); |
|
685 | + if ($matches[1] != '...') { |
|
686 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
687 | + } |
|
688 | + if ($matches[2] != '...') { |
|
689 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
690 | + } |
|
691 | + if ($matches[3] != '...') { |
|
692 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
693 | + } |
|
694 | + if ($matches[4] != '...') { |
|
695 | + $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
696 | + } |
|
697 | + if ($matches[5] != '...') { |
|
698 | + $result['humidity'] = intval($matches[5]); |
|
699 | + } |
|
700 | + if ($matches[6] != '...') { |
|
701 | + $result['pressure'] = round((intval($matches[6])/10),1); |
|
702 | + } |
|
569 | 703 | $body_parse = substr($body_parse,strlen($matches[0])); |
570 | 704 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
571 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
572 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
573 | - if ($matches[2] != '...') $result['humidity'] = intval($matches[3]); |
|
574 | - if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10),1); |
|
705 | + if ($matches[1] != '...') { |
|
706 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
707 | + } |
|
708 | + if ($matches[2] != '...') { |
|
709 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
710 | + } |
|
711 | + if ($matches[2] != '...') { |
|
712 | + $result['humidity'] = intval($matches[3]); |
|
713 | + } |
|
714 | + if ($matches[4] != '...') { |
|
715 | + $result['pressure'] = round((intval($matches[4])/10),1); |
|
716 | + } |
|
575 | 717 | $body_parse = substr($body_parse,strlen($matches[0])); |
576 | 718 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
577 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
578 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
579 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
580 | - if ($matches[4] != '...') $result['humidity'] = intval($matches[4]); |
|
581 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
719 | + if ($matches[1] != '...') { |
|
720 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
721 | + } |
|
722 | + if ($matches[2] != '...') { |
|
723 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
724 | + } |
|
725 | + if ($matches[3] != '...') { |
|
726 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
727 | + } |
|
728 | + if ($matches[4] != '...') { |
|
729 | + $result['humidity'] = intval($matches[4]); |
|
730 | + } |
|
731 | + if ($matches[5] != '...') { |
|
732 | + $result['pressure'] = round((intval($matches[5])/10),1); |
|
733 | + } |
|
582 | 734 | $body_parse = substr($body_parse,strlen($matches[0])); |
583 | 735 | } |
584 | 736 | $result['comment'] = trim($body_parse); |
585 | 737 | } |
586 | - } else $result['comment'] = trim($body_parse); |
|
738 | + } else { |
|
739 | + $result['comment'] = trim($body_parse); |
|
740 | + } |
|
587 | 741 | |
588 | 742 | } |
589 | 743 | //} |
590 | - if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4); |
|
591 | - if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4); |
|
592 | - if ($debug) print_r($result); |
|
744 | + if (isset($result['latitude'])) { |
|
745 | + $result['latitude'] = round($result['latitude'],4); |
|
746 | + } |
|
747 | + if (isset($result['longitude'])) { |
|
748 | + $result['longitude'] = round($result['longitude'],4); |
|
749 | + } |
|
750 | + if ($debug) { |
|
751 | + print_r($result); |
|
752 | + } |
|
593 | 753 | return $result; |
594 | 754 | } |
595 | 755 | |
@@ -598,12 +758,21 @@ discard block |
||
598 | 758 | $aprs_connect = 0; |
599 | 759 | $aprs_keep = 120; |
600 | 760 | $aprs_last_tx = time(); |
601 | - if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
|
602 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
603 | - if (isset($globalServerAPRSssid)) $aprs_ssid = $globalServerAPRSssid; |
|
604 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
605 | - if (isset($globalServerAPRSpass)) $aprs_pass = $globalServerAPRSpass; |
|
606 | - else $aprs_pass = '-1'; |
|
761 | + if (isset($globalAPRSversion)) { |
|
762 | + $aprs_version = $globalAPRSversion; |
|
763 | + } else { |
|
764 | + $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
765 | + } |
|
766 | + if (isset($globalServerAPRSssid)) { |
|
767 | + $aprs_ssid = $globalServerAPRSssid; |
|
768 | + } else { |
|
769 | + $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
770 | + } |
|
771 | + if (isset($globalServerAPRSpass)) { |
|
772 | + $aprs_pass = $globalServerAPRSpass; |
|
773 | + } else { |
|
774 | + $aprs_pass = '-1'; |
|
775 | + } |
|
607 | 776 | |
608 | 777 | $aprs_filter = ''; |
609 | 778 | $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
@@ -636,10 +805,14 @@ discard block |
||
636 | 805 | |
637 | 806 | public function send($data) { |
638 | 807 | global $globalDebug; |
639 | - if ($this->connected === false) $this->connect(); |
|
808 | + if ($this->connected === false) { |
|
809 | + $this->connect(); |
|
810 | + } |
|
640 | 811 | $send = socket_send( $this->socket , $data , strlen($data),0); |
641 | 812 | if ($send === FALSE) { |
642 | - if ($globalDebug) echo 'Reconnect...'; |
|
813 | + if ($globalDebug) { |
|
814 | + echo 'Reconnect...'; |
|
815 | + } |
|
643 | 816 | socket_close($this->socket); |
644 | 817 | $this->connect(); |
645 | 818 | } |
@@ -661,22 +834,32 @@ discard block |
||
661 | 834 | //$w = '00'; |
662 | 835 | $custom = ''; |
663 | 836 | if ($ident != '') { |
664 | - if ($custom != '') $custom .= '/'; |
|
837 | + if ($custom != '') { |
|
838 | + $custom .= '/'; |
|
839 | + } |
|
665 | 840 | $custom .= 'CS='.$ident; |
666 | 841 | } |
667 | 842 | if ($squawk != '') { |
668 | - if ($custom != '') $custom .= '/'; |
|
843 | + if ($custom != '') { |
|
844 | + $custom .= '/'; |
|
845 | + } |
|
669 | 846 | $custom .= 'SQ='.$squawk; |
670 | 847 | } |
671 | 848 | if ($verticalrate != '') { |
672 | - if ($custom != '') $custom .= '/'; |
|
849 | + if ($custom != '') { |
|
850 | + $custom .= '/'; |
|
851 | + } |
|
673 | 852 | $custom .= 'VR='.$verticalrate; |
674 | 853 | } |
675 | 854 | if ($aircraft_icao != '' && $aircraft_icao != 'NA') { |
676 | - if ($custom != '') $custom .= '/'; |
|
855 | + if ($custom != '') { |
|
856 | + $custom .= '/'; |
|
857 | + } |
|
677 | 858 | $custom .= 'AI='.$aircraft_icao; |
678 | 859 | } |
679 | - if ($custom != '') $custom = ' '.$custom; |
|
860 | + if ($custom != '') { |
|
861 | + $custom = ' '.$custom; |
|
862 | + } |
|
680 | 863 | /* |
681 | 864 | // Use AMSL altitude |
682 | 865 | $GeoidClass = new GeoidHeight(); |
@@ -700,30 +883,44 @@ discard block |
||
700 | 883 | //$w = '00'; |
701 | 884 | $custom = ''; |
702 | 885 | if ($ident != '') { |
703 | - if ($custom != '') $custom .= '/'; |
|
886 | + if ($custom != '') { |
|
887 | + $custom .= '/'; |
|
888 | + } |
|
704 | 889 | $custom .= 'CS='.str_replace(' ','_',$ident); |
705 | 890 | } |
706 | 891 | if ($typeid != '') { |
707 | - if ($custom != '') $custom .= '/'; |
|
892 | + if ($custom != '') { |
|
893 | + $custom .= '/'; |
|
894 | + } |
|
708 | 895 | $custom .= 'TI='.$typeid; |
709 | 896 | } |
710 | 897 | if ($statusid != '') { |
711 | - if ($custom != '') $custom .= '/'; |
|
898 | + if ($custom != '') { |
|
899 | + $custom .= '/'; |
|
900 | + } |
|
712 | 901 | $custom .= 'SI='.$statusid; |
713 | 902 | } |
714 | 903 | if ($imo != '') { |
715 | - if ($custom != '') $custom .= '/'; |
|
904 | + if ($custom != '') { |
|
905 | + $custom .= '/'; |
|
906 | + } |
|
716 | 907 | $custom .= 'IMO='.$imo; |
717 | 908 | } |
718 | 909 | if ($arrival_date != '') { |
719 | - if ($custom != '') $custom .= '/'; |
|
910 | + if ($custom != '') { |
|
911 | + $custom .= '/'; |
|
912 | + } |
|
720 | 913 | $custom .= 'AD='.strtotime($arrival_date); |
721 | 914 | } |
722 | 915 | if ($arrival_code != '') { |
723 | - if ($custom != '') $custom .= '/'; |
|
916 | + if ($custom != '') { |
|
917 | + $custom .= '/'; |
|
918 | + } |
|
724 | 919 | $custom .= 'AC='.str_replace(' ','_',$arrival_code); |
725 | 920 | } |
726 | - if ($custom != '') $custom = ' '.$custom; |
|
921 | + if ($custom != '') { |
|
922 | + $custom = ' '.$custom; |
|
923 | + } |
|
727 | 924 | $altitude = 0; |
728 | 925 | $this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His',strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
729 | 926 | } |
@@ -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); |
@@ -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: text/plain"); |
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); |
@@ -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'])) |
@@ -49,7 +57,7 @@ discard block |
||
49 | 57 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
50 | 58 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
51 | 59 | } |
52 | -} else { |
|
60 | +} else { |
|
53 | 61 | $limit_explode = explode(",", $_GET['limit']); |
54 | 62 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
55 | 63 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -70,8 +78,11 @@ discard block |
||
70 | 78 | |
71 | 79 | $date = date("c", time()); |
72 | 80 | |
73 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
74 | -else $sort = ''; |
|
81 | +if (isset($_GET['sort'])) { |
|
82 | + $sort = $_GET['sort']; |
|
83 | +} else { |
|
84 | + $sort = ''; |
|
85 | +} |
|
75 | 86 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
76 | 87 | $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
77 | 88 | $aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
@@ -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'])) { |
@@ -47,7 +55,7 @@ discard block |
||
47 | 55 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
48 | 56 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
49 | 57 | } |
50 | -} else { |
|
58 | +} else { |
|
51 | 59 | $limit_explode = explode(",", $_GET['limit']); |
52 | 60 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
53 | 61 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -66,8 +74,11 @@ discard block |
||
66 | 74 | header('Content-Type: application/rss+xml; charset=utf-8'); |
67 | 75 | |
68 | 76 | $date = date("D, d M Y H:i:s T", time()); |
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); |
@@ -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'])) { |
@@ -47,7 +55,7 @@ discard block |
||
47 | 55 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
48 | 56 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
49 | 57 | } |
50 | -} else { |
|
58 | +} else { |
|
51 | 59 | $limit_explode = explode(",", $_GET['limit']); |
52 | 60 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
53 | 61 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -65,8 +73,11 @@ discard block |
||
65 | 73 | |
66 | 74 | header("Content-type: text/csv"); |
67 | 75 | |
68 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
69 | -else $sort = ''; |
|
76 | +if (isset($_GET['sort'])) { |
|
77 | + $sort = $_GET['sort']; |
|
78 | +} else { |
|
79 | + $sort = ''; |
|
80 | +} |
|
70 | 81 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
71 | 82 | $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
72 | 83 | $aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |