@@ -131,7 +131,7 @@ |
||
131 | 131 | } else { |
132 | 132 | var clockViewModel = new Cesium.ClockViewModel(viewer.clock); |
133 | 133 | var animationViewModel = new Cesium.AnimationViewModel(clockViewModel); |
134 | - $(".archivebox").html('<h4><?php echo str_replace("'","\'",_("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>'); |
|
134 | + $(".archivebox").html('<h4><?php echo str_replace("'", "\'", _("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>'); |
|
135 | 135 | } |
136 | 136 | function MarineiconColor(color) { |
137 | 137 | document.cookie = 'MarineIconColor='+color.substring(1)+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/' |
@@ -167,8 +167,7 @@ discard block |
||
167 | 167 | |
168 | 168 | |
169 | 169 | private function urshift($n, $s) { |
170 | - return ($n >= 0) ? ($n >> $s) : |
|
171 | - (($n & 0x7fffffff) >> $s) | |
|
170 | + return ($n >= 0) ? ($n >> $s) : (($n&0x7fffffff) >> $s)| |
|
172 | 171 | (0x40000000 >> ($s - 1)); |
173 | 172 | } |
174 | 173 | |
@@ -180,7 +179,7 @@ discard block |
||
180 | 179 | //$split_input = str_split($input); |
181 | 180 | |
182 | 181 | /* Find the end of header checking for NULL bytes while doing it. */ |
183 | - $splitpos = strpos($input,':'); |
|
182 | + $splitpos = strpos($input, ':'); |
|
184 | 183 | |
185 | 184 | /* Check that end was found and body has at least one byte. */ |
186 | 185 | if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) { |
@@ -190,15 +189,15 @@ discard block |
||
190 | 189 | |
191 | 190 | if ($debug) echo 'input : '.$input."\n"; |
192 | 191 | /* Save header and body. */ |
193 | - $body = substr($input,$splitpos+1,$input_len); |
|
192 | + $body = substr($input, $splitpos + 1, $input_len); |
|
194 | 193 | $body_len = strlen($body); |
195 | - $header = substr($input,0,$splitpos); |
|
194 | + $header = substr($input, 0, $splitpos); |
|
196 | 195 | //$header_len = strlen($header); |
197 | 196 | if ($debug) echo 'header : '.$header."\n"; |
198 | 197 | |
199 | 198 | /* Parse source, target and path. */ |
200 | 199 | //FLRDF0A52>APRS,qAS,LSTB |
201 | - if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/',$header,$matches)) { |
|
200 | + if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/', $header, $matches)) { |
|
202 | 201 | $ident = $matches[1]; |
203 | 202 | $all_elements = $matches[2]; |
204 | 203 | if ($ident == 'AIRCRAFT') { |
@@ -215,14 +214,14 @@ discard block |
||
215 | 214 | if ($debug) 'No ident'."\n"; |
216 | 215 | return false; |
217 | 216 | } |
218 | - $elements = explode(',',$all_elements); |
|
217 | + $elements = explode(',', $all_elements); |
|
219 | 218 | $source = end($elements); |
220 | 219 | $result['source'] = $source; |
221 | 220 | foreach ($elements as $element) { |
222 | - if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) { |
|
221 | + if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/', $element)) { |
|
223 | 222 | //echo "ok"; |
224 | 223 | //if ($element == 'TCPIP*') return false; |
225 | - } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) { |
|
224 | + } elseif (!preg_match('/^([0-9A-F]{32})$/', $element)) { |
|
226 | 225 | if ($debug) echo 'element : '.$element."\n"; |
227 | 226 | return false; |
228 | 227 | } |
@@ -235,14 +234,14 @@ discard block |
||
235 | 234 | */ |
236 | 235 | } |
237 | 236 | |
238 | - $type = substr($body,0,1); |
|
237 | + $type = substr($body, 0, 1); |
|
239 | 238 | if ($debug) echo 'type : '.$type."\n"; |
240 | 239 | if ($type == ';') { |
241 | 240 | if (isset($result['source_type']) && $result['source_type'] == 'modes') { |
242 | - $result['address'] = trim(substr($body,1,9)); |
|
241 | + $result['address'] = trim(substr($body, 1, 9)); |
|
243 | 242 | } elseif (isset($result['source_type']) && $result['source_type'] == 'ais') { |
244 | - $result['mmsi'] = trim(substr($body,1,9)); |
|
245 | - } else $result['ident'] = trim(substr($body,1,9)); |
|
243 | + $result['mmsi'] = trim(substr($body, 1, 9)); |
|
244 | + } else $result['ident'] = trim(substr($body, 1, 9)); |
|
246 | 245 | } elseif ($type == ',') { |
247 | 246 | // Invalid data or test data |
248 | 247 | return false; |
@@ -250,24 +249,24 @@ discard block |
||
250 | 249 | |
251 | 250 | // Check for Timestamp |
252 | 251 | $find = false; |
253 | - $body_parse = substr($body,1); |
|
252 | + $body_parse = substr($body, 1); |
|
254 | 253 | //echo 'Body : '.$body."\n"; |
255 | - if (preg_match('/^;(.){9}\*/',$body,$matches)) { |
|
256 | - $body_parse = substr($body_parse,10); |
|
254 | + if (preg_match('/^;(.){9}\*/', $body, $matches)) { |
|
255 | + $body_parse = substr($body_parse, 10); |
|
257 | 256 | $find = true; |
258 | 257 | //echo $body_parse."\n"; |
259 | 258 | } |
260 | - if (preg_match('/^`(.*)\//',$body,$matches)) { |
|
261 | - $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
259 | + if (preg_match('/^`(.*)\//', $body, $matches)) { |
|
260 | + $body_parse = substr($body_parse, strlen($matches[1]) - 1); |
|
262 | 261 | $find = true; |
263 | 262 | //echo $body_parse."\n"; |
264 | 263 | } |
265 | - if (preg_match("/^'(.*)\//",$body,$matches)) { |
|
266 | - $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
264 | + if (preg_match("/^'(.*)\//", $body, $matches)) { |
|
265 | + $body_parse = substr($body_parse, strlen($matches[1]) - 1); |
|
267 | 266 | $find = true; |
268 | 267 | //echo $body_parse."\n"; |
269 | 268 | } |
270 | - if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/',$body_parse,$matches)) { |
|
269 | + if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/', $body_parse, $matches)) { |
|
271 | 270 | $find = true; |
272 | 271 | //print_r($matches); |
273 | 272 | $timestamp = $matches[0]; |
@@ -282,19 +281,19 @@ discard block |
||
282 | 281 | // This work or not ? |
283 | 282 | $timestamp = strtotime(date('Ym').$matches[1].' '.$matches[2].':'.$matches[3]); |
284 | 283 | } |
285 | - $body_parse = substr($body_parse,7); |
|
284 | + $body_parse = substr($body_parse, 7); |
|
286 | 285 | $result['timestamp'] = $timestamp; |
287 | 286 | //echo date('Ymd H:i:s',$timestamp); |
288 | 287 | } |
289 | - if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/',$body_parse,$matches)) { |
|
288 | + if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/', $body_parse, $matches)) { |
|
290 | 289 | $find = true; |
291 | 290 | $timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]); |
292 | - $body_parse = substr($body_parse,8); |
|
291 | + $body_parse = substr($body_parse, 8); |
|
293 | 292 | $result['timestamp'] = $timestamp; |
294 | 293 | //echo date('Ymd H:i:s',$timestamp); |
295 | 294 | } |
296 | 295 | //if (strlen($body_parse) > 19) { |
297 | - if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) { |
|
296 | + if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/', $body_parse, $matches)) { |
|
298 | 297 | $find = true; |
299 | 298 | // 4658.70N/00707.78Ez |
300 | 299 | //print_r(str_split($body_parse)); |
@@ -321,11 +320,11 @@ discard block |
||
321 | 320 | */ |
322 | 321 | $latitude = $lat + floatval($lat_min)/60; |
323 | 322 | $longitude = $lon + floatval($lon_min)/60; |
324 | - if ($sind == 'S') $latitude = 0-$latitude; |
|
325 | - if ($wind == 'W') $longitude = 0-$longitude; |
|
323 | + if ($sind == 'S') $latitude = 0 - $latitude; |
|
324 | + if ($wind == 'W') $longitude = 0 - $longitude; |
|
326 | 325 | $result['latitude'] = $latitude; |
327 | 326 | $result['longitude'] = $longitude; |
328 | - $body_parse = substr($body_parse,18); |
|
327 | + $body_parse = substr($body_parse, 18); |
|
329 | 328 | $body_parse_len = strlen($body_parse); |
330 | 329 | } |
331 | 330 | $body_parse_len = strlen($body_parse); |
@@ -357,7 +356,7 @@ discard block |
||
357 | 356 | //echo $body_parse; |
358 | 357 | //if ($type != ';' && $type != '>') { |
359 | 358 | if ($type != '') { |
360 | - $body_parse = substr($body_parse,1); |
|
359 | + $body_parse = substr($body_parse, 1); |
|
361 | 360 | $body_parse_len = strlen($body_parse); |
362 | 361 | $result['symbol_code'] = $symbol_code; |
363 | 362 | if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code]; |
@@ -368,16 +367,16 @@ discard block |
||
368 | 367 | //$body_parse_len = strlen($body_parse); |
369 | 368 | if ($body_parse_len >= 7) { |
370 | 369 | |
371 | - if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) { |
|
372 | - $course = substr($body_parse,0,3); |
|
370 | + if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/', $body_parse)) { |
|
371 | + $course = substr($body_parse, 0, 3); |
|
373 | 372 | $tmp_s = intval($course); |
374 | 373 | if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course); |
375 | - $speed = substr($body_parse,4,3); |
|
374 | + $speed = substr($body_parse, 4, 3); |
|
376 | 375 | if ($speed != '...') { |
377 | 376 | //$result['speed'] = round($speed*1.852); |
378 | 377 | $result['speed'] = intval($speed); |
379 | 378 | } |
380 | - $body_parse = substr($body_parse,7); |
|
379 | + $body_parse = substr($body_parse, 7); |
|
381 | 380 | } |
382 | 381 | // Check PHGR, PHG, RNG |
383 | 382 | } |
@@ -387,12 +386,12 @@ discard block |
||
387 | 386 | } |
388 | 387 | */ |
389 | 388 | if (strlen($body_parse) > 0) { |
390 | - if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) { |
|
389 | + if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/', $body_parse, $matches)) { |
|
391 | 390 | $altitude = intval($matches[1]); |
392 | 391 | //$result['altitude'] = round($altitude*0.3048); |
393 | 392 | $result['altitude'] = $altitude; |
394 | 393 | //$body_parse = trim(substr($body_parse,strlen($matches[0]))); |
395 | - $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse)); |
|
394 | + $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/', '', $body_parse)); |
|
396 | 395 | } |
397 | 396 | } |
398 | 397 | |
@@ -404,13 +403,13 @@ discard block |
||
404 | 403 | */ |
405 | 404 | // DAO |
406 | 405 | |
407 | - if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) { |
|
406 | + if (preg_match('/^!([0-9A-Z]{3})/', $body_parse, $matches)) { |
|
408 | 407 | |
409 | 408 | $dao = $matches[1]; |
410 | - if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) { |
|
409 | + if (preg_match('/^([A-Z])([0-9]{2})/', $dao)) { |
|
411 | 410 | $dao_split = str_split($dao); |
412 | - $lat_off = (($dao_split[1])-48.0)*0.001/60.0; |
|
413 | - $lon_off = (($dao_split[2])-48.0)*0.001/60.0; |
|
411 | + $lat_off = (($dao_split[1]) - 48.0)*0.001/60.0; |
|
412 | + $lon_off = (($dao_split[2]) - 48.0)*0.001/60.0; |
|
414 | 413 | |
415 | 414 | if ($result['latitude'] < 0) $result['latitude'] -= $lat_off; |
416 | 415 | else $result['latitude'] += $lat_off; |
@@ -418,50 +417,50 @@ discard block |
||
418 | 417 | else $result['longitude'] += $lon_off; |
419 | 418 | } |
420 | 419 | |
421 | - $body_parse = substr($body_parse,6); |
|
420 | + $body_parse = substr($body_parse, 6); |
|
422 | 421 | } |
423 | 422 | |
424 | - if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) { |
|
425 | - $result['ident'] = str_replace('_',' ',$matches[1]); |
|
423 | + if (preg_match('/CS=([0-9A-Z_]*)/', $body_parse, $matches)) { |
|
424 | + $result['ident'] = str_replace('_', ' ', $matches[1]); |
|
426 | 425 | } |
427 | - if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) { |
|
426 | + if (preg_match('/SQ=([0-9]{4})/', $body_parse, $matches)) { |
|
428 | 427 | $result['squawk'] = $matches[1]; |
429 | 428 | } |
430 | - if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) { |
|
429 | + if (preg_match('/AI=([0-9A-Z]{4})/', $body_parse, $matches)) { |
|
431 | 430 | $result['aircraft_icao'] = $matches[1]; |
432 | 431 | } |
433 | - if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) { |
|
432 | + if (preg_match('/VR=([0-9]*)/', $body_parse, $matches)) { |
|
434 | 433 | $result['verticalrate'] = $matches[1]; |
435 | 434 | } |
436 | - if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) { |
|
435 | + if (preg_match('/TI=([0-9]*)/', $body_parse, $matches)) { |
|
437 | 436 | $result['typeid'] = $matches[1]; |
438 | 437 | } |
439 | - if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) { |
|
438 | + if (preg_match('/SI=([0-9]*)/', $body_parse, $matches)) { |
|
440 | 439 | $result['statusid'] = $matches[1]; |
441 | 440 | } |
442 | - if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) { |
|
441 | + if (preg_match('/IMO=([0-9]{7})/', $body_parse, $matches)) { |
|
443 | 442 | $result['imo'] = $matches[1]; |
444 | 443 | } |
445 | - if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) { |
|
444 | + if (preg_match('/AD=([0-9]*)/', $body_parse, $matches)) { |
|
446 | 445 | $result['arrival_date'] = $matches[1]; |
447 | 446 | } |
448 | - if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) { |
|
449 | - $result['arrival_code'] = str_replace('_',' ',$matches[1]); |
|
447 | + if (preg_match('/AC=([0-9A-Z_]*)/', $body_parse, $matches)) { |
|
448 | + $result['arrival_code'] = str_replace('_', ' ', $matches[1]); |
|
450 | 449 | } |
451 | 450 | // OGN comment |
452 | 451 | // echo "Before OGN : ".$body_parse."\n"; |
453 | 452 | //if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) { |
454 | - if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) { |
|
453 | + if (preg_match('/^id([0-9A-F]{8})/', $body_parse, $matches)) { |
|
455 | 454 | $id = $matches[1]; |
456 | 455 | //$mode = substr($id,0,2); |
457 | - $address = substr($id,2); |
|
456 | + $address = substr($id, 2); |
|
458 | 457 | //print_r($matches); |
459 | - $addressType = (intval(substr($id,0,2),16))&3; |
|
458 | + $addressType = (intval(substr($id, 0, 2), 16))&3; |
|
460 | 459 | if ($addressType == 0) $result['addresstype'] = "RANDOM"; |
461 | 460 | elseif ($addressType == 1) $result['addresstype'] = "ICAO"; |
462 | 461 | elseif ($addressType == 2) $result['addresstype'] = "FLARM"; |
463 | 462 | elseif ($addressType == 3) $result['addresstype'] = "OGN"; |
464 | - $aircraftType = $this->urshift(((intval(substr($id,0,2),16)) & 0b1111100),2); |
|
463 | + $aircraftType = $this->urshift(((intval(substr($id, 0, 2), 16))&0b1111100), 2); |
|
465 | 464 | $result['aircrafttype_code'] = $aircraftType; |
466 | 465 | if ($aircraftType == 0) $result['aircrafttype'] = "UNKNOWN"; |
467 | 466 | elseif ($aircraftType == 1) $result['aircrafttype'] = "GLIDER"; |
@@ -478,7 +477,7 @@ discard block |
||
478 | 477 | elseif ($aircraftType == 12) $result['aircrafttype'] = "AIRSHIP"; |
479 | 478 | elseif ($aircraftType == 13) $result['aircrafttype'] = "UAV"; |
480 | 479 | elseif ($aircraftType == 15) $result['aircrafttype'] = "STATIC_OBJECT"; |
481 | - $stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0; |
|
480 | + $stealth = (intval(substr($id, 0, 2), 16)&0b10000000) != 0; |
|
482 | 481 | $result['stealth'] = $stealth; |
483 | 482 | $result['address'] = $address; |
484 | 483 | } |
@@ -490,96 +489,96 @@ discard block |
||
490 | 489 | //$body_parse = substr($body_parse,1); |
491 | 490 | //$body_parse_len = strlen($body_parse); |
492 | 491 | //echo 'weather'."\n"; |
493 | - if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
492 | + if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) { |
|
494 | 493 | $result['wind_dir'] = intval($matches[1]); |
495 | - $result['wind_speed'] = round(intval($matches[2])*1.60934,1); |
|
496 | - $result['wind_gust'] = round(intval($matches[3])*1.60934,1); |
|
497 | - $result['temp'] = round(5/9*((intval($matches[4]))-32),1); |
|
498 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
499 | - } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
494 | + $result['wind_speed'] = round(intval($matches[2])*1.60934, 1); |
|
495 | + $result['wind_gust'] = round(intval($matches[3])*1.60934, 1); |
|
496 | + $result['temp'] = round(5/9*((intval($matches[4])) - 32), 1); |
|
497 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
498 | + } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) { |
|
500 | 499 | $result['wind_dir'] = intval($matches[1]); |
501 | - $result['wind_speed'] = round($matches[2]*1.60934,1); |
|
502 | - $result['wind_gust'] = round($matches[3]*1.60934,1); |
|
503 | - $result['temp'] = round(5/9*(($matches[4])-32),1); |
|
504 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
505 | - } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
500 | + $result['wind_speed'] = round($matches[2]*1.60934, 1); |
|
501 | + $result['wind_gust'] = round($matches[3]*1.60934, 1); |
|
502 | + $result['temp'] = round(5/9*(($matches[4]) - 32), 1); |
|
503 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
504 | + } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) { |
|
506 | 505 | $result['wind_dir'] = intval($matches[1]); |
507 | - $result['wind_speed'] = round($matches[2]*1.60934,1); |
|
508 | - $result['wind_gust'] = round($matches[3]*1.60934,1); |
|
509 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
510 | - } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) { |
|
506 | + $result['wind_speed'] = round($matches[2]*1.60934, 1); |
|
507 | + $result['wind_gust'] = round($matches[3]*1.60934, 1); |
|
508 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
509 | + } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/', $body_parse, $matches)) { |
|
511 | 510 | $result['wind_dir'] = intval($matches[1]); |
512 | - $result['wind_speed'] = round($matches[2]*1.60934,1); |
|
513 | - $result['wind_gust'] = round($matches[3]*1.60934,1); |
|
514 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
511 | + $result['wind_speed'] = round($matches[2]*1.60934, 1); |
|
512 | + $result['wind_gust'] = round($matches[3]*1.60934, 1); |
|
513 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
515 | 514 | } |
516 | 515 | //if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) { |
517 | 516 | //g012t088r000p000P000h38b10110 |
518 | 517 | //g011t086r000p000P000h29b10198 |
519 | - 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); |
|
518 | + 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)) { |
|
519 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
520 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
521 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
522 | + if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1); |
|
523 | + if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1, 1); |
|
525 | 524 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
526 | - if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1); |
|
527 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
528 | - } 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); |
|
525 | + if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10), 1); |
|
526 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
527 | + } 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)) { |
|
528 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
529 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
530 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
531 | + if ($matches[5] != '...') $result['precipitation'] = round((intval($matches[5])/100)*25.1, 1); |
|
532 | + if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1, 1); |
|
534 | 533 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
535 | - if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1); |
|
536 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
537 | - } 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); |
|
534 | + if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10), 1); |
|
535 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
536 | + } 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)) { |
|
537 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
538 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
539 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
540 | + if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1); |
|
541 | + if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1, 1); |
|
543 | 542 | if ($matches[7] != '...') $result['humidity'] = intval($matches[7]); |
544 | - if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1); |
|
545 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
546 | - } 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); |
|
543 | + if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10), 1); |
|
544 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
545 | + } 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)) { |
|
546 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
547 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
548 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
549 | + if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1, 1); |
|
551 | 550 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
552 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
553 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
554 | - } 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); |
|
551 | + if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10), 1); |
|
552 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
553 | + } 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)) { |
|
554 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
555 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
556 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
557 | + if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1); |
|
559 | 558 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
560 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
561 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
562 | - } 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); |
|
559 | + if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10), 1); |
|
560 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
561 | + } 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)) { |
|
562 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
563 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
564 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
565 | + if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1); |
|
567 | 566 | if ($matches[5] != '...') $result['humidity'] = intval($matches[5]); |
568 | - if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1); |
|
569 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
570 | - } 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); |
|
567 | + if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10), 1); |
|
568 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
569 | + } 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)) { |
|
570 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
571 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
573 | 572 | if ($matches[2] != '...') $result['humidity'] = intval($matches[3]); |
574 | - if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10),1); |
|
575 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
576 | - } 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); |
|
573 | + if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10), 1); |
|
574 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
575 | + } 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)) { |
|
576 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
577 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
578 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
580 | 579 | if ($matches[4] != '...') $result['humidity'] = intval($matches[4]); |
581 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
582 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
580 | + if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10), 1); |
|
581 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
583 | 582 | } |
584 | 583 | $result['comment'] = trim($body_parse); |
585 | 584 | } |
@@ -587,42 +586,42 @@ discard block |
||
587 | 586 | |
588 | 587 | } |
589 | 588 | //} |
590 | - if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4); |
|
591 | - if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4); |
|
589 | + if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'], 4); |
|
590 | + if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'], 4); |
|
592 | 591 | if ($debug) print_r($result); |
593 | 592 | return $result; |
594 | 593 | } |
595 | 594 | |
596 | 595 | public function connect() { |
597 | - global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass,$globalName, $globalServerAPRShost, $globalServerAPRSport; |
|
596 | + global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass, $globalName, $globalServerAPRShost, $globalServerAPRSport; |
|
598 | 597 | $aprs_connect = 0; |
599 | 598 | $aprs_keep = 120; |
600 | 599 | $aprs_last_tx = time(); |
601 | 600 | if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
602 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
601 | + else $aprs_version = 'FlightAirMap '.str_replace(' ', '_', $globalName); |
|
603 | 602 | if (isset($globalServerAPRSssid)) $aprs_ssid = $globalServerAPRSssid; |
604 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
603 | + else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ', '_', $globalName)), 0, 8); |
|
605 | 604 | if (isset($globalServerAPRSpass)) $aprs_pass = $globalServerAPRSpass; |
606 | 605 | else $aprs_pass = '-1'; |
607 | 606 | |
608 | - $aprs_filter = ''; |
|
607 | + $aprs_filter = ''; |
|
609 | 608 | $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
610 | 609 | $Common = new Common(); |
611 | - $s = $Common->create_socket($globalServerAPRShost,$globalServerAPRSport,$errno,$errstr); |
|
610 | + $s = $Common->create_socket($globalServerAPRShost, $globalServerAPRSport, $errno, $errstr); |
|
612 | 611 | if ($s !== false) { |
613 | 612 | echo 'Connected to APRS server! '."\n"; |
614 | 613 | $authstart = time(); |
615 | 614 | $this->socket = $s; |
616 | - $send = socket_send( $this->socket , $aprs_login , strlen($aprs_login) , 0 ); |
|
617 | - socket_set_option($this->socket,SOL_SOCKET,SO_KEEPALIVE,1); |
|
618 | - while ($msgin = socket_read($this->socket, 1000,PHP_NORMAL_READ)) { |
|
615 | + $send = socket_send($this->socket, $aprs_login, strlen($aprs_login), 0); |
|
616 | + socket_set_option($this->socket, SOL_SOCKET, SO_KEEPALIVE, 1); |
|
617 | + while ($msgin = socket_read($this->socket, 1000, PHP_NORMAL_READ)) { |
|
619 | 618 | if (strpos($msgin, "$aprs_ssid verified") !== FALSE) { |
620 | 619 | echo 'APRS user verified !'."\n"; |
621 | 620 | $this->connected = true; |
622 | 621 | return true; |
623 | 622 | break; |
624 | 623 | } |
625 | - if (time()-$authstart > 5) { |
|
624 | + if (time() - $authstart > 5) { |
|
626 | 625 | echo 'APRS timeout'."\n"; |
627 | 626 | break; |
628 | 627 | } |
@@ -637,7 +636,7 @@ discard block |
||
637 | 636 | public function send($data) { |
638 | 637 | global $globalDebug; |
639 | 638 | if ($this->connected === false) $this->connect(); |
640 | - $send = socket_send( $this->socket , $data , strlen($data),0); |
|
639 | + $send = socket_send($this->socket, $data, strlen($data), 0); |
|
641 | 640 | if ($send === FALSE) { |
642 | 641 | if ($globalDebug) echo 'Reconnect...'; |
643 | 642 | socket_close($this->socket); |
@@ -647,16 +646,16 @@ discard block |
||
647 | 646 | } |
648 | 647 | |
649 | 648 | class APRSSpotter extends APRS { |
650 | - public function addLiveSpotterData($id,$ident,$aircraft_icao,$departure_airport,$arrival_airport,$latitude,$longitude,$waypoints,$altitude,$altitude_real,$heading,$speed,$datetime,$departure_airport_time,$arrival_airport_time,$squawk,$route_stop,$hex,$putinarchive,$registration,$pilot_id,$pilot_name, $verticalrate, $noarchive, $ground,$format_source,$source_name,$over_country) { |
|
649 | + public function addLiveSpotterData($id, $ident, $aircraft_icao, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $speed, $datetime, $departure_airport_time, $arrival_airport_time, $squawk, $route_stop, $hex, $putinarchive, $registration, $pilot_id, $pilot_name, $verticalrate, $noarchive, $ground, $format_source, $source_name, $over_country) { |
|
651 | 650 | $Common = new Common(); |
652 | 651 | if ($latitude != '' && $longitude != '') { |
653 | 652 | $lat = $latitude; |
654 | 653 | $long = $longitude; |
655 | - $latitude = $Common->convertDM($latitude,'latitude'); |
|
656 | - $longitude = $Common->convertDM($longitude,'longitude'); |
|
657 | - $coordinate = sprintf("%02d",$latitude['deg']).str_pad(number_format($latitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d",$longitude['deg']).str_pad(number_format($longitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$longitude['NSEW']; |
|
658 | - $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'],2,'.',''))*1000)); |
|
659 | - $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'],2,'.',''))*1000)); |
|
654 | + $latitude = $Common->convertDM($latitude, 'latitude'); |
|
655 | + $longitude = $Common->convertDM($longitude, 'longitude'); |
|
656 | + $coordinate = sprintf("%02d", $latitude['deg']).str_pad(number_format($latitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d", $longitude['deg']).str_pad(number_format($longitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$longitude['NSEW']; |
|
657 | + $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'], 2, '.', ''))*1000)); |
|
658 | + $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'], 2, '.', ''))*1000)); |
|
660 | 659 | $w = $w1.$w2; |
661 | 660 | //$w = '00'; |
662 | 661 | $custom = ''; |
@@ -683,25 +682,25 @@ discard block |
||
683 | 682 | $geoid= round($GeoidClass->get($lat,$long)*3.28084,2); |
684 | 683 | $altitude_real = round($altitude_real + $geoid); |
685 | 684 | */ |
686 | - $this->send('AIRCRAFT>APRS,TCPIP*:;'.$hex.' *'.date('His',strtotime($datetime)).'h'.$coordinate.'^'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude_real,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
|
685 | + $this->send('AIRCRAFT>APRS,TCPIP*:;'.$hex.' *'.date('His', strtotime($datetime)).'h'.$coordinate.'^'.str_pad($heading, 3, '0', STR_PAD_LEFT).'/'.str_pad($speed, 3, '0', STR_PAD_LEFT).'/A='.str_pad($altitude_real, 6, '0', STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
|
687 | 686 | } |
688 | 687 | } |
689 | 688 | } |
690 | 689 | class APRSMarine extends APRS { |
691 | - public function addLiveMarineData($id, $ident, $latitude, $longitude, $heading, $speed,$datetime, $putinarchive,$mmsi,$type,$typeid,$imo,$callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source,$source_name,$over_country) { |
|
690 | + public function addLiveMarineData($id, $ident, $latitude, $longitude, $heading, $speed, $datetime, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $statusid, $noarchive, $format_source, $source_name, $over_country) { |
|
692 | 691 | $Common = new Common(); |
693 | 692 | if ($latitude != '' && $longitude != '') { |
694 | - $latitude = $Common->convertDM($latitude,'latitude'); |
|
695 | - $longitude = $Common->convertDM($longitude,'longitude'); |
|
696 | - $coordinate = sprintf("%02d",$latitude['deg']).str_pad(number_format($latitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d",$longitude['deg']).str_pad(number_format($longitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$longitude['NSEW']; |
|
697 | - $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'],2,'.',''))*1000)); |
|
698 | - $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'],2,'.',''))*1000)); |
|
693 | + $latitude = $Common->convertDM($latitude, 'latitude'); |
|
694 | + $longitude = $Common->convertDM($longitude, 'longitude'); |
|
695 | + $coordinate = sprintf("%02d", $latitude['deg']).str_pad(number_format($latitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d", $longitude['deg']).str_pad(number_format($longitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$longitude['NSEW']; |
|
696 | + $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'], 2, '.', ''))*1000)); |
|
697 | + $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'], 2, '.', ''))*1000)); |
|
699 | 698 | $w = $w1.$w2; |
700 | 699 | //$w = '00'; |
701 | 700 | $custom = ''; |
702 | 701 | if ($ident != '') { |
703 | 702 | if ($custom != '') $custom .= '/'; |
704 | - $custom .= 'CS='.str_replace(' ','_',$ident); |
|
703 | + $custom .= 'CS='.str_replace(' ', '_', $ident); |
|
705 | 704 | } |
706 | 705 | if ($typeid != '') { |
707 | 706 | if ($custom != '') $custom .= '/'; |
@@ -721,11 +720,11 @@ discard block |
||
721 | 720 | } |
722 | 721 | if ($arrival_code != '') { |
723 | 722 | if ($custom != '') $custom .= '/'; |
724 | - $custom .= 'AC='.str_replace(' ','_',$arrival_code); |
|
723 | + $custom .= 'AC='.str_replace(' ', '_', $arrival_code); |
|
725 | 724 | } |
726 | 725 | if ($custom != '') $custom = ' '.$custom; |
727 | 726 | $altitude = 0; |
728 | - $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"); |
|
727 | + $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 | 728 | } |
730 | 729 | } |
731 | 730 | } |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | } else return $ident; |
32 | 32 | } else return $ident; |
33 | 33 | 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'); |
|
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'); |
|
36 | 36 | } else { |
37 | 37 | $identicao = $Spotter->getAllAirlineInfo($airline_icao); |
38 | 38 | if (isset($identicao[0])) { |
39 | - $icao = $identicao[0]['icao'].ltrim(substr($ident,2),'0'); |
|
39 | + $icao = $identicao[0]['icao'].ltrim(substr($ident, 2), '0'); |
|
40 | 40 | } else $icao = $ident; |
41 | 41 | } |
42 | 42 | return $icao; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | try { |
49 | 49 | $sth = $this->db->prepare($query); |
50 | 50 | $sth->execute($query_values); |
51 | - } catch(PDOException $e) { |
|
51 | + } catch (PDOException $e) { |
|
52 | 52 | return "error : ".$e->getMessage(); |
53 | 53 | } |
54 | 54 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -58,29 +58,29 @@ discard block |
||
58 | 58 | } else return $ident; |
59 | 59 | } |
60 | 60 | |
61 | - public function addOperator($ident,$correct_ident,$source) { |
|
61 | + public function addOperator($ident, $correct_ident, $source) { |
|
62 | 62 | $query = "INSERT INTO translation (Operator,Operator_correct,Source) VALUES (:ident,:correct_ident,:source)"; |
63 | - $query_values = array(':ident' => $ident,':correct_ident' => $correct_ident, ':source' => $source); |
|
63 | + $query_values = array(':ident' => $ident, ':correct_ident' => $correct_ident, ':source' => $source); |
|
64 | 64 | try { |
65 | 65 | $sth = $this->db->prepare($query); |
66 | 66 | $sth->execute($query_values); |
67 | - } catch(PDOException $e) { |
|
67 | + } catch (PDOException $e) { |
|
68 | 68 | return "error : ".$e->getMessage(); |
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | - public function updateOperator($ident,$correct_ident,$source) { |
|
72 | + public function updateOperator($ident, $correct_ident, $source) { |
|
73 | 73 | $query = "UPDATE translation SET Operator_correct = :correct_ident,Source = :source WHERE Operator = :ident"; |
74 | - $query_values = array(':ident' => $ident,':correct_ident' => $correct_ident, ':source' => $source); |
|
74 | + $query_values = array(':ident' => $ident, ':correct_ident' => $correct_ident, ':source' => $source); |
|
75 | 75 | try { |
76 | 76 | $sth = $this->db->prepare($query); |
77 | 77 | $sth->execute($query_values); |
78 | - } catch(PDOException $e) { |
|
78 | + } catch (PDOException $e) { |
|
79 | 79 | return "error : ".$e->getMessage(); |
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | - public function checkTranslation($ident,$web = false) { |
|
83 | + public function checkTranslation($ident, $web = false) { |
|
84 | 84 | global $globalTranslationSources, $globalTranslationFetch; |
85 | 85 | //if (!isset($globalTranslationSources)) $globalTranslationSources = array('planefinder'); |
86 | 86 | $globalTranslationSources = array(); |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | |
12 | 12 | function __construct($dbs = null) { |
13 | 13 | if ($dbs === null) { |
14 | - $Connection = new Connection(null,'server'); |
|
14 | + $Connection = new Connection(null, 'server'); |
|
15 | 15 | $this->dbs = $Connection->dbs; |
16 | 16 | $query = "CREATE TABLE IF NOT EXISTS `spotter_temp` ( `id_data` INT NOT NULL AUTO_INCREMENT , `id_user` INT NOT NULL , `datetime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , `hex` VARCHAR(20) NOT NULL , `ident` VARCHAR(20) NULL , `latitude` FLOAT NULL , `longitude` FLOAT NULL , `verticalrate` INT NULL , `speed` INT NULL , `squawk` INT NULL , `altitude` INT NULL , `heading` INT NULL , `registration` VARCHAR(10) NULL , `aircraft_icao` VARCHAR(10) NULL , `waypoints` VARCHAR(255) NULL , `noarchive` BOOLEAN NOT NULL DEFAULT FALSE, `id_source` INT NOT NULL DEFAULT '1', `format_source` VARCHAR(25) NULL, `source_name` VARCHAR(25) NULL, `over_country` VARCHAR(255) NULL, PRIMARY KEY (`id_data`) ) ENGINE = MEMORY;"; |
17 | 17 | try { |
18 | 18 | $sth = $this->dbs['server']->exec($query); |
19 | - } catch(PDOException $e) { |
|
19 | + } catch (PDOException $e) { |
|
20 | 20 | return "error : ".$e->getMessage(); |
21 | 21 | } |
22 | 22 | } |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | date_default_timezone_set('UTC'); |
32 | 32 | //if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'aprs')) { |
33 | 33 | if (isset($line['format_source'])) { |
34 | - if(is_array($line) && isset($line['hex'])) { |
|
34 | + if (is_array($line) && isset($line['hex'])) { |
|
35 | 35 | if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) { |
36 | 36 | $data['hex'] = trim($line['hex']); |
37 | - if (preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
37 | + if (preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/', $line['datetime'])) { |
|
38 | 38 | $data['datetime'] = $line['datetime']; |
39 | 39 | } else $data['datetime'] = date('Y-m-d H:i:s'); |
40 | 40 | if (!isset($line['aircraft_icao'])) { |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | if ($id_user == NULL) $id_user = 1; |
111 | 111 | if (!isset($id_source)) $id_source = 1; |
112 | 112 | $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 | - $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']); |
|
113 | + $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 | 114 | try { |
115 | 115 | $sth = $this->dbs['server']->prepare($query); |
116 | 116 | $sth->execute($query_values); |
117 | - } catch(PDOException $e) { |
|
117 | + } catch (PDOException $e) { |
|
118 | 118 | return "error : ".$e->getMessage(); |
119 | 119 | } |
120 | 120 | } |
@@ -7,13 +7,13 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
11 | -$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
12 | -$spotter_array = $Spotter->getSpotterDataByIdent($ident,"0,1", $sort); |
|
10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
11 | +$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
12 | +$spotter_array = $Spotter->getSpotterDataByIdent($ident, "0,1", $sort); |
|
13 | 13 | |
14 | 14 | if (!empty($spotter_array)) |
15 | 15 | { |
16 | - $title = sprintf(_("Most Common Time of Day of %s"),$spotter_array[0]['ident']); |
|
16 | + $title = sprintf(_("Most Common Time of Day of %s"), $spotter_array[0]['ident']); |
|
17 | 17 | require_once('header.php'); |
18 | 18 | print '<div class="info column">'; |
19 | 19 | print '<h1>'.$spotter_array[0]['ident'].'</h1>'; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | include('ident-sub-menu.php'); |
25 | 25 | print '<div class="column">'; |
26 | 26 | print '<h2>'._("Most Common Time of Day").'</h2>'; |
27 | - print '<p>'.sprintf(_("The statistic below shows the most common time of day of flights with the ident/callsign <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
27 | + print '<p>'.sprintf(_("The statistic below shows the most common time of day of flights with the ident/callsign <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>'; |
|
28 | 28 | $hour_array = $Spotter->countAllHoursByIdent($ident); |
29 | 29 | print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">'; |
30 | 30 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | $hour_data = ''; |
34 | 34 | $hour_cnt = ''; |
35 | 35 | $last = 0; |
36 | - foreach($hour_array as $hour_item) |
|
36 | + foreach ($hour_array as $hour_item) |
|
37 | 37 | { |
38 | - while($last != $hour_item['hour_name']) { |
|
38 | + while ($last != $hour_item['hour_name']) { |
|
39 | 39 | $hour_data .= '"'.$last.':00",'; |
40 | 40 | $hour_cnt .= '0,'; |
41 | 41 | $last++; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $hour_cnt .= $hour_item['hour_count'].','; |
46 | 46 | } |
47 | 47 | $hour_data = "['x',".substr($hour_data, 0, -1)."]"; |
48 | - $hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]"; |
|
48 | + $hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]"; |
|
49 | 49 | print 'c3.generate({ |
50 | 50 | bindto: "#chartHour", |
51 | 51 | data: { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | print '</thead>'; |
71 | 71 | print '<tbody>'; |
72 | 72 | $i = 1; |
73 | - foreach($hour_array as $hour_item) |
|
73 | + foreach ($hour_array as $hour_item) |
|
74 | 74 | { |
75 | 75 | print '<tr>'; |
76 | 76 | print '<td>'.$hour_item['hour_name'].':00</td>'; |
@@ -5,14 +5,14 @@ discard block |
||
5 | 5 | $Spotter = new Spotter(); |
6 | 6 | if (isset($_GET['start_date'])) { |
7 | 7 | //for the date manipulation into the query |
8 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
8 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
9 | 9 | $start_date = $_GET['start_date'].":00"; |
10 | 10 | $end_date = $_GET['end_date'].":00"; |
11 | 11 | $sql_date = $start_date.",".$end_date; |
12 | - } else if($_GET['start_date'] != ""){ |
|
12 | + } else if ($_GET['start_date'] != "") { |
|
13 | 13 | $start_date = $_GET['start_date'].":00"; |
14 | 14 | $sql_date = $start_date; |
15 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
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 | 18 | } else $sql_date = ''; |
@@ -20,38 +20,38 @@ discard block |
||
20 | 20 | |
21 | 21 | if (isset($_GET['highest_altitude'])) { |
22 | 22 | //for altitude manipulation |
23 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
24 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
25 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
23 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
24 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
25 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
26 | 26 | $sql_altitude = $start_altitude.",".$end_altitude; |
27 | - } else if($_GET['highest_altitude'] != ""){ |
|
28 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
27 | + } else if ($_GET['highest_altitude'] != "") { |
|
28 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
29 | 29 | $sql_altitude = $end_altitude; |
30 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
31 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
30 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
31 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
32 | 32 | $sql_altitude = $start_altitude; |
33 | 33 | } else $sql_altitude = ''; |
34 | 34 | } else $sql_altitude = ''; |
35 | 35 | |
36 | 36 | //calculuation for the pagination |
37 | -if(!isset($_GET['limit'])) |
|
37 | +if (!isset($_GET['limit'])) |
|
38 | 38 | { |
39 | 39 | if (!isset($_GET['number_results'])) { |
40 | 40 | $limit_start = 0; |
41 | 41 | $limit_end = 25; |
42 | 42 | $absolute_difference = 25; |
43 | 43 | } else { |
44 | - if ($_GET['number_results'] > 1000){ |
|
44 | + if ($_GET['number_results'] > 1000) { |
|
45 | 45 | $_GET['number_results'] = 1000; |
46 | 46 | } |
47 | 47 | $limit_start = 0; |
48 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
49 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
48 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
49 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
50 | 50 | } |
51 | -} else { |
|
51 | +} else { |
|
52 | 52 | $limit_explode = explode(",", $_GET['limit']); |
53 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
54 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
53 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
54 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | $absolute_difference = abs($limit_start - $limit_end); |
@@ -68,23 +68,23 @@ discard block |
||
68 | 68 | |
69 | 69 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
70 | 70 | else $sort = ''; |
71 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
72 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
73 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
74 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
75 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
76 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
77 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
78 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
79 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
80 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
81 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
82 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
83 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
84 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
85 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
86 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
87 | -$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
71 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
72 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
73 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
74 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
75 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
76 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
77 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
78 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
79 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
80 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
81 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
82 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
83 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
84 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
85 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
86 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
87 | +$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
88 | 88 | |
89 | 89 | $output = '{'; |
90 | 90 | $output .= '"flightairmap": {'; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $output .= '"aircraft": ['; |
94 | 94 | |
95 | 95 | if (!empty($spotter_array)) { |
96 | - foreach($spotter_array as $spotter_item) { |
|
96 | + foreach ($spotter_array as $spotter_item) { |
|
97 | 97 | $output .= '{'; |
98 | 98 | $output .= '"id": "'.$spotter_item['spotter_id'].'",'; |
99 | 99 | $output .= '"ident": "'.$spotter_item['ident'].'",'; |
@@ -5,14 +5,14 @@ discard block |
||
5 | 5 | $Spotter = new Spotter(); |
6 | 6 | if (isset($_GET['start_date'])) { |
7 | 7 | //for the date manipulation into the query |
8 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
8 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
9 | 9 | $start_date = $_GET['start_date'].":00"; |
10 | 10 | $end_date = $_GET['end_date'].":00"; |
11 | 11 | $sql_date = $start_date.",".$end_date; |
12 | - } else if($_GET['start_date'] != ""){ |
|
12 | + } else if ($_GET['start_date'] != "") { |
|
13 | 13 | $start_date = $_GET['start_date'].":00"; |
14 | 14 | $sql_date = $start_date; |
15 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
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 | 18 | } else $sql_date = ''; |
@@ -20,38 +20,38 @@ discard block |
||
20 | 20 | |
21 | 21 | if (isset($_GET['highest_altitude'])) { |
22 | 22 | //for altitude manipulation |
23 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
24 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
25 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
23 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
24 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
25 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
26 | 26 | $sql_altitude = $start_altitude.",".$end_altitude; |
27 | - } else if($_GET['highest_altitude'] != ""){ |
|
28 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
27 | + } else if ($_GET['highest_altitude'] != "") { |
|
28 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
29 | 29 | $sql_altitude = $end_altitude; |
30 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
31 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
30 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
31 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
32 | 32 | $sql_altitude = $start_altitude; |
33 | 33 | } else $sql_altitude = ''; |
34 | 34 | } else $sql_altitude = ''; |
35 | 35 | |
36 | 36 | //calculuation for the pagination |
37 | -if(!isset($_GET['limit'])) |
|
37 | +if (!isset($_GET['limit'])) |
|
38 | 38 | { |
39 | 39 | if (!isset($_GET['number_results'])) { |
40 | 40 | $limit_start = 0; |
41 | 41 | $limit_end = 25; |
42 | 42 | $absolute_difference = 25; |
43 | 43 | } else { |
44 | - if ($_GET['number_results'] > 1000){ |
|
44 | + if ($_GET['number_results'] > 1000) { |
|
45 | 45 | $_GET['number_results'] = 1000; |
46 | 46 | } |
47 | 47 | $limit_start = 0; |
48 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
49 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
48 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
49 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
50 | 50 | } |
51 | -} else { |
|
51 | +} else { |
|
52 | 52 | $limit_explode = explode(",", $_GET['limit']); |
53 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
54 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
53 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
54 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | $absolute_difference = abs($limit_start - $limit_end); |
@@ -68,27 +68,27 @@ discard block |
||
68 | 68 | |
69 | 69 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
70 | 70 | else $sort = ''; |
71 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
72 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
73 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
74 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
75 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
76 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
77 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
78 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
79 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
80 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
81 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
82 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
83 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
84 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
85 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
86 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
87 | -$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
71 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
72 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
73 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
74 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
75 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
76 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
77 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
78 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
79 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
80 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
81 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
82 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
83 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
84 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
85 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
86 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
87 | +$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
88 | 88 | |
89 | 89 | $flights = array(); |
90 | 90 | if (!empty($spotter_array)) { |
91 | - foreach($spotter_array as $spotter_item) { |
|
91 | + foreach ($spotter_array as $spotter_item) { |
|
92 | 92 | array_push($flights, array( |
93 | 93 | "id" => $spotter_item['spotter_id'], |
94 | 94 | "ident" => $spotter_item['ident'], |
@@ -5,14 +5,14 @@ discard block |
||
5 | 5 | $Spotter = new Spotter(); |
6 | 6 | if (isset($_GET['start_date'])) { |
7 | 7 | //for the date manipulation into the query |
8 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
8 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
9 | 9 | $start_date = $_GET['start_date'].":00"; |
10 | 10 | $end_date = $_GET['end_date'].":00"; |
11 | 11 | $sql_date = $start_date.",".$end_date; |
12 | - } else if($_GET['start_date'] != ""){ |
|
12 | + } else if ($_GET['start_date'] != "") { |
|
13 | 13 | $start_date = $_GET['start_date'].":00"; |
14 | 14 | $sql_date = $start_date; |
15 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
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 | 18 | } else $sql_date = ''; |
@@ -20,21 +20,21 @@ discard block |
||
20 | 20 | |
21 | 21 | if (isset($_GET['highest_altitude'])) { |
22 | 22 | //for altitude manipulation |
23 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
24 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
25 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
23 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
24 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
25 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
26 | 26 | $sql_altitude = $start_altitude.",".$end_altitude; |
27 | - } else if($_GET['highest_altitude'] != ""){ |
|
28 | - $end_altitude = filter_input(iNPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
27 | + } else if ($_GET['highest_altitude'] != "") { |
|
28 | + $end_altitude = filter_input(iNPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
29 | 29 | $sql_altitude = $end_altitude; |
30 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
31 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
30 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
31 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
32 | 32 | $sql_altitude = $start_altitude; |
33 | 33 | } else $sql_altitude = ''; |
34 | 34 | } else $sql_altitude = ''; |
35 | 35 | |
36 | 36 | //calculuation for the pagination |
37 | -if(!isset($_GET['limit'])) |
|
37 | +if (!isset($_GET['limit'])) |
|
38 | 38 | { |
39 | 39 | if (!isset($_GET['number_results'])) |
40 | 40 | { |
@@ -42,17 +42,17 @@ discard block |
||
42 | 42 | $limit_end = 25; |
43 | 43 | $absolute_difference = 25; |
44 | 44 | } else { |
45 | - if ($_GET['number_results'] > 1000){ |
|
45 | + if ($_GET['number_results'] > 1000) { |
|
46 | 46 | $_GET['number_results'] = 1000; |
47 | 47 | } |
48 | 48 | $limit_start = 0; |
49 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
50 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
49 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
50 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
51 | 51 | } |
52 | -} else { |
|
52 | +} else { |
|
53 | 53 | $limit_explode = explode(",", $_GET['limit']); |
54 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
55 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
54 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
55 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | $absolute_difference = abs($limit_start - $limit_end); |
@@ -72,23 +72,23 @@ discard block |
||
72 | 72 | |
73 | 73 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
74 | 74 | else $sort = ''; |
75 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
76 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
77 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
78 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
79 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
80 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
81 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
82 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
83 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
84 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
85 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
86 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
87 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
88 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
89 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
90 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
91 | -$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
75 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
76 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
77 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
78 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
79 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
80 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
81 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
82 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
83 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
84 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
85 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
86 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
87 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
88 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
89 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
90 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
91 | +$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
92 | 92 | |
93 | 93 | print '<?xml version="1.0" encoding="UTF-8" ?>'; |
94 | 94 | print '<feed xmlns="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">'; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | print '</author>'; |
104 | 104 | print '<id>FlightAirMap</id>'; |
105 | 105 | if (!empty($spotter_array)) { |
106 | - foreach($spotter_array as $spotter_item) { |
|
106 | + foreach ($spotter_array as $spotter_item) { |
|
107 | 107 | print '<entry>'; |
108 | 108 | print '<title>'.$spotter_item['ident'].' '.$spotter_item['airline_name'].' | '.$spotter_item['registration'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].') | '.$spotter_item['departure_airport'].' - '.$spotter_item['arrival_airport'].'</title>'; |
109 | 109 | print '<link href="http://www.flightairmap.fr/flightid/'.$spotter_item['spotter_id'].'"/>'; |
@@ -5,14 +5,14 @@ discard block |
||
5 | 5 | $Spotter = new Spotter(); |
6 | 6 | if (isset($_GET['start_date'])) { |
7 | 7 | //for the date manipulation into the query |
8 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
8 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
9 | 9 | $start_date = $_GET['start_date'].":00"; |
10 | 10 | $end_date = $_GET['end_date'].":00"; |
11 | 11 | $sql_date = $start_date.",".$end_date; |
12 | - } else if($_GET['start_date'] != ""){ |
|
12 | + } else if ($_GET['start_date'] != "") { |
|
13 | 13 | $start_date = $_GET['start_date'].":00"; |
14 | 14 | $sql_date = $start_date; |
15 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
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 | 18 | } else $sql_date = ''; |
@@ -20,37 +20,37 @@ discard block |
||
20 | 20 | |
21 | 21 | if (isset($_GET['highest_altitude'])) { |
22 | 22 | //for altitude manipulation |
23 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
24 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
25 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
23 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
24 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
25 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
26 | 26 | $sql_altitude = $start_altitude.",".$end_altitude; |
27 | - } else if($_GET['highest_altitude'] != ""){ |
|
28 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
27 | + } else if ($_GET['highest_altitude'] != "") { |
|
28 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
29 | 29 | $sql_altitude = $end_altitude; |
30 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
31 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
30 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
31 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
32 | 32 | $sql_altitude = $start_altitude; |
33 | 33 | } else $sql_altitude = ''; |
34 | 34 | } else $sql_altitude = ''; |
35 | 35 | |
36 | 36 | //calculuation for the pagination |
37 | -if(!isset($_GET['limit'])) { |
|
37 | +if (!isset($_GET['limit'])) { |
|
38 | 38 | if (!isset($_GET['number_results'])) { |
39 | 39 | $limit_start = 0; |
40 | 40 | $limit_end = 25; |
41 | 41 | $absolute_difference = 25; |
42 | 42 | } else { |
43 | - if ($_GET['number_results'] > 1000){ |
|
43 | + if ($_GET['number_results'] > 1000) { |
|
44 | 44 | $_GET['number_results'] = 1000; |
45 | 45 | } |
46 | 46 | $limit_start = 0; |
47 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
48 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
47 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
48 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
49 | 49 | } |
50 | -} else { |
|
50 | +} else { |
|
51 | 51 | $limit_explode = explode(",", $_GET['limit']); |
52 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
53 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
52 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
53 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $absolute_difference = abs($limit_start - $limit_end); |
@@ -68,23 +68,23 @@ discard block |
||
68 | 68 | $date = date("D, d M Y H:i:s T", time()); |
69 | 69 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
70 | 70 | else $sort = ''; |
71 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
72 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
73 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
74 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
75 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
76 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
77 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
78 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
79 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
80 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
81 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
82 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
83 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
84 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
85 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
86 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
87 | -$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
71 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
72 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
73 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
74 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
75 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
76 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
77 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
78 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
79 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
80 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
81 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
82 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
83 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
84 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
85 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
86 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
87 | +$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
88 | 88 | |
89 | 89 | print '<?xml version="1.0" encoding="UTF-8" ?>'; |
90 | 90 | print '<rss xmlns:flightairmap="http://'.$_SERVER['HTTP_HOST'].''.htmlentities($_SERVER['REQUEST_URI']).'" version="2.0">'; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | print '<lastBuildDate>'.$date.'</lastBuildDate>'; |
98 | 98 | |
99 | 99 | if (!empty($spotter_array)) { |
100 | - foreach($spotter_array as $spotter_item) { |
|
100 | + foreach ($spotter_array as $spotter_item) { |
|
101 | 101 | print '<item>'; |
102 | 102 | print '<title>'.$spotter_item['ident'].' '.$spotter_item['airline_name'].' | '.$spotter_item['registration'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].') | '.$spotter_item['departure_airport'].' - '.$spotter_item['arrival_airport'].'</title>'; |
103 | 103 | print '<link>http://www.flightairmap.fr/flightid/'.$spotter_item['spotter_id'].'</link>'; |