@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /* |
22 | 22 | * Initialize DB connection |
23 | 23 | */ |
24 | - public function __construct($dbc = null,$fromACARSscript = false) { |
|
24 | + public function __construct($dbc = null, $fromACARSscript = false) { |
|
25 | 25 | $Connection = new Connection($dbc); |
26 | 26 | $this->db = $Connection->db(); |
27 | 27 | if ($this->db === null) die('Error: No DB connection. (ACARS)'); |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | * @return String the icao |
39 | 39 | */ |
40 | 40 | public function ident2icao($ident) { |
41 | - if (substr($ident,0,2) == 'AF') { |
|
42 | - if (filter_var(substr($ident,2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $ident; |
|
43 | - else $icao = 'AFR'.ltrim(substr($ident,2),'0'); |
|
41 | + if (substr($ident, 0, 2) == 'AF') { |
|
42 | + if (filter_var(substr($ident, 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $ident; |
|
43 | + else $icao = 'AFR'.ltrim(substr($ident, 2), '0'); |
|
44 | 44 | } else { |
45 | 45 | $Spotter = new Spotter($this->db); |
46 | - $identicao = $Spotter->getAllAirlineInfo(substr($ident,0,2)); |
|
46 | + $identicao = $Spotter->getAllAirlineInfo(substr($ident, 0, 2)); |
|
47 | 47 | if (isset($identicao[0])) { |
48 | - $icao = $identicao[0]['icao'].ltrim(substr($ident,2),'0'); |
|
48 | + $icao = $identicao[0]['icao'].ltrim(substr($ident, 2), '0'); |
|
49 | 49 | } else $icao = $ident; |
50 | 50 | } |
51 | 51 | return $icao; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | $sth = $this->db->prepare($query); |
71 | 71 | $sth->execute(); |
72 | - } catch(PDOException $e) { |
|
72 | + } catch (PDOException $e) { |
|
73 | 73 | return "error"; |
74 | 74 | } |
75 | 75 | return "success"; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | $sth = $this->db->prepare($query); |
95 | 95 | $sth->execute(); |
96 | - } catch(PDOException $e) { |
|
96 | + } catch (PDOException $e) { |
|
97 | 97 | return "error"; |
98 | 98 | } |
99 | 99 | return "success"; |
@@ -119,13 +119,13 @@ discard block |
||
119 | 119 | $ident = ''; |
120 | 120 | $message = ''; |
121 | 121 | $result = array(); |
122 | - $n = sscanf($data,'%*[0-9a-z.] %*d %*02d/%*02d/%*04d %*02d:%*02d:%*02d %*d %*[0-9-] %*[A-Z0-9] %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message); |
|
123 | - if ($n == 0) $n = sscanf($data,'AC%*c %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message); |
|
124 | - if ($n == 0) $n = sscanf($data,'%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%6[0-9A-Z-],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message); |
|
125 | - if ($n == 0) $n = sscanf($data,'%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%5[0-9A-Z],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message); |
|
122 | + $n = sscanf($data, '%*[0-9a-z.] %*d %*02d/%*02d/%*04d %*02d:%*02d:%*02d %*d %*[0-9-] %*[A-Z0-9] %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]', $registration, $label, $block_id, $msg_no, $ident, $message); |
|
123 | + if ($n == 0) $n = sscanf($data, 'AC%*c %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]', $registration, $label, $block_id, $msg_no, $ident, $message); |
|
124 | + if ($n == 0) $n = sscanf($data, '%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%6[0-9A-Z-],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]', $registration, $label, $block_id, $msg_no, $ident, $message); |
|
125 | + if ($n == 0) $n = sscanf($data, '%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%5[0-9A-Z],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]', $registration, $label, $block_id, $msg_no, $ident, $message); |
|
126 | 126 | if ($n != 0 && ($registration != '' || $ident != '' || $label != '' || $block_id != '' || $msg_no != '')) { |
127 | - $registration = str_replace('.','',$registration); |
|
128 | - $result = array('registration' => $registration, 'ident' => $ident,'label' => $label, 'block_id' => $block_id,'msg_no' => $msg_no,'message' => $message); |
|
127 | + $registration = str_replace('.', '', $registration); |
|
128 | + $result = array('registration' => $registration, 'ident' => $ident, 'label' => $label, 'block_id' => $block_id, 'msg_no' => $msg_no, 'message' => $message); |
|
129 | 129 | if ($globalDebug) echo "Reg. : ".$registration." - Ident : ".$ident." - Label : ".$label." - Message : ".$message."\n"; |
130 | 130 | } else $message = $data; |
131 | 131 | $decode = array(); |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | $temp = ''; |
146 | 146 | $n = sscanf($message, "FST01%4c%4c%c%06d%c%07d%03d%*8[0-9a-zA-Z ]-%02dC", $dair, $darr, $lac, $la, $lnc, $ln, $alt, $temp); |
147 | 147 | if ($n > 5 && ($lac == 'N' || $lac == 'S') && ($lnc == 'E' || $lnc == 'W')) { |
148 | - $latitude = $la / 10000.0; |
|
149 | - $longitude = $ln / 10000.0; |
|
148 | + $latitude = $la/10000.0; |
|
149 | + $longitude = $ln/10000.0; |
|
150 | 150 | if ($lac == 'S') $latitude = '-'.$latitude; |
151 | 151 | if ($lnc == 'W') $longitude = '-'.$longitude; |
152 | 152 | // Temp not always available |
153 | 153 | if ($globalDebug) echo 'latitude : '.$latitude.' - longitude : '.$longitude.' - airport depart : '.$dair.' - airport arrival : '.$darr.' - température : '.$temp."°C\n"; |
154 | - if ($temp == '') $decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr,'Altitude' => $alt); |
|
155 | - else $decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr, 'Altitude' => 'FL'.$alt,'Temperature' => $temp.'°C'); |
|
154 | + if ($temp == '') $decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr, 'Altitude' => $alt); |
|
155 | + else $decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr, 'Altitude' => 'FL'.$alt, 'Temperature' => $temp.'°C'); |
|
156 | 156 | |
157 | 157 | //$icao = $Translation->checkTranslation($ident); |
158 | 158 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
@@ -164,19 +164,19 @@ discard block |
||
164 | 164 | $dhour = ''; |
165 | 165 | $darr = ''; |
166 | 166 | $ahour = ''; |
167 | - $n = sscanf($message, "ARR01 %4[A-Z]%4d %4[A-Z]%4d", $dair, $dhour, $darr,$ahour); |
|
167 | + $n = sscanf($message, "ARR01 %4[A-Z]%4d %4[A-Z]%4d", $dair, $dhour, $darr, $ahour); |
|
168 | 168 | if ($n == 4 && strlen($darr) == 4) { |
169 | - if ($dhour != '') $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2); |
|
170 | - if ($ahour != '') $ahour = substr(sprintf('%04d',$ahour),0,2).':'.substr(sprintf('%04d',$ahour),2); |
|
171 | - if ($globalDebug) echo 'departure airport : '.$dair.' - arrival airport : '. $darr.' - departure hour : '. $dhour.' - arrival hour : '.$ahour."\n"; |
|
169 | + if ($dhour != '') $dhour = substr(sprintf('%04d', $dhour), 0, 2).':'.substr(sprintf('%04d', $dhour), 2); |
|
170 | + if ($ahour != '') $ahour = substr(sprintf('%04d', $ahour), 0, 2).':'.substr(sprintf('%04d', $ahour), 2); |
|
171 | + if ($globalDebug) echo 'departure airport : '.$dair.' - arrival airport : '.$darr.' - departure hour : '.$dhour.' - arrival hour : '.$ahour."\n"; |
|
172 | 172 | //$icao = ACARS->ident2icao($ident); |
173 | 173 | //$icao = $Translation->checkTranslation($ident); |
174 | 174 | //$Schedule->addSchedule($icao,$dair,$dhour,$darr,$ahour,'ACARS'); |
175 | 175 | $decode = array('Departure airport' => $dair, 'Departure hour' => $dhour, 'Arrival airport' => $darr, 'Arrival hour' => $ahour); |
176 | 176 | $found = true; |
177 | 177 | } |
178 | - elseif ($n == 2 || $n == 4) { |
|
179 | - if ($dhour != '') $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2); |
|
178 | + elseif ($n == 2 || $n == 4) { |
|
179 | + if ($dhour != '') $dhour = substr(sprintf('%04d', $dhour), 0, 2).':'.substr(sprintf('%04d', $dhour), 2); |
|
180 | 180 | if ($globalDebug) echo 'airport arrival : '.$dair.' - arrival hour : '.$dhour."\n"; |
181 | 181 | //$icao = ACARS->ident2icao($ident); |
182 | 182 | //$icao = $Translation->checkTranslation($ident); |
@@ -234,11 +234,11 @@ discard block |
||
234 | 234 | $ahour = ''; |
235 | 235 | $aair = ''; |
236 | 236 | $apiste = ''; |
237 | - $n = sscanf(str_replace(array("\r\n", "\n", "\r"),'',$message), "%*[0-9A-Z]/%*3d/%4s/%*cSCH/%6[0-9A-Z ]/%4c/%4c/%5s/%4d%*3c/%4d/%4c/%[0-9A-Z ]/", $airicao,$aident,$dair, $darr, $ddate, $dhour,$ahour, $aair, $apiste); |
|
237 | + $n = sscanf(str_replace(array("\r\n", "\n", "\r"), '', $message), "%*[0-9A-Z]/%*3d/%4s/%*cSCH/%6[0-9A-Z ]/%4c/%4c/%5s/%4d%*3c/%4d/%4c/%[0-9A-Z ]/", $airicao, $aident, $dair, $darr, $ddate, $dhour, $ahour, $aair, $apiste); |
|
238 | 238 | if ($n > 8) { |
239 | - if ($globalDebug) echo 'airicao : '. $airicao.' - ident : '.$aident.' - departure airport : '.$dair.' - arrival airport : '. $darr.' - date depart : '.$ddate.' - departure hour : '. $dhour.' - arrival hour : '.$ahour.' - arrival airport : '.$aair.' - arrival piste : '.$apiste."\n"; |
|
240 | - if ($dhour != '') $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2); |
|
241 | - if ($ahour != '') $ahour = substr(sprintf('%04d',$ahour),0,2).':'.substr(sprintf('%04d',$ahour),2); |
|
239 | + if ($globalDebug) echo 'airicao : '.$airicao.' - ident : '.$aident.' - departure airport : '.$dair.' - arrival airport : '.$darr.' - date depart : '.$ddate.' - departure hour : '.$dhour.' - arrival hour : '.$ahour.' - arrival airport : '.$aair.' - arrival piste : '.$apiste."\n"; |
|
240 | + if ($dhour != '') $dhour = substr(sprintf('%04d', $dhour), 0, 2).':'.substr(sprintf('%04d', $dhour), 2); |
|
241 | + if ($ahour != '') $ahour = substr(sprintf('%04d', $ahour), 0, 2).':'.substr(sprintf('%04d', $ahour), 2); |
|
242 | 242 | $icao = trim($aident); |
243 | 243 | |
244 | 244 | //$decode = 'Departure airport : '.$dair.' ('.$ddate.' at '.$dhour.') - Arrival Airport : '.$aair.' (at '.$ahour.') way '.$apiste; |
@@ -263,8 +263,8 @@ discard block |
||
263 | 263 | if ($n == 10 && ($lac == 'N' || $lac == 'S') && ($lnc == 'E' || $lnc == 'W')) { |
264 | 264 | $las = $las.'.'.$lass; |
265 | 265 | $lns = $lns.'.'.$lns; |
266 | - $latitude = $las / 1000.0; |
|
267 | - $longitude = $lns / 1000.0; |
|
266 | + $latitude = $las/1000.0; |
|
267 | + $longitude = $lns/1000.0; |
|
268 | 268 | if ($lac == 'S') $latitude = '-'.$latitude; |
269 | 269 | if ($lnc == 'W') $longitude = '-'.$longitude; |
270 | 270 | if ($globalDebug) echo 'latitude : '.$latitude.' - longitude : '.$longitude."\n"; |
@@ -359,17 +359,17 @@ discard block |
||
359 | 359 | $alt = ''; |
360 | 360 | $fuel = ''; |
361 | 361 | $speed = ''; |
362 | - $n = sscanf(str_replace(array("\r\n", "\n", "\r"),'',$message), "#DFB(POS-%s -%4d%c%5d%c/%*d F%dRMK/FUEL %f M%f", $aident, $las, $lac, $lns, $lnc, $alt, $fuel, $speed); |
|
362 | + $n = sscanf(str_replace(array("\r\n", "\n", "\r"), '', $message), "#DFB(POS-%s -%4d%c%5d%c/%*d F%dRMK/FUEL %f M%f", $aident, $las, $lac, $lns, $lnc, $alt, $fuel, $speed); |
|
363 | 363 | if ($n == 9) { |
364 | 364 | //if (self->$debug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
365 | 365 | $icao = trim($aident); |
366 | 366 | $decode['icao'] = $icao; |
367 | - $latitude = $las / 100.0; |
|
368 | - $longitude = $lns / 100.0; |
|
367 | + $latitude = $las/100.0; |
|
368 | + $longitude = $lns/100.0; |
|
369 | 369 | if ($lac == 'S') $latitude = '-'.$latitude; |
370 | 370 | if ($lnc == 'W') $longitude = '-'.$longitude; |
371 | 371 | |
372 | - $decode = array('Latitude' => $latitude,'Longitude' => $longitude,'Altitude' => 'FL'.$alt,'Fuel' => $fuel,'speed' => $speed); |
|
372 | + $decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Altitude' => 'FL'.$alt, 'Fuel' => $fuel, 'speed' => $speed); |
|
373 | 373 | $found = true; |
374 | 374 | } |
375 | 375 | } |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | if ($lac == 'S') $latitude = '-'.$latitude; |
389 | 389 | if ($lnc == 'W') $longitude = '-'.$longitude; |
390 | 390 | |
391 | - $decode = array('Latitude' => $latitude,'Longitude' => $longitude); |
|
391 | + $decode = array('Latitude' => $latitude, 'Longitude' => $longitude); |
|
392 | 392 | $found = true; |
393 | 393 | } |
394 | 394 | } |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | $dair = ''; |
422 | 422 | $darr = ''; |
423 | 423 | $aident = ''; |
424 | - $n = sscanf(str_replace(array("\r\n", "\n", "\r"),'',$message), "%*[0-9A-Z],,%*[0-9A-Z],%*[0-9A-Z],%4s,%4s,.%*6s,%*4[A-Z],%[0-9A-Z],", $dair, $darr, $aident); |
|
424 | + $n = sscanf(str_replace(array("\r\n", "\n", "\r"), '', $message), "%*[0-9A-Z],,%*[0-9A-Z],%*[0-9A-Z],%4s,%4s,.%*6s,%*4[A-Z],%[0-9A-Z],", $dair, $darr, $aident); |
|
425 | 425 | if ($n == 8) { |
426 | 426 | if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
427 | 427 | $icao = trim($aident); |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | */ |
454 | 454 | $dair = ''; |
455 | 455 | $darr = ''; |
456 | - $n = sscanf($message,'%4[A-Z]%4[A-Z]%*4d',$dair,$darr); |
|
456 | + $n = sscanf($message, '%4[A-Z]%4[A-Z]%*4d', $dair, $darr); |
|
457 | 457 | if ($n == 3) { |
458 | 458 | if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
459 | 459 | //$icao = $Translation->checkTranslation($ident); |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | */ |
469 | 469 | $dair = ''; |
470 | 470 | $darr = ''; |
471 | - $n = sscanf($message,'3J01 DSPTCH %*d/%*d %4s/%4s .%*6s',$dair,$darr); |
|
471 | + $n = sscanf($message, '3J01 DSPTCH %*d/%*d %4s/%4s .%*6s', $dair, $darr); |
|
472 | 472 | if ($n == 3) { |
473 | 473 | if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
474 | 474 | //$icao = $Translation->checkTranslation($ident); |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | } |
479 | 479 | } |
480 | 480 | if (!$found) { |
481 | - $n = sscanf($message,'MET01%4c',$airport); |
|
481 | + $n = sscanf($message, 'MET01%4c', $airport); |
|
482 | 482 | if ($n == 1) { |
483 | 483 | if ($globalDebug) echo 'airport name : '.$airport; |
484 | 484 | $decode = array('Airport/Waypoint name' => $airport); |
@@ -486,241 +486,241 @@ discard block |
||
486 | 486 | } |
487 | 487 | } |
488 | 488 | if ($label == 'H1') { |
489 | - if (preg_match('/^#CFBFLR/',$message) || preg_match('/^#CFBWRN/',$message)) { |
|
490 | - $decode = array_merge(array('Message nature' => 'Equipment failure'),$decode); |
|
489 | + if (preg_match('/^#CFBFLR/', $message) || preg_match('/^#CFBWRN/', $message)) { |
|
490 | + $decode = array_merge(array('Message nature' => 'Equipment failure'), $decode); |
|
491 | 491 | } |
492 | - elseif (preg_match('/^#DFB\*TKO/',$message) || preg_match('/^#DFBTKO/',$message)) { |
|
493 | - $decode = array_merge(array('Message nature' => 'Take off performance data'),$decode); |
|
492 | + elseif (preg_match('/^#DFB\*TKO/', $message) || preg_match('/^#DFBTKO/', $message)) { |
|
493 | + $decode = array_merge(array('Message nature' => 'Take off performance data'), $decode); |
|
494 | 494 | } |
495 | - elseif (preg_match('/^#DFB\*CRZ/',$message) || preg_match('/^#DFBCRZ/',$message)) { |
|
496 | - $decode = array_merge(array('Message nature' => 'Cruise performance data'),$decode); |
|
495 | + elseif (preg_match('/^#DFB\*CRZ/', $message) || preg_match('/^#DFBCRZ/', $message)) { |
|
496 | + $decode = array_merge(array('Message nature' => 'Cruise performance data'), $decode); |
|
497 | 497 | } |
498 | - elseif (preg_match('/^#DFB\*WOB/',$message) || preg_match('/^#DFBWOB/',$message)) { |
|
499 | - $decode = array_merge(array('Message nature' => 'Weather observation'),$decode); |
|
498 | + elseif (preg_match('/^#DFB\*WOB/', $message) || preg_match('/^#DFBWOB/', $message)) { |
|
499 | + $decode = array_merge(array('Message nature' => 'Weather observation'), $decode); |
|
500 | 500 | } |
501 | - elseif (preg_match(':^#DFB/PIREP:',$message)) { |
|
502 | - $decode = array_merge(array('Message nature' => 'Pilot Report'),$decode); |
|
501 | + elseif (preg_match(':^#DFB/PIREP:', $message)) { |
|
502 | + $decode = array_merge(array('Message nature' => 'Pilot Report'), $decode); |
|
503 | 503 | } |
504 | - elseif (preg_match('/^#DFBEDA/',$message) || preg_match('/^#DFBENG/',$message)) { |
|
505 | - $decode = array_merge(array('Message nature' => 'Engine Data'),$decode); |
|
504 | + elseif (preg_match('/^#DFBEDA/', $message) || preg_match('/^#DFBENG/', $message)) { |
|
505 | + $decode = array_merge(array('Message nature' => 'Engine Data'), $decode); |
|
506 | 506 | } |
507 | - elseif (preg_match(':^#M1AAEP:',$message)) { |
|
508 | - $decode = array_merge(array('Message nature' => 'Position/Weather Report'),$decode); |
|
507 | + elseif (preg_match(':^#M1AAEP:', $message)) { |
|
508 | + $decode = array_merge(array('Message nature' => 'Position/Weather Report'), $decode); |
|
509 | 509 | } |
510 | - elseif (preg_match(':^#M2APWD:',$message)) { |
|
511 | - $decode = array_merge(array('Message nature' => 'Flight plan predicted wind data'),$decode); |
|
510 | + elseif (preg_match(':^#M2APWD:', $message)) { |
|
511 | + $decode = array_merge(array('Message nature' => 'Flight plan predicted wind data'), $decode); |
|
512 | 512 | } |
513 | - elseif (preg_match(':^#M1BREQPWI:',$message)) { |
|
514 | - $decode = array_merge(array('Message nature' => 'Predicted wind info request'),$decode); |
|
513 | + elseif (preg_match(':^#M1BREQPWI:', $message)) { |
|
514 | + $decode = array_merge(array('Message nature' => 'Predicted wind info request'), $decode); |
|
515 | 515 | } |
516 | - elseif (preg_match(':^#CF:',$message)) { |
|
517 | - $decode = array_merge(array('Message nature' => 'Central Fault Display'),$decode); |
|
516 | + elseif (preg_match(':^#CF:', $message)) { |
|
517 | + $decode = array_merge(array('Message nature' => 'Central Fault Display'), $decode); |
|
518 | 518 | } |
519 | - elseif (preg_match(':^#DF:',$message)) { |
|
520 | - $decode = array_merge(array('Message nature' => 'Digital Flight Data Acquisition Unit'),$decode); |
|
519 | + elseif (preg_match(':^#DF:', $message)) { |
|
520 | + $decode = array_merge(array('Message nature' => 'Digital Flight Data Acquisition Unit'), $decode); |
|
521 | 521 | } |
522 | - elseif (preg_match(':^#EC:',$message)) { |
|
523 | - $decode = array_merge(array('Message nature' => 'Engine Display System'),$decode); |
|
522 | + elseif (preg_match(':^#EC:', $message)) { |
|
523 | + $decode = array_merge(array('Message nature' => 'Engine Display System'), $decode); |
|
524 | 524 | } |
525 | - elseif (preg_match(':^#EI:',$message)) { |
|
526 | - $decode = array_merge(array('Message nature' => 'Engine Report'),$decode); |
|
525 | + elseif (preg_match(':^#EI:', $message)) { |
|
526 | + $decode = array_merge(array('Message nature' => 'Engine Report'), $decode); |
|
527 | 527 | } |
528 | - elseif (preg_match(':^#H1:',$message)) { |
|
529 | - $decode = array_merge(array('Message nature' => 'HF Data Radio - Left'),$decode); |
|
528 | + elseif (preg_match(':^#H1:', $message)) { |
|
529 | + $decode = array_merge(array('Message nature' => 'HF Data Radio - Left'), $decode); |
|
530 | 530 | } |
531 | - elseif (preg_match(':^#H2:',$message)) { |
|
532 | - $decode = array_merge(array('Message nature' => 'HF Data Radio - Right'),$decode); |
|
531 | + elseif (preg_match(':^#H2:', $message)) { |
|
532 | + $decode = array_merge(array('Message nature' => 'HF Data Radio - Right'), $decode); |
|
533 | 533 | } |
534 | - elseif (preg_match(':^#HD:',$message)) { |
|
535 | - $decode = array_merge(array('Message nature' => 'HF Data Radio - Selected'),$decode); |
|
534 | + elseif (preg_match(':^#HD:', $message)) { |
|
535 | + $decode = array_merge(array('Message nature' => 'HF Data Radio - Selected'), $decode); |
|
536 | 536 | } |
537 | - elseif (preg_match(':^#M1:',$message)) { |
|
538 | - $decode = array_merge(array('Message nature' => 'Flight Management Computer - Left'),$decode); |
|
537 | + elseif (preg_match(':^#M1:', $message)) { |
|
538 | + $decode = array_merge(array('Message nature' => 'Flight Management Computer - Left'), $decode); |
|
539 | 539 | } |
540 | - elseif (preg_match(':^#M2:',$message)) { |
|
541 | - $decode = array_merge(array('Message nature' => 'Flight Management Computer - Right'),$decode); |
|
540 | + elseif (preg_match(':^#M2:', $message)) { |
|
541 | + $decode = array_merge(array('Message nature' => 'Flight Management Computer - Right'), $decode); |
|
542 | 542 | } |
543 | - elseif (preg_match(':^#M3:',$message)) { |
|
544 | - $decode = array_merge(array('Message nature' => 'Flight Management Computer - Center'),$decode); |
|
543 | + elseif (preg_match(':^#M3:', $message)) { |
|
544 | + $decode = array_merge(array('Message nature' => 'Flight Management Computer - Center'), $decode); |
|
545 | 545 | } |
546 | - elseif (preg_match(':^#MD:',$message)) { |
|
547 | - $decode = array_merge(array('Message nature' => 'Flight Management Computer - Selected'),$decode); |
|
546 | + elseif (preg_match(':^#MD:', $message)) { |
|
547 | + $decode = array_merge(array('Message nature' => 'Flight Management Computer - Selected'), $decode); |
|
548 | 548 | } |
549 | - elseif (preg_match(':^#PS:',$message)) { |
|
550 | - $decode = array_merge(array('Message nature' => 'Keyboard/Display Unit'),$decode); |
|
549 | + elseif (preg_match(':^#PS:', $message)) { |
|
550 | + $decode = array_merge(array('Message nature' => 'Keyboard/Display Unit'), $decode); |
|
551 | 551 | } |
552 | - elseif (preg_match(':^#S1:',$message)) { |
|
553 | - $decode = array_merge(array('Message nature' => 'SDU - Left'),$decode); |
|
552 | + elseif (preg_match(':^#S1:', $message)) { |
|
553 | + $decode = array_merge(array('Message nature' => 'SDU - Left'), $decode); |
|
554 | 554 | } |
555 | - elseif (preg_match(':^#S2:',$message)) { |
|
556 | - $decode = array_merge(array('Message nature' => 'SDU - Right'),$decode); |
|
555 | + elseif (preg_match(':^#S2:', $message)) { |
|
556 | + $decode = array_merge(array('Message nature' => 'SDU - Right'), $decode); |
|
557 | 557 | } |
558 | - elseif (preg_match(':^#SD:',$message)) { |
|
559 | - $decode = array_merge(array('Message nature' => 'SDU - Selected'),$decode); |
|
558 | + elseif (preg_match(':^#SD:', $message)) { |
|
559 | + $decode = array_merge(array('Message nature' => 'SDU - Selected'), $decode); |
|
560 | 560 | } |
561 | - elseif (preg_match(':^#T[0-8]:',$message)) { |
|
562 | - $decode = array_merge(array('Message nature' => 'Cabin Terminal Messages'),$decode); |
|
561 | + elseif (preg_match(':^#T[0-8]:', $message)) { |
|
562 | + $decode = array_merge(array('Message nature' => 'Cabin Terminal Messages'), $decode); |
|
563 | 563 | } |
564 | - elseif (preg_match(':^#WO:',$message)) { |
|
565 | - $decode = array_merge(array('Message nature' => 'Weather Observation Report'),$decode); |
|
564 | + elseif (preg_match(':^#WO:', $message)) { |
|
565 | + $decode = array_merge(array('Message nature' => 'Weather Observation Report'), $decode); |
|
566 | 566 | } |
567 | - elseif (preg_match(':^#A1:',$message)) { |
|
568 | - $decode = array_merge(array('Message nature' => 'Oceanic Clearance'),$decode); |
|
567 | + elseif (preg_match(':^#A1:', $message)) { |
|
568 | + $decode = array_merge(array('Message nature' => 'Oceanic Clearance'), $decode); |
|
569 | 569 | } |
570 | - elseif (preg_match(':^#A3:',$message)) { |
|
571 | - $decode = array_merge(array('Message nature' => 'Departure Clearance Response'),$decode); |
|
570 | + elseif (preg_match(':^#A3:', $message)) { |
|
571 | + $decode = array_merge(array('Message nature' => 'Departure Clearance Response'), $decode); |
|
572 | 572 | } |
573 | - elseif (preg_match(':^#A4:',$message)) { |
|
574 | - $decode = array_merge(array('Message nature' => 'Flight Systems Message'),$decode); |
|
573 | + elseif (preg_match(':^#A4:', $message)) { |
|
574 | + $decode = array_merge(array('Message nature' => 'Flight Systems Message'), $decode); |
|
575 | 575 | } |
576 | - elseif (preg_match(':^#A6:',$message)) { |
|
577 | - $decode = array_merge(array('Message nature' => 'Request ADS Reports'),$decode); |
|
576 | + elseif (preg_match(':^#A6:', $message)) { |
|
577 | + $decode = array_merge(array('Message nature' => 'Request ADS Reports'), $decode); |
|
578 | 578 | } |
579 | - elseif (preg_match(':^#A8:',$message)) { |
|
580 | - $decode = array_merge(array('Message nature' => 'Deliver Departure Slot'),$decode); |
|
579 | + elseif (preg_match(':^#A8:', $message)) { |
|
580 | + $decode = array_merge(array('Message nature' => 'Deliver Departure Slot'), $decode); |
|
581 | 581 | } |
582 | - elseif (preg_match(':^#A9:',$message)) { |
|
583 | - $decode = array_merge(array('Message nature' => 'ATIS report'),$decode); |
|
582 | + elseif (preg_match(':^#A9:', $message)) { |
|
583 | + $decode = array_merge(array('Message nature' => 'ATIS report'), $decode); |
|
584 | 584 | } |
585 | - elseif (preg_match(':^#A0:',$message)) { |
|
586 | - $decode = array_merge(array('Message nature' => 'ATIS Facility Notification (AFN)'),$decode); |
|
585 | + elseif (preg_match(':^#A0:', $message)) { |
|
586 | + $decode = array_merge(array('Message nature' => 'ATIS Facility Notification (AFN)'), $decode); |
|
587 | 587 | } |
588 | - elseif (preg_match(':^#AA:',$message)) { |
|
589 | - $decode = array_merge(array('Message nature' => 'ATCComm'),$decode); |
|
588 | + elseif (preg_match(':^#AA:', $message)) { |
|
589 | + $decode = array_merge(array('Message nature' => 'ATCComm'), $decode); |
|
590 | 590 | } |
591 | - elseif (preg_match(':^#AB:',$message)) { |
|
592 | - $decode = array_merge(array('Message nature' => 'TWIP Report'),$decode); |
|
591 | + elseif (preg_match(':^#AB:', $message)) { |
|
592 | + $decode = array_merge(array('Message nature' => 'TWIP Report'), $decode); |
|
593 | 593 | } |
594 | - elseif (preg_match(':^#AC:',$message)) { |
|
595 | - $decode = array_merge(array('Message nature' => 'Pushback Clearance'),$decode); |
|
594 | + elseif (preg_match(':^#AC:', $message)) { |
|
595 | + $decode = array_merge(array('Message nature' => 'Pushback Clearance'), $decode); |
|
596 | 596 | } |
597 | - elseif (preg_match(':^#AD:',$message)) { |
|
598 | - $decode = array_merge(array('Message nature' => 'Expected Taxi Clearance'),$decode); |
|
597 | + elseif (preg_match(':^#AD:', $message)) { |
|
598 | + $decode = array_merge(array('Message nature' => 'Expected Taxi Clearance'), $decode); |
|
599 | 599 | } |
600 | - elseif (preg_match(':^#AF:',$message)) { |
|
601 | - $decode = array_merge(array('Message nature' => 'CPC Command/Response'),$decode); |
|
600 | + elseif (preg_match(':^#AF:', $message)) { |
|
601 | + $decode = array_merge(array('Message nature' => 'CPC Command/Response'), $decode); |
|
602 | 602 | } |
603 | - elseif (preg_match(':^#B1:',$message)) { |
|
604 | - $decode = array_merge(array('Message nature' => 'Request Oceanic Clearance'),$decode); |
|
603 | + elseif (preg_match(':^#B1:', $message)) { |
|
604 | + $decode = array_merge(array('Message nature' => 'Request Oceanic Clearance'), $decode); |
|
605 | 605 | } |
606 | - elseif (preg_match(':^#B2:',$message)) { |
|
607 | - $decode = array_merge(array('Message nature' => 'Oceanic Clearance Readback'),$decode); |
|
606 | + elseif (preg_match(':^#B2:', $message)) { |
|
607 | + $decode = array_merge(array('Message nature' => 'Oceanic Clearance Readback'), $decode); |
|
608 | 608 | } |
609 | - elseif (preg_match(':^#B3:',$message)) { |
|
610 | - $decode = array_merge(array('Message nature' => 'Request Departure Clearance'),$decode); |
|
609 | + elseif (preg_match(':^#B3:', $message)) { |
|
610 | + $decode = array_merge(array('Message nature' => 'Request Departure Clearance'), $decode); |
|
611 | 611 | } |
612 | - elseif (preg_match(':^#B4:',$message)) { |
|
613 | - $decode = array_merge(array('Message nature' => 'Departure Clearance Readback'),$decode); |
|
612 | + elseif (preg_match(':^#B4:', $message)) { |
|
613 | + $decode = array_merge(array('Message nature' => 'Departure Clearance Readback'), $decode); |
|
614 | 614 | } |
615 | - elseif (preg_match(':^#B6:',$message)) { |
|
616 | - $decode = array_merge(array('Message nature' => 'Provide ADS Report'),$decode); |
|
615 | + elseif (preg_match(':^#B6:', $message)) { |
|
616 | + $decode = array_merge(array('Message nature' => 'Provide ADS Report'), $decode); |
|
617 | 617 | } |
618 | - elseif (preg_match(':^#B8:',$message)) { |
|
619 | - $decode = array_merge(array('Message nature' => 'Request Departure Slot'),$decode); |
|
618 | + elseif (preg_match(':^#B8:', $message)) { |
|
619 | + $decode = array_merge(array('Message nature' => 'Request Departure Slot'), $decode); |
|
620 | 620 | } |
621 | - elseif (preg_match(':^#B9:',$message)) { |
|
622 | - $decode = array_merge(array('Message nature' => 'Request ATIS Report'),$decode); |
|
621 | + elseif (preg_match(':^#B9:', $message)) { |
|
622 | + $decode = array_merge(array('Message nature' => 'Request ATIS Report'), $decode); |
|
623 | 623 | } |
624 | - elseif (preg_match(':^#B0:',$message)) { |
|
625 | - $decode = array_merge(array('Message nature' => 'ATS Facility Notification'),$decode); |
|
624 | + elseif (preg_match(':^#B0:', $message)) { |
|
625 | + $decode = array_merge(array('Message nature' => 'ATS Facility Notification'), $decode); |
|
626 | 626 | } |
627 | - elseif (preg_match(':^#BA:',$message)) { |
|
628 | - $decode = array_merge(array('Message nature' => 'ATCComm'),$decode); |
|
627 | + elseif (preg_match(':^#BA:', $message)) { |
|
628 | + $decode = array_merge(array('Message nature' => 'ATCComm'), $decode); |
|
629 | 629 | } |
630 | - elseif (preg_match(':^#BB:',$message)) { |
|
631 | - $decode = array_merge(array('Message nature' => 'Request TWIP Report'),$decode); |
|
630 | + elseif (preg_match(':^#BB:', $message)) { |
|
631 | + $decode = array_merge(array('Message nature' => 'Request TWIP Report'), $decode); |
|
632 | 632 | } |
633 | - elseif (preg_match(':^#BC:',$message)) { |
|
634 | - $decode = array_merge(array('Message nature' => 'Pushback Clearance Request'),$decode); |
|
633 | + elseif (preg_match(':^#BC:', $message)) { |
|
634 | + $decode = array_merge(array('Message nature' => 'Pushback Clearance Request'), $decode); |
|
635 | 635 | } |
636 | - elseif (preg_match(':^#BD:',$message)) { |
|
637 | - $decode = array_merge(array('Message nature' => 'Expected Taxi Clearance Request'),$decode); |
|
636 | + elseif (preg_match(':^#BD:', $message)) { |
|
637 | + $decode = array_merge(array('Message nature' => 'Expected Taxi Clearance Request'), $decode); |
|
638 | 638 | } |
639 | - elseif (preg_match(':^#BE:',$message)) { |
|
640 | - $decode = array_merge(array('Message nature' => 'CPC Aircraft Log-On/Off Request'),$decode); |
|
639 | + elseif (preg_match(':^#BE:', $message)) { |
|
640 | + $decode = array_merge(array('Message nature' => 'CPC Aircraft Log-On/Off Request'), $decode); |
|
641 | 641 | } |
642 | - elseif (preg_match(':^#BF:',$message)) { |
|
643 | - $decode = array_merge(array('Message nature' => 'CPC WILCO/UNABLE Response'),$decode); |
|
642 | + elseif (preg_match(':^#BF:', $message)) { |
|
643 | + $decode = array_merge(array('Message nature' => 'CPC WILCO/UNABLE Response'), $decode); |
|
644 | 644 | } |
645 | - elseif (preg_match(':^#H3:',$message)) { |
|
646 | - $decode = array_merge(array('Message nature' => 'Icing Report'),$decode); |
|
645 | + elseif (preg_match(':^#H3:', $message)) { |
|
646 | + $decode = array_merge(array('Message nature' => 'Icing Report'), $decode); |
|
647 | 647 | } |
648 | 648 | } |
649 | 649 | if ($label == '10') { |
650 | - if (preg_match(':^DTO01:',$message)) { |
|
651 | - $decode = array_merge(array('Message nature' => 'Delayed Takeoff Report'),$decode); |
|
650 | + if (preg_match(':^DTO01:', $message)) { |
|
651 | + $decode = array_merge(array('Message nature' => 'Delayed Takeoff Report'), $decode); |
|
652 | 652 | } |
653 | - elseif (preg_match(':^AIS01:',$message)) { |
|
654 | - $decode = array_merge(array('Message nature' => 'AIS Request'),$decode); |
|
653 | + elseif (preg_match(':^AIS01:', $message)) { |
|
654 | + $decode = array_merge(array('Message nature' => 'AIS Request'), $decode); |
|
655 | 655 | } |
656 | - elseif (preg_match(':^FTX01:',$message)) { |
|
657 | - $decode = array_merge(array('Message nature' => 'Free Text Downlink'),$decode); |
|
656 | + elseif (preg_match(':^FTX01:', $message)) { |
|
657 | + $decode = array_merge(array('Message nature' => 'Free Text Downlink'), $decode); |
|
658 | 658 | } |
659 | - elseif (preg_match(':^FPL01:',$message)) { |
|
660 | - $decode = array_merge(array('Message nature' => 'Flight Plan Request'),$decode); |
|
659 | + elseif (preg_match(':^FPL01:', $message)) { |
|
660 | + $decode = array_merge(array('Message nature' => 'Flight Plan Request'), $decode); |
|
661 | 661 | } |
662 | - elseif (preg_match(':^WAB01:',$message)) { |
|
663 | - $decode = array_merge(array('Message nature' => 'Weight & Balance Request'),$decode); |
|
662 | + elseif (preg_match(':^WAB01:', $message)) { |
|
663 | + $decode = array_merge(array('Message nature' => 'Weight & Balance Request'), $decode); |
|
664 | 664 | } |
665 | - elseif (preg_match(':^MET01:',$message)) { |
|
666 | - $decode = array_merge(array('Message nature' => 'Weather Data Request'),$decode); |
|
665 | + elseif (preg_match(':^MET01:', $message)) { |
|
666 | + $decode = array_merge(array('Message nature' => 'Weather Data Request'), $decode); |
|
667 | 667 | } |
668 | - elseif (preg_match(':^WAB02:',$message)) { |
|
669 | - $decode = array_merge(array('Message nature' => 'Weight and Balance Acknowledgement'),$decode); |
|
668 | + elseif (preg_match(':^WAB02:', $message)) { |
|
669 | + $decode = array_merge(array('Message nature' => 'Weight and Balance Acknowledgement'), $decode); |
|
670 | 670 | } |
671 | 671 | } |
672 | 672 | if ($label == '15') { |
673 | - if (preg_match(':^FST01:',$message)) { |
|
674 | - $decode = array_merge(array('Message nature' => 'Flight Status Report'),$decode); |
|
673 | + if (preg_match(':^FST01:', $message)) { |
|
674 | + $decode = array_merge(array('Message nature' => 'Flight Status Report'), $decode); |
|
675 | 675 | } |
676 | 676 | } |
677 | 677 | if (!$found && $label == 'SA') { |
678 | - $n = sscanf($message, "%d%c%c%6[0-9]", $version,$state,$type,$at); |
|
678 | + $n = sscanf($message, "%d%c%c%6[0-9]", $version, $state, $type, $at); |
|
679 | 679 | if ($n == 4) { |
680 | 680 | $vsta = array('Version' => $version); |
681 | 681 | if ($state == 'E') { |
682 | - $vsta = array_merge($vsta,array('Link state' => 'Established')); |
|
682 | + $vsta = array_merge($vsta, array('Link state' => 'Established')); |
|
683 | 683 | } |
684 | 684 | elseif ($state == 'L') { |
685 | - $vsta = array_merge($vsta,array('Link state' => 'Lost')); |
|
685 | + $vsta = array_merge($vsta, array('Link state' => 'Lost')); |
|
686 | 686 | } |
687 | 687 | else { |
688 | - $vsta = array_merge($vsta,array('Link state' => 'Unknown')); |
|
688 | + $vsta = array_merge($vsta, array('Link state' => 'Unknown')); |
|
689 | 689 | } |
690 | 690 | if ($type == 'V') { |
691 | - $vsta = array_merge($vsta,array('Link type' => 'VHF ACARS')); |
|
691 | + $vsta = array_merge($vsta, array('Link type' => 'VHF ACARS')); |
|
692 | 692 | } |
693 | 693 | elseif ($type == 'S') { |
694 | - $vsta = array_merge($vsta,array('Link type' => 'Generic SATCOM')); |
|
694 | + $vsta = array_merge($vsta, array('Link type' => 'Generic SATCOM')); |
|
695 | 695 | } |
696 | 696 | elseif ($type == 'H') { |
697 | - $vsta = array_merge($vsta,array('Link type' => 'HF')); |
|
697 | + $vsta = array_merge($vsta, array('Link type' => 'HF')); |
|
698 | 698 | } |
699 | 699 | elseif ($type == 'G') { |
700 | - $vsta = array_merge($vsta,array('Link type' => 'GlobalStar SATCOM')); |
|
700 | + $vsta = array_merge($vsta, array('Link type' => 'GlobalStar SATCOM')); |
|
701 | 701 | } |
702 | 702 | elseif ($type == 'C') { |
703 | - $vsta = array_merge($vsta,array('Link type' => 'ICO SATCOM')); |
|
703 | + $vsta = array_merge($vsta, array('Link type' => 'ICO SATCOM')); |
|
704 | 704 | } |
705 | 705 | elseif ($type == '2') { |
706 | - $vsta = array_merge($vsta,array('Link type' => 'VDL Mode 2')); |
|
706 | + $vsta = array_merge($vsta, array('Link type' => 'VDL Mode 2')); |
|
707 | 707 | } |
708 | 708 | elseif ($type == 'X') { |
709 | - $vsta = array_merge($vsta,array('Link type' => 'Inmarsat Aero')); |
|
709 | + $vsta = array_merge($vsta, array('Link type' => 'Inmarsat Aero')); |
|
710 | 710 | } |
711 | 711 | elseif ($type == 'I') { |
712 | - $vsta = array_merge($vsta,array('Link type' => 'Irridium SATCOM')); |
|
712 | + $vsta = array_merge($vsta, array('Link type' => 'Irridium SATCOM')); |
|
713 | 713 | } |
714 | 714 | else { |
715 | - $vsta = array_merge($vsta,array('Link type' => 'Unknown')); |
|
715 | + $vsta = array_merge($vsta, array('Link type' => 'Unknown')); |
|
716 | 716 | } |
717 | - $vsta = array_merge($vsta,array('Event occured at' => implode(':',str_split($at,2)))); |
|
718 | - $decode = array_merge($vsta,$decode); |
|
717 | + $vsta = array_merge($vsta, array('Event occured at' => implode(':', str_split($at, 2)))); |
|
718 | + $decode = array_merge($vsta, $decode); |
|
719 | 719 | } |
720 | 720 | } |
721 | 721 | |
722 | 722 | $title = $this->getTitlefromLabel($label); |
723 | - if ($title != '') $decode = array_merge(array('Message title' => $title),$decode); |
|
723 | + if ($title != '') $decode = array_merge(array('Message title' => $title), $decode); |
|
724 | 724 | /* |
725 | 725 | // Business jets always use GS0001 |
726 | 726 | if ($ident != 'GS0001') $info = $this->addModeSData($ident,$registration,$icao,$airicao,$latitude,$longitude); |
@@ -741,21 +741,21 @@ discard block |
||
741 | 741 | * @param String ACARS data in acarsdec data |
742 | 742 | * |
743 | 743 | */ |
744 | - public function add($data,$message = array()) { |
|
744 | + public function add($data, $message = array()) { |
|
745 | 745 | global $globalDebug, $globalACARSArchive; |
746 | 746 | $Image = new Image($this->db); |
747 | 747 | $Schedule = new Schedule($this->db); |
748 | 748 | $Translation = new Translation($this->db); |
749 | 749 | |
750 | - $message = array_merge($message,$this->parse($data)); |
|
750 | + $message = array_merge($message, $this->parse($data)); |
|
751 | 751 | if (isset($message['registration']) && $message['registration'] != '' && $message['ident'] != '' && $message['registration'] != '!') { |
752 | - $ident = (string)$message['ident']; |
|
752 | + $ident = (string) $message['ident']; |
|
753 | 753 | $label = $message['label']; |
754 | 754 | $block_id = $message['block_id']; |
755 | 755 | $msg_no = $message['msg_no']; |
756 | 756 | $msg = $message['message']; |
757 | 757 | $decode = $message['decode']; |
758 | - $registration = (string)$message['registration']; |
|
758 | + $registration = (string) $message['registration']; |
|
759 | 759 | if (isset($decode['latitude'])) $latitude = $decode['latitude']; |
760 | 760 | else $latitude = ''; |
761 | 761 | if (isset($decode['longitude'])) $longitude = $decode['longitude']; |
@@ -769,20 +769,20 @@ discard block |
||
769 | 769 | $Image->addSpotterImage($registration); |
770 | 770 | } |
771 | 771 | // Business jets always use GS0001 |
772 | - if ($ident != 'GS0001') $info = $this->addModeSData($ident,$registration,$icao,$airicao,$latitude,$longitude); |
|
772 | + if ($ident != 'GS0001') $info = $this->addModeSData($ident, $registration, $icao, $airicao, $latitude, $longitude); |
|
773 | 773 | if ($globalDebug && isset($info) && $info != '') echo $info; |
774 | 774 | if (count($decode) > 0) $decode_json = json_encode($decode); |
775 | 775 | else $decode_json = ''; |
776 | 776 | if (isset($decode['Departure airport']) && isset($decode['Departure hour']) && isset($decode['Arrival airport']) && isset($decode['Arrival hour'])) { |
777 | - $Schedule->addSchedule($icao,$decode['Departure airport'],$decode['Departure hour'],$decode['Arrival airport'],$decode['Arrival hour'],'ACARS'); |
|
777 | + $Schedule->addSchedule($icao, $decode['Departure airport'], $decode['Departure hour'], $decode['Arrival airport'], $decode['Arrival hour'], 'ACARS'); |
|
778 | 778 | } elseif (isset($decode['Departure airport']) && isset($decode['Arrival airport'])) { |
779 | - $Schedule->addSchedule($icao,$decode['Departure airport'],'',$decode['Arrival airport'],'','ACARS'); |
|
779 | + $Schedule->addSchedule($icao, $decode['Departure airport'], '', $decode['Arrival airport'], '', 'ACARS'); |
|
780 | 780 | } |
781 | - $result = $this->addLiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$msg,$decode_json); |
|
782 | - if (!isset($globalACARSArchive)) $globalACARSArchive = array('10','80','81','82','3F'); |
|
783 | - if ($result && in_array($label,$globalACARSArchive)) $this->addArchiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$msg,$decode_json); |
|
781 | + $result = $this->addLiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $msg, $decode_json); |
|
782 | + if (!isset($globalACARSArchive)) $globalACARSArchive = array('10', '80', '81', '82', '3F'); |
|
783 | + if ($result && in_array($label, $globalACARSArchive)) $this->addArchiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $msg, $decode_json); |
|
784 | 784 | if ($globalDebug && count($decode) > 0) { |
785 | - echo "Human readable data : ".implode(' - ',$decode)."\n"; |
|
785 | + echo "Human readable data : ".implode(' - ', $decode)."\n"; |
|
786 | 786 | } |
787 | 787 | } |
788 | 788 | } |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | * @param string $decode |
800 | 800 | * @return bool |
801 | 801 | */ |
802 | - public function addLiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$message,$decode = '') { |
|
802 | + public function addLiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $message, $decode = '') { |
|
803 | 803 | global $globalDebug; |
804 | 804 | date_default_timezone_set('UTC'); |
805 | 805 | if ($label != 'SQ' && $label != 'Q0' && $label != '_d' && $message != '') { |
@@ -807,22 +807,22 @@ discard block |
||
807 | 807 | $this->db = $Connection->db; |
808 | 808 | if ($globalDebug) echo "Test if not already in Live ACARS table..."; |
809 | 809 | $query_test = "SELECT COUNT(*) as nb FROM acars_live WHERE ident = :ident AND registration = :registration AND message = :message"; |
810 | - $query_test_values = array(':ident' => $ident,':registration' => $registration, ':message' => $message); |
|
810 | + $query_test_values = array(':ident' => $ident, ':registration' => $registration, ':message' => $message); |
|
811 | 811 | try { |
812 | 812 | $stht = $this->db->prepare($query_test); |
813 | 813 | $stht->execute($query_test_values); |
814 | - } catch(PDOException $e) { |
|
814 | + } catch (PDOException $e) { |
|
815 | 815 | echo "error : ".$e->getMessage(); |
816 | 816 | return false; |
817 | 817 | } |
818 | 818 | if ($stht->fetchColumn() == 0) { |
819 | 819 | if ($globalDebug) echo "Add Live ACARS data..."; |
820 | 820 | $query = "INSERT INTO acars_live (ident,registration,label,block_id,msg_no,message,decode,date) VALUES (:ident,:registration,:label,:block_id,:msg_no,:message,:decode,:date)"; |
821 | - $query_values = array(':ident' => $ident,':registration' => $registration, ':label' => $label,':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode,':date' => date("Y-m-d H:i:s")); |
|
821 | + $query_values = array(':ident' => $ident, ':registration' => $registration, ':label' => $label, ':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode, ':date' => date("Y-m-d H:i:s")); |
|
822 | 822 | try { |
823 | 823 | $sth = $this->db->prepare($query); |
824 | 824 | $sth->execute($query_values); |
825 | - } catch(PDOException $e) { |
|
825 | + } catch (PDOException $e) { |
|
826 | 826 | echo "error : ".$e->getMessage(); |
827 | 827 | return false; |
828 | 828 | } |
@@ -848,10 +848,10 @@ discard block |
||
848 | 848 | * @param string $decode |
849 | 849 | * @return string |
850 | 850 | */ |
851 | - public function addArchiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$message,$decode = '') { |
|
851 | + public function addArchiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $message, $decode = '') { |
|
852 | 852 | global $globalDebug; |
853 | 853 | date_default_timezone_set('UTC'); |
854 | - if ($label != 'SQ' && $label != 'Q0' && $label != '_d' && $message != '' && preg_match('/^MET0/',$message) === 0 && preg_match('/^ARR0/',$message) === 0 && preg_match('/^ETA/',$message) === 0 && preg_match('/^WXR/',$message) === 0 && preg_match('/^FTX01.FIC/',$message) === 0) { |
|
854 | + if ($label != 'SQ' && $label != 'Q0' && $label != '_d' && $message != '' && preg_match('/^MET0/', $message) === 0 && preg_match('/^ARR0/', $message) === 0 && preg_match('/^ETA/', $message) === 0 && preg_match('/^WXR/', $message) === 0 && preg_match('/^FTX01.FIC/', $message) === 0) { |
|
855 | 855 | /* |
856 | 856 | if ($globalDebug) echo "Test if not already in Archive ACARS table..."; |
857 | 857 | $query_test = "SELECT COUNT(*) as nb FROM acars_archive WHERE ident = :ident AND registration = :registration AND message = :message"; |
@@ -866,11 +866,11 @@ discard block |
||
866 | 866 | */ |
867 | 867 | if ($globalDebug) echo "Add Live ACARS data..."; |
868 | 868 | $query = "INSERT INTO acars_archive (ident,registration,label,block_id,msg_no,message,decode) VALUES (:ident,:registration,:label,:block_id,:msg_no,:message,:decode)"; |
869 | - $query_values = array(':ident' => $ident,':registration' => $registration, ':label' => $label,':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode); |
|
869 | + $query_values = array(':ident' => $ident, ':registration' => $registration, ':label' => $label, ':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode); |
|
870 | 870 | try { |
871 | 871 | $sth = $this->db->prepare($query); |
872 | 872 | $sth->execute($query_values); |
873 | - } catch(PDOException $e) { |
|
873 | + } catch (PDOException $e) { |
|
874 | 874 | return "error : ".$e->getMessage(); |
875 | 875 | } |
876 | 876 | if ($globalDebug) echo "Done\n"; |
@@ -892,7 +892,7 @@ discard block |
||
892 | 892 | try { |
893 | 893 | $sth = $this->db->prepare($query); |
894 | 894 | $sth->execute($query_values); |
895 | - } catch(PDOException $e) { |
|
895 | + } catch (PDOException $e) { |
|
896 | 896 | echo "error : ".$e->getMessage(); |
897 | 897 | return ''; |
898 | 898 | } |
@@ -912,7 +912,7 @@ discard block |
||
912 | 912 | try { |
913 | 913 | $sth = $this->db->prepare($query); |
914 | 914 | $sth->execute($query_values); |
915 | - } catch(PDOException $e) { |
|
915 | + } catch (PDOException $e) { |
|
916 | 916 | echo "error : ".$e->getMessage(); |
917 | 917 | return array(); |
918 | 918 | } |
@@ -933,7 +933,7 @@ discard block |
||
933 | 933 | try { |
934 | 934 | $sth = $this->db->prepare($query); |
935 | 935 | $sth->execute($query_values); |
936 | - } catch(PDOException $e) { |
|
936 | + } catch (PDOException $e) { |
|
937 | 937 | echo "error : ".$e->getMessage(); |
938 | 938 | return array(); |
939 | 939 | } |
@@ -949,7 +949,7 @@ discard block |
||
949 | 949 | * @param string $label |
950 | 950 | * @return array Return ACARS data in array |
951 | 951 | */ |
952 | - public function getLatestAcarsData($limit = '',$label = '') { |
|
952 | + public function getLatestAcarsData($limit = '', $label = '') { |
|
953 | 953 | global $globalURL; |
954 | 954 | $Image = new Image($this->db); |
955 | 955 | $Spotter = new Spotter($this->db); |
@@ -960,8 +960,8 @@ discard block |
||
960 | 960 | if ($limit != "") |
961 | 961 | { |
962 | 962 | $limit_array = explode(",", $limit); |
963 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
964 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
963 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
964 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
965 | 965 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
966 | 966 | { |
967 | 967 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
@@ -977,7 +977,7 @@ discard block |
||
977 | 977 | try { |
978 | 978 | $sth = $this->db->prepare($query); |
979 | 979 | $sth->execute($query_values); |
980 | - } catch(PDOException $e) { |
|
980 | + } catch (PDOException $e) { |
|
981 | 981 | echo "error : ".$e->getMessage(); |
982 | 982 | return array(); |
983 | 983 | } |
@@ -985,39 +985,39 @@ discard block |
||
985 | 985 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
986 | 986 | $data = array(); |
987 | 987 | if ($row['registration'] != '') { |
988 | - $row['registration'] = str_replace('.','',$row['registration']); |
|
988 | + $row['registration'] = str_replace('.', '', $row['registration']); |
|
989 | 989 | $image_array = $Image->getSpotterImage($row['registration']); |
990 | - if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website'])); |
|
991 | - else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
992 | - } else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
990 | + if (count($image_array) > 0) $data = array_merge($data, array('image' => $image_array[0]['image'], 'image_thumbnail' => $image_array[0]['image_thumbnail'], 'image_copyright' => $image_array[0]['image_copyright'], 'image_source' => $image_array[0]['image_source'], 'image_source_website' => $image_array[0]['image_source_website'])); |
|
991 | + else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
992 | + } else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
993 | 993 | if ($row['registration'] == '') $row['registration'] = 'NA'; |
994 | 994 | if ($row['ident'] == '') $row['ident'] = 'NA'; |
995 | - $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,2)); |
|
995 | + $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'], 0, 2)); |
|
996 | 996 | if (isset($identicao[0])) { |
997 | - if (substr($row['ident'],0,2) == 'AF') { |
|
998 | - if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
999 | - else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
1000 | - } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
1001 | - $data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name'])); |
|
997 | + if (substr($row['ident'], 0, 2) == 'AF') { |
|
998 | + if (filter_var(substr($row['ident'], 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
999 | + else $icao = 'AFR'.ltrim(substr($row['ident'], 2), '0'); |
|
1000 | + } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'], 2), '0'); |
|
1001 | + $data = array_merge($data, array('airline_icao' => $identicao[0]['icao'], 'airline_name' => $identicao[0]['name'])); |
|
1002 | 1002 | } else $icao = $row['ident']; |
1003 | - $icao = $Translation->checkTranslation($icao,false); |
|
1004 | - $decode = json_decode($row['decode'],true); |
|
1003 | + $icao = $Translation->checkTranslation($icao, false); |
|
1004 | + $decode = json_decode($row['decode'], true); |
|
1005 | 1005 | $found = false; |
1006 | - if ($decode != '' && array_key_exists('Departure airport',$decode)) { |
|
1006 | + if ($decode != '' && array_key_exists('Departure airport', $decode)) { |
|
1007 | 1007 | $airport_info = $Spotter->getAllAirportInfo($decode['Departure airport']); |
1008 | 1008 | if (isset($airport_info[0]['icao'])) { |
1009 | 1009 | $decode['Departure airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
1010 | 1010 | $found = true; |
1011 | 1011 | } |
1012 | 1012 | } |
1013 | - if ($decode != '' && array_key_exists('Arrival airport',$decode)) { |
|
1013 | + if ($decode != '' && array_key_exists('Arrival airport', $decode)) { |
|
1014 | 1014 | $airport_info = $Spotter->getAllAirportInfo($decode['Arrival airport']); |
1015 | 1015 | if (isset($airport_info[0]['icao'])) { |
1016 | 1016 | $decode['Arrival airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
1017 | 1017 | $found = true; |
1018 | 1018 | } |
1019 | 1019 | } |
1020 | - if ($decode != '' && array_key_exists('Airport/Waypoint name',$decode)) { |
|
1020 | + if ($decode != '' && array_key_exists('Airport/Waypoint name', $decode)) { |
|
1021 | 1021 | $airport_info = $Spotter->getAllAirportInfo($decode['Airport/Waypoint name']); |
1022 | 1022 | if (isset($airport_info[0]['icao'])) { |
1023 | 1023 | $decode['Airport/Waypoint name'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | } |
1026 | 1026 | } |
1027 | 1027 | if ($found) $row['decode'] = json_encode($decode); |
1028 | - $data = array_merge($data,array('registration' => $row['registration'],'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode'])); |
|
1028 | + $data = array_merge($data, array('registration' => $row['registration'], 'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode'])); |
|
1029 | 1029 | $result[] = $data; |
1030 | 1030 | $i++; |
1031 | 1031 | } |
@@ -1043,7 +1043,7 @@ discard block |
||
1043 | 1043 | * @param string $label |
1044 | 1044 | * @return array Return ACARS data in array |
1045 | 1045 | */ |
1046 | - public function getArchiveAcarsData($limit = '',$label = '') { |
|
1046 | + public function getArchiveAcarsData($limit = '', $label = '') { |
|
1047 | 1047 | global $globalURL; |
1048 | 1048 | $Image = new Image($this->db); |
1049 | 1049 | $Spotter = new Spotter($this->db); |
@@ -1053,8 +1053,8 @@ discard block |
||
1053 | 1053 | if ($limit != "") |
1054 | 1054 | { |
1055 | 1055 | $limit_array = explode(",", $limit); |
1056 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1057 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1056 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1057 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1058 | 1058 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1059 | 1059 | { |
1060 | 1060 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
@@ -1075,45 +1075,45 @@ discard block |
||
1075 | 1075 | try { |
1076 | 1076 | $sth = $this->db->prepare($query); |
1077 | 1077 | $sth->execute($query_values); |
1078 | - } catch(PDOException $e) { |
|
1078 | + } catch (PDOException $e) { |
|
1079 | 1079 | echo "error : ".$e->getMessage(); |
1080 | 1080 | return array(); |
1081 | 1081 | } |
1082 | - $i=0; |
|
1082 | + $i = 0; |
|
1083 | 1083 | $result = array(); |
1084 | 1084 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
1085 | 1085 | $data = array(); |
1086 | 1086 | if ($row['registration'] != '') { |
1087 | - $row['registration'] = str_replace('.','',$row['registration']); |
|
1087 | + $row['registration'] = str_replace('.', '', $row['registration']); |
|
1088 | 1088 | $image_array = $Image->getSpotterImage($row['registration']); |
1089 | - if (count($image_array) > 0) $data = array_merge($data,array('image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website'])); |
|
1090 | - else $data = array_merge($data,array('image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
1091 | - } else $data = array_merge($data,array('image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
1089 | + if (count($image_array) > 0) $data = array_merge($data, array('image_thumbnail' => $image_array[0]['image_thumbnail'], 'image_copyright' => $image_array[0]['image_copyright'], 'image_source' => $image_array[0]['image_source'], 'image_source_website' => $image_array[0]['image_source_website'])); |
|
1090 | + else $data = array_merge($data, array('image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
1091 | + } else $data = array_merge($data, array('image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
1092 | 1092 | $icao = ''; |
1093 | 1093 | if ($row['registration'] == '') $row['registration'] = 'NA'; |
1094 | 1094 | if ($row['ident'] == '') $row['ident'] = 'NA'; |
1095 | - $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,2)); |
|
1095 | + $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'], 0, 2)); |
|
1096 | 1096 | if (isset($identicao[0])) { |
1097 | - if (substr($row['ident'],0,2) == 'AF') { |
|
1098 | - if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
1099 | - else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
1100 | - } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
1101 | - $data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name'])); |
|
1097 | + if (substr($row['ident'], 0, 2) == 'AF') { |
|
1098 | + if (filter_var(substr($row['ident'], 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
1099 | + else $icao = 'AFR'.ltrim(substr($row['ident'], 2), '0'); |
|
1100 | + } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'], 2), '0'); |
|
1101 | + $data = array_merge($data, array('airline_icao' => $identicao[0]['icao'], 'airline_name' => $identicao[0]['name'])); |
|
1102 | 1102 | } else $icao = $row['ident']; |
1103 | 1103 | $icao = $Translation->checkTranslation($icao); |
1104 | - $decode = json_decode($row['decode'],true); |
|
1104 | + $decode = json_decode($row['decode'], true); |
|
1105 | 1105 | $found = false; |
1106 | - if ($decode != '' && array_key_exists('Departure airport',$decode)) { |
|
1106 | + if ($decode != '' && array_key_exists('Departure airport', $decode)) { |
|
1107 | 1107 | $airport_info = $Spotter->getAllAirportInfo($decode['Departure airport']); |
1108 | 1108 | if (isset($airport_info[0]['icao'])) $decode['Departure airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
1109 | 1109 | $found = true; |
1110 | 1110 | } |
1111 | - if ($decode != '' && array_key_exists('Arrival airport',$decode)) { |
|
1111 | + if ($decode != '' && array_key_exists('Arrival airport', $decode)) { |
|
1112 | 1112 | $airport_info = $Spotter->getAllAirportInfo($decode['Arrival airport']); |
1113 | 1113 | if (isset($airport_info[0]['icao'])) $decode['Arrival airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
1114 | 1114 | $found = true; |
1115 | 1115 | } |
1116 | - if ($decode != '' && array_key_exists('Airport/Waypoint name',$decode)) { |
|
1116 | + if ($decode != '' && array_key_exists('Airport/Waypoint name', $decode)) { |
|
1117 | 1117 | $airport_info = $Spotter->getAllAirportInfo($decode['Airport/Waypoint name']); |
1118 | 1118 | if (isset($airport_info[0]['icao'])) { |
1119 | 1119 | $decode['Airport/Waypoint name'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
@@ -1121,7 +1121,7 @@ discard block |
||
1121 | 1121 | } |
1122 | 1122 | } |
1123 | 1123 | if ($found) $row['decode'] = json_encode($decode); |
1124 | - $data = array_merge($data,array('registration' => $row['registration'],'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode'])); |
|
1124 | + $data = array_merge($data, array('registration' => $row['registration'], 'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode'])); |
|
1125 | 1125 | $result[] = $data; |
1126 | 1126 | $i++; |
1127 | 1127 | } |
@@ -1142,7 +1142,7 @@ discard block |
||
1142 | 1142 | * @param string $longitude |
1143 | 1143 | * @return string |
1144 | 1144 | */ |
1145 | - public function addModeSData($ident,$registration,$icao = '',$ICAOTypeCode = '',$latitude = '', $longitude = '') { |
|
1145 | + public function addModeSData($ident, $registration, $icao = '', $ICAOTypeCode = '', $latitude = '', $longitude = '') { |
|
1146 | 1146 | global $globalDebug, $globalDBdriver; |
1147 | 1147 | $ident = trim($ident); |
1148 | 1148 | $Translation = new Translation($this->db); |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | if ($globalDebug) echo "Ident or registration null, exit\n"; |
1156 | 1156 | return ''; |
1157 | 1157 | } |
1158 | - $registration = str_replace('.','',$registration); |
|
1158 | + $registration = str_replace('.', '', $registration); |
|
1159 | 1159 | $ident = $Translation->ident2icao($ident); |
1160 | 1160 | // Check if a flight with same registration is flying now, if ok check if callsign = name in ACARS, else add it to translation |
1161 | 1161 | if ($globalDebug) echo "Check if needed to add translation ".$ident.'... '; |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | try { |
1165 | 1165 | $sthsi = $this->db->prepare($querysi); |
1166 | 1166 | $sthsi->execute($querysi_values); |
1167 | - } catch(PDOException $e) { |
|
1167 | + } catch (PDOException $e) { |
|
1168 | 1168 | if ($globalDebug) echo $e->getMessage(); |
1169 | 1169 | return "error : ".$e->getMessage(); |
1170 | 1170 | } |
@@ -1174,8 +1174,8 @@ discard block |
||
1174 | 1174 | $Translation = new Translation($this->db); |
1175 | 1175 | $trans_ident = $Translation->getOperator($resultsi['ident']); |
1176 | 1176 | if ($globalDebug) echo 'Add translation to table : '.$ident.' -> '.$resultsi['ident'].' '; |
1177 | - if ($ident != $trans_ident) $Translation->addOperator($resultsi['ident'],$ident,'ACARS'); |
|
1178 | - elseif ($trans_ident == $ident) $Translation->updateOperator($resultsi['ident'],$ident,'ACARS'); |
|
1177 | + if ($ident != $trans_ident) $Translation->addOperator($resultsi['ident'], $ident, 'ACARS'); |
|
1178 | + elseif ($trans_ident == $ident) $Translation->updateOperator($resultsi['ident'], $ident, 'ACARS'); |
|
1179 | 1179 | } else { |
1180 | 1180 | if ($registration != '' && $latitude != '' && $longitude != '') { |
1181 | 1181 | $query = "SELECT ModeS FROM aircraft_modes WHERE Registration = :registration LIMIT 1"; |
@@ -1183,7 +1183,7 @@ discard block |
||
1183 | 1183 | try { |
1184 | 1184 | $sth = $this->db->prepare($query); |
1185 | 1185 | $sth->execute($query_values); |
1186 | - } catch(PDOException $e) { |
|
1186 | + } catch (PDOException $e) { |
|
1187 | 1187 | if ($globalDebug) echo $e->getMessage(); |
1188 | 1188 | return "error : ".$e->getMessage(); |
1189 | 1189 | } |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | $sth->closeCursor(); |
1192 | 1192 | if (isset($result['modes'])) $hex = $result['modes']; |
1193 | 1193 | else $hex = ''; |
1194 | - $SI_data = array('hex' => $hex,'ident' => $ident,'aircraft_icao' => $ICAOTypeCode,'registration' => $registration,'latitude' => $latitude,'$longitude' => $longitude,'format_source' => 'ACARS'); |
|
1194 | + $SI_data = array('hex' => $hex, 'ident' => $ident, 'aircraft_icao' => $ICAOTypeCode, 'registration' => $registration, 'latitude' => $latitude, '$longitude' => $longitude, 'format_source' => 'ACARS'); |
|
1195 | 1195 | if ($this->fromACARSscript) $this->SI->add($SI_data); |
1196 | 1196 | } |
1197 | 1197 | } |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | try { |
1202 | 1202 | $sth = $this->db->prepare($query); |
1203 | 1203 | $sth->execute($query_values); |
1204 | - } catch(PDOException $e) { |
|
1204 | + } catch (PDOException $e) { |
|
1205 | 1205 | if ($globalDebug) echo $e->getMessage(); |
1206 | 1206 | return "error : ".$e->getMessage(); |
1207 | 1207 | } |
@@ -1211,7 +1211,7 @@ discard block |
||
1211 | 1211 | if (isset($result['ModeS'])) $ModeS = $result['ModeS']; |
1212 | 1212 | else $ModeS = ''; |
1213 | 1213 | if ($ModeS == '') { |
1214 | - $id = explode('-',$result['flightaware_id']); |
|
1214 | + $id = explode('-', $result['flightaware_id']); |
|
1215 | 1215 | $ModeS = $id[0]; |
1216 | 1216 | } |
1217 | 1217 | if ($ModeS != '') { |
@@ -1221,20 +1221,20 @@ discard block |
||
1221 | 1221 | try { |
1222 | 1222 | $sthc = $this->db->prepare($queryc); |
1223 | 1223 | $sthc->execute($queryc_values); |
1224 | - } catch(PDOException $e) { |
|
1224 | + } catch (PDOException $e) { |
|
1225 | 1225 | if ($globalDebug) echo $e->getMessage(); |
1226 | 1226 | return "error : ".$e->getMessage(); |
1227 | 1227 | } |
1228 | 1228 | $row = $sthc->fetch(PDO::FETCH_ASSOC); |
1229 | 1229 | $sthc->closeCursor(); |
1230 | - if (count($row) == 0) { |
|
1230 | + if (count($row) == 0) { |
|
1231 | 1231 | if ($globalDebug) echo " Add to ModeS table - "; |
1232 | 1232 | $queryi = "INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:ModeS,:ModeSCountry,:Registration, :ICAOTypeCode,'ACARS')"; |
1233 | - $queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode); |
|
1233 | + $queryi_values = array(':ModeS' => $ModeS, ':ModeSCountry' => $country, ':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode); |
|
1234 | 1234 | try { |
1235 | 1235 | $sthi = $this->db->prepare($queryi); |
1236 | 1236 | $sthi->execute($queryi_values); |
1237 | - } catch(PDOException $e) { |
|
1237 | + } catch (PDOException $e) { |
|
1238 | 1238 | if ($globalDebug) echo $e->getMessage(); |
1239 | 1239 | return "error : ".$e->getMessage(); |
1240 | 1240 | } |
@@ -1242,15 +1242,15 @@ discard block |
||
1242 | 1242 | if ($globalDebug) echo " Update ModeS table - "; |
1243 | 1243 | if ($ICAOTypeCode != '') { |
1244 | 1244 | $queryi = "UPDATE aircraft_modes SET ModeSCountry = :ModeSCountry,Registration = :Registration,ICAOTypeCode = :ICAOTypeCode,Source = 'ACARS',LastModified = NOW() WHERE ModeS = :ModeS"; |
1245 | - $queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode); |
|
1245 | + $queryi_values = array(':ModeS' => $ModeS, ':ModeSCountry' => $country, ':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode); |
|
1246 | 1246 | } else { |
1247 | 1247 | $queryi = "UPDATE aircraft_modes SET ModeSCountry = :ModeSCountry,Registration = :Registration,Source = 'ACARS',LastModified = NOW() WHERE ModeS = :ModeS"; |
1248 | - $queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration); |
|
1248 | + $queryi_values = array(':ModeS' => $ModeS, ':ModeSCountry' => $country, ':Registration' => $registration); |
|
1249 | 1249 | } |
1250 | 1250 | try { |
1251 | 1251 | $sthi = $this->db->prepare($queryi); |
1252 | 1252 | $sthi->execute($queryi_values); |
1253 | - } catch(PDOException $e) { |
|
1253 | + } catch (PDOException $e) { |
|
1254 | 1254 | if ($globalDebug) echo $e->getMessage(); |
1255 | 1255 | return "error : ".$e->getMessage(); |
1256 | 1256 | } |
@@ -1287,12 +1287,12 @@ discard block |
||
1287 | 1287 | elseif ($globalDBdriver == 'pgsql') { |
1288 | 1288 | $queryi = "UPDATE spotter_output SET registration = :Registration WHERE ident = :ident AND date >= NOW() AT TIME ZONE 'UTC' - INTERVAL '1 HOUR'"; |
1289 | 1289 | } |
1290 | - $queryi_values = array(':Registration' => $registration,':ident' => $icao); |
|
1290 | + $queryi_values = array(':Registration' => $registration, ':ident' => $icao); |
|
1291 | 1291 | } |
1292 | 1292 | try { |
1293 | 1293 | $sthi = $this->db->prepare($queryi); |
1294 | 1294 | $sthi->execute($queryi_values); |
1295 | - } catch(PDOException $e) { |
|
1295 | + } catch (PDOException $e) { |
|
1296 | 1296 | if ($globalDebug) echo $e->getMessage(); |
1297 | 1297 | return "error : ".$e->getMessage(); |
1298 | 1298 | } |
@@ -65,18 +65,18 @@ discard block |
||
65 | 65 | $min = true; |
66 | 66 | $allhistory = false; |
67 | 67 | $filter['source'] = array(); |
68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
69 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
70 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
71 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
72 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
73 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
74 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
75 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
76 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
77 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
78 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
79 | -if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT); |
|
68 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
69 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
70 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
71 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
72 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
73 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
74 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
75 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
76 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
77 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
78 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
79 | +if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'], FILTER_SANITIZE_NUMBER_INT); |
|
80 | 80 | if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') $filter['blocked'] = true; |
81 | 81 | |
82 | 82 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | |
86 | 86 | |
87 | 87 | if (isset($_COOKIE['map_2d_limit'])) { |
88 | - $limit = filter_var($_COOKIE['map_2d_limit'],FILTER_SANITIZE_NUMBER_INT); |
|
88 | + $limit = filter_var($_COOKIE['map_2d_limit'], FILTER_SANITIZE_NUMBER_INT); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | $spotter_array = array(); |
92 | 92 | |
93 | 93 | if (isset($_GET['ident'])) { |
94 | - $ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
|
94 | + $ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING)); |
|
95 | 95 | if ($tracker) { |
96 | 96 | $spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident); |
97 | 97 | } elseif ($marine) { |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | } |
106 | 106 | $allhistory = true; |
107 | 107 | } elseif (isset($_GET['flightaware_id'])) { |
108 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
108 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
109 | 109 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
110 | 110 | if (empty($spotter_array)) { |
111 | 111 | $from_archive = true; |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | } |
114 | 114 | $allhistory = true; |
115 | 115 | } elseif (isset($_GET['famtrack_id'])) { |
116 | - $famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING)); |
|
116 | + $famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING)); |
|
117 | 117 | $spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id); |
118 | 118 | $allhistory = true; |
119 | 119 | } elseif (isset($_GET['fammarine_id'])) { |
120 | - $fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING)); |
|
120 | + $fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING)); |
|
121 | 121 | $spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id); |
122 | 122 | $allhistory = true; |
123 | 123 | /* |
@@ -137,15 +137,15 @@ discard block |
||
137 | 137 | */ |
138 | 138 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min && !isset($_GET['archive'])) { |
139 | 139 | $usecoord = true; |
140 | - $coord = explode(',',$_GET['coord']); |
|
141 | - if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
140 | + $coord = explode(',', $_GET['coord']); |
|
141 | + if (filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
142 | 142 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) { |
143 | 143 | if ($tracker) { |
144 | - $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter); |
|
144 | + $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter); |
|
145 | 145 | } elseif ($marine) { |
146 | - $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter); |
|
146 | + $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter); |
|
147 | 147 | } else { |
148 | - $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$limit,$filter); |
|
148 | + $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $limit, $filter); |
|
149 | 149 | } |
150 | 150 | } else { |
151 | 151 | if ($tracker) { |
@@ -153,41 +153,41 @@ discard block |
||
153 | 153 | } elseif ($marine) { |
154 | 154 | $spotter_array = $MarineLive->getMinLiveMarineData($filter); |
155 | 155 | } else { |
156 | - $spotter_array = $SpotterLive->getMinLiveSpotterData($limit,$filter); |
|
156 | + $spotter_array = $SpotterLive->getMinLiveSpotterData($limit, $filter); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed']) && !isset($_GET['tracker']) && !isset($_GET['marine'])) { |
160 | 160 | $from_archive = true; |
161 | 161 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
162 | 162 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
163 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
164 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
165 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
166 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
167 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
168 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
163 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
164 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
165 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
166 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
167 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
168 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
169 | 169 | } elseif ($min) { |
170 | 170 | if ($tracker) { |
171 | 171 | $spotter_array = $TrackerLive->getMinLiveTrackerData($filter); |
172 | 172 | } elseif ($marine) { |
173 | 173 | $spotter_array = $MarineLive->getMinLiveMarineData($filter); |
174 | 174 | } else { |
175 | - $spotter_array = $SpotterLive->getMinLiveSpotterData($limit,$filter); |
|
175 | + $spotter_array = $SpotterLive->getMinLiveSpotterData($limit, $filter); |
|
176 | 176 | } |
177 | 177 | # $min = true; |
178 | 178 | } else { |
179 | 179 | if ($tracker) { |
180 | - $spotter_array = $TrackerLive->getLiveTrackerData('','',$filter); |
|
180 | + $spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter); |
|
181 | 181 | } elseif ($marine) { |
182 | - $spotter_array = $marineLive->getLiveMarineData('','',$filter); |
|
182 | + $spotter_array = $marineLive->getLiveMarineData('', '', $filter); |
|
183 | 183 | } else { |
184 | - $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
|
184 | + $spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter); |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
188 | 188 | if ($usecoord) { |
189 | 189 | if (isset($_GET['archive'])) { |
190 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
190 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
191 | 191 | } else { |
192 | 192 | if ($tracker) { |
193 | 193 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | if ($flightcnt == '') $flightcnt = 0; |
201 | 201 | } else $flightcnt = 0; |
202 | 202 | |
203 | -$sqltime = round(microtime(true)-$begintime,2); |
|
203 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
204 | 204 | |
205 | -$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
205 | +$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
206 | 206 | if ($currenttime != '') $currenttime = round($currenttime/1000); |
207 | 207 | |
208 | 208 | if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation === FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | if (!empty($spotter_array) && is_array($spotter_array)) |
222 | 222 | { |
223 | 223 | $output .= '"features": ['; |
224 | - foreach($spotter_array as $spotter_item) |
|
224 | + foreach ($spotter_array as $spotter_item) |
|
225 | 225 | { |
226 | 226 | $j++; |
227 | 227 | unset($idistance); |
@@ -278,8 +278,8 @@ discard block |
||
278 | 278 | */ |
279 | 279 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
280 | 280 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
281 | - if ($compress) $output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
282 | - else $output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
281 | + if ($compress) $output .= '"c": '.json_encode(str_replace('\\', '', $spotter_item['ident'])).','; |
|
282 | + else $output .= '"callsign": '.json_encode(str_replace('\\', '', $spotter_item['ident'])).','; |
|
283 | 283 | //' |
284 | 284 | } else { |
285 | 285 | if ($compress) $output .= '"c": "NA",'; |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | } |
292 | 292 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
293 | 293 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
294 | - $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
|
294 | + $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",'; |
|
295 | 295 | } elseif (isset($spotter_item['aircraft_type'])) { |
296 | 296 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
297 | 297 | } elseif (!$min) { |
@@ -377,22 +377,22 @@ discard block |
||
377 | 377 | else $output .= '"aircraft_shadow": "car.png",'; |
378 | 378 | } |
379 | 379 | } elseif ($marine) { |
380 | - if (isset($spotter_item['type']) && ($spotter_item['type'] == '50' Performance Cruiser' || $spotter_item['type'] == '50\' Performance Cruiser' || $spotter_item['type'] == 'Sail')) { |
|
380 | + if (isset($spotter_item['type']) && ($spotter_item['type'] == '50' Performance Cruiser' || $spotter_item['type'] == '50\' Performance Cruiser' || $spotter_item['type'] == 'Sail')) { |
|
381 | 381 | if ($compress) $output .= '"as": "50perfcruiser.png",'; |
382 | 382 | else $output .= '"aircraft_shadow": "50perfcruiser.png",'; |
383 | - } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Sailaway Cruiser 38') { |
|
383 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Sailaway Cruiser 38') { |
|
384 | 384 | if ($compress) $output .= '"as": "cruiser38.png",'; |
385 | 385 | else $output .= '"aircraft_shadow": "cruiser38.png",'; |
386 | - } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Mini Transat') { |
|
386 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Mini Transat') { |
|
387 | 387 | if ($compress) $output .= '"as": "transat.png",'; |
388 | 388 | else $output .= '"aircraft_shadow": "transat.png",'; |
389 | - } elseif (isset($spotter_item['type']) && $spotter_item['type'] == '52' Cruising Cat') { |
|
389 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == '52' Cruising Cat') { |
|
390 | 390 | if ($compress) $output .= '"as": "catamaran.png",'; |
391 | 391 | else $output .= '"aircraft_shadow": "catamaran.png",'; |
392 | - } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Caribbean Rose') { |
|
392 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Caribbean Rose') { |
|
393 | 393 | if ($compress) $output .= '"as": "carib.png",'; |
394 | 394 | else $output .= '"aircraft_shadow": "carib.png",'; |
395 | - } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Nordic Folkboat') { |
|
395 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Nordic Folkboat') { |
|
396 | 396 | if ($compress) $output .= '"as": "nordic.png",'; |
397 | 397 | else $output .= '"aircraft_shadow": "nordic.png",'; |
398 | 398 | } else { |
@@ -458,15 +458,15 @@ discard block |
||
458 | 458 | if (isset($archivespeed) || $usenextlatlon) { |
459 | 459 | if (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
460 | 460 | if (isset($spotter_item['arrival_airport_latitude'])) { |
461 | - $cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']); |
|
462 | - $idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']); |
|
461 | + $cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']); |
|
462 | + $idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']); |
|
463 | 463 | $farr_lat = $spotter_item['arrival_airport_latitude']; |
464 | 464 | $farr_lon = $spotter_item['arrival_airport_longitude']; |
465 | 465 | } else { |
466 | 466 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
467 | 467 | if (isset($aairport[0]['latitude'])) { |
468 | - $cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']); |
|
469 | - $idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']); |
|
468 | + $cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']); |
|
469 | + $idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']); |
|
470 | 470 | $farr_lat = $aairport[0]['latitude']; |
471 | 471 | $farr_lon = $aairport[0]['longitude']; |
472 | 472 | } |
@@ -479,59 +479,59 @@ discard block |
||
479 | 479 | if ($currenttime != '') { |
480 | 480 | if (strtotime($spotter_item['date']) < $currenttime) { |
481 | 481 | if (isset($archivespeed)) { |
482 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
483 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
482 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
483 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
484 | 484 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
485 | 485 | else { |
486 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
487 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
486 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
487 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
488 | 488 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
489 | 489 | else { |
490 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
490 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
491 | 491 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
492 | 492 | } |
493 | 493 | } |
494 | 494 | } elseif ($usenextlatlon) { |
495 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
496 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
495 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
496 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
497 | 497 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
498 | 498 | else { |
499 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
500 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
499 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
500 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
501 | 501 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
502 | 502 | else { |
503 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
503 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
504 | 504 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
505 | 505 | } |
506 | 506 | } |
507 | 507 | } |
508 | 508 | } else { |
509 | 509 | if (isset($archivespeed)) { |
510 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
510 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
511 | 511 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
512 | 512 | } elseif ($usenextlatlon) { |
513 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
513 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
514 | 514 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
515 | 515 | } |
516 | 516 | } |
517 | 517 | } else { |
518 | 518 | if (isset($archivespeed)) { |
519 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
520 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
519 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
520 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
521 | 521 | if (!isset($idistance) || $fdistance < $idistance) { |
522 | 522 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
523 | 523 | } else { |
524 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed); |
|
524 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed); |
|
525 | 525 | //$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
526 | 526 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
527 | 527 | } |
528 | 528 | } elseif ($usenextlatlon) { |
529 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
530 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
529 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
530 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
531 | 531 | if (!isset($idistance) || $fdistance < $idistance) { |
532 | 532 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
533 | 533 | } else { |
534 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading); |
|
534 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading); |
|
535 | 535 | //$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
536 | 536 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
537 | 537 | } |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | |
541 | 541 | if (!$min) $output .= '"image": "'.$image.'",'; |
542 | 542 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
543 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
543 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
544 | 544 | } |
545 | 545 | if (isset($spotter_item['image_source_website'])) { |
546 | 546 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
575 | 575 | } |
576 | 576 | if (isset($spotter_item['acars'])) { |
577 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
577 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
578 | 578 | } |
579 | 579 | // type when not aircraft ? |
580 | 580 | if (isset($spotter_item['type'])) { |
@@ -594,12 +594,12 @@ discard block |
||
594 | 594 | if ($currenttime != '') { |
595 | 595 | if (strtotime($spotter_item['date']) < $currenttime) { |
596 | 596 | if (!isset($archivespeed)) $archivespeed = 1; |
597 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
|
598 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
597 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']))); |
|
598 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
599 | 599 | if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
600 | 600 | else { |
601 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
|
602 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
601 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']))); |
|
602 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
603 | 603 | if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
604 | 604 | else { |
605 | 605 | $output .= $spotter_item['longitude'].', '; |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | |
679 | 679 | } |
680 | 680 | */ |
681 | - $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
|
681 | + $history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING); |
|
682 | 682 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
683 | 683 | |
684 | 684 | if ( |
@@ -686,11 +686,11 @@ discard block |
||
686 | 686 | || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
687 | 687 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
688 | 688 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
689 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
689 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
690 | 690 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
691 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
691 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id'])) |
|
692 | 692 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
693 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
693 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid'])) |
|
694 | 694 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
695 | 695 | ) { |
696 | 696 | if ($tracker) { |
@@ -719,9 +719,9 @@ discard block |
||
719 | 719 | require(dirname(__FILE__).'/require/class.MapMatching.php'); |
720 | 720 | $MapMatching = new MapMatching(); |
721 | 721 | if (isset($spotter_item['date_iso_8601'])) { |
722 | - $spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date_iso_8601']))))); |
|
722 | + $spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date_iso_8601']))))); |
|
723 | 723 | } else { |
724 | - $spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date']))))); |
|
724 | + $spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date']))))); |
|
725 | 725 | } |
726 | 726 | $spotter_history_array = $MapMatching->match($spotter_history_array_mm); |
727 | 727 | } |
@@ -754,9 +754,9 @@ discard block |
||
754 | 754 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
755 | 755 | } |
756 | 756 | $output_history .= '['; |
757 | - $output_history .= $spotter_history['longitude'].', '; |
|
758 | - $output_history .= $spotter_history['latitude'].', '; |
|
759 | - $output_history .= $spotter_history['altitude']*30.48; |
|
757 | + $output_history .= $spotter_history['longitude'].', '; |
|
758 | + $output_history .= $spotter_history['latitude'].', '; |
|
759 | + $output_history .= $spotter_history['altitude']*30.48; |
|
760 | 760 | $output_history .= '],'; |
761 | 761 | /* |
762 | 762 | if ($from_archive === false) { |
@@ -779,8 +779,8 @@ discard block |
||
779 | 779 | $d = true; |
780 | 780 | } |
781 | 781 | $output_history .= '['; |
782 | - $output_history .= $spotter_history['longitude'].', '; |
|
783 | - $output_history .= $spotter_history['latitude']; |
|
782 | + $output_history .= $spotter_history['longitude'].', '; |
|
783 | + $output_history .= $spotter_history['latitude']; |
|
784 | 784 | $output_history .= '],'; |
785 | 785 | /* |
786 | 786 | if ($from_archive === false) { |
@@ -796,9 +796,9 @@ discard block |
||
796 | 796 | //echo $output_history; |
797 | 797 | if ($from_archive === false && !isset($spotter_history_array[0]['mapmatching_engine'])) { |
798 | 798 | $output_historyd = '['; |
799 | - $output_historyd .= $spotter_item['longitude'].', '; |
|
800 | - $output_historyd .= $spotter_item['latitude']; |
|
801 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
799 | + $output_historyd .= $spotter_item['longitude'].', '; |
|
800 | + $output_historyd .= $spotter_item['latitude']; |
|
801 | + if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
802 | 802 | $output_historyd .= '],'; |
803 | 803 | //$output_history = $output_historyd.$output_history; |
804 | 804 | $output_history = $output_history.$output_historyd; |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | $last = array_pop($spotter_history_array); |
807 | 807 | $latitude = $last['latitude']; |
808 | 808 | $longitude = $last['longitude']; |
809 | - $output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}','"coordinates": ['.$longitude.', '.$latitude.']}',$output); |
|
809 | + $output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}', '"coordinates": ['.$longitude.', '.$latitude.']}', $output); |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | $output_history = substr($output_history, 0, -1); |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | |
819 | 819 | } |
820 | 820 | |
821 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
821 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
822 | 822 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
823 | 823 | && (isset($spotter_item['departure_airport']) |
824 | 824 | && $spotter_item['departure_airport'] != 'NA' |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | |
853 | 853 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
854 | 854 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
855 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
855 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
856 | 856 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
857 | 857 | && (isset($spotter_item['arrival_airport']) |
858 | 858 | && $spotter_item['arrival_airport'] != 'NA' |
@@ -879,11 +879,11 @@ discard block |
||
879 | 879 | } |
880 | 880 | } |
881 | 881 | if ($havedata) { |
882 | - $line = $Common->greatCircle($spotter_item['latitude'],$spotter_item['longitude'],$end_lat,$end_lon); |
|
882 | + $line = $Common->greatCircle($spotter_item['latitude'], $spotter_item['longitude'], $end_lat, $end_lon); |
|
883 | 883 | foreach ($line[0] as $coord) { |
884 | 884 | $output_dest .= '['.$coord[0].','.$coord[1].'],'; |
885 | 885 | } |
886 | - $output_dest = substr($output_dest, 0, -1); |
|
886 | + $output_dest = substr($output_dest, 0, -1); |
|
887 | 887 | } |
888 | 888 | $output_dest .= ']}},'; |
889 | 889 | if ($havedata) $output .= $output_dest; |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | $output = substr($output, 0, -1); |
894 | 894 | $output .= ']'; |
895 | 895 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
896 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
896 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
897 | 897 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
898 | 898 | $output .= '"fc": "'.$j.'"'; |
899 | 899 | } else { |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | require_once('require/class.Satellite.php'); |
6 | 6 | |
7 | -$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING); |
|
7 | +$trackident = filter_input(INPUT_GET, 'trackid', FILTER_SANITIZE_STRING); |
|
8 | 8 | if ($trackident != '') { |
9 | 9 | require_once('require/class.SpotterLive.php'); |
10 | 10 | $SpotterLive = new SpotterLive(); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident); |
15 | 15 | header('Location: '.$globalURL.'/flightid/'.$spotterid); |
16 | 16 | } else { |
17 | - setcookie('MapTrack',$resulttrackident[0]['flightaware_id']); |
|
17 | + setcookie('MapTrack', $resulttrackident[0]['flightaware_id']); |
|
18 | 18 | } |
19 | 19 | /* |
20 | 20 | } else { |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | */ |
24 | 24 | } |
25 | 25 | |
26 | -$raceid = filter_input(INPUT_GET,'raceid',FILTER_SANITIZE_NUMBER_INT); |
|
26 | +$raceid = filter_input(INPUT_GET, 'raceid', FILTER_SANITIZE_NUMBER_INT); |
|
27 | 27 | if ($raceid != '') { |
28 | - setcookie('filter_race',$raceid); |
|
28 | + setcookie('filter_race', $raceid); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | $title = _("Home"); |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | <div class="form-group"> |
261 | 261 | <label><?php echo _("From:"); ?></label> |
262 | 262 | <div class='input-group date' id='datetimepicker1'> |
263 | - <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; ?>" required /> |
|
263 | + <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i", $_COOKIE['archive_begin']).' UTC'; ?>" required /> |
|
264 | 264 | <span class="input-group-addon"> |
265 | 265 | <span class="glyphicon glyphicon-calendar"></span> |
266 | 266 | </span> |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | <div class="form-group"> |
270 | 270 | <label><?php echo _("To:"); ?></label> |
271 | 271 | <div class='input-group date' id='datetimepicker2'> |
272 | - <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; ?>" /> |
|
272 | + <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i", $_COOKIE['archive_end']).' UTC'; ?>" /> |
|
273 | 273 | <span class="input-group-addon"> |
274 | 274 | <span class="glyphicon glyphicon-calendar"></span> |
275 | 275 | </span> |
@@ -439,9 +439,9 @@ discard block |
||
439 | 439 | <select class="selectpicker" onchange="terrainType(this);"> |
440 | 440 | <option value="world"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'world') print ' selected'; ?>>world terrain</option> |
441 | 441 | <option value="stk"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
442 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
443 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
444 | - <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option> |
|
442 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option> |
|
443 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option> |
|
444 | + <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected'; ?>>ArticDEM</option> |
|
445 | 445 | </select> |
446 | 446 | </li> |
447 | 447 | <?php |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li> |
512 | 512 | <?php |
513 | 513 | } |
514 | - if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
514 | + if (time() > mktime(0, 0, 0, 12, 1, date("Y")) && time() < mktime(0, 0, 0, 12, 31, date("Y"))) { |
|
515 | 515 | ?> |
516 | 516 | <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li> |
517 | 517 | <?php |
@@ -707,10 +707,10 @@ discard block |
||
707 | 707 | $Spotter = new Spotter(); |
708 | 708 | $allairlinenames = $Spotter->getAllAirlineNames(); |
709 | 709 | } |
710 | - foreach($allairlinenames as $airline) { |
|
710 | + foreach ($allairlinenames as $airline) { |
|
711 | 711 | $airline_name = $airline['airline_name']; |
712 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
713 | - if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { |
|
712 | + if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...'; |
|
713 | + if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['filter_Airlines']))) { |
|
714 | 714 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
715 | 715 | } else { |
716 | 716 | echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>'; |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
730 | 730 | <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
731 | 731 | <?php |
732 | - foreach($allalliancenames as $alliance) { |
|
732 | + foreach ($allalliancenames as $alliance) { |
|
733 | 733 | $alliance_name = $alliance['alliance']; |
734 | 734 | if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] == $alliance_name) { |
735 | 735 | echo '<option value="'.$alliance_name.'" selected>'.$alliance_name.'</option>'; |
@@ -765,8 +765,8 @@ discard block |
||
765 | 765 | */ |
766 | 766 | $Source = new Source(); |
767 | 767 | $datasource = $Source->getLocationInfoByType('gs'); |
768 | - foreach($datasource as $src) { |
|
769 | - if (isset($_COOKIE['filter_Sources']) && in_array($src['name'],explode(',',$_COOKIE['filter_Sources']))) { |
|
768 | + foreach ($datasource as $src) { |
|
769 | + if (isset($_COOKIE['filter_Sources']) && in_array($src['name'], explode(',', $_COOKIE['filter_Sources']))) { |
|
770 | 770 | echo '<option value="'.$src['name'].'" selected>'.$src['name'].'</option>'; |
771 | 771 | } else { |
772 | 772 | echo '<option value="'.$src['name'].'">'.$src['name'].'</option>'; |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
879 | 879 | else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
880 | 880 | |
881 | - if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
|
881 | + if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) { |
|
882 | 882 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |
883 | 883 | } else { |
884 | 884 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | require_once(dirname(__FILE__).'/class.create_db.php'); |
24 | 24 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
25 | 25 | require_once(dirname(__FILE__).'/class.settings.php'); |
26 | -$title="Install"; |
|
26 | +$title = "Install"; |
|
27 | 27 | require(dirname(__FILE__).'/../require/settings.php'); |
28 | 28 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
29 | 29 | require(dirname(__FILE__).'/header.php'); |
30 | 30 | |
31 | 31 | if (!isset($_SESSION['install']) && !isset($_SESSION['identified'])) { |
32 | - $password = filter_input(INPUT_POST,'password',FILTER_SANITIZE_STRING); |
|
32 | + $password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING); |
|
33 | 33 | if ($password == '') { |
34 | 34 | if ($globalInstalled === TRUE && (!isset($globalInstallPassword) || $globalInstallPassword == '')) { |
35 | 35 | print '<div class="alert alert-danger">You need to change $globalInstalled in settings.php to FALSE if you want to access setup again.</div>'; |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | if (!file_exists(dirname(__FILE__).'/../.htaccess')) { |
111 | 111 | $error[] = dirname(__FILE__).'/../.htaccess'." doesn't exist. The provided .htaccess must exist if you use Apache."; |
112 | 112 | } |
113 | - if(function_exists('apache_get_modules') ){ |
|
114 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
113 | + if (function_exists('apache_get_modules')) { |
|
114 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
115 | 115 | $error[] = "mod_rewrite is not available."; |
116 | 116 | } |
117 | 117 | /* |
@@ -130,22 +130,22 @@ discard block |
||
130 | 130 | $alllng = $Language->listLocaleDir(); |
131 | 131 | if (count($alllng) != count($availablelng)) { |
132 | 132 | $notavailable = array(); |
133 | - foreach($alllng as $lng) { |
|
133 | + foreach ($alllng as $lng) { |
|
134 | 134 | if (!isset($availablelng[$lng])) $notavailable[] = $lng; |
135 | 135 | } |
136 | - print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ',$notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>'; |
|
136 | + print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ', $notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>'; |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | print '<div class="alert alert-info">If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some tables can fail.</div>'; |
140 | 140 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
141 | 141 | if (function_exists('get_headers')) { |
142 | 142 | //$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
143 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'live/geojson?test',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
|
144 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
143 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/', 'install'), 'live/geojson?test', str_replace('index.php', '', $_SERVER["REQUEST_URI"]))); |
|
144 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
145 | 145 | print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>'; |
146 | 146 | } else { |
147 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
|
148 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
147 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/', 'install'), 'search', str_replace('index.php', '', $_SERVER["REQUEST_URI"]))); |
|
148 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
149 | 149 | print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>'; |
150 | 150 | } |
151 | 151 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) { |
234 | 234 | if (isset($_SERVER['REQUEST_URI'])) { |
235 | 235 | $URL = $_SERVER['REQUEST_URI']; |
236 | - $globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL))); |
|
236 | + $globalURL = str_replace('/install', '', str_replace('/install/', '', str_replace('/install/index.php', '', $URL))); |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | ?> |
@@ -583,13 +583,13 @@ discard block |
||
583 | 583 | ?> |
584 | 584 | <tr> |
585 | 585 | <?php |
586 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
586 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
587 | 587 | ?> |
588 | 588 | <td><input type="text" name="host[]" value="<?php print $source['host']; ?>" /></td> |
589 | 589 | <td><input type="text" name="port[]" class="col-xs-2" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
590 | 590 | <?php |
591 | 591 | } else { |
592 | - $hostport = explode(':',$source['host']); |
|
592 | + $hostport = explode(':', $source['host']); |
|
593 | 593 | if (isset($hostport[1])) { |
594 | 594 | $host = $hostport[0]; |
595 | 595 | $port = $hostport[1]; |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | <select name="timezones[]"> |
645 | 645 | <?php |
646 | 646 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
647 | - foreach($timezonelist as $timezones){ |
|
647 | + foreach ($timezonelist as $timezones) { |
|
648 | 648 | if (isset($source['timezone']) && $source['timezone'] == $timezones) { |
649 | 649 | print '<option selected>'.$timezones.'</option>'; |
650 | 650 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | <select name="timezones[]" id="timezones"> |
705 | 705 | <?php |
706 | 706 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
707 | - foreach($timezonelist as $timezones){ |
|
707 | + foreach ($timezonelist as $timezones) { |
|
708 | 708 | if ($timezones == 'UTC') { |
709 | 709 | print '<option selected>'.$timezones.'</option>'; |
710 | 710 | } else print '<option>'.$timezones.'</option>'; |
@@ -1184,7 +1184,7 @@ discard block |
||
1184 | 1184 | <br /> |
1185 | 1185 | <p> |
1186 | 1186 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
1187 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
1187 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
1188 | 1188 | </p> |
1189 | 1189 | <br /> |
1190 | 1190 | <p> |
@@ -1267,17 +1267,17 @@ discard block |
||
1267 | 1267 | $error = ''; |
1268 | 1268 | |
1269 | 1269 | if (isset($_POST['dbtype'])) { |
1270 | - $installpass = filter_input(INPUT_POST,'installpass',FILTER_SANITIZE_STRING); |
|
1271 | - $settings = array_merge($settings,array('globalInstallPassword' => $installpass)); |
|
1270 | + $installpass = filter_input(INPUT_POST, 'installpass', FILTER_SANITIZE_STRING); |
|
1271 | + $settings = array_merge($settings, array('globalInstallPassword' => $installpass)); |
|
1272 | 1272 | |
1273 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
1274 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
1275 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
1276 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
1277 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
1278 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
1279 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
1280 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
1273 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
1274 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
1275 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
1276 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
1277 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
1278 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
1279 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
1280 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
1281 | 1281 | |
1282 | 1282 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
1283 | 1283 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -1297,60 +1297,60 @@ discard block |
||
1297 | 1297 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
1298 | 1298 | */ |
1299 | 1299 | |
1300 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
1300 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
1301 | 1301 | |
1302 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
1303 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
1304 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
1305 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
1306 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
1302 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
1303 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
1304 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
1305 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
1306 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
1307 | 1307 | |
1308 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
1309 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
1310 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
1311 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
1312 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
1313 | - $openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING); |
|
1314 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
1315 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
1316 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
1317 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1308 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
1309 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
1310 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
1311 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
1312 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
1313 | + $openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING); |
|
1314 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
1315 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
1316 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
1317 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1318 | 1318 | |
1319 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
1320 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
1321 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
1322 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
1323 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
1324 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
1319 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
1320 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
1321 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
1322 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
1323 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
1324 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
1325 | 1325 | |
1326 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
1327 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
1326 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
1327 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
1328 | 1328 | |
1329 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
1330 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
1331 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
1329 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
1330 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
1331 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
1332 | 1332 | |
1333 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
1333 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
1334 | 1334 | if ($acars == 'acars') { |
1335 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
1335 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
1336 | 1336 | } else { |
1337 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
1337 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
1338 | 1338 | } |
1339 | - $updatecheck = filter_input(INPUT_POST,'updatecheck',FILTER_SANITIZE_STRING); |
|
1339 | + $updatecheck = filter_input(INPUT_POST, 'updatecheck', FILTER_SANITIZE_STRING); |
|
1340 | 1340 | if ($updatecheck == 'updatecheck') { |
1341 | - $settings = array_merge($settings,array('globalDisableUpdateCheck' => 'TRUE')); |
|
1341 | + $settings = array_merge($settings, array('globalDisableUpdateCheck' => 'TRUE')); |
|
1342 | 1342 | } else { |
1343 | - $settings = array_merge($settings,array('globalDisableUpdateCheck' => 'FALSE')); |
|
1343 | + $settings = array_merge($settings, array('globalDisableUpdateCheck' => 'FALSE')); |
|
1344 | 1344 | } |
1345 | 1345 | |
1346 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
1347 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
1348 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
1346 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
1347 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
1348 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
1349 | 1349 | |
1350 | - $sailawayemail = filter_input(INPUT_POST,'sailawayemail',FILTER_SANITIZE_STRING); |
|
1351 | - $sailawaypass = filter_input(INPUT_POST,'sailawaypassword',FILTER_SANITIZE_STRING); |
|
1352 | - $sailawaykey = filter_input(INPUT_POST,'sailawaykey',FILTER_SANITIZE_STRING); |
|
1353 | - $settings = array_merge($settings,array('globalSailaway' => array('email' => $sailawayemail,'password' => $sailawaypass,'key' => $sailawaykey))); |
|
1350 | + $sailawayemail = filter_input(INPUT_POST, 'sailawayemail', FILTER_SANITIZE_STRING); |
|
1351 | + $sailawaypass = filter_input(INPUT_POST, 'sailawaypassword', FILTER_SANITIZE_STRING); |
|
1352 | + $sailawaykey = filter_input(INPUT_POST, 'sailawaykey', FILTER_SANITIZE_STRING); |
|
1353 | + $settings = array_merge($settings, array('globalSailaway' => array('email' => $sailawayemail, 'password' => $sailawaypass, 'key' => $sailawaykey))); |
|
1354 | 1354 | |
1355 | 1355 | $source_name = $_POST['source_name']; |
1356 | 1356 | $source_latitude = $_POST['source_latitude']; |
@@ -1364,8 +1364,8 @@ discard block |
||
1364 | 1364 | |
1365 | 1365 | $sources = array(); |
1366 | 1366 | foreach ($source_name as $keys => $name) { |
1367 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
1368 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
1367 | + if (isset($source_id[$keys])) $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'id' => $source_id[$keys], 'source' => $source_ref[$keys]); |
|
1368 | + else $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'source' => $source_ref[$keys]); |
|
1369 | 1369 | } |
1370 | 1370 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
1371 | 1371 | |
@@ -1374,16 +1374,16 @@ discard block |
||
1374 | 1374 | $newstype = $_POST['newstype']; |
1375 | 1375 | |
1376 | 1376 | $newsfeeds = array(); |
1377 | - foreach($newsurl as $newskey => $url) { |
|
1377 | + foreach ($newsurl as $newskey => $url) { |
|
1378 | 1378 | if ($url != '') { |
1379 | 1379 | $type = $newstype[$newskey]; |
1380 | 1380 | $lng = $newslng[$newskey]; |
1381 | 1381 | if (isset($newsfeeds[$type][$lng])) { |
1382 | - $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
|
1382 | + $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng], array($url)); |
|
1383 | 1383 | } else $newsfeeds[$type][$lng] = array($url); |
1384 | 1384 | } |
1385 | 1385 | } |
1386 | - $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
|
1386 | + $settings = array_merge($settings, array('globalNewsFeeds' => $newsfeeds)); |
|
1387 | 1387 | |
1388 | 1388 | //$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING); |
1389 | 1389 | //$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT); |
@@ -1394,28 +1394,28 @@ discard block |
||
1394 | 1394 | $sbsurl = $_POST['sbsurl']; |
1395 | 1395 | */ |
1396 | 1396 | |
1397 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
1398 | - $globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING); |
|
1399 | - $globalvm = filter_input(INPUT_POST,'globalvm',FILTER_SANITIZE_STRING); |
|
1400 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
1401 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
1402 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
1403 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
1404 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
1405 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
1397 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
1398 | + $globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING); |
|
1399 | + $globalvm = filter_input(INPUT_POST, 'globalvm', FILTER_SANITIZE_STRING); |
|
1400 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
1401 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
1402 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
1403 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
1404 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
1405 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
1406 | 1406 | |
1407 | - $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
|
1408 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1409 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1410 | - $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
|
1411 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1412 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1413 | - $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
|
1414 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1415 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1416 | - $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
|
1417 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1418 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1407 | + $globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING); |
|
1408 | + if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE')); |
|
1409 | + else $settings = array_merge($settings, array('globalAircraft' => 'FALSE')); |
|
1410 | + $globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING); |
|
1411 | + if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE')); |
|
1412 | + else $settings = array_merge($settings, array('globalTracker' => 'FALSE')); |
|
1413 | + $globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING); |
|
1414 | + if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE')); |
|
1415 | + else $settings = array_merge($settings, array('globalMarine' => 'FALSE')); |
|
1416 | + $globalsatellite = filter_input(INPUT_POST, 'globalsatellite', FILTER_SANITIZE_STRING); |
|
1417 | + if ($globalsatellite == 'satellite') $settings = array_merge($settings, array('globalSatellite' => 'TRUE')); |
|
1418 | + else $settings = array_merge($settings, array('globalSatellite' => 'FALSE')); |
|
1419 | 1419 | |
1420 | 1420 | /* |
1421 | 1421 | $globalSBS1Hosts = array(); |
@@ -1431,7 +1431,7 @@ discard block |
||
1431 | 1431 | } |
1432 | 1432 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
1433 | 1433 | */ |
1434 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
1434 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
1435 | 1435 | $host = $_POST['host']; |
1436 | 1436 | $port = $_POST['port']; |
1437 | 1437 | $name = $_POST['name']; |
@@ -1448,115 +1448,115 @@ discard block |
||
1448 | 1448 | else $cov = 'FALSE'; |
1449 | 1449 | if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
1450 | 1450 | else $arch = 'FALSE'; |
1451 | - if (strpos($format[$key],'_callback')) { |
|
1452 | - $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
|
1451 | + if (strpos($format[$key], '_callback')) { |
|
1452 | + $gSources[] = array('host' => $h, 'pass' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'TRUE'); |
|
1453 | 1453 | } elseif ($format[$key] != 'auto' || ($h != '' || $name[$key] != '')) { |
1454 | - $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
|
1454 | + $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'FALSE'); |
|
1455 | 1455 | } |
1456 | 1456 | if ($format[$key] == 'airwhere') $forcepilots = true; |
1457 | 1457 | } |
1458 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
1458 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
1459 | 1459 | |
1460 | 1460 | /* |
1461 | 1461 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
1462 | 1462 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
1463 | 1463 | */ |
1464 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
1465 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
1466 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
1464 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
1465 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
1466 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
1467 | 1467 | |
1468 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
1469 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
1468 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
1469 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
1470 | 1470 | |
1471 | - $customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING); |
|
1472 | - $settings = array_merge($settings,array('globalCustomCSS' => $customcss)); |
|
1471 | + $customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING); |
|
1472 | + $settings = array_merge($settings, array('globalCustomCSS' => $customcss)); |
|
1473 | 1473 | |
1474 | - $map3dtile = filter_input(INPUT_POST,'map3dtileset',FILTER_SANITIZE_STRING); |
|
1475 | - $settings = array_merge($settings,array('globalMap3DTiles' => $map3dtile)); |
|
1474 | + $map3dtile = filter_input(INPUT_POST, 'map3dtileset', FILTER_SANITIZE_STRING); |
|
1475 | + $settings = array_merge($settings, array('globalMap3DTiles' => $map3dtile)); |
|
1476 | 1476 | |
1477 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
1478 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
1479 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
1480 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
1477 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
1478 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
1479 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
1480 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
1481 | 1481 | |
1482 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
1483 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
1484 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
1482 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
1483 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
1484 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
1485 | 1485 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1486 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
1487 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1486 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
1487 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
1488 | 1488 | |
1489 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
1490 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
1491 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
1492 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
1493 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
1494 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
1495 | - $minfetch = filter_input(INPUT_POST,'minfetch',FILTER_SANITIZE_NUMBER_INT); |
|
1496 | - $settings = array_merge($settings,array('globalMinFetch' => $minfetch)); |
|
1497 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
1498 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
1489 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
1490 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
1491 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
1492 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
1493 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
1494 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
1495 | + $minfetch = filter_input(INPUT_POST, 'minfetch', FILTER_SANITIZE_NUMBER_INT); |
|
1496 | + $settings = array_merge($settings, array('globalMinFetch' => $minfetch)); |
|
1497 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
1498 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
1499 | 1499 | |
1500 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
1501 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
1500 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
1501 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
1502 | 1502 | |
1503 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
1504 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
1503 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
1504 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
1505 | 1505 | |
1506 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
1506 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
1507 | 1507 | if ($archiveyear == "archiveyear") { |
1508 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
1508 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
1509 | 1509 | } else { |
1510 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
1510 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
1511 | 1511 | } |
1512 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1513 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1514 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1515 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1512 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1513 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1514 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1515 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1516 | 1516 | |
1517 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
1518 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
1519 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
1520 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
1517 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
1518 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
1519 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
1520 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
1521 | 1521 | |
1522 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
1523 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
1524 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
1522 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
1523 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
1524 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
1525 | 1525 | |
1526 | 1526 | // Create in settings.php keys not yet configurable if not already here |
1527 | 1527 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1528 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1528 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
1529 | 1529 | |
1530 | - $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
|
1530 | + $resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING); |
|
1531 | 1531 | if ($resetyearstats == 'resetyearstats') { |
1532 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE')); |
|
1532 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE')); |
|
1533 | 1533 | } else { |
1534 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE')); |
|
1534 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE')); |
|
1535 | 1535 | } |
1536 | 1536 | |
1537 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
1537 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
1538 | 1538 | if ($archive == 'archive') { |
1539 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
1539 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
1540 | 1540 | } else { |
1541 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
1541 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
1542 | 1542 | } |
1543 | - $archiveresults = filter_input(INPUT_POST,'archiveresults',FILTER_SANITIZE_STRING); |
|
1543 | + $archiveresults = filter_input(INPUT_POST, 'archiveresults', FILTER_SANITIZE_STRING); |
|
1544 | 1544 | if ($archiveresults == 'archiveresults') { |
1545 | - $settings = array_merge($settings,array('globalArchiveResults' => 'TRUE')); |
|
1545 | + $settings = array_merge($settings, array('globalArchiveResults' => 'TRUE')); |
|
1546 | 1546 | } else { |
1547 | - $settings = array_merge($settings,array('globalArchiveResults' => 'FALSE')); |
|
1547 | + $settings = array_merge($settings, array('globalArchiveResults' => 'FALSE')); |
|
1548 | 1548 | } |
1549 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
1549 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
1550 | 1550 | if ($daemon == 'daemon') { |
1551 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
1551 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
1552 | 1552 | } else { |
1553 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
1553 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
1554 | 1554 | } |
1555 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
1555 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
1556 | 1556 | if ($schedules == 'schedules') { |
1557 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
1557 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
1558 | 1558 | } else { |
1559 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
1559 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
1560 | 1560 | } |
1561 | 1561 | |
1562 | 1562 | /* |
@@ -1567,311 +1567,311 @@ discard block |
||
1567 | 1567 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
1568 | 1568 | } |
1569 | 1569 | */ |
1570 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
1571 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1572 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1573 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1574 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1570 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
1571 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
1572 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
1573 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
1574 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
1575 | 1575 | $va = false; |
1576 | 1576 | if ($globalivao == 'ivao') { |
1577 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
1577 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
1578 | 1578 | $va = true; |
1579 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1579 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
1580 | 1580 | if ($globalvatsim == 'vatsim') { |
1581 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
1581 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
1582 | 1582 | $va = true; |
1583 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1583 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
1584 | 1584 | if ($globalphpvms == 'phpvms') { |
1585 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
1585 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
1586 | 1586 | $va = true; |
1587 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1587 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
1588 | 1588 | if ($globalvam == 'vam') { |
1589 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
1589 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
1590 | 1590 | $va = true; |
1591 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1591 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
1592 | 1592 | if ($va) { |
1593 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
1594 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1593 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
1594 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
1595 | 1595 | if ($globalva == 'va' || $va) { |
1596 | - $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
|
1597 | - $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1596 | + $settings = array_merge($settings, array('globalVA' => 'TRUE')); |
|
1597 | + $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1598 | 1598 | } else { |
1599 | - $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
1600 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1601 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1599 | + $settings = array_merge($settings, array('globalVA' => 'FALSE')); |
|
1600 | + if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1601 | + else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE')); |
|
1602 | 1602 | } |
1603 | 1603 | if ($globalvm == 'vm') { |
1604 | - $settings = array_merge($settings,array('globalVM' => 'TRUE')); |
|
1604 | + $settings = array_merge($settings, array('globalVM' => 'TRUE')); |
|
1605 | 1605 | } else { |
1606 | - $settings = array_merge($settings,array('globalVM' => 'FALSE')); |
|
1606 | + $settings = array_merge($settings, array('globalVM' => 'FALSE')); |
|
1607 | 1607 | } |
1608 | 1608 | |
1609 | - $mapoffline = filter_input(INPUT_POST,'mapoffline',FILTER_SANITIZE_STRING); |
|
1609 | + $mapoffline = filter_input(INPUT_POST, 'mapoffline', FILTER_SANITIZE_STRING); |
|
1610 | 1610 | if ($mapoffline == 'mapoffline') { |
1611 | - $settings = array_merge($settings,array('globalMapOffline' => 'TRUE')); |
|
1611 | + $settings = array_merge($settings, array('globalMapOffline' => 'TRUE')); |
|
1612 | 1612 | } else { |
1613 | - $settings = array_merge($settings,array('globalMapOffline' => 'FALSE')); |
|
1613 | + $settings = array_merge($settings, array('globalMapOffline' => 'FALSE')); |
|
1614 | 1614 | } |
1615 | - $globaloffline = filter_input(INPUT_POST,'globaloffline',FILTER_SANITIZE_STRING); |
|
1615 | + $globaloffline = filter_input(INPUT_POST, 'globaloffline', FILTER_SANITIZE_STRING); |
|
1616 | 1616 | if ($globaloffline == 'globaloffline') { |
1617 | - $settings = array_merge($settings,array('globalOffline' => 'TRUE')); |
|
1617 | + $settings = array_merge($settings, array('globalOffline' => 'TRUE')); |
|
1618 | 1618 | } else { |
1619 | - $settings = array_merge($settings,array('globalOffline' => 'FALSE')); |
|
1619 | + $settings = array_merge($settings, array('globalOffline' => 'FALSE')); |
|
1620 | 1620 | } |
1621 | 1621 | |
1622 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
1622 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
1623 | 1623 | if ($notam == 'notam') { |
1624 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
1624 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
1625 | 1625 | } else { |
1626 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
1626 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
1627 | 1627 | } |
1628 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
1628 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
1629 | 1629 | if ($owner == 'owner') { |
1630 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
1630 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
1631 | 1631 | } else { |
1632 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
1632 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
1633 | 1633 | } |
1634 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
1634 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
1635 | 1635 | if ($map3d == 'map3d') { |
1636 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
1636 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
1637 | 1637 | } else { |
1638 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
1638 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
1639 | 1639 | } |
1640 | - $crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING); |
|
1640 | + $crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING); |
|
1641 | 1641 | if ($crash == 'crash') { |
1642 | - $settings = array_merge($settings,array('globalAccidents' => 'TRUE')); |
|
1642 | + $settings = array_merge($settings, array('globalAccidents' => 'TRUE')); |
|
1643 | 1643 | } else { |
1644 | - $settings = array_merge($settings,array('globalAccidents' => 'FALSE')); |
|
1644 | + $settings = array_merge($settings, array('globalAccidents' => 'FALSE')); |
|
1645 | 1645 | } |
1646 | - $fires = filter_input(INPUT_POST,'fires',FILTER_SANITIZE_STRING); |
|
1646 | + $fires = filter_input(INPUT_POST, 'fires', FILTER_SANITIZE_STRING); |
|
1647 | 1647 | if ($fires == 'fires') { |
1648 | - $settings = array_merge($settings,array('globalMapFires' => 'TRUE')); |
|
1648 | + $settings = array_merge($settings, array('globalMapFires' => 'TRUE')); |
|
1649 | 1649 | } else { |
1650 | - $settings = array_merge($settings,array('globalMapFires' => 'FALSE')); |
|
1650 | + $settings = array_merge($settings, array('globalMapFires' => 'FALSE')); |
|
1651 | 1651 | } |
1652 | - $firessupport = filter_input(INPUT_POST,'firessupport',FILTER_SANITIZE_STRING); |
|
1652 | + $firessupport = filter_input(INPUT_POST, 'firessupport', FILTER_SANITIZE_STRING); |
|
1653 | 1653 | if ($firessupport == 'firessupport') { |
1654 | - $settings = array_merge($settings,array('globalFires' => 'TRUE')); |
|
1654 | + $settings = array_merge($settings, array('globalFires' => 'TRUE')); |
|
1655 | 1655 | } else { |
1656 | - $settings = array_merge($settings,array('globalFires' => 'FALSE')); |
|
1656 | + $settings = array_merge($settings, array('globalFires' => 'FALSE')); |
|
1657 | 1657 | } |
1658 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
1658 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
1659 | 1659 | if ($mapsatellites == 'mapsatellites') { |
1660 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
1660 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
1661 | 1661 | } else { |
1662 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
1662 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
1663 | 1663 | } |
1664 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
1664 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
1665 | 1665 | if ($map3ddefault == 'map3ddefault') { |
1666 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
1666 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
1667 | 1667 | } else { |
1668 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
1668 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
1669 | 1669 | } |
1670 | - $one3dmodel = filter_input(INPUT_POST,'one3dmodel',FILTER_SANITIZE_STRING); |
|
1670 | + $one3dmodel = filter_input(INPUT_POST, 'one3dmodel', FILTER_SANITIZE_STRING); |
|
1671 | 1671 | if ($one3dmodel == 'one3dmodel') { |
1672 | - $settings = array_merge($settings,array('globalMap3DOneModel' => 'TRUE')); |
|
1672 | + $settings = array_merge($settings, array('globalMap3DOneModel' => 'TRUE')); |
|
1673 | 1673 | } else { |
1674 | - $settings = array_merge($settings,array('globalMap3DOneModel' => 'FALSE')); |
|
1674 | + $settings = array_merge($settings, array('globalMap3DOneModel' => 'FALSE')); |
|
1675 | 1675 | } |
1676 | - $map3dliveries = filter_input(INPUT_POST,'map3dliveries',FILTER_SANITIZE_STRING); |
|
1676 | + $map3dliveries = filter_input(INPUT_POST, 'map3dliveries', FILTER_SANITIZE_STRING); |
|
1677 | 1677 | if ($map3dliveries == 'map3dliveries') { |
1678 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'TRUE')); |
|
1678 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'TRUE')); |
|
1679 | 1679 | } else { |
1680 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'FALSE')); |
|
1680 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'FALSE')); |
|
1681 | 1681 | } |
1682 | - $map3dshadows = filter_input(INPUT_POST,'map3dshadows',FILTER_SANITIZE_STRING); |
|
1682 | + $map3dshadows = filter_input(INPUT_POST, 'map3dshadows', FILTER_SANITIZE_STRING); |
|
1683 | 1683 | if ($map3dshadows == 'map3dshadows') { |
1684 | - $settings = array_merge($settings,array('globalMap3DShadows' => 'TRUE')); |
|
1684 | + $settings = array_merge($settings, array('globalMap3DShadows' => 'TRUE')); |
|
1685 | 1685 | } else { |
1686 | - $settings = array_merge($settings,array('globalMap3DShadows' => 'FALSE')); |
|
1686 | + $settings = array_merge($settings, array('globalMap3DShadows' => 'FALSE')); |
|
1687 | 1687 | } |
1688 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
1688 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
1689 | 1689 | if ($translate == 'translate') { |
1690 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
1690 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
1691 | 1691 | } else { |
1692 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
1692 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
1693 | 1693 | } |
1694 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
1694 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
1695 | 1695 | if ($realairlines == 'realairlines') { |
1696 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
1696 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
1697 | 1697 | } else { |
1698 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
1698 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
1699 | 1699 | } |
1700 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
1700 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
1701 | 1701 | if ($estimation == 'estimation') { |
1702 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
1702 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
1703 | 1703 | } else { |
1704 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
1704 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
1705 | 1705 | } |
1706 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
1706 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
1707 | 1707 | if ($metar == 'metar') { |
1708 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
1708 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
1709 | 1709 | } else { |
1710 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
1710 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
1711 | 1711 | } |
1712 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
1712 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
1713 | 1713 | if ($metarcycle == 'metarcycle') { |
1714 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
1714 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
1715 | 1715 | } else { |
1716 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
1716 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
1717 | 1717 | } |
1718 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
1718 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
1719 | 1719 | if ($fork == 'fork') { |
1720 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
1720 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
1721 | 1721 | } else { |
1722 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
1722 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
1723 | 1723 | } |
1724 | 1724 | |
1725 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
1725 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
1726 | 1726 | if ($colormap == 'colormap') { |
1727 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
1727 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
1728 | 1728 | } else { |
1729 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
1729 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
1730 | 1730 | } |
1731 | 1731 | |
1732 | 1732 | if (isset($_POST['aircrafticoncolor'])) { |
1733 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
1734 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
1733 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
1734 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
1735 | 1735 | } |
1736 | 1736 | if (isset($_POST['marineiconcolor'])) { |
1737 | - $marineiconcolor = filter_input(INPUT_POST,'marineiconcolor',FILTER_SANITIZE_STRING); |
|
1738 | - $settings = array_merge($settings,array('globalMarineIconColor' => substr($marineiconcolor,1))); |
|
1737 | + $marineiconcolor = filter_input(INPUT_POST, 'marineiconcolor', FILTER_SANITIZE_STRING); |
|
1738 | + $settings = array_merge($settings, array('globalMarineIconColor' => substr($marineiconcolor, 1))); |
|
1739 | 1739 | } |
1740 | 1740 | if (isset($_POST['trackericoncolor'])) { |
1741 | - $trackericoncolor = filter_input(INPUT_POST,'trackericoncolor',FILTER_SANITIZE_STRING); |
|
1742 | - $settings = array_merge($settings,array('globalTrackerIconColor' => substr($trackericoncolor,1))); |
|
1741 | + $trackericoncolor = filter_input(INPUT_POST, 'trackericoncolor', FILTER_SANITIZE_STRING); |
|
1742 | + $settings = array_merge($settings, array('globalTrackerIconColor' => substr($trackericoncolor, 1))); |
|
1743 | 1743 | } |
1744 | 1744 | if (isset($_POST['satelliteiconcolor'])) { |
1745 | - $satelliteiconcolor = filter_input(INPUT_POST,'satelliteiconcolor',FILTER_SANITIZE_STRING); |
|
1746 | - $settings = array_merge($settings,array('globalSatelliteIconColor' => substr($satelliteiconcolor,1))); |
|
1745 | + $satelliteiconcolor = filter_input(INPUT_POST, 'satelliteiconcolor', FILTER_SANITIZE_STRING); |
|
1746 | + $settings = array_merge($settings, array('globalSatelliteIconColor' => substr($satelliteiconcolor, 1))); |
|
1747 | 1747 | } |
1748 | 1748 | |
1749 | - $corsproxy = filter_input(INPUT_POST,'corsproxy',FILTER_SANITIZE_STRING); |
|
1750 | - $settings = array_merge($settings,array('globalCORSproxy' => $corsproxy)); |
|
1749 | + $corsproxy = filter_input(INPUT_POST, 'corsproxy', FILTER_SANITIZE_STRING); |
|
1750 | + $settings = array_merge($settings, array('globalCORSproxy' => $corsproxy)); |
|
1751 | 1751 | |
1752 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
1753 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
1752 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
1753 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
1754 | 1754 | |
1755 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
1756 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
1757 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
1758 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
1759 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
1760 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
1755 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
1756 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
1757 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
1758 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
1759 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
1760 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
1761 | 1761 | |
1762 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
1762 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
1763 | 1763 | if ($mappopup == 'mappopup') { |
1764 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
1764 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
1765 | 1765 | } else { |
1766 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
1766 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
1767 | 1767 | } |
1768 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
1768 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
1769 | 1769 | if ($airportpopup == 'airportpopup') { |
1770 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
1770 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
1771 | 1771 | } else { |
1772 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
1772 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
1773 | 1773 | } |
1774 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
1774 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
1775 | 1775 | if ($maphistory == 'maphistory') { |
1776 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
1776 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
1777 | 1777 | } else { |
1778 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
1778 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
1779 | 1779 | } |
1780 | - $maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING); |
|
1780 | + $maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING); |
|
1781 | 1781 | if ($maptooltip == 'maptooltip') { |
1782 | - $settings = array_merge($settings,array('globalMapTooltip' => 'TRUE')); |
|
1782 | + $settings = array_merge($settings, array('globalMapTooltip' => 'TRUE')); |
|
1783 | 1783 | } else { |
1784 | - $settings = array_merge($settings,array('globalMapTooltip' => 'FALSE')); |
|
1784 | + $settings = array_merge($settings, array('globalMapTooltip' => 'FALSE')); |
|
1785 | 1785 | } |
1786 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
1786 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
1787 | 1787 | if ($flightroute == 'flightroute') { |
1788 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
1788 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
1789 | 1789 | } else { |
1790 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
1790 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
1791 | 1791 | } |
1792 | - $flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING); |
|
1792 | + $flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING); |
|
1793 | 1793 | if ($flightremainingroute == 'flightremainingroute') { |
1794 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE')); |
|
1794 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE')); |
|
1795 | 1795 | } else { |
1796 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE')); |
|
1796 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE')); |
|
1797 | 1797 | } |
1798 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
1798 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
1799 | 1799 | if ($allflights == 'allflights') { |
1800 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
1800 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
1801 | 1801 | } else { |
1802 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
1802 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
1803 | 1803 | } |
1804 | - $bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING); |
|
1804 | + $bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING); |
|
1805 | 1805 | if ($bbox == 'bbox') { |
1806 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE')); |
|
1806 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE')); |
|
1807 | 1807 | } else { |
1808 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE')); |
|
1808 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE')); |
|
1809 | 1809 | } |
1810 | - $singlemodel = filter_input(INPUT_POST,'singlemodel',FILTER_SANITIZE_STRING); |
|
1810 | + $singlemodel = filter_input(INPUT_POST, 'singlemodel', FILTER_SANITIZE_STRING); |
|
1811 | 1811 | if ($singlemodel == 'singlemodel') { |
1812 | - $settings = array_merge($settings,array('globalMap3DSelected' => 'TRUE')); |
|
1812 | + $settings = array_merge($settings, array('globalMap3DSelected' => 'TRUE')); |
|
1813 | 1813 | } else { |
1814 | - $settings = array_merge($settings,array('globalMap3DSelected' => 'FALSE')); |
|
1814 | + $settings = array_merge($settings, array('globalMap3DSelected' => 'FALSE')); |
|
1815 | 1815 | } |
1816 | - $groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING); |
|
1816 | + $groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING); |
|
1817 | 1817 | if ($groundaltitude == 'groundaltitude') { |
1818 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE')); |
|
1818 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE')); |
|
1819 | 1819 | } else { |
1820 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE')); |
|
1820 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE')); |
|
1821 | 1821 | } |
1822 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
1822 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
1823 | 1823 | if ($waypoints == 'waypoints') { |
1824 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
1824 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
1825 | 1825 | } else { |
1826 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
1826 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
1827 | 1827 | } |
1828 | - $geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING); |
|
1828 | + $geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING); |
|
1829 | 1829 | if ($geoid == 'geoid') { |
1830 | - $settings = array_merge($settings,array('globalGeoid' => 'TRUE')); |
|
1830 | + $settings = array_merge($settings, array('globalGeoid' => 'TRUE')); |
|
1831 | 1831 | } else { |
1832 | - $settings = array_merge($settings,array('globalGeoid' => 'FALSE')); |
|
1832 | + $settings = array_merge($settings, array('globalGeoid' => 'FALSE')); |
|
1833 | 1833 | } |
1834 | - $geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING); |
|
1835 | - $settings = array_merge($settings,array('globalGeoidSource' => $geoid_source)); |
|
1834 | + $geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING); |
|
1835 | + $settings = array_merge($settings, array('globalGeoidSource' => $geoid_source)); |
|
1836 | 1836 | |
1837 | - $noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING); |
|
1837 | + $noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING); |
|
1838 | 1838 | if ($noairlines == 'noairlines') { |
1839 | - $settings = array_merge($settings,array('globalNoAirlines' => 'TRUE')); |
|
1839 | + $settings = array_merge($settings, array('globalNoAirlines' => 'TRUE')); |
|
1840 | 1840 | } else { |
1841 | - $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
|
1841 | + $settings = array_merge($settings, array('globalNoAirlines' => 'FALSE')); |
|
1842 | 1842 | } |
1843 | 1843 | |
1844 | - $tsk = filter_input(INPUT_POST,'tsk',FILTER_SANITIZE_STRING); |
|
1844 | + $tsk = filter_input(INPUT_POST, 'tsk', FILTER_SANITIZE_STRING); |
|
1845 | 1845 | if ($tsk == 'tsk') { |
1846 | - $settings = array_merge($settings,array('globalTSK' => 'TRUE')); |
|
1846 | + $settings = array_merge($settings, array('globalTSK' => 'TRUE')); |
|
1847 | 1847 | } else { |
1848 | - $settings = array_merge($settings,array('globalTSK' => 'FALSE')); |
|
1848 | + $settings = array_merge($settings, array('globalTSK' => 'FALSE')); |
|
1849 | 1849 | } |
1850 | - $mapmatching = filter_input(INPUT_POST,'mapmatching',FILTER_SANITIZE_STRING); |
|
1850 | + $mapmatching = filter_input(INPUT_POST, 'mapmatching', FILTER_SANITIZE_STRING); |
|
1851 | 1851 | if ($mapmatching == 'mapmatching') { |
1852 | - $settings = array_merge($settings,array('globalMapMatching' => 'TRUE')); |
|
1852 | + $settings = array_merge($settings, array('globalMapMatching' => 'TRUE')); |
|
1853 | 1853 | } else { |
1854 | - $settings = array_merge($settings,array('globalMapMatching' => 'FALSE')); |
|
1854 | + $settings = array_merge($settings, array('globalMapMatching' => 'FALSE')); |
|
1855 | 1855 | } |
1856 | - $mapmatchingsource = filter_input(INPUT_POST,'mapmatchingsource',FILTER_SANITIZE_STRING); |
|
1857 | - $settings = array_merge($settings,array('globalMapMatchingSource' => $mapmatchingsource)); |
|
1858 | - $graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING); |
|
1859 | - $settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper)); |
|
1856 | + $mapmatchingsource = filter_input(INPUT_POST, 'mapmatchingsource', FILTER_SANITIZE_STRING); |
|
1857 | + $settings = array_merge($settings, array('globalMapMatchingSource' => $mapmatchingsource)); |
|
1858 | + $graphhopper = filter_input(INPUT_POST, 'graphhopper', FILTER_SANITIZE_STRING); |
|
1859 | + $settings = array_merge($settings, array('globalGraphHopperKey' => $graphhopper)); |
|
1860 | 1860 | |
1861 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1861 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
1862 | 1862 | |
1863 | 1863 | // Set some defaults values... |
1864 | 1864 | if (!isset($globalAircraftImageSources)) { |
1865 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1866 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1865 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
1866 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1867 | 1867 | } |
1868 | 1868 | |
1869 | 1869 | if (!isset($globalSchedulesSources)) { |
1870 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1871 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1870 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1871 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1872 | 1872 | } |
1873 | 1873 | |
1874 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
1874 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
1875 | 1875 | |
1876 | 1876 | if ($error == '') settings::modify_settings($settings); |
1877 | 1877 | if ($error == '') settings::comment_settings($settings_comment); |
@@ -27,33 +27,33 @@ discard block |
||
27 | 27 | * @param bool $and |
28 | 28 | * @return string the SQL part |
29 | 29 | */ |
30 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
30 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
31 | 31 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
32 | 32 | $filters = array(); |
33 | 33 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
34 | 34 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
35 | 35 | $filters = $globalStatsFilters[$globalFilterName]; |
36 | 36 | } else { |
37 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
37 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | if (isset($filter[0]['source'])) { |
41 | - $filters = array_merge($filters,$filter); |
|
41 | + $filters = array_merge($filters, $filter); |
|
42 | 42 | } |
43 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
43 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
44 | 44 | $filter_query_join = ''; |
45 | 45 | $filter_query_where = ''; |
46 | - foreach($filters as $flt) { |
|
46 | + foreach ($filters as $flt) { |
|
47 | 47 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
48 | 48 | if (isset($flt['source'])) { |
49 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND marine_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
49 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND marine_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
50 | 50 | } else { |
51 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
51 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | } |
55 | 55 | if (isset($filter['source']) && !empty($filter['source'])) { |
56 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
56 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
57 | 57 | } |
58 | 58 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
59 | 59 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -91,15 +91,15 @@ discard block |
||
91 | 91 | $filter_query_date .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'"; |
92 | 92 | } |
93 | 93 | } |
94 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id"; |
|
94 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id"; |
|
95 | 95 | } |
96 | 96 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
97 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
97 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
98 | 98 | } |
99 | 99 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
100 | 100 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
101 | 101 | if ($filter_query_where != '') { |
102 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
102 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
103 | 103 | } |
104 | 104 | $filter_query = $filter_query_join.$filter_query_where; |
105 | 105 | return $filter_query; |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | if ($limit != '') |
125 | 125 | { |
126 | 126 | $limit_array = explode(',', $limit); |
127 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
128 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
127 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
128 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
129 | 129 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
130 | 130 | { |
131 | 131 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
141 | 141 | } |
142 | 142 | } |
143 | - if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC'; |
|
143 | + if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC'; |
|
144 | 144 | |
145 | 145 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
146 | 146 | if ($globalDBdriver == 'mysql') { |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | } else { |
150 | 150 | $query = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate".$filter_query.$orderby_query; |
151 | 151 | } |
152 | - $spotter_array = $Marine->getDataFromDB($query.$limit_query,array(),'',true); |
|
152 | + $spotter_array = $Marine->getDataFromDB($query.$limit_query, array(), '', true); |
|
153 | 153 | |
154 | 154 | return $spotter_array; |
155 | 155 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | global $globalDBdriver, $globalLiveInterval; |
166 | 166 | date_default_timezone_set('UTC'); |
167 | 167 | |
168 | - $filter_query = $this->getFilter($filter,true,true); |
|
168 | + $filter_query = $this->getFilter($filter, true, true); |
|
169 | 169 | |
170 | 170 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
171 | 171 | if ($globalDBdriver == 'mysql') { |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | try { |
180 | 180 | $sth = $this->db->prepare($query); |
181 | 181 | $sth->execute(); |
182 | - } catch(PDOException $e) { |
|
182 | + } catch (PDOException $e) { |
|
183 | 183 | echo $e->getMessage(); |
184 | 184 | die; |
185 | 185 | } |
@@ -197,26 +197,26 @@ discard block |
||
197 | 197 | * @param string $id |
198 | 198 | * @return array the spotter information |
199 | 199 | */ |
200 | - public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false, $id = '') |
|
200 | + public function getMinLastLiveMarineData($coord = array(), $filter = array(), $limit = false, $id = '') |
|
201 | 201 | { |
202 | 202 | global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive; |
203 | 203 | date_default_timezone_set('UTC'); |
204 | 204 | $usecoord = false; |
205 | 205 | if (is_array($coord) && !empty($coord)) { |
206 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
207 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
208 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
209 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
206 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
207 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
208 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
209 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
210 | 210 | $usecoord = true; |
211 | 211 | } |
212 | - $id = filter_var($id,FILTER_SANITIZE_STRING); |
|
213 | - $filter_query = $this->getFilter($filter,true,true); |
|
212 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
213 | + $filter_query = $this->getFilter($filter, true, true); |
|
214 | 214 | |
215 | 215 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
216 | 216 | if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300'; |
217 | 217 | if ($globalDBdriver == 'mysql') { |
218 | 218 | if (isset($globalArchive) && $globalArchive === TRUE) { |
219 | - $query = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
|
219 | + $query = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
|
220 | 220 | FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id "; |
221 | 221 | if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
222 | 222 | if ($id != '') $query .= "OR marine_archive.fammarine_id = :id "; |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | ORDER BY fammarine_id, date"; |
231 | 231 | if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
232 | 232 | } else { |
233 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
233 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
234 | 234 | FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date "; |
235 | 235 | if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
236 | 236 | if ($id != '') $query .= "OR marine_live.fammarine_id = :id "; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | } |
241 | 241 | } else { |
242 | 242 | if (isset($globalArchive) && $globalArchive === TRUE) { |
243 | - $query = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
|
243 | + $query = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
|
244 | 244 | FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id "; |
245 | 245 | if ($usecoord) $query .= "AND (marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
246 | 246 | if ($id != '') $query .= "OR marine_archive.fammarine_id = :id "; |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | try { |
268 | 268 | $sth = $this->db->prepare($query); |
269 | 269 | $sth->execute($query_values); |
270 | - } catch(PDOException $e) { |
|
270 | + } catch (PDOException $e) { |
|
271 | 271 | echo $e->getMessage(); |
272 | 272 | die; |
273 | 273 | } |
@@ -283,12 +283,12 @@ discard block |
||
283 | 283 | * @param bool $limit |
284 | 284 | * @return array the spotter information |
285 | 285 | */ |
286 | - public function getMinLastLiveMarineDataByID($id = '',$filter = array(), $limit = false) |
|
286 | + public function getMinLastLiveMarineDataByID($id = '', $filter = array(), $limit = false) |
|
287 | 287 | { |
288 | 288 | global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive; |
289 | 289 | date_default_timezone_set('UTC'); |
290 | - $id = filter_var($id,FILTER_SANITIZE_STRING); |
|
291 | - $filter_query = $this->getFilter($filter,true,true); |
|
290 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
291 | + $filter_query = $this->getFilter($filter, true, true); |
|
292 | 292 | |
293 | 293 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
294 | 294 | if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300'; |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | try { |
334 | 334 | $sth = $this->db->prepare($query); |
335 | 335 | $sth->execute($query_values); |
336 | - } catch(PDOException $e) { |
|
336 | + } catch (PDOException $e) { |
|
337 | 337 | echo $e->getMessage(); |
338 | 338 | die; |
339 | 339 | } |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | public function getLiveMarineCount($filter = array()) |
351 | 351 | { |
352 | 352 | global $globalDBdriver, $globalLiveInterval; |
353 | - $filter_query = $this->getFilter($filter,true,true); |
|
353 | + $filter_query = $this->getFilter($filter, true, true); |
|
354 | 354 | |
355 | 355 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
356 | 356 | if ($globalDBdriver == 'mysql') { |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | try { |
362 | 362 | $sth = $this->db->prepare($query); |
363 | 363 | $sth->execute(); |
364 | - } catch(PDOException $e) { |
|
364 | + } catch (PDOException $e) { |
|
365 | 365 | echo $e->getMessage(); |
366 | 366 | die; |
367 | 367 | } |
@@ -385,10 +385,10 @@ discard block |
||
385 | 385 | $filter_query = $this->getFilter($filter); |
386 | 386 | |
387 | 387 | if (is_array($coord)) { |
388 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
389 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
390 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
391 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
388 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
389 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
390 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
391 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
392 | 392 | } else return array(); |
393 | 393 | if ($globalDBdriver == 'mysql') { |
394 | 394 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id ORDER BY date DESC'.$filter_query; |
@@ -411,13 +411,13 @@ discard block |
||
411 | 411 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
412 | 412 | $Marine = new Marine($this->db); |
413 | 413 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
414 | - $filter_query = $this->getFilter($filter,true,true); |
|
414 | + $filter_query = $this->getFilter($filter, true, true); |
|
415 | 415 | |
416 | 416 | if (is_array($coord)) { |
417 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
418 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
419 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
420 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
417 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
418 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
419 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
420 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
421 | 421 | } else return array(); |
422 | 422 | /* |
423 | 423 | if ($globalDBdriver == 'mysql') { |
@@ -432,13 +432,13 @@ discard block |
||
432 | 432 | */ |
433 | 433 | if ($globalDBdriver == 'mysql') { |
434 | 434 | if (isset($globalArchive) && $globalArchive === TRUE) { |
435 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
435 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
436 | 436 | FROM marine_live |
437 | 437 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= marine_live.date |
438 | 438 | AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
439 | 439 | AND marine_live.latitude <> 0 AND marine_live.longitude <> 0 ORDER BY race_rank,date DESC'; |
440 | 440 | } else { |
441 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
441 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
442 | 442 | FROM marine_live |
443 | 443 | INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate |
444 | 444 | FROM marine_live l |
@@ -450,14 +450,14 @@ discard block |
||
450 | 450 | } |
451 | 451 | } else { |
452 | 452 | if (isset($globalArchive) && $globalArchive === TRUE) { |
453 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
453 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
454 | 454 | FROM marine_live |
455 | 455 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date |
456 | 456 | AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
457 | 457 | AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
458 | 458 | AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' ORDER BY race_rank, date DESC"; |
459 | 459 | } else { |
460 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
460 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
461 | 461 | FROM marine_live |
462 | 462 | INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate |
463 | 463 | FROM marine_live l |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | if ($interval == '1m') |
518 | 518 | { |
519 | 519 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
520 | - } else if ($interval == '15m'){ |
|
520 | + } else if ($interval == '15m') { |
|
521 | 521 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date '; |
522 | 522 | } |
523 | 523 | } |
@@ -525,14 +525,14 @@ discard block |
||
525 | 525 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
526 | 526 | } |
527 | 527 | |
528 | - $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
528 | + $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
529 | 529 | WHERE marine_live.latitude <> '' |
530 | 530 | AND marine_live.longitude <> '' |
531 | 531 | ".$additional_query." |
532 | 532 | HAVING distance < :radius |
533 | 533 | ORDER BY distance"; |
534 | 534 | |
535 | - $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
535 | + $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
536 | 536 | |
537 | 537 | return $spotter_array; |
538 | 538 | } |
@@ -550,9 +550,9 @@ discard block |
||
550 | 550 | date_default_timezone_set('UTC'); |
551 | 551 | |
552 | 552 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
553 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
553 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
554 | 554 | |
555 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
555 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
556 | 556 | |
557 | 557 | return $spotter_array; |
558 | 558 | } |
@@ -564,14 +564,14 @@ discard block |
||
564 | 564 | * @param $date |
565 | 565 | * @return array the spotter information |
566 | 566 | */ |
567 | - public function getDateLiveMarineDataByIdent($ident,$date) |
|
567 | + public function getDateLiveMarineDataByIdent($ident, $date) |
|
568 | 568 | { |
569 | 569 | $Marine = new Marine($this->db); |
570 | 570 | date_default_timezone_set('UTC'); |
571 | 571 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
572 | 572 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
573 | - $date = date('c',$date); |
|
574 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
573 | + $date = date('c', $date); |
|
574 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
575 | 575 | return $spotter_array; |
576 | 576 | } |
577 | 577 | |
@@ -582,14 +582,14 @@ discard block |
||
582 | 582 | * @param $date |
583 | 583 | * @return array the spotter information |
584 | 584 | */ |
585 | - public function getDateLiveMarineDataByMMSI($mmsi,$date) |
|
585 | + public function getDateLiveMarineDataByMMSI($mmsi, $date) |
|
586 | 586 | { |
587 | 587 | $Marine = new Marine($this->db); |
588 | 588 | date_default_timezone_set('UTC'); |
589 | 589 | $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
590 | 590 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.mmsi = :mmsi AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
591 | - $date = date('c',$date); |
|
592 | - $spotter_array = $Marine->getDataFromDB($query,array(':mmsi' => $mmsi,':date' => $date)); |
|
591 | + $date = date('c', $date); |
|
592 | + $spotter_array = $Marine->getDataFromDB($query, array(':mmsi' => $mmsi, ':date' => $date)); |
|
593 | 593 | return $spotter_array; |
594 | 594 | } |
595 | 595 | |
@@ -605,9 +605,9 @@ discard block |
||
605 | 605 | date_default_timezone_set('UTC'); |
606 | 606 | |
607 | 607 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
608 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
608 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
609 | 609 | |
610 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true); |
|
610 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id), '', true); |
|
611 | 611 | |
612 | 612 | return $spotter_array; |
613 | 613 | } |
@@ -619,15 +619,15 @@ discard block |
||
619 | 619 | * @param $date |
620 | 620 | * @return array the spotter information |
621 | 621 | */ |
622 | - public function getDateLiveMarineDataById($id,$date) |
|
622 | + public function getDateLiveMarineDataById($id, $date) |
|
623 | 623 | { |
624 | 624 | $Marine = new Marine($this->db); |
625 | 625 | date_default_timezone_set('UTC'); |
626 | 626 | |
627 | 627 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
628 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
629 | - $date = date('c',$date); |
|
630 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
628 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
629 | + $date = date('c', $date); |
|
630 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
631 | 631 | |
632 | 632 | return $spotter_array; |
633 | 633 | } |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | * @param bool $liveinterval |
641 | 641 | * @return array the spotter information |
642 | 642 | */ |
643 | - public function getAllLiveMarineDataById($id,$liveinterval = false) |
|
643 | + public function getAllLiveMarineDataById($id, $liveinterval = false) |
|
644 | 644 | { |
645 | 645 | global $globalDBdriver, $globalLiveInterval; |
646 | 646 | date_default_timezone_set('UTC'); |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | try { |
660 | 660 | $sth = $this->db->prepare($query); |
661 | 661 | $sth->execute(array(':id' => $id)); |
662 | - } catch(PDOException $e) { |
|
662 | + } catch (PDOException $e) { |
|
663 | 663 | echo $e->getMessage(); |
664 | 664 | die; |
665 | 665 | } |
@@ -677,12 +677,12 @@ discard block |
||
677 | 677 | { |
678 | 678 | date_default_timezone_set('UTC'); |
679 | 679 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
680 | - $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
|
680 | + $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
|
681 | 681 | try { |
682 | 682 | |
683 | 683 | $sth = $this->db->prepare($query); |
684 | 684 | $sth->execute(array(':ident' => $ident)); |
685 | - } catch(PDOException $e) { |
|
685 | + } catch (PDOException $e) { |
|
686 | 686 | echo $e->getMessage(); |
687 | 687 | die; |
688 | 688 | } |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | |
713 | 713 | $sth = $this->db->prepare($query); |
714 | 714 | $sth->execute(); |
715 | - } catch(PDOException $e) { |
|
715 | + } catch (PDOException $e) { |
|
716 | 716 | return "error"; |
717 | 717 | } |
718 | 718 | |
@@ -735,14 +735,14 @@ discard block |
||
735 | 735 | |
736 | 736 | $sth = $this->db->prepare($query); |
737 | 737 | $sth->execute(); |
738 | - } catch(PDOException $e) { |
|
738 | + } catch (PDOException $e) { |
|
739 | 739 | return "error"; |
740 | 740 | } |
741 | 741 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
742 | 742 | $i = 0; |
743 | - $j =0; |
|
743 | + $j = 0; |
|
744 | 744 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
745 | - foreach($all as $row) |
|
745 | + foreach ($all as $row) |
|
746 | 746 | { |
747 | 747 | $i++; |
748 | 748 | $j++; |
@@ -750,9 +750,9 @@ discard block |
||
750 | 750 | if ($globalDebug) echo "."; |
751 | 751 | try { |
752 | 752 | |
753 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
753 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
754 | 754 | $sth->execute(); |
755 | - } catch(PDOException $e) { |
|
755 | + } catch (PDOException $e) { |
|
756 | 756 | return "error"; |
757 | 757 | } |
758 | 758 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
@@ -763,9 +763,9 @@ discard block |
||
763 | 763 | if ($i > 0) { |
764 | 764 | try { |
765 | 765 | |
766 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
766 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
767 | 767 | $sth->execute(); |
768 | - } catch(PDOException $e) { |
|
768 | + } catch (PDOException $e) { |
|
769 | 769 | return "error"; |
770 | 770 | } |
771 | 771 | } |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | |
779 | 779 | $sth = $this->db->prepare($query); |
780 | 780 | $sth->execute(); |
781 | - } catch(PDOException $e) { |
|
781 | + } catch (PDOException $e) { |
|
782 | 782 | return "error"; |
783 | 783 | } |
784 | 784 | /* $query_delete = "DELETE FROM marine_live WHERE fammarine_id IN ("; |
@@ -827,13 +827,13 @@ discard block |
||
827 | 827 | public function deleteLiveMarineDataByIdent($ident) |
828 | 828 | { |
829 | 829 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
830 | - $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
|
830 | + $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
|
831 | 831 | |
832 | 832 | try { |
833 | 833 | |
834 | 834 | $sth = $this->db->prepare($query); |
835 | 835 | $sth->execute(array(':ident' => $ident)); |
836 | - } catch(PDOException $e) { |
|
836 | + } catch (PDOException $e) { |
|
837 | 837 | return "error"; |
838 | 838 | } |
839 | 839 | |
@@ -849,13 +849,13 @@ discard block |
||
849 | 849 | public function deleteLiveMarineDataById($id) |
850 | 850 | { |
851 | 851 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
852 | - $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
|
852 | + $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
|
853 | 853 | |
854 | 854 | try { |
855 | 855 | |
856 | 856 | $sth = $this->db->prepare($query); |
857 | 857 | $sth->execute(array(':id' => $id)); |
858 | - } catch(PDOException $e) { |
|
858 | + } catch (PDOException $e) { |
|
859 | 859 | return "error"; |
860 | 860 | } |
861 | 861 | |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | */ |
872 | 872 | public function getAllRaces() |
873 | 873 | { |
874 | - $query = 'SELECT DISTINCT marine_live.race_id, marine_live.race_name FROM marine_live ORDER BY marine_live.race_name'; |
|
874 | + $query = 'SELECT DISTINCT marine_live.race_id, marine_live.race_name FROM marine_live ORDER BY marine_live.race_name'; |
|
875 | 875 | $sth = $this->db->prepare($query); |
876 | 876 | $sth->execute(); |
877 | 877 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -887,13 +887,13 @@ discard block |
||
887 | 887 | { |
888 | 888 | global $globalDBdriver; |
889 | 889 | if ($globalDBdriver == 'mysql') { |
890 | - $query = 'SELECT marine_live.ident FROM marine_live |
|
890 | + $query = 'SELECT marine_live.ident FROM marine_live |
|
891 | 891 | WHERE marine_live.ident = :ident |
892 | 892 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
893 | 893 | AND marine_live.date < UTC_TIMESTAMP()'; |
894 | 894 | $query_data = array(':ident' => $ident); |
895 | 895 | } else { |
896 | - $query = "SELECT marine_live.ident FROM marine_live |
|
896 | + $query = "SELECT marine_live.ident FROM marine_live |
|
897 | 897 | WHERE marine_live.ident = :ident |
898 | 898 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
899 | 899 | AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -902,8 +902,8 @@ discard block |
||
902 | 902 | |
903 | 903 | $sth = $this->db->prepare($query); |
904 | 904 | $sth->execute($query_data); |
905 | - $ident_result=''; |
|
906 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
905 | + $ident_result = ''; |
|
906 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
907 | 907 | { |
908 | 908 | $ident_result = $row['ident']; |
909 | 909 | } |
@@ -920,13 +920,13 @@ discard block |
||
920 | 920 | { |
921 | 921 | global $globalDBdriver; |
922 | 922 | if ($globalDBdriver == 'mysql') { |
923 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
923 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
924 | 924 | WHERE marine_live.ident = :ident |
925 | 925 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
926 | 926 | // AND marine_live.date < UTC_TIMESTAMP()"; |
927 | 927 | $query_data = array(':ident' => $ident); |
928 | 928 | } else { |
929 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
929 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
930 | 930 | WHERE marine_live.ident = :ident |
931 | 931 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
932 | 932 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -935,8 +935,8 @@ discard block |
||
935 | 935 | |
936 | 936 | $sth = $this->db->prepare($query); |
937 | 937 | $sth->execute($query_data); |
938 | - $ident_result=''; |
|
939 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
938 | + $ident_result = ''; |
|
939 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
940 | 940 | { |
941 | 941 | $ident_result = $row['fammarine_id']; |
942 | 942 | } |
@@ -953,13 +953,13 @@ discard block |
||
953 | 953 | { |
954 | 954 | global $globalDBdriver; |
955 | 955 | if ($globalDBdriver == 'mysql') { |
956 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
956 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
957 | 957 | WHERE marine_live.fammarine_id = :id |
958 | 958 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
959 | 959 | // AND marine_live.date < UTC_TIMESTAMP()"; |
960 | 960 | $query_data = array(':id' => $id); |
961 | 961 | } else { |
962 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
962 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
963 | 963 | WHERE marine_live.fammarine_id = :id |
964 | 964 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
965 | 965 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -968,8 +968,8 @@ discard block |
||
968 | 968 | |
969 | 969 | $sth = $this->db->prepare($query); |
970 | 970 | $sth->execute($query_data); |
971 | - $ident_result=''; |
|
972 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
971 | + $ident_result = ''; |
|
972 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
973 | 973 | { |
974 | 974 | $ident_result = $row['fammarine_id']; |
975 | 975 | } |
@@ -986,13 +986,13 @@ discard block |
||
986 | 986 | { |
987 | 987 | global $globalDBdriver; |
988 | 988 | if ($globalDBdriver == 'mysql') { |
989 | - $query = 'SELECT marine_live.fammarine_id FROM marine_live |
|
989 | + $query = 'SELECT marine_live.fammarine_id FROM marine_live |
|
990 | 990 | WHERE marine_live.mmsi = :mmsi |
991 | 991 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
992 | 992 | // AND marine_live.date < UTC_TIMESTAMP()"; |
993 | 993 | $query_data = array(':mmsi' => $mmsi); |
994 | 994 | } else { |
995 | - $query = "SELECT marine_live.fammarine_id FROM marine_live |
|
995 | + $query = "SELECT marine_live.fammarine_id FROM marine_live |
|
996 | 996 | WHERE marine_live.mmsi = :mmsi |
997 | 997 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
998 | 998 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -1001,8 +1001,8 @@ discard block |
||
1001 | 1001 | |
1002 | 1002 | $sth = $this->db->prepare($query); |
1003 | 1003 | $sth->execute($query_data); |
1004 | - $ident_result=''; |
|
1005 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1004 | + $ident_result = ''; |
|
1005 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1006 | 1006 | { |
1007 | 1007 | $ident_result = $row['fammarine_id']; |
1008 | 1008 | } |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | * @param string $race_time |
1043 | 1043 | * @return String success or false |
1044 | 1044 | */ |
1045 | - public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '',$captain_id = '',$captain_name = '',$race_id = '', $race_name = '', $distance = '', $race_rank = '', $race_time = '') |
|
1045 | + public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '', $captain_id = '', $captain_name = '', $race_id = '', $race_name = '', $distance = '', $race_rank = '', $race_time = '') |
|
1046 | 1046 | { |
1047 | 1047 | global $globalArchive, $globalDebug; |
1048 | 1048 | $Common = new Common(); |
@@ -1094,39 +1094,39 @@ discard block |
||
1094 | 1094 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
1095 | 1095 | |
1096 | 1096 | |
1097 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
1098 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1099 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1100 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1101 | - $distance = filter_var($distance,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1102 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
1103 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1104 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
1105 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
1106 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
1107 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
1108 | - $typeid = filter_var($typeid,FILTER_SANITIZE_NUMBER_INT); |
|
1109 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
1110 | - $status = filter_var($status,FILTER_SANITIZE_STRING); |
|
1111 | - $statusid = filter_var($statusid,FILTER_SANITIZE_NUMBER_INT); |
|
1112 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
1113 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
1114 | - $arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING); |
|
1115 | - $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
|
1116 | - $captain_id = filter_var($captain_id,FILTER_SANITIZE_STRING); |
|
1117 | - $captain_name = filter_var($captain_name,FILTER_SANITIZE_STRING); |
|
1118 | - $race_id = filter_var($race_id,FILTER_SANITIZE_STRING); |
|
1119 | - $race_name = filter_var($race_name,FILTER_SANITIZE_STRING); |
|
1120 | - $race_rank = filter_var($race_rank,FILTER_SANITIZE_NUMBER_INT); |
|
1097 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
1098 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1099 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1100 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1101 | + $distance = filter_var($distance, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1102 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
1103 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1104 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
1105 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
1106 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
1107 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
1108 | + $typeid = filter_var($typeid, FILTER_SANITIZE_NUMBER_INT); |
|
1109 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
1110 | + $status = filter_var($status, FILTER_SANITIZE_STRING); |
|
1111 | + $statusid = filter_var($statusid, FILTER_SANITIZE_NUMBER_INT); |
|
1112 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
1113 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
1114 | + $arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING); |
|
1115 | + $arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING); |
|
1116 | + $captain_id = filter_var($captain_id, FILTER_SANITIZE_STRING); |
|
1117 | + $captain_name = filter_var($captain_name, FILTER_SANITIZE_STRING); |
|
1118 | + $race_id = filter_var($race_id, FILTER_SANITIZE_STRING); |
|
1119 | + $race_name = filter_var($race_name, FILTER_SANITIZE_STRING); |
|
1120 | + $race_rank = filter_var($race_rank, FILTER_SANITIZE_NUMBER_INT); |
|
1121 | 1121 | if ($race_rank == '') $race_rank = NULL; |
1122 | - $race_time = filter_var($race_time,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1122 | + $race_time = filter_var($race_time, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1123 | 1123 | if ($race_time == '') $race_time = NULL; |
1124 | 1124 | if ($typeid == '') $typeid = NULL; |
1125 | 1125 | if ($statusid == '') $statusid = NULL; |
1126 | 1126 | if ($distance == '') $distance = NULL; |
1127 | 1127 | |
1128 | 1128 | //if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
1129 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1129 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
1130 | 1130 | if ($arrival_date == '') $arrival_date = NULL; |
1131 | 1131 | $query = ''; |
1132 | 1132 | if ($globalArchive) { |
@@ -1135,19 +1135,19 @@ discard block |
||
1135 | 1135 | } |
1136 | 1136 | $query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,type_id,status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name,distance,race_rank,race_time) |
1137 | 1137 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:mmsi,:type,:typeid,:status,:statusid,:imo,:arrival_port_name,:arrival_port_date,:captain_id,:captain_name,:race_id,:race_name,:distance,:race_rank,:race_time)'; |
1138 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':mmsi' => $mmsi,':type' => $type,':typeid' => $typeid,':status' => $status,':statusid' => $statusid,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date,':captain_id' => $captain_id,':captain_name' => $captain_name,':race_id' => $race_id,':race_name' => $race_name,':distance' => $distance,':race_time' => $race_time,':race_rank' => $race_rank); |
|
1138 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':mmsi' => $mmsi, ':type' => $type, ':typeid' => $typeid, ':status' => $status, ':statusid' => $statusid, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date, ':captain_id' => $captain_id, ':captain_name' => $captain_name, ':race_id' => $race_id, ':race_name' => $race_name, ':distance' => $distance, ':race_time' => $race_time, ':race_rank' => $race_rank); |
|
1139 | 1139 | try { |
1140 | 1140 | $sth = $this->db->prepare($query); |
1141 | 1141 | $sth->execute($query_values); |
1142 | 1142 | $sth->closeCursor(); |
1143 | - } catch(PDOException $e) { |
|
1143 | + } catch (PDOException $e) { |
|
1144 | 1144 | return "error : ".$e->getMessage(); |
1145 | 1145 | } |
1146 | 1146 | |
1147 | 1147 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1148 | 1148 | if ($globalDebug) echo '(Add to Marine archive : '; |
1149 | 1149 | $MarineArchive = new MarineArchive($this->db); |
1150 | - $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source, $source_name, $over_country,$captain_id,$captain_name,$race_id,$race_name,$distance,$race_rank,$race_time); |
|
1150 | + $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $statusid, $noarchive, $format_source, $source_name, $over_country, $captain_id, $captain_name, $race_id, $race_name, $distance, $race_rank, $race_time); |
|
1151 | 1151 | if ($globalDebug) echo $result.')'; |
1152 | 1152 | } |
1153 | 1153 | return "success"; |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | |
1156 | 1156 | public function getOrderBy() |
1157 | 1157 | { |
1158 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC")); |
|
1158 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC")); |
|
1159 | 1159 | return $orderby; |
1160 | 1160 | } |
1161 | 1161 |
@@ -68,15 +68,15 @@ discard block |
||
68 | 68 | $Marine = new Marine($this->db); |
69 | 69 | if (isset($globalVM) && $globalVM) { |
70 | 70 | if ($this->all_tracked[$key]['status'] == 'Racing') { |
71 | - $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
71 | + $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime'], $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']); |
|
72 | 72 | } else { |
73 | - $timerace = (strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']); |
|
73 | + $timerace = (strtotime($this->all_tracked[$key]['race_begin']) + $this->all_tracked[$key]['race_time']); |
|
74 | 74 | if ($timerace > time()) $finaldatetime = NULL; |
75 | - else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
76 | - $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
75 | + else $finaldatetime = date('Y-m-d H:i:s', $timerace); |
|
76 | + $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $finaldatetime, $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']); |
|
77 | 77 | } |
78 | 78 | } else { |
79 | - $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
79 | + $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime'], $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
90 | 90 | foreach ($this->all_tracked as $key => $flight) { |
91 | 91 | if (isset($flight['lastupdate'])) { |
92 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
92 | + if ($flight['lastupdate'] < (time() - 3000)) { |
|
93 | 93 | if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
94 | 94 | if (isset($this->all_tracked[$key]['id'])) { |
95 | 95 | if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
@@ -103,15 +103,15 @@ discard block |
||
103 | 103 | if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
104 | 104 | if (isset($globalVM) && $globalVM) { |
105 | 105 | if ($this->all_tracked[$key]['status'] == 'Racing') { |
106 | - $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
106 | + $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime'], $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']); |
|
107 | 107 | } else { |
108 | - $timerace = strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']; |
|
108 | + $timerace = strtotime($this->all_tracked[$key]['race_begin']) + $this->all_tracked[$key]['race_time']; |
|
109 | 109 | if ($timerace > time()) $finaldatetime = NULL; |
110 | - else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
111 | - $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
110 | + else $finaldatetime = date('Y-m-d H:i:s', $timerace); |
|
111 | + $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $finaldatetime, $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']); |
|
112 | 112 | } |
113 | 113 | } else { |
114 | - $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
114 | + $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime'], $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']); |
|
115 | 115 | } |
116 | 116 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
117 | 117 | } |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | public function add($line) { |
129 | - global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine, $globalLiveInterval, $globalVM, $globalOnlyID; |
|
129 | + global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS, $APRSMarine, $globalLiveInterval, $globalVM, $globalOnlyID; |
|
130 | 130 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
131 | 131 | date_default_timezone_set('UTC'); |
132 | 132 | $dataFound = false; |
133 | 133 | $send = false; |
134 | 134 | |
135 | 135 | // SBS format is CSV format |
136 | - if(is_array($line) && (isset($line['mmsi']) || isset($line['id']))) { |
|
136 | + if (is_array($line) && (isset($line['mmsi']) || isset($line['id']))) { |
|
137 | 137 | //print_r($line); |
138 | 138 | if (isset($line['mmsi']) || isset($line['id'])) { |
139 | 139 | |
@@ -158,25 +158,25 @@ discard block |
||
158 | 158 | |
159 | 159 | if (!isset($this->all_tracked[$id])) { |
160 | 160 | $this->all_tracked[$id] = array(); |
161 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
162 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '','captain_id' => '','captain_name' => '','race_id' => '','race_name' => '','distance' => NULL,'race_rank' => NULL,'race_time' => NULL,'race_begin' => '')); |
|
163 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
161 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('addedMarine' => 0)); |
|
162 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => '', 'latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '', 'source_name' => '', 'comment'=> '', 'type' => '', 'typeid' => '', 'noarchive' => false, 'putinarchive' => true, 'over_country' => '', 'mmsi' => '', 'status' => '', 'status_id' => '', 'imo' => '', 'callsign' => '', 'arrival_code' => '', 'arrival_date' => '', 'mmsi_type' => '', 'captain_id' => '', 'captain_name' => '', 'race_id' => '', 'race_name' => '', 'distance' => NULL, 'race_rank' => NULL, 'race_time' => NULL, 'race_begin' => '')); |
|
163 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('lastupdate' => time())); |
|
164 | 164 | if (!isset($line['id'])) { |
165 | 165 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
166 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
167 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
166 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
167 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $line['id'])); |
|
168 | 168 | if ($globalAllTracked !== FALSE) $dataFound = true; |
169 | 169 | } |
170 | 170 | |
171 | 171 | if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) { |
172 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
172 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('mmsi' => $line['mmsi'])); |
|
173 | 173 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
174 | 174 | $Marine = new Marine($this->db); |
175 | 175 | $identity = $Marine->getIdentity($line['mmsi']); |
176 | 176 | if (!empty($identity)) { |
177 | 177 | $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
178 | 178 | $this->all_tracked[$id]['type'] = $identity['type']; |
179 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($identity['type']))); |
|
179 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('typeid' => $AIS->getShipTypeID($identity['type']))); |
|
180 | 180 | } |
181 | 181 | //print_r($identity); |
182 | 182 | unset($Marine); |
@@ -184,25 +184,25 @@ discard block |
||
184 | 184 | } |
185 | 185 | } |
186 | 186 | if (isset($line['type_id'])) { |
187 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
188 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id'])); |
|
187 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $AIS->getShipType($line['type_id']))); |
|
188 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('typeid' => $line['type_id'])); |
|
189 | 189 | } |
190 | 190 | if (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] == '') { |
191 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
192 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($line['type']))); |
|
191 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type'])); |
|
192 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('typeid' => $AIS->getShipTypeID($line['type']))); |
|
193 | 193 | } elseif (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] != '') { |
194 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
194 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type'])); |
|
195 | 195 | } |
196 | 196 | if (isset($line['status']) && $line['status'] != '') { |
197 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
197 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('status' => $line['status'])); |
|
198 | 198 | } |
199 | 199 | if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) { |
200 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
200 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('status_id' => $line['status_id'])); |
|
201 | 201 | if ($this->all_tracked[$id]['addedMarine'] == 1) { |
202 | 202 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
203 | 203 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
204 | 204 | $Marine = new Marine($this->db); |
205 | - $Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']); |
|
205 | + $Marine->updateStatusMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['status']); |
|
206 | 206 | unset($Marine); |
207 | 207 | } |
208 | 208 | } |
@@ -211,24 +211,24 @@ discard block |
||
211 | 211 | |
212 | 212 | |
213 | 213 | if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') { |
214 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
214 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('mmsi_type' => $line['mmsi_type'])); |
|
215 | 215 | } |
216 | 216 | if (isset($line['imo']) && $line['imo'] != '') { |
217 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
217 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('imo' => $line['imo'])); |
|
218 | 218 | } |
219 | 219 | if (isset($line['callsign']) && $line['callsign'] != '') { |
220 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
220 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('callsign' => $line['callsign'])); |
|
221 | 221 | } |
222 | 222 | if (isset($line['arrival_code']) && $line['arrival_code'] != '') { |
223 | 223 | if (!isset($this->all_tracked[$id]['arrival_code'])) { |
224 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
|
224 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('arrival_code' => $line['arrival_code'])); |
|
225 | 225 | if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n"; |
226 | 226 | if ($this->all_tracked[$id]['addedMarine'] != 0) { |
227 | 227 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
228 | 228 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
229 | 229 | $Marine = new Marine($this->db); |
230 | 230 | $fromsource = NULL; |
231 | - $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource); |
|
231 | + $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['arrival_code'], $fromsource); |
|
232 | 232 | $Marine->db = null; |
233 | 233 | } |
234 | 234 | } |
@@ -244,31 +244,31 @@ discard block |
||
244 | 244 | } |
245 | 245 | } |
246 | 246 | if (isset($line['arrival_date']) && $line['arrival_date'] != '') { |
247 | - if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
247 | + if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('arrival_date' => $line['arrival_date'])); |
|
248 | 248 | } |
249 | 249 | if (isset($line['captain_id']) && $line['captain_id'] != '') { |
250 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_id' => $line['captain_id'])); |
|
250 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('captain_id' => $line['captain_id'])); |
|
251 | 251 | } |
252 | 252 | if (isset($line['captain_name']) && $line['captain_name'] != '') { |
253 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_name' => $line['captain_name'])); |
|
253 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('captain_name' => $line['captain_name'])); |
|
254 | 254 | } |
255 | 255 | if (isset($line['race_id']) && $line['race_id'] != '') { |
256 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_id' => $line['race_id'])); |
|
256 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('race_id' => $line['race_id'])); |
|
257 | 257 | } |
258 | 258 | if (isset($line['race_name']) && $line['race_name'] != '') { |
259 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_name' => $line['race_name'])); |
|
259 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('race_name' => $line['race_name'])); |
|
260 | 260 | } |
261 | 261 | if (isset($line['race_rank']) && $line['race_rank'] != '') { |
262 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_rank' => $line['race_rank'])); |
|
262 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('race_rank' => $line['race_rank'])); |
|
263 | 263 | } |
264 | 264 | if (isset($line['race_time']) && $line['race_time'] != '') { |
265 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_time' => $line['race_time'])); |
|
265 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('race_time' => $line['race_time'])); |
|
266 | 266 | } |
267 | 267 | if (isset($line['race_begin']) && $line['race_begin'] != '') { |
268 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_begin' => $line['race_begin'])); |
|
268 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('race_begin' => $line['race_begin'])); |
|
269 | 269 | } |
270 | 270 | if (isset($line['distance']) && $line['distance'] != '') { |
271 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('distance' => $line['distance'])); |
|
271 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('distance' => $line['distance'])); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | //if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { |
@@ -277,44 +277,44 @@ discard block |
||
277 | 277 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
278 | 278 | $timeelapsed = microtime(true); |
279 | 279 | $Marine = new Marine($this->db); |
280 | - $Marine->addIdentity($this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['type']); |
|
280 | + $Marine->addIdentity($this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['type']); |
|
281 | 281 | $Marine->db = null; |
282 | 282 | } |
283 | 283 | } |
284 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
284 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => trim($line['ident']))); |
|
285 | 285 | if ($this->all_tracked[$id]['addedMarine'] == 1) { |
286 | 286 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
287 | 287 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
288 | 288 | $timeelapsed = microtime(true); |
289 | 289 | $Marine = new Marine($this->db); |
290 | 290 | $fromsource = NULL; |
291 | - $result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
291 | + $result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $fromsource); |
|
292 | 292 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
293 | 293 | $Marine->db = null; |
294 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
294 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
295 | 295 | } |
296 | 296 | } |
297 | 297 | } |
298 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
298 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'])); |
|
299 | 299 | } |
300 | 300 | |
301 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-30*60 && strtotime($line['datetime']) < time()+20*60) { |
|
301 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 30*60 && strtotime($line['datetime']) < time() + 20*60) { |
|
302 | 302 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
303 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
|
303 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => $line['datetime'])); |
|
304 | 304 | } else { |
305 | 305 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n"; |
306 | 306 | elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
307 | 307 | return ''; |
308 | 308 | } |
309 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time()-30*60) { |
|
309 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time() - 30*60) { |
|
310 | 310 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n"; |
311 | 311 | return ''; |
312 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) >= time()+20*60) { |
|
312 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) >= time() + 20*60) { |
|
313 | 313 | if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n"; |
314 | 314 | return ''; |
315 | 315 | } elseif (!isset($line['datetime'])) { |
316 | 316 | date_default_timezone_set('UTC'); |
317 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
317 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
318 | 318 | } else { |
319 | 319 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." date: ".$line['datetime']." - format : ".$line['format_source']."!!!\n"; |
320 | 320 | return ''; |
@@ -322,20 +322,20 @@ discard block |
||
322 | 322 | |
323 | 323 | |
324 | 324 | if (isset($line['speed'])) { |
325 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'],2))); |
|
326 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
325 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($line['speed'], 2))); |
|
326 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed_fromsrc' => true)); |
|
327 | 327 | } else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
328 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
328 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm'); |
|
329 | 329 | if ($distance > 1000 && $distance < 10000) { |
330 | 330 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
331 | 331 | $speed = $speed*3.6; |
332 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed,2))); |
|
332 | + if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($speed, 2))); |
|
333 | 333 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['id']." : ".$speed." - distance : ".$distance."\n"; |
334 | 334 | } |
335 | 335 | } |
336 | 336 | |
337 | 337 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
338 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
338 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time() - $this->all_tracked[$id]['time_last_coord']); |
|
339 | 339 | else unset($timediff); |
340 | 340 | if ($this->tmd > 5 || |
341 | 341 | !isset($timediff) || |
@@ -344,11 +344,11 @@ discard block |
||
344 | 344 | $timediff > 30 && |
345 | 345 | isset($this->all_tracked[$id]['latitude']) && |
346 | 346 | isset($this->all_tracked[$id]['longitude']) && |
347 | - $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')) |
|
347 | + $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')) |
|
348 | 348 | ) |
349 | 349 | ) { |
350 | 350 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
351 | - if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
351 | + if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['livedb_latitude'], $this->all_tracked[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) { |
|
352 | 352 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
353 | 353 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
354 | 354 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -357,10 +357,10 @@ discard block |
||
357 | 357 | $timeelapsed = microtime(true); |
358 | 358 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
359 | 359 | $Marine = new Marine($this->db); |
360 | - $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
360 | + $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
361 | 361 | if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
362 | 362 | $Marine->db = null; |
363 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
363 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
364 | 364 | } |
365 | 365 | $this->tmd = 0; |
366 | 366 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
@@ -369,55 +369,55 @@ discard block |
||
369 | 369 | |
370 | 370 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
371 | 371 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
372 | - if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
372 | + if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
373 | 373 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
374 | 374 | $dataFound = true; |
375 | 375 | $this->all_tracked[$id]['time_last_coord'] = time(); |
376 | 376 | } |
377 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
|
377 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('latitude' => $line['latitude'])); |
|
378 | 378 | } |
379 | 379 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
380 | 380 | if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
381 | 381 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
382 | - if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
382 | + if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
383 | 383 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
384 | 384 | $dataFound = true; |
385 | 385 | $this->all_tracked[$id]['time_last_coord'] = time(); |
386 | 386 | } |
387 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
|
387 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('longitude' => $line['longitude'])); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | } else if ($globalDebug && $timediff > 20) { |
391 | 391 | $this->tmd = $this->tmd + 1; |
392 | 392 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
393 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
|
394 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
393 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')."m -"; |
|
394 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
395 | 395 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
396 | 396 | } |
397 | 397 | } |
398 | 398 | if (isset($line['last_update']) && $line['last_update'] != '') { |
399 | 399 | if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
400 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
400 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('last_update' => $line['last_update'])); |
|
401 | 401 | } |
402 | 402 | if (isset($line['format_source']) && $line['format_source'] != '') { |
403 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
403 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('format_source' => $line['format_source'])); |
|
404 | 404 | } |
405 | 405 | if (isset($line['source_name']) && $line['source_name'] != '') { |
406 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
406 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('source_name' => $line['source_name'])); |
|
407 | 407 | } |
408 | 408 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
409 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
409 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('noarchive' => true)); |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | if (isset($line['heading']) && $line['heading'] != '') { |
413 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
414 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
415 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
413 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading'] - round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
414 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($line['heading']))); |
|
415 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading_fromsrc' => true)); |
|
416 | 416 | //$dataFound = true; |
417 | 417 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
418 | - $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
419 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
420 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
418 | + $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
419 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($heading))); |
|
420 | + if (abs($this->all_tracked[$id]['heading'] - round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
421 | 421 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
422 | 422 | } |
423 | 423 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | if ($dataFound === true && (isset($this->all_tracked[$id]['mmsi']) || isset($this->all_tracked[$id]['id']))) { |
428 | 428 | $this->all_tracked[$id]['lastupdate'] = time(); |
429 | 429 | if ($this->all_tracked[$id]['addedMarine'] == 0 || (isset($globalVM) && $globalVM)) { |
430 | - if ((!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) && (!isset($globalOnlyID) || in_array($id,$globalOnlyID))) { |
|
430 | + if ((!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) && (!isset($globalOnlyID) || in_array($id, $globalOnlyID))) { |
|
431 | 431 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
432 | 432 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
433 | 433 | if ($globalDebug) echo "Check if vessel is already in DB..."; |
@@ -436,28 +436,28 @@ discard block |
||
436 | 436 | if (isset($line['id']) && isset($globalVM) && $globalVM) { |
437 | 437 | $Marine = new Marine($this->db); |
438 | 438 | $recent_ident = $Marine->checkId($line['id']); |
439 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkId : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
440 | - $Marine->db=null; |
|
439 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkId : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
440 | + $Marine->db = null; |
|
441 | 441 | } elseif (isset($line['id'])) { |
442 | 442 | $recent_ident = $MarineLive->checkIdRecent($line['id']); |
443 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
443 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
444 | 444 | } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
445 | 445 | $recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']); |
446 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
446 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
447 | 447 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
448 | 448 | $recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
449 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
449 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
450 | 450 | } else $recent_ident = ''; |
451 | - $MarineLive->db=null; |
|
451 | + $MarineLive->db = null; |
|
452 | 452 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
453 | 453 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
454 | 454 | } else $recent_ident = ''; |
455 | 455 | } else { |
456 | 456 | $recent_ident = ''; |
457 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
|
457 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('forcenew' => 0)); |
|
458 | 458 | } |
459 | 459 | //if there was no vessel with the same callsign within the last hour and go post it into the archive |
460 | - if($recent_ident == "" && (($this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') || (isset($globalVM) && $globalVM))) |
|
460 | + if ($recent_ident == "" && (($this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') || (isset($globalVM) && $globalVM))) |
|
461 | 461 | { |
462 | 462 | if ($globalDebug) { |
463 | 463 | if ($this->all_tracked[$id]['mmsi'] != '') echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
@@ -465,19 +465,19 @@ discard block |
||
465 | 465 | } |
466 | 466 | //adds the spotter data for the archive |
467 | 467 | $highlight = ''; |
468 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
468 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
469 | 469 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
470 | 470 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
471 | 471 | $timeelapsed = microtime(true); |
472 | 472 | $Marine = new Marine($this->db); |
473 | 473 | if (isset($globalVM) && $globalVM && ($this->all_tracked[$id]['race_begin'] != '' || $this->all_tracked[$id]['format_source'] == 'sailaway')) { |
474 | - $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['race_begin'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']); |
|
474 | + $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['race_begin'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['captain_id'], $this->all_tracked[$id]['captain_name'], $this->all_tracked[$id]['race_id'], $this->all_tracked[$id]['race_name'], $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time']); |
|
475 | 475 | } else { |
476 | - $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']); |
|
476 | + $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['captain_id'], $this->all_tracked[$id]['captain_name'], $this->all_tracked[$id]['race_id'], $this->all_tracked[$id]['race_name'], $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time']); |
|
477 | 477 | } |
478 | 478 | $Marine->db = null; |
479 | 479 | if ($globalDebug && isset($result)) echo $result."\n"; |
480 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
480 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
481 | 481 | } |
482 | 482 | } |
483 | 483 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
@@ -485,15 +485,15 @@ discard block |
||
485 | 485 | $Stats = new Stats($this->db); |
486 | 486 | if (!empty($this->stats)) { |
487 | 487 | if ($globalDebug) echo 'Add source stats : '; |
488 | - foreach($this->stats as $date => $data) { |
|
489 | - foreach($data as $source => $sourced) { |
|
488 | + foreach ($this->stats as $date => $data) { |
|
489 | + foreach ($data as $source => $sourced) { |
|
490 | 490 | //print_r($sourced); |
491 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
492 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
491 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar_marine', $date); |
|
492 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist_marine', $date); |
|
493 | 493 | if (isset($sourced['msg'])) { |
494 | 494 | if (time() - $sourced['msg']['date'] > 10) { |
495 | 495 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
496 | - echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
496 | + echo $Stats->addStatSource($nbmsg, $source, 'msg_marine', $date); |
|
497 | 497 | unset($this->stats[$date][$source]['msg']); |
498 | 498 | } |
499 | 499 | } |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
518 | 518 | $MarineLive = new MarineLive($this->db); |
519 | 519 | $MarineLive->deleteLiveMarineData(); |
520 | - $MarineLive->db=null; |
|
520 | + $MarineLive->db = null; |
|
521 | 521 | if ($globalDebug) echo " Done\n"; |
522 | 522 | } |
523 | 523 | $this->last_delete = time(); |
@@ -530,17 +530,17 @@ discard block |
||
530 | 530 | $Marine = new Marine($this->db); |
531 | 531 | if (isset($globalVM) && $globalVM) { |
532 | 532 | if ($this->all_tracked[$id]['status'] == 'Racing') { |
533 | - $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
|
533 | + $Marine->updateLatestMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['race_begin']); |
|
534 | 534 | } else { |
535 | 535 | //$finaldatetime = date('Y-m-d H:i:s',strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']); |
536 | - $timerace = (strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']); |
|
536 | + $timerace = (strtotime($this->all_tracked[$id]['race_begin']) + $this->all_tracked[$id]['race_time']); |
|
537 | 537 | if ($timerace > time()) $finaldatetime = NULL; |
538 | - else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
538 | + else $finaldatetime = date('Y-m-d H:i:s', $timerace); |
|
539 | 539 | |
540 | - $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$finaldatetime,$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
|
540 | + $Marine->updateLatestMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['speed'], $finaldatetime, $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['race_begin']); |
|
541 | 541 | } |
542 | 542 | } else { |
543 | - $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
|
543 | + $Marine->updateLatestMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['race_begin']); |
|
544 | 544 | } |
545 | 545 | $Marine->db = null; |
546 | 546 | } |
@@ -556,20 +556,20 @@ discard block |
||
556 | 556 | $ignoreImport = false; |
557 | 557 | if ((isset($globalVM) && $globalVM) && $this->all_tracked[$id]['status'] == 'sailawayfull' && $this->all_tracked[$id]['status'] != 'Racing') $ignoreImport = true; |
558 | 558 | if (!$ignoreImport) { |
559 | - if ((!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) && (!isset($globalOnlyID) || in_array($id,$globalOnlyID))) { |
|
559 | + if ((!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) && (!isset($globalOnlyID) || in_array($id, $globalOnlyID))) { |
|
560 | 560 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
561 | 561 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
562 | 562 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
563 | 563 | $timeelapsed = microtime(true); |
564 | 564 | $MarineLive = new MarineLive($this->db); |
565 | - $result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']); |
|
565 | + $result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country'], $this->all_tracked[$id]['captain_id'], $this->all_tracked[$id]['captain_name'], $this->all_tracked[$id]['race_id'], $this->all_tracked[$id]['race_name'], $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time']); |
|
566 | 566 | $MarineLive->db = null; |
567 | 567 | if ($globalDebug) echo $result."\n"; |
568 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
568 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
569 | 569 | } |
570 | 570 | } |
571 | 571 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) { |
572 | - $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
|
572 | + $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']); |
|
573 | 573 | } |
574 | 574 | $this->all_tracked[$id]['putinarchive'] = false; |
575 | 575 | |
@@ -588,19 +588,19 @@ discard block |
||
588 | 588 | $latitude = $globalCenterLatitude; |
589 | 589 | $longitude = $globalCenterLongitude; |
590 | 590 | } |
591 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
591 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
592 | 592 | } else { |
593 | 593 | $latitude = $this->source_location[$source]['latitude']; |
594 | 594 | $longitude = $this->source_location[$source]['longitude']; |
595 | 595 | } |
596 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
596 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
597 | 597 | //$stats_heading = $stats_heading%22.5; |
598 | 598 | $stats_heading = round($stats_heading/22.5); |
599 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
599 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
600 | 600 | $current_date = date('Y-m-d'); |
601 | 601 | if ($stats_heading == 16) $stats_heading = 0; |
602 | 602 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
603 | - for ($i=0;$i<=15;$i++) { |
|
603 | + for ($i = 0; $i <= 15; $i++) { |
|
604 | 604 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
605 | 605 | } |
606 | 606 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -615,9 +615,9 @@ discard block |
||
615 | 615 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
616 | 616 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
617 | 617 | end($this->stats[$current_date][$source]['hist']); |
618 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
618 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
619 | 619 | } else $mini = 0; |
620 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
620 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
621 | 621 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
622 | 622 | } |
623 | 623 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | |
630 | 630 | $this->all_tracked[$id]['lastupdate'] = time(); |
631 | 631 | if ($this->all_tracked[$id]['putinarchive']) $send = true; |
632 | - } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
632 | + } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
633 | 633 | //$this->del(); |
634 | 634 | |
635 | 635 | |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | |
657 | 657 | public function race_add($data) { |
658 | 658 | $Marine = new Marine(); |
659 | - $Marine->addRace($data['id'],$data['name'],$data['creator'],$data['desc'],$data['startdate'],$data['markers']); |
|
659 | + $Marine->addRace($data['id'], $data['name'], $data['creator'], $data['desc'], $data['startdate'], $data['markers']); |
|
660 | 660 | $Marine->db = null; |
661 | 661 | } |
662 | 662 | } |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | break; |
400 | 400 | } |
401 | 401 | } |
402 | - var tsk_geojson = Cesium.Resource.fetchJson("<?php print $globalURL; ?>/tsk-geojson.php?tsk=<?php print filter_input(INPUT_GET,'tsk',FILTER_SANITIZE_URL); ?>"); |
|
402 | + var tsk_geojson = Cesium.Resource.fetchJson("<?php print $globalURL; ?>/tsk-geojson.php?tsk=<?php print filter_input(INPUT_GET, 'tsk', FILTER_SANITIZE_URL); ?>"); |
|
403 | 403 | tsk_geojson.then(function(geojsondata) { |
404 | 404 | tsk = new Cesium.CustomDataSource('tsk'); |
405 | 405 | for (var i =0;i < geojsondata.features.length; i++) { |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | <?php |
479 | 479 | if (isset($_COOKIE['lastcentercoord']) || (isset($globalCenterLatitude) && isset($globalCenterLongitude) && $globalCenterLatitude != '' && $globalCenterLongitude != '')) { |
480 | 480 | if (isset($_COOKIE['lastcentercoord'])) { |
481 | - $lastcentercoord = explode(',',$_COOKIE['lastcentercoord']); |
|
481 | + $lastcentercoord = explode(',', $_COOKIE['lastcentercoord']); |
|
482 | 482 | if (!isset($lastcentercoord[3])) $zoom = $lastcentercoord[2]*1000000.0; |
483 | 483 | else $zoom = $lastcentercoord[3]; |
484 | 484 | $viewcenterlatitude = $lastcentercoord[0]; |
@@ -59,20 +59,20 @@ discard block |
||
59 | 59 | die; |
60 | 60 | } |
61 | 61 | //$hosts = array($globalSBS1Host.':'.$globalSBS1Port); |
62 | - $globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port); |
|
62 | + $globalSources[] = array('host' => $globalSBS1Host, 'port' => $globalSBS1Port); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
66 | -$options = getopt('s::',array('source::','server','nodaemon','idsource::','aprsserverssid::','aprsserverpass::','aprsserverhost::','aprsserverport::','format::','noaprsserver','enable-aircraft','disable-aircraft','enable-tracker','disable-tracker','enable-marine','disable-marine')); |
|
66 | +$options = getopt('s::', array('source::', 'server', 'nodaemon', 'idsource::', 'aprsserverssid::', 'aprsserverpass::', 'aprsserverhost::', 'aprsserverport::', 'format::', 'noaprsserver', 'enable-aircraft', 'disable-aircraft', 'enable-tracker', 'disable-tracker', 'enable-marine', 'disable-marine')); |
|
67 | 67 | //if (isset($options['s'])) $hosts = array($options['s']); |
68 | 68 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
69 | 69 | if (isset($options['s'])) { |
70 | 70 | $globalSources = array(); |
71 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
71 | + if (isset($options['format'])) $globalSources[] = array('host' => $options['s'], 'format' => $options['format']); |
|
72 | 72 | else $globalSources[] = array('host' => $options['s']); |
73 | 73 | } elseif (isset($options['source'])) { |
74 | 74 | $globalSources = array(); |
75 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
75 | + if (isset($options['format'])) $globalSources[] = array('host' => $options['source'], 'format' => $options['format']); |
|
76 | 76 | else $globalSources[] = array('host' => $options['source']); |
77 | 77 | } |
78 | 78 | if (isset($options['aprsserverhost'])) { |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | else $id_source = 1; |
114 | 114 | if (isset($globalServer) && $globalServer) { |
115 | 115 | if ($globalDebug) echo "Using Server Mode\n"; |
116 | - $SI=new SpotterServer(); |
|
116 | + $SI = new SpotterServer(); |
|
117 | 117 | /* |
118 | 118 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
119 | 119 | $SI = new adsb2aprs(); |
120 | 120 | $SI->connect(); |
121 | 121 | */ |
122 | -} else $SI=new SpotterImport($Connection->db); |
|
122 | +} else $SI = new SpotterImport($Connection->db); |
|
123 | 123 | |
124 | 124 | if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
125 | 125 | if (isset($globalMarine) && $globalMarine) { |
@@ -133,17 +133,17 @@ discard block |
||
133 | 133 | $MI = new MarineImport($Connection->db); |
134 | 134 | } |
135 | 135 | //$APRS=new APRS($Connection->db); |
136 | -$SBS=new SBS(); |
|
136 | +$SBS = new SBS(); |
|
137 | 137 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
138 | - $ACARS=new ACARS($Connection->db,true); |
|
139 | - $Source=new Source($Connection->db); |
|
138 | + $ACARS = new ACARS($Connection->db, true); |
|
139 | + $Source = new Source($Connection->db); |
|
140 | 140 | } |
141 | -$Common=new Common(); |
|
141 | +$Common = new Common(); |
|
142 | 142 | date_default_timezone_set('UTC'); |
143 | 143 | //$servertz = system('date +%Z'); |
144 | 144 | // signal handler - playing nice with sockets and dump1090 |
145 | 145 | if (function_exists('pcntl_fork')) { |
146 | - pcntl_signal(SIGINT, function() { |
|
146 | + pcntl_signal(SIGINT, function() { |
|
147 | 147 | global $sockets; |
148 | 148 | echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
149 | 149 | die("Bye!\n"); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | |
160 | 160 | function connect_all($hosts) { |
161 | 161 | //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
162 | - global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
|
162 | + global $sockets, $httpfeeds, $globalSources, $globalDebug, $aprs_connect, $last_exec, $globalSourcesRights, $use_aprs, $reset, $context; |
|
163 | 163 | $reset++; |
164 | 164 | if ($globalDebug) echo 'Connect to all...'."\n"; |
165 | 165 | foreach ($hosts as $id => $value) { |
@@ -167,33 +167,33 @@ discard block |
||
167 | 167 | $udp = false; |
168 | 168 | $globalSources[$id]['last_exec'] = 0; |
169 | 169 | // Here we check type of source(s) |
170 | - if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
171 | - if (preg_match('/deltadb.txt$/i',$host)) { |
|
170 | + if (filter_var($host, FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
171 | + if (preg_match('/deltadb.txt$/i', $host)) { |
|
172 | 172 | //$formats[$id] = 'deltadbtxt'; |
173 | 173 | $globalSources[$id]['format'] = 'deltadbtxt'; |
174 | 174 | //$last_exec['deltadbtxt'] = 0; |
175 | 175 | if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
176 | - } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
176 | + } else if (preg_match('/vatsim-data.txt$/i', $host)) { |
|
177 | 177 | //$formats[$id] = 'vatsimtxt'; |
178 | 178 | $globalSources[$id]['format'] = 'vatsimtxt'; |
179 | 179 | //$last_exec['vatsimtxt'] = 0; |
180 | 180 | if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
181 | - } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
181 | + } else if (preg_match('/aircraftlist.json$/i', $host)) { |
|
182 | 182 | //$formats[$id] = 'aircraftlistjson'; |
183 | 183 | $globalSources[$id]['format'] = 'aircraftlistjson'; |
184 | 184 | //$last_exec['aircraftlistjson'] = 0; |
185 | 185 | if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
186 | - } else if (preg_match('/aircraft.json$/i',$host)) { |
|
186 | + } else if (preg_match('/aircraft.json$/i', $host)) { |
|
187 | 187 | //$formats[$id] = 'aircraftjson'; |
188 | 188 | $globalSources[$id]['format'] = 'aircraftjson'; |
189 | 189 | //$last_exec['aircraftlistjson'] = 0; |
190 | 190 | if ($globalDebug) echo "Connect to aircraft.json source (".$host.")...\n"; |
191 | - } else if (preg_match('/aircraft$/i',$host)) { |
|
191 | + } else if (preg_match('/aircraft$/i', $host)) { |
|
192 | 192 | //$formats[$id] = 'planefinderclient'; |
193 | 193 | $globalSources[$id]['format'] = 'planefinderclient'; |
194 | 194 | //$last_exec['aircraftlistjson'] = 0; |
195 | 195 | if ($globalDebug) echo "Connect to planefinderclient source (".$host.")...\n"; |
196 | - } else if (preg_match('/opensky/i',$host)) { |
|
196 | + } else if (preg_match('/opensky/i', $host)) { |
|
197 | 197 | //$formats[$id] = 'aircraftlistjson'; |
198 | 198 | $globalSources[$id]['format'] = 'opensky'; |
199 | 199 | //$last_exec['aircraftlistjson'] = 0; |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | exit(0); |
211 | 211 | } |
212 | 212 | */ |
213 | - } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
213 | + } else if (preg_match('/planeUpdateFAA.php$/i', $host)) { |
|
214 | 214 | //$formats[$id] = 'planeupdatefaa'; |
215 | 215 | $globalSources[$id]['format'] = 'planeupdatefaa'; |
216 | 216 | //$last_exec['planeupdatefaa'] = 0; |
@@ -219,37 +219,37 @@ discard block |
||
219 | 219 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
220 | 220 | exit(0); |
221 | 221 | } |
222 | - } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
222 | + } else if (preg_match('/\/action.php\/acars\/data$/i', $host)) { |
|
223 | 223 | //$formats[$id] = 'phpvmacars'; |
224 | 224 | $globalSources[$id]['format'] = 'phpvmacars'; |
225 | 225 | //$last_exec['phpvmacars'] = 0; |
226 | 226 | if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
227 | - } else if (preg_match('/\/api\/v1\/acars\/data$/i',$host)) { |
|
227 | + } else if (preg_match('/\/api\/v1\/acars\/data$/i', $host)) { |
|
228 | 228 | //$formats[$id] = 'phpvmacars'; |
229 | 229 | $globalSources[$id]['format'] = 'vaos'; |
230 | 230 | //$last_exec['phpvmacars'] = 0; |
231 | 231 | if ($globalDebug) echo "Connect to vaos source (".$host.")...\n"; |
232 | - } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
232 | + } else if (preg_match('/VAM-json.php$/i', $host)) { |
|
233 | 233 | //$formats[$id] = 'phpvmacars'; |
234 | 234 | $globalSources[$id]['format'] = 'vam'; |
235 | 235 | if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
236 | - } else if (preg_match('/whazzup/i',$host)) { |
|
236 | + } else if (preg_match('/whazzup/i', $host)) { |
|
237 | 237 | //$formats[$id] = 'whazzup'; |
238 | 238 | $globalSources[$id]['format'] = 'whazzup'; |
239 | 239 | //$last_exec['whazzup'] = 0; |
240 | 240 | if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
241 | - } else if (preg_match('/blitzortung/i',$host)) { |
|
241 | + } else if (preg_match('/blitzortung/i', $host)) { |
|
242 | 242 | $globalSources[$id]['format'] = 'blitzortung'; |
243 | 243 | if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n"; |
244 | - } else if (preg_match('/airwhere/i',$host)) { |
|
244 | + } else if (preg_match('/airwhere/i', $host)) { |
|
245 | 245 | $globalSources[$id]['format'] = 'airwhere'; |
246 | 246 | if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; |
247 | - } else if (preg_match('/recentpireps/i',$host)) { |
|
247 | + } else if (preg_match('/recentpireps/i', $host)) { |
|
248 | 248 | //$formats[$id] = 'pirepsjson'; |
249 | 249 | $globalSources[$id]['format'] = 'pirepsjson'; |
250 | 250 | //$last_exec['pirepsjson'] = 0; |
251 | 251 | if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
252 | - } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
252 | + } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i', $host)) { |
|
253 | 253 | //$formats[$id] = 'fr24json'; |
254 | 254 | $globalSources[$id]['format'] = 'fr24json'; |
255 | 255 | //$last_exec['fr24json'] = 0; |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
259 | 259 | exit(0); |
260 | 260 | } |
261 | - } else if (preg_match(':myshiptracking.com/:i',$host)) { |
|
261 | + } else if (preg_match(':myshiptracking.com/:i', $host)) { |
|
262 | 262 | //$formats[$id] = 'fr24json'; |
263 | 263 | $globalSources[$id]['format'] = 'myshiptracking'; |
264 | 264 | //$last_exec['fr24json'] = 0; |
@@ -268,14 +268,14 @@ discard block |
||
268 | 268 | exit(0); |
269 | 269 | } |
270 | 270 | //} else if (preg_match('/10001/',$host)) { |
271 | - } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
271 | + } else if (preg_match('/10001/', $host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
272 | 272 | //$formats[$id] = 'tsv'; |
273 | 273 | $globalSources[$id]['format'] = 'tsv'; |
274 | 274 | if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
275 | 275 | } |
276 | - } elseif (filter_var($host,FILTER_VALIDATE_URL) || (isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'sailaway') || (isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'sailawayfull') || (isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'acarsjson')) { |
|
276 | + } elseif (filter_var($host, FILTER_VALIDATE_URL) || (isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'sailaway') || (isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'sailawayfull') || (isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'acarsjson')) { |
|
277 | 277 | if ($globalSources[$id]['format'] == 'aisnmeahttp' || $globalSources[$id]['format'] == 'acarsjson') { |
278 | - $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
|
278 | + $idf = fopen($globalSources[$id]['host'], 'r', false, $context); |
|
279 | 279 | if ($idf !== false) { |
280 | 280 | $httpfeeds[$id] = $idf; |
281 | 281 | if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | } elseif ($globalDebug && isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'sailaway') echo "Connect to ".$globalSources[$id]['format']." source (sailaway)...\n"; |
284 | 284 | elseif ($globalDebug && isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'sailawayfull') echo "Connect to ".$globalSources[$id]['format']." source (sailawayfull)...\n"; |
285 | 285 | elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
286 | - } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
287 | - $hostport = explode(':',$host); |
|
286 | + } elseif (!filter_var($host, FILTER_VALIDATE_URL)) { |
|
287 | + $hostport = explode(':', $host); |
|
288 | 288 | if (isset($hostport[1])) { |
289 | 289 | $port = $hostport[1]; |
290 | 290 | $hostn = $hostport[0]; |
@@ -294,20 +294,20 @@ discard block |
||
294 | 294 | } |
295 | 295 | $Common = new Common(); |
296 | 296 | if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acarsjsonudp' && $globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
297 | - $s = $Common->create_socket($hostn,$port, $errno, $errstr); |
|
297 | + $s = $Common->create_socket($hostn, $port, $errno, $errstr); |
|
298 | 298 | } else { |
299 | 299 | $udp = true; |
300 | - $s = $Common->create_socket_udp($hostn,$port, $errno, $errstr); |
|
300 | + $s = $Common->create_socket_udp($hostn, $port, $errno, $errstr); |
|
301 | 301 | } |
302 | 302 | if ($s) { |
303 | 303 | $sockets[$id] = $s; |
304 | 304 | if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
305 | - if (preg_match('/aprs/',$hostn) || $port == '10152' || $port == '14580') { |
|
305 | + if (preg_match('/aprs/', $hostn) || $port == '10152' || $port == '14580') { |
|
306 | 306 | //$formats[$id] = 'aprs'; |
307 | 307 | $globalSources[$id]['format'] = 'aprs'; |
308 | 308 | //$aprs_connect = 0; |
309 | 309 | //$use_aprs = true; |
310 | - } elseif (preg_match('/pub-vrs/',$hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
310 | + } elseif (preg_match('/pub-vrs/', $hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
311 | 311 | $globalSources[$id]['format'] = 'vrstcp'; |
312 | 312 | } elseif ($port == '10001') { |
313 | 313 | //$formats[$id] = 'tsv'; |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; |
350 | 350 | else $timeout = 20; |
351 | 351 | $errno = ''; |
352 | -$errstr=''; |
|
352 | +$errstr = ''; |
|
353 | 353 | |
354 | 354 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
355 | 355 | /* Initiate connections to all the hosts simultaneously */ |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | //connect_all($globalSources); |
358 | 358 | |
359 | 359 | if (isset($globalProxy) && $globalProxy) { |
360 | - $context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true))); |
|
360 | + $context = stream_context_create(array('http' => array('timeout' => $timeout, 'proxy' => $globalProxy, 'request_fulluri' => true))); |
|
361 | 361 | } else { |
362 | 362 | $context = stream_context_create(array('http' => array('timeout' => $timeout))); |
363 | 363 | } |
@@ -387,16 +387,16 @@ discard block |
||
387 | 387 | |
388 | 388 | if ($use_aprs) { |
389 | 389 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
390 | - $APRS=new APRS(); |
|
390 | + $APRS = new APRS(); |
|
391 | 391 | $aprs_connect = 0; |
392 | 392 | $aprs_keep = 120; |
393 | 393 | $aprs_last_tx = time(); |
394 | 394 | if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
395 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
395 | + else $aprs_version = 'FlightAirMap '.str_replace(' ', '_', $globalName); |
|
396 | 396 | if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid; |
397 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
397 | + else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ', '_', $globalName)), 0, 8); |
|
398 | 398 | if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; |
399 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
399 | + else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
400 | 400 | if ($aprs_full) $aprs_filter = ''; |
401 | 401 | if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass; |
402 | 402 | else $aprs_pass = '-1'; |
@@ -410,12 +410,12 @@ discard block |
||
410 | 410 | sleep(1); |
411 | 411 | if ($globalDebug) echo "SCAN MODE \n\n"; |
412 | 412 | if (!isset($globalCronEnd)) $globalCronEnd = 60; |
413 | -$endtime = time()+$globalCronEnd; |
|
413 | +$endtime = time() + $globalCronEnd; |
|
414 | 414 | $i = 1; |
415 | 415 | $tt = array(); |
416 | 416 | // Delete all ATC |
417 | 417 | if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
418 | - $ATC=new ATC($Connection->db); |
|
418 | + $ATC = new ATC($Connection->db); |
|
419 | 419 | } |
420 | 420 | if (!$globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
421 | 421 | $ATC->deleteAll(); |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | while ($i > 0) { |
426 | 426 | if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
427 | 427 | |
428 | - if (!$globalDaemon) $i = $endtime-time(); |
|
428 | + if (!$globalDaemon) $i = $endtime - time(); |
|
429 | 429 | // Delete old ATC |
430 | 430 | if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
431 | 431 | if ($globalDebug) echo 'Delete old ATC...'."\n"; |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | } |
440 | 440 | if ($max < $globalMinFetch) { |
441 | 441 | if ($globalDebug) echo 'Sleeping...'."\n"; |
442 | - sleep($globalMinFetch-$max+2); |
|
442 | + sleep($globalMinFetch - $max + 2); |
|
443 | 443 | } |
444 | 444 | } |
445 | 445 | |
@@ -494,10 +494,10 @@ discard block |
||
494 | 494 | //$buffer = $Common->getData($hosts[$id]); |
495 | 495 | $buffer = $Common->getData($value['host']); |
496 | 496 | if ($buffer != '') { |
497 | - $all_data = json_decode($buffer,true); |
|
497 | + $all_data = json_decode($buffer, true); |
|
498 | 498 | foreach ($all_data as $line) { |
499 | 499 | $data = array(); |
500 | - $data['datetime'] = date('Y-m-d H:i:s',$line['uti']); |
|
500 | + $data['datetime'] = date('Y-m-d H:i:s', $line['uti']); |
|
501 | 501 | $data['hex'] = $line['hex']; // hex |
502 | 502 | $data['ident'] = $line['fli']; // ident |
503 | 503 | $data['altitude'] = $line['alt']; // altitude |
@@ -532,11 +532,11 @@ discard block |
||
532 | 532 | ) |
533 | 533 | ) { |
534 | 534 | date_default_timezone_set('CET'); |
535 | - $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
|
535 | + $buffer = $Common->getData(str_replace('{date}', date('Ymd'), $value['host'])); |
|
536 | 536 | date_default_timezone_set('UTC'); |
537 | 537 | if ($buffer != '') $reset = 0; |
538 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
539 | - $buffer = explode('\n',$buffer); |
|
538 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
539 | + $buffer = explode('\n', $buffer); |
|
540 | 540 | foreach ($buffer as $line) { |
541 | 541 | if ($line != '') { |
542 | 542 | //echo "'".$line."'\n"; |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | $ais_data = $AIS->parse_line(trim($line)); |
545 | 545 | $data = array(); |
546 | 546 | if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
547 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
547 | + if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'], -9); |
|
548 | 548 | if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
549 | 549 | if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
550 | 550 | if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
557 | 557 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
558 | 558 | if (isset($ais_data['timestamp'])) { |
559 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
559 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
560 | 560 | if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { |
561 | 561 | $last_exec[$id]['timestamp'] = $ais_data['timestamp']; |
562 | 562 | $add = true; |
@@ -579,21 +579,21 @@ discard block |
||
579 | 579 | $w = $e = null; |
580 | 580 | |
581 | 581 | if (isset($arr[$id])) { |
582 | - $nn = stream_select($arr,$w,$e,$timeout); |
|
582 | + $nn = stream_select($arr, $w, $e, $timeout); |
|
583 | 583 | if ($nn > 0) { |
584 | 584 | foreach ($httpfeeds as $feed) { |
585 | - $buffer = stream_get_line($feed,2000,"\n"); |
|
585 | + $buffer = stream_get_line($feed, 2000, "\n"); |
|
586 | 586 | if ($buffer === FALSE) { |
587 | 587 | connect_all($globalSources); |
588 | 588 | } |
589 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
590 | - $buffer = explode('\n',$buffer); |
|
589 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
590 | + $buffer = explode('\n', $buffer); |
|
591 | 591 | foreach ($buffer as $line) { |
592 | 592 | if ($line != '') { |
593 | 593 | $ais_data = $AIS->parse_line(trim($line)); |
594 | 594 | $data = array(); |
595 | 595 | if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
596 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
596 | + if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'], -9); |
|
597 | 597 | if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
598 | 598 | if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
599 | 599 | if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
@@ -605,9 +605,9 @@ discard block |
||
605 | 605 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
606 | 606 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
607 | 607 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
608 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
608 | + if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']); |
|
609 | 609 | if (isset($ais_data['timestamp'])) { |
610 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
610 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
611 | 611 | } else { |
612 | 612 | $data['datetime'] = date('Y-m-d H:i:s'); |
613 | 613 | } |
@@ -639,10 +639,10 @@ discard block |
||
639 | 639 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
640 | 640 | ) |
641 | 641 | ) { |
642 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
642 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); |
|
643 | 643 | if ($buffer != '') { |
644 | 644 | //echo $buffer; |
645 | - $all_data = json_decode($buffer,true); |
|
645 | + $all_data = json_decode($buffer, true); |
|
646 | 646 | //print_r($all_data); |
647 | 647 | if (isset($all_data[0]['DATA'])) { |
648 | 648 | foreach ($all_data[0]['DATA'] as $line) { |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | $data['ident'] = $line['NAME']; |
652 | 652 | $data['mmsi'] = $line['MMSI']; |
653 | 653 | if (strlen($data['mmsi']) > 9) { |
654 | - $data['mmsi'] = substr($data['mmsi'],-9); |
|
654 | + $data['mmsi'] = substr($data['mmsi'], -9); |
|
655 | 655 | } |
656 | 656 | $data['speed'] = $line['SOG']; |
657 | 657 | $data['heading'] = $line['COG']; |
@@ -661,8 +661,8 @@ discard block |
||
661 | 661 | //$data['type_id'] = $line['TYPE']; |
662 | 662 | $data['imo'] = $line['IMO']; |
663 | 663 | if ($line['DEST'] != '') $data['arrival_code'] = $line['DEST']; |
664 | - if ($line['ARV'] != '') $data['arrival_time'] = date('Y-m-d H:i:s',strtotime($line['ARV'])); |
|
665 | - $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
|
664 | + if ($line['ARV'] != '') $data['arrival_time'] = date('Y-m-d H:i:s', strtotime($line['ARV'])); |
|
665 | + $data['datetime'] = date('Y-m-d H:i:s', $line['T']); |
|
666 | 666 | $data['format_source'] = 'myshiptracking'; |
667 | 667 | $data['id_source'] = $id_source; |
668 | 668 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -679,16 +679,16 @@ discard block |
||
679 | 679 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
680 | 680 | ) |
681 | 681 | ) { |
682 | - $buffer = $Common->getData(str_replace('{timestamp}',time(),$value['host'])); |
|
682 | + $buffer = $Common->getData(str_replace('{timestamp}', time(), $value['host'])); |
|
683 | 683 | if ($buffer != '') { |
684 | - $all_data = json_decode($buffer,true); |
|
684 | + $all_data = json_decode($buffer, true); |
|
685 | 685 | if (isset($all_data[0]['mmsi'])) { |
686 | 686 | foreach ($all_data as $line) { |
687 | 687 | if ($line != '') { |
688 | 688 | $data = array(); |
689 | 689 | $data['ident'] = $line['shipname']; |
690 | 690 | $data['callsign'] = $line['callsign']; |
691 | - $data['mmsi'] = substr($line['mmsi'],-9); |
|
691 | + $data['mmsi'] = substr($line['mmsi'], -9); |
|
692 | 692 | $data['speed'] = $line['sog']; |
693 | 693 | if ($line['heading'] != '511') $data['heading'] = $line['heading']; |
694 | 694 | $data['latitude'] = $line['latitude']; |
@@ -715,14 +715,14 @@ discard block |
||
715 | 715 | ) { |
716 | 716 | $buffer = $Common->getData($value['host']); |
717 | 717 | if ($buffer != '') { |
718 | - $all_data = json_decode($buffer,true); |
|
718 | + $all_data = json_decode($buffer, true); |
|
719 | 719 | if (isset($all_data['features'][0]['id'])) { |
720 | 720 | foreach ($all_data['features'] as $line) { |
721 | 721 | print_r($line); |
722 | 722 | $data = array(); |
723 | 723 | if (isset($line['properties']['name'])) $data['ident'] = $line['properties']['name']; |
724 | 724 | if (isset($line['properties']['callsign'])) $data['callsign'] = $line['properties']['callsign']; |
725 | - if (isset($line['properties']['mmsi'])) $data['mmsi'] = substr($line['properties']['mmsi'],-9); |
|
725 | + if (isset($line['properties']['mmsi'])) $data['mmsi'] = substr($line['properties']['mmsi'], -9); |
|
726 | 726 | if (isset($line['properties']['imo'])) $data['imo'] = $line['properties']['imo']; |
727 | 727 | if (isset($line['properties']['speed'])) $data['speed'] = $line['properties']['speed']; |
728 | 728 | if (isset($line['properties']['heading']) && $line['properties']['heading'] != 0) $data['heading'] = $line['properties']['heading']; |
@@ -749,31 +749,31 @@ discard block |
||
749 | 749 | ) |
750 | 750 | ) { |
751 | 751 | if ($globalDebug) echo 'download...'; |
752 | - $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
|
752 | + $buffer = $Common->getData($value['host'], 'post', $value['post'], '', '', '', '', 'ShipPlotter'); |
|
753 | 753 | if ($globalDebug) echo 'done !'."\n"; |
754 | 754 | // FIXME: Need more work |
755 | 755 | if ($buffer != '') $reset = 0; |
756 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
757 | - $buffer = explode('\n',$buffer); |
|
756 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
757 | + $buffer = explode('\n', $buffer); |
|
758 | 758 | foreach ($buffer as $line) { |
759 | 759 | if ($line != '') { |
760 | 760 | $data = array(); |
761 | 761 | //echo $line."\n"; |
762 | - $data['mmsi'] = (int)substr($line,0,9); |
|
763 | - $data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10)); |
|
764 | - $data['status_id'] = substr($line,21,2); |
|
765 | - $data['type_id'] = substr($line,24,3); |
|
766 | - $data['latitude'] = substr($line,29,9); |
|
767 | - $data['longitude'] = substr($line,41,9); |
|
768 | - $data['speed'] = round(substr($line,51,5)); |
|
762 | + $data['mmsi'] = (int) substr($line, 0, 9); |
|
763 | + $data['datetime'] = date('Y-m-d H:i:s', substr($line, 10, 10)); |
|
764 | + $data['status_id'] = substr($line, 21, 2); |
|
765 | + $data['type_id'] = substr($line, 24, 3); |
|
766 | + $data['latitude'] = substr($line, 29, 9); |
|
767 | + $data['longitude'] = substr($line, 41, 9); |
|
768 | + $data['speed'] = round(substr($line, 51, 5)); |
|
769 | 769 | //$data['course'] = substr($line,57,5); |
770 | - $data['heading'] = round(substr($line,63,3)); |
|
770 | + $data['heading'] = round(substr($line, 63, 3)); |
|
771 | 771 | //$data['draft'] = substr($line,67,4); |
772 | 772 | //$data['length'] = substr($line,72,3); |
773 | 773 | //$data['beam'] = substr($line,76,2); |
774 | - $data['ident'] = trim(utf8_encode(substr($line,78,20))); |
|
774 | + $data['ident'] = trim(utf8_encode(substr($line, 78, 20))); |
|
775 | 775 | //$data['callsign'] = trim(substr($line,100,7); |
776 | - $data['arrival_code'] = substr($line,108,20); |
|
776 | + $data['arrival_code'] = substr($line, 108, 20); |
|
777 | 777 | //$data['etaDate'] = substr($line,129,5); |
778 | 778 | //$data['etaTime'] = substr($line,135,5); |
779 | 779 | $data['format_source'] = 'shipplotter'; |
@@ -796,28 +796,28 @@ discard block |
||
796 | 796 | exit(0); |
797 | 797 | } |
798 | 798 | $sailawayoption = array('key' => $globalSailaway['key']); |
799 | - if (isset($globalSailaway['usrnr'])) $sailawayoption = array_merge($sailawayoption,array('usrnr' => $globalSailaway['usrnr'])); |
|
800 | - if (isset($globalSailaway['ubtnr'])) $sailawayoption = array_merge($sailawayoption,array('ubtnr' => $globalSailaway['ubtnr'])); |
|
799 | + if (isset($globalSailaway['usrnr'])) $sailawayoption = array_merge($sailawayoption, array('usrnr' => $globalSailaway['usrnr'])); |
|
800 | + if (isset($globalSailaway['ubtnr'])) $sailawayoption = array_merge($sailawayoption, array('ubtnr' => $globalSailaway['ubtnr'])); |
|
801 | 801 | |
802 | 802 | for ($i = 0; $i <= 1; $i++) { |
803 | 803 | if ($globalDebug) echo '! Download... '; |
804 | - $buffer = $Common->getData('http://backend.sailaway.world/cgi-bin/sailaway/GetMissions.pl?'.http_build_query($sailawayoption).'&race='.$i.'&tutorial=0&hist=1&racetype=2&challengetype=2','get','','','','',30); |
|
804 | + $buffer = $Common->getData('http://backend.sailaway.world/cgi-bin/sailaway/GetMissions.pl?'.http_build_query($sailawayoption).'&race='.$i.'&tutorial=0&hist=1&racetype=2&challengetype=2', 'get', '', '', '', '', 30); |
|
805 | 805 | if ($globalDebug) echo 'done'."\n"; |
806 | 806 | if ($buffer != '') { |
807 | - $all_data = json_decode($buffer,true); |
|
807 | + $all_data = json_decode($buffer, true); |
|
808 | 808 | if (isset($all_data['missions'])) { |
809 | 809 | foreach ($all_data['missions'] as $mission) { |
810 | 810 | $mission_user = $mission['usrname']; |
811 | - $mission_name = preg_replace('/[\x00-\x1F\x7F-\xFF]/', '',$Common->remove_accents($mission['mistitle'])); |
|
812 | - if (!isset($globalFilter['sailway']['race']) || (isset($globalFilter['sailway']['race']) && in_array($mission['misnr'],$globalFilter['sailway']['race']))) { |
|
811 | + $mission_name = preg_replace('/[\x00-\x1F\x7F-\xFF]/', '', $Common->remove_accents($mission['mistitle'])); |
|
812 | + if (!isset($globalFilter['sailway']['race']) || (isset($globalFilter['sailway']['race']) && in_array($mission['misnr'], $globalFilter['sailway']['race']))) { |
|
813 | 813 | //print_r($mission); |
814 | 814 | $datar = array(); |
815 | 815 | $datar['id'] = $mission['misnr']; |
816 | 816 | $datar['desc'] = $mission['misdescr']; |
817 | 817 | //$datar['creator'] = trim(preg_replace('/[\x00-\x1F\x7F-\xFF]/', '',$Common->remove_accents($mission['usrname']))); |
818 | 818 | $datar['creator'] = ''; |
819 | - $datar['name'] = trim(preg_replace('/[\x00-\x1F\x7F-\xFF]/', '',$Common->remove_accents($mission['mistitle']))); |
|
820 | - if (isset($mission['misstart'])) $datar['startdate'] = date('Y-m-d H:i:s',strtotime($mission['misstart'])); |
|
819 | + $datar['name'] = trim(preg_replace('/[\x00-\x1F\x7F-\xFF]/', '', $Common->remove_accents($mission['mistitle']))); |
|
820 | + if (isset($mission['misstart'])) $datar['startdate'] = date('Y-m-d H:i:s', strtotime($mission['misstart'])); |
|
821 | 821 | else $datar['startdate'] = '1970-01-01 00:00:00'; |
822 | 822 | /* |
823 | 823 | $markers = array(); |
@@ -837,9 +837,9 @@ discard block |
||
837 | 837 | if ($globalDebug) echo '=== Wait... ==='; |
838 | 838 | sleep(10*60); |
839 | 839 | } |
840 | - $buffer = $Common->getData('http://backend.sailaway.world/cgi-bin/sailaway/TrackAllBoats.pl?'.http_build_query($sailawayoption),'get','','','','',30); |
|
840 | + $buffer = $Common->getData('http://backend.sailaway.world/cgi-bin/sailaway/TrackAllBoats.pl?'.http_build_query($sailawayoption), 'get', '', '', '', '', 30); |
|
841 | 841 | if ($buffer != '') { |
842 | - $data = json_decode($buffer,true); |
|
842 | + $data = json_decode($buffer, true); |
|
843 | 843 | //print_r($data); |
844 | 844 | if (isset($data['boats'])) { |
845 | 845 | foreach ($data['boats'] as $sail) { |
@@ -851,12 +851,12 @@ discard block |
||
851 | 851 | $data['longitude'] = $sail['ubtlon']; |
852 | 852 | $data['type_id'] = 36; |
853 | 853 | $data['heading'] = $sail['ubtheading']; |
854 | - $data['ident'] = trim(preg_replace('/[\x00-\x1F\x7F-\xFF]/', '',$Common->remove_accents($sail['ubtname']))); |
|
854 | + $data['ident'] = trim(preg_replace('/[\x00-\x1F\x7F-\xFF]/', '', $Common->remove_accents($sail['ubtname']))); |
|
855 | 855 | $data['captain_name'] = $sail['usrname']; |
856 | - $allboats = array('Sailaway Cruiser 38','Mini Transat','Caribbean Rose','52' Cruising Cat','50' Performance Cruiser','Nordic Folkboat'); |
|
856 | + $allboats = array('Sailaway Cruiser 38', 'Mini Transat', 'Caribbean Rose', '52' Cruising Cat', '50' Performance Cruiser', 'Nordic Folkboat'); |
|
857 | 857 | $boattype = $sail['ubtbtpnr']; |
858 | - if (isset($allboats[$boattype-1])) $data['type'] = $allboats[$boattype-1]; |
|
859 | - $data['speed'] = round($sail['ubtspeed']*3.6,2); |
|
858 | + if (isset($allboats[$boattype - 1])) $data['type'] = $allboats[$boattype - 1]; |
|
859 | + $data['speed'] = round($sail['ubtspeed']*3.6, 2); |
|
860 | 860 | $data['format_source'] = 'sailaway'; |
861 | 861 | $data['id_source'] = $id_source; |
862 | 862 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -889,11 +889,11 @@ discard block |
||
889 | 889 | } |
890 | 890 | if ($globalDebug) echo '! Download... '; |
891 | 891 | $sailawayoption = array('key' => $globalSailaway['key']); |
892 | - if (isset($globalSailaway['usrnr'])) $sailawayoption = array_merge($sailawayoption,array('usrnr' => $globalSailaway['usrnr'])); |
|
893 | - if (isset($globalSailaway['ubtnr'])) $sailawayoption = array_merge($sailawayoption,array('ubtnr' => $globalSailaway['ubtnr'])); |
|
894 | - $buffer = $Common->getData('http://backend.sailaway.world/cgi-bin/sailaway/TrackAllBoats.pl?'.http_build_query($sailawayoption),'get','','','','',30); |
|
892 | + if (isset($globalSailaway['usrnr'])) $sailawayoption = array_merge($sailawayoption, array('usrnr' => $globalSailaway['usrnr'])); |
|
893 | + if (isset($globalSailaway['ubtnr'])) $sailawayoption = array_merge($sailawayoption, array('ubtnr' => $globalSailaway['ubtnr'])); |
|
894 | + $buffer = $Common->getData('http://backend.sailaway.world/cgi-bin/sailaway/TrackAllBoats.pl?'.http_build_query($sailawayoption), 'get', '', '', '', '', 30); |
|
895 | 895 | if ($buffer != '') { |
896 | - $data = json_decode($buffer,true); |
|
896 | + $data = json_decode($buffer, true); |
|
897 | 897 | //print_r($data); |
898 | 898 | if (isset($data['boats'])) { |
899 | 899 | foreach ($data['boats'] as $sail) { |
@@ -905,12 +905,12 @@ discard block |
||
905 | 905 | $data['longitude'] = $sail['ubtlon']; |
906 | 906 | $data['type_id'] = 36; |
907 | 907 | $data['heading'] = $sail['ubtheading']; |
908 | - $data['ident'] = trim(preg_replace('/[\x00-\x1F\x7F-\xFF]/', '',$Common->remove_accents($sail['ubtname']))); |
|
908 | + $data['ident'] = trim(preg_replace('/[\x00-\x1F\x7F-\xFF]/', '', $Common->remove_accents($sail['ubtname']))); |
|
909 | 909 | $data['captain_name'] = $sail['usrname']; |
910 | - $allboats = array('Sailaway Cruiser 38','Mini Transat','Caribbean Rose','52' Cruising Cat','50' Performance Cruiser','Nordic Folkboat'); |
|
910 | + $allboats = array('Sailaway Cruiser 38', 'Mini Transat', 'Caribbean Rose', '52' Cruising Cat', '50' Performance Cruiser', 'Nordic Folkboat'); |
|
911 | 911 | $boattype = $sail['ubtbtpnr']; |
912 | - if (isset($allboats[$boattype-1])) $data['type'] = $allboats[$boattype-1]; |
|
913 | - $data['speed'] = round($sail['ubtspeed']*3.6,2); |
|
912 | + if (isset($allboats[$boattype - 1])) $data['type'] = $allboats[$boattype - 1]; |
|
913 | + $data['speed'] = round($sail['ubtspeed']*3.6, 2); |
|
914 | 914 | $data['format_source'] = 'sailaway'; |
915 | 915 | $data['id_source'] = $id_source; |
916 | 916 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -938,8 +938,8 @@ discard block |
||
938 | 938 | ) { |
939 | 939 | //$buffer = $Common->getData($hosts[$id]); |
940 | 940 | $buffer = $Common->getData($value['host']); |
941 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
942 | - $buffer = explode('\n',$buffer); |
|
941 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
942 | + $buffer = explode('\n', $buffer); |
|
943 | 943 | $reset = 0; |
944 | 944 | foreach ($buffer as $line) { |
945 | 945 | if ($line != '') { |
@@ -950,7 +950,7 @@ discard block |
||
950 | 950 | else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
951 | 951 | $data['pilot_id'] = $line[1]; |
952 | 952 | $data['pilot_name'] = $line[2]; |
953 | - $data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT); |
|
953 | + $data['hex'] = str_pad(dechex($Common->str2int($line[1])), 6, '000000', STR_PAD_LEFT); |
|
954 | 954 | $data['ident'] = $line[0]; // ident |
955 | 955 | if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude |
956 | 956 | $data['speed'] = $line[8]; // speed |
@@ -966,7 +966,7 @@ discard block |
||
966 | 966 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37])); |
967 | 967 | //if (isset($line[37])) $data['last_update'] = $line[37]; |
968 | 968 | $data['departure_airport_icao'] = $line[11]; |
969 | - $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
969 | + $data['departure_airport_time'] = rtrim(chunk_split($line[22], 2, ':'), ':'); |
|
970 | 970 | $data['arrival_airport_icao'] = $line[13]; |
971 | 971 | $data['frequency'] = $line[4]; |
972 | 972 | $data['type'] = $line[18]; |
@@ -975,7 +975,7 @@ discard block |
||
975 | 975 | $data['id_source'] = $id_source; |
976 | 976 | //$data['arrival_airport_time'] = ; |
977 | 977 | if ($line[9] != '') { |
978 | - $aircraft_data = explode('/',$line[9]); |
|
978 | + $aircraft_data = explode('/', $line[9]); |
|
979 | 979 | if (isset($aircraft_data[1])) { |
980 | 980 | $data['aircraft_icao'] = $aircraft_data[1]; |
981 | 981 | } |
@@ -990,9 +990,9 @@ discard block |
||
990 | 990 | if ($line[3] === 'PILOT') $SI->add($data); |
991 | 991 | elseif ($line[3] === 'ATC') { |
992 | 992 | //print_r($data); |
993 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
994 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
995 | - $typec = substr($data['ident'],-3); |
|
993 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
994 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
995 | + $typec = substr($data['ident'], -3); |
|
996 | 996 | if ($typec === 'APP') $data['type'] = 'Approach'; |
997 | 997 | elseif ($typec === 'TWR') $data['type'] = 'Tower'; |
998 | 998 | elseif ($typec === 'OBS') $data['type'] = 'Observer'; |
@@ -1004,8 +1004,8 @@ discard block |
||
1004 | 1004 | elseif ($data['type'] === '') $data['type'] = 'Observer'; |
1005 | 1005 | if (!isset($data['source_name'])) $data['source_name'] = ''; |
1006 | 1006 | if (isset($ATC)) { |
1007 | - if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
1008 | - else echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
1007 | + if (count($ATC->getByIdent($data['ident'], $data['format_source'])) > 0) echo $ATC->update($data['ident'], $data['frequency'], $data['latitude'], $data['longitude'], $data['range'], $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source'], $data['source_name']); |
|
1008 | + else echo $ATC->add($data['ident'], $data['frequency'], $data['latitude'], $data['longitude'], $data['range'], $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source'], $data['source_name']); |
|
1009 | 1009 | } |
1010 | 1010 | } |
1011 | 1011 | unset($data); |
@@ -1021,24 +1021,24 @@ discard block |
||
1021 | 1021 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
1022 | 1022 | ) |
1023 | 1023 | ) { |
1024 | - $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php','get','','','','','20'); |
|
1024 | + $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php', 'get', '', '', '', '', '20'); |
|
1025 | 1025 | if ($buffer != '') { |
1026 | 1026 | $all_data = simplexml_load_string($buffer); |
1027 | - foreach($all_data->children() as $childdata) { |
|
1027 | + foreach ($all_data->children() as $childdata) { |
|
1028 | 1028 | $data = array(); |
1029 | 1029 | $line = $childdata; |
1030 | 1030 | //$data['hex'] = str_pad(dechex((int)$line['pktPilotID']),6,'000000',STR_PAD_LEFT); |
1031 | - $data['id'] = date('Ymd').(int)$line['pktPilotID']; |
|
1032 | - $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST')); |
|
1033 | - $data['latitude'] = (float)$line['pktLatitude']; |
|
1034 | - $data['longitude'] = (float)$line['pktLongitude']; |
|
1035 | - if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack']; |
|
1036 | - if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed']; |
|
1037 | - $data['altitude'] = round((int)$line['pktAltitude']*3.28084); |
|
1031 | + $data['id'] = date('Ymd').(int) $line['pktPilotID']; |
|
1032 | + $data['datetime'] = date('Y-m-d H:i:s', strtotime((string) $line['entryTime'].' BST')); |
|
1033 | + $data['latitude'] = (float) $line['pktLatitude']; |
|
1034 | + $data['longitude'] = (float) $line['pktLongitude']; |
|
1035 | + if ((float) $line['pktTrack'] != 0) $data['heading'] = (float) $line['pktTrack']; |
|
1036 | + if ((int) $line['pktSpeed'] != 0) $data['speed'] = (int) $line['pktSpeed']; |
|
1037 | + $data['altitude'] = round((int) $line['pktAltitude']*3.28084); |
|
1038 | 1038 | $data['altitude_relative'] = 'AMSL'; |
1039 | - $data['pilot_id'] = (int)$line['pktPilotID']; |
|
1039 | + $data['pilot_id'] = (int) $line['pktPilotID']; |
|
1040 | 1040 | $data['aircraft_icao'] = 'PARAGLIDER'; |
1041 | - $pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
|
1041 | + $pilot_data = explode(',', $Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
|
1042 | 1042 | if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4]; |
1043 | 1043 | $data['format_source'] = $value['format']; |
1044 | 1044 | $SI->add($data); |
@@ -1046,22 +1046,22 @@ discard block |
||
1046 | 1046 | } |
1047 | 1047 | } |
1048 | 1048 | $Source->deleteOldLocationByType('gs'); |
1049 | - $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php','get','','','','','20'); |
|
1049 | + $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php', 'get', '', '', '', '', '20'); |
|
1050 | 1050 | if ($buffer != '') { |
1051 | 1051 | $all_data = simplexml_load_string($buffer); |
1052 | - foreach($all_data->children() as $childdata) { |
|
1052 | + foreach ($all_data->children() as $childdata) { |
|
1053 | 1053 | $data = array(); |
1054 | 1054 | $line = $childdata; |
1055 | - $data['id'] = (int)$line['gsID']; |
|
1056 | - $data['latitude'] = (float)$line['gsLatitude']; |
|
1057 | - $data['longitude'] = (float)$line['gsLongitude']; |
|
1058 | - $data['altitude'] = round((int)$line['gsHeight']*3.28084); |
|
1055 | + $data['id'] = (int) $line['gsID']; |
|
1056 | + $data['latitude'] = (float) $line['gsLatitude']; |
|
1057 | + $data['longitude'] = (float) $line['gsLongitude']; |
|
1058 | + $data['altitude'] = round((int) $line['gsHeight']*3.28084); |
|
1059 | 1059 | $data['altitude_relative'] = 'AMSL'; |
1060 | - $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['gsLastUpdate'].' BST')); |
|
1060 | + $data['datetime'] = date('Y-m-d H:i:s', strtotime((string) $line['gsLastUpdate'].' BST')); |
|
1061 | 1061 | if (count($Source->getLocationInfoByLocationID($data['id'])) > 0) { |
1062 | - $Source->updateLocationByLocationID('',$data['latitude'],$data['longitude'],$data['altitude'],'','','airwhere','antenna.png','gs',$id,$data['id'],$data['datetime']); |
|
1062 | + $Source->updateLocationByLocationID('', $data['latitude'], $data['longitude'], $data['altitude'], '', '', 'airwhere', 'antenna.png', 'gs', $id, $data['id'], $data['datetime']); |
|
1063 | 1063 | } else { |
1064 | - $Source->addLocation('',$data['latitude'],$data['longitude'],$data['altitude'],'','','airwhere','antenna.png','gs',$id,$data['id'],$data['datetime']); |
|
1064 | + $Source->addLocation('', $data['latitude'], $data['longitude'], $data['altitude'], '', '', 'airwhere', 'antenna.png', 'gs', $id, $data['id'], $data['datetime']); |
|
1065 | 1065 | } |
1066 | 1066 | unset($data); |
1067 | 1067 | } |
@@ -1079,9 +1079,9 @@ discard block |
||
1079 | 1079 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
1080 | 1080 | ) |
1081 | 1081 | ) { |
1082 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
1082 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); |
|
1083 | 1083 | if ($buffer != '') { |
1084 | - $all_data = json_decode($buffer,true); |
|
1084 | + $all_data = json_decode($buffer, true); |
|
1085 | 1085 | if (isset($all_data['acList'])) { |
1086 | 1086 | $reset = 0; |
1087 | 1087 | foreach ($all_data['acList'] as $line) { |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
1098 | 1098 | $data['emergency'] = ''; // emergency |
1099 | 1099 | if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
1100 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
1100 | + if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000)); |
|
1101 | 1101 | else $data['datetime'] = date('Y-m-d H:i:s'); |
1102 | 1102 | //$data['datetime'] = date('Y-m-d H:i:s'); |
1103 | 1103 | if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
@@ -1122,7 +1122,7 @@ discard block |
||
1122 | 1122 | $data['verticalrate'] = $line['vrt']; // verticale rate |
1123 | 1123 | $data['squawk'] = $line['squawk']; // squawk |
1124 | 1124 | $data['emergency'] = ''; // emergency |
1125 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
1125 | + if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000)); |
|
1126 | 1126 | else $data['datetime'] = date('Y-m-d H:i:s'); |
1127 | 1127 | $data['format_source'] = 'aircraftlistjson'; |
1128 | 1128 | $data['id_source'] = $id_source; |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | ) |
1144 | 1144 | ) { |
1145 | 1145 | $buffer = $Common->getData($value['host']); |
1146 | - $all_data = json_decode($buffer,true); |
|
1146 | + $all_data = json_decode($buffer, true); |
|
1147 | 1147 | if (isset($all_data['planes'])) { |
1148 | 1148 | $reset = 0; |
1149 | 1149 | foreach ($all_data['planes'] as $key => $line) { |
@@ -1160,12 +1160,12 @@ discard block |
||
1160 | 1160 | $data['emergency'] = ''; // emergency |
1161 | 1161 | $data['registration'] = $line[2]; |
1162 | 1162 | $data['aircraft_icao'] = $line[0]; |
1163 | - $deparr = explode('-',$line[1]); |
|
1163 | + $deparr = explode('-', $line[1]); |
|
1164 | 1164 | if (count($deparr) === 2) { |
1165 | 1165 | $data['departure_airport_icao'] = $deparr[0]; |
1166 | 1166 | $data['arrival_airport_icao'] = $deparr[1]; |
1167 | 1167 | } |
1168 | - $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
1168 | + $data['datetime'] = date('Y-m-d H:i:s', $line[9]); |
|
1169 | 1169 | $data['format_source'] = 'planeupdatefaa'; |
1170 | 1170 | $data['id_source'] = $id_source; |
1171 | 1171 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -1183,7 +1183,7 @@ discard block |
||
1183 | 1183 | ) |
1184 | 1184 | ) { |
1185 | 1185 | $buffer = $Common->getData($value['host']); |
1186 | - $all_data = json_decode($buffer,true); |
|
1186 | + $all_data = json_decode($buffer, true); |
|
1187 | 1187 | if (isset($all_data['states'])) { |
1188 | 1188 | $reset = 0; |
1189 | 1189 | foreach ($all_data['states'] as $key => $line) { |
@@ -1200,7 +1200,7 @@ discard block |
||
1200 | 1200 | //$data['emergency'] = ''; // emergency |
1201 | 1201 | //$data['registration'] = $line[2]; |
1202 | 1202 | //$data['aircraft_icao'] = $line[0]; |
1203 | - $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
1203 | + $data['datetime'] = date('Y-m-d H:i:s', $line[3]); |
|
1204 | 1204 | $data['format_source'] = 'opensky'; |
1205 | 1205 | $data['id_source'] = $id_source; |
1206 | 1206 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -1217,8 +1217,8 @@ discard block |
||
1217 | 1217 | ) |
1218 | 1218 | ) { |
1219 | 1219 | $buffer = $Common->getData($value['host']); |
1220 | - $all_data = json_decode($buffer,true); |
|
1221 | - if (isset($all_data['aircraft']) && isset($all_data['now']) && $all_data['now'] > time()-1800) { |
|
1220 | + $all_data = json_decode($buffer, true); |
|
1221 | + if (isset($all_data['aircraft']) && isset($all_data['now']) && $all_data['now'] > time() - 1800) { |
|
1222 | 1222 | $reset = 0; |
1223 | 1223 | foreach ($all_data['aircraft'] as $key => $line) { |
1224 | 1224 | $data = array(); |
@@ -1256,7 +1256,7 @@ discard block |
||
1256 | 1256 | ) |
1257 | 1257 | ) { |
1258 | 1258 | $buffer = $Common->getData($value['host']); |
1259 | - $all_data = json_decode($buffer,true); |
|
1259 | + $all_data = json_decode($buffer, true); |
|
1260 | 1260 | if (isset($all_data['aircraft'])) { |
1261 | 1261 | $reset = 0; |
1262 | 1262 | foreach ($all_data['aircraft'] as $key => $line) { |
@@ -1273,7 +1273,7 @@ discard block |
||
1273 | 1273 | //$data['emergency'] = ''; // emergency |
1274 | 1274 | if (isset($line['reg'])) $data['registration'] = $line['reg']; |
1275 | 1275 | if (isset($line['type'])) $data['aircraft_icao'] = $line['type']; |
1276 | - $data['datetime'] = date('Y-m-d H:i:s',$line['pos_update_time']); |
|
1276 | + $data['datetime'] = date('Y-m-d H:i:s', $line['pos_update_time']); |
|
1277 | 1277 | $data['format_source'] = 'planefinderclient'; |
1278 | 1278 | $data['id_source'] = $id_source; |
1279 | 1279 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
@@ -1292,7 +1292,7 @@ discard block |
||
1292 | 1292 | ) { |
1293 | 1293 | //$buffer = $Common->getData($hosts[$id]); |
1294 | 1294 | $buffer = $Common->getData($value['host']); |
1295 | - $all_data = json_decode($buffer,true); |
|
1295 | + $all_data = json_decode($buffer, true); |
|
1296 | 1296 | if (!empty($all_data)) $reset = 0; |
1297 | 1297 | foreach ($all_data as $key => $line) { |
1298 | 1298 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
@@ -1330,11 +1330,11 @@ discard block |
||
1330 | 1330 | ) |
1331 | 1331 | ) { |
1332 | 1332 | //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
1333 | - $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
1333 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '150'); |
|
1334 | 1334 | //echo $buffer; |
1335 | - $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
1336 | - $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
1337 | - $all_data = json_decode($buffer,true); |
|
1335 | + $buffer = str_replace(array("\n", "\r"), "", $buffer); |
|
1336 | + $buffer = preg_replace('/,"num":(.+)/', '}', $buffer); |
|
1337 | + $all_data = json_decode($buffer, true); |
|
1338 | 1338 | if (json_last_error() != JSON_ERROR_NONE) { |
1339 | 1339 | die(json_last_error_msg()); |
1340 | 1340 | } |
@@ -1357,7 +1357,7 @@ discard block |
||
1357 | 1357 | //$data['departure_airport_iata'] = $line[11]; |
1358 | 1358 | //$data['arrival_airport_iata'] = $line[12]; |
1359 | 1359 | //$data['emergency'] = ''; // emergency |
1360 | - $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
|
1360 | + $data['datetime'] = date('Y-m-d H:i:s', $line['inf']['dt']); //$line[10] |
|
1361 | 1361 | $data['format_source'] = 'radarvirtueljson'; |
1362 | 1362 | $data['id_source'] = $id_source; |
1363 | 1363 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -1378,14 +1378,14 @@ discard block |
||
1378 | 1378 | ) { |
1379 | 1379 | //$buffer = $Common->getData($hosts[$id]); |
1380 | 1380 | $buffer = $Common->getData($value['host'].'?'.time()); |
1381 | - $all_data = json_decode(utf8_encode($buffer),true); |
|
1381 | + $all_data = json_decode(utf8_encode($buffer), true); |
|
1382 | 1382 | |
1383 | 1383 | if (isset($all_data['pireps'])) { |
1384 | 1384 | $reset = 0; |
1385 | 1385 | foreach ($all_data['pireps'] as $line) { |
1386 | 1386 | $data = array(); |
1387 | 1387 | $data['id'] = $line['id']; |
1388 | - $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
1388 | + $data['hex'] = substr(str_pad(dechex($line['id']), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
1389 | 1389 | $data['ident'] = $line['callsign']; // ident |
1390 | 1390 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
1391 | 1391 | if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
@@ -1415,9 +1415,9 @@ discard block |
||
1415 | 1415 | $SI->add($data); |
1416 | 1416 | // print_r($data); |
1417 | 1417 | } elseif ($line['icon'] === 'ct') { |
1418 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
1419 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
1420 | - $typec = substr($data['ident'],-3); |
|
1418 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
1419 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
1420 | + $typec = substr($data['ident'], -3); |
|
1421 | 1421 | $data['type'] = ''; |
1422 | 1422 | if ($typec === 'APP') $data['type'] = 'Approach'; |
1423 | 1423 | elseif ($typec === 'TWR') $data['type'] = 'Tower'; |
@@ -1428,7 +1428,7 @@ discard block |
||
1428 | 1428 | elseif ($typec === 'FSS') $data['type'] = 'Flight Service Station'; |
1429 | 1429 | elseif ($typec === 'CTR') $data['type'] = 'Control Radar or Centre'; |
1430 | 1430 | else $data['type'] = 'Observer'; |
1431 | - if (isset($ATC)) echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); |
|
1431 | + if (isset($ATC)) echo $ATC->add($data['ident'], '', $data['latitude'], $data['longitude'], '0', $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source']); |
|
1432 | 1432 | } |
1433 | 1433 | unset($data); |
1434 | 1434 | } |
@@ -1445,14 +1445,14 @@ discard block |
||
1445 | 1445 | //$buffer = $Common->getData($hosts[$id]); |
1446 | 1446 | if ($globalDebug) echo 'Get Data...'."\n"; |
1447 | 1447 | $buffer = $Common->getData($value['host']); |
1448 | - $all_data = json_decode($buffer,true); |
|
1448 | + $all_data = json_decode($buffer, true); |
|
1449 | 1449 | if ($buffer != '' && is_array($all_data)) { |
1450 | 1450 | $reset = 0; |
1451 | 1451 | foreach ($all_data as $line) { |
1452 | 1452 | $data = array(); |
1453 | 1453 | //$data['id'] = $line['id']; // id not usable |
1454 | 1454 | if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
1455 | - $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
1455 | + $data['hex'] = substr(str_pad(bin2hex($line['flightnum']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
1456 | 1456 | if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
1457 | 1457 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
1458 | 1458 | $data['ident'] = $line['flightnum']; // ident |
@@ -1467,7 +1467,7 @@ discard block |
||
1467 | 1467 | //$data['datetime'] = $line['lastupdate']; |
1468 | 1468 | //$data['last_update'] = $line['lastupdate']; |
1469 | 1469 | if (isset($value['timezone'])) { |
1470 | - $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); |
|
1470 | + $datetime = new DateTime($line['lastupdate'], new DateTimeZone($value['timezone'])); |
|
1471 | 1471 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
1472 | 1472 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
1473 | 1473 | } else $data['datetime'] = date('Y-m-d H:i:s'); |
@@ -1483,14 +1483,14 @@ discard block |
||
1483 | 1483 | if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
1484 | 1484 | if (isset($line['aircraftname'])) { |
1485 | 1485 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
1486 | - $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
|
1487 | - $aircraft_data = explode('-',$line['aircraftname']); |
|
1486 | + $line['aircraftname'] = str_replace('BOEING ', 'B', $line['aircraftname']); |
|
1487 | + $aircraft_data = explode('-', $line['aircraftname']); |
|
1488 | 1488 | if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; |
1489 | 1489 | elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; |
1490 | 1490 | else { |
1491 | - $aircraft_data = explode(' ',$line['aircraftname']); |
|
1492 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
1493 | - else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
1491 | + $aircraft_data = explode(' ', $line['aircraftname']); |
|
1492 | + if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-', '', $aircraft_data[1]); |
|
1493 | + else $data['aircraft_icao'] = str_replace('-', '', $line['aircraftname']); |
|
1494 | 1494 | } |
1495 | 1495 | } |
1496 | 1496 | if (isset($line['route'])) $data['waypoints'] = $line['route']; |
@@ -1515,7 +1515,7 @@ discard block |
||
1515 | 1515 | //$buffer = $Common->getData($hosts[$id]); |
1516 | 1516 | if ($globalDebug) echo 'Get Data...'."\n"; |
1517 | 1517 | $buffer = $Common->getData($value['host']); |
1518 | - $all_data = json_decode($buffer,true); |
|
1518 | + $all_data = json_decode($buffer, true); |
|
1519 | 1519 | if ($buffer != '' && is_array($all_data) && isset($all_data['ACARSData'])) { |
1520 | 1520 | $reset = 0; |
1521 | 1521 | foreach ($all_data['ACARSData'] as $line) { |
@@ -1526,7 +1526,7 @@ discard block |
||
1526 | 1526 | //$data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
1527 | 1527 | if (isset($line['user']['username'])) $data['pilot_name'] = $line['user']['username']; |
1528 | 1528 | if (isset($line['user_id'])) $data['pilot_id'] = $line['user_id']; |
1529 | - $data['ident'] = str_replace(' ','',$line['bid']['flightnum']); // ident |
|
1529 | + $data['ident'] = str_replace(' ', '', $line['bid']['flightnum']); // ident |
|
1530 | 1530 | if (is_numeric($data['ident'])) $data['ident'] = $line['bid']['airline']['icao'].$data['ident']; |
1531 | 1531 | $data['altitude'] = $line['altitude']; // altitude |
1532 | 1532 | $data['speed'] = $line['groundspeed']; // speed |
@@ -1537,7 +1537,7 @@ discard block |
||
1537 | 1537 | //$data['squawk'] = ''; // squawk |
1538 | 1538 | //$data['emergency'] = ''; // emergency |
1539 | 1539 | if (isset($value['timezone'])) { |
1540 | - $datetime = new DateTime($line['updated_at'],new DateTimeZone($value['timezone'])); |
|
1540 | + $datetime = new DateTime($line['updated_at'], new DateTimeZone($value['timezone'])); |
|
1541 | 1541 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
1542 | 1542 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
1543 | 1543 | } else $data['datetime'] = date('Y-m-d H:i:s'); |
@@ -1573,14 +1573,14 @@ discard block |
||
1573 | 1573 | //$buffer = $Common->getData($hosts[$id]); |
1574 | 1574 | if ($globalDebug) echo 'Get Data...'."\n"; |
1575 | 1575 | $buffer = $Common->getData($value['host']); |
1576 | - $all_data = json_decode($buffer,true); |
|
1576 | + $all_data = json_decode($buffer, true); |
|
1577 | 1577 | if ($buffer != '' && is_array($all_data)) { |
1578 | 1578 | $reset = 0; |
1579 | 1579 | foreach ($all_data as $line) { |
1580 | 1580 | $data = array(); |
1581 | 1581 | //$data['id'] = $line['id']; // id not usable |
1582 | 1582 | $data['id'] = trim($line['flight_id']); |
1583 | - $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
1583 | + $data['hex'] = substr(str_pad(bin2hex($line['callsign']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
1584 | 1584 | $data['pilot_name'] = $line['pilot_name']; |
1585 | 1585 | $data['pilot_id'] = $line['pilot_id']; |
1586 | 1586 | $data['ident'] = trim($line['callsign']); // ident |
@@ -1624,24 +1624,24 @@ discard block |
||
1624 | 1624 | //$buffer = $Common->getData($hosts[$id]); |
1625 | 1625 | if ($globalDebug) echo 'Get Data...'."\n"; |
1626 | 1626 | $buffer = $Common->getData($value['host']); |
1627 | - $all_data = json_decode($buffer,true); |
|
1627 | + $all_data = json_decode($buffer, true); |
|
1628 | 1628 | if ($buffer != '') { |
1629 | 1629 | $Source->deleteLocationBySource('blitzortung'); |
1630 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
1631 | - $buffer = explode('\n',$buffer); |
|
1630 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
1631 | + $buffer = explode('\n', $buffer); |
|
1632 | 1632 | foreach ($buffer as $buffer_line) { |
1633 | - $line = json_decode($buffer_line,true); |
|
1633 | + $line = json_decode($buffer_line, true); |
|
1634 | 1634 | if (isset($line['time'])) { |
1635 | 1635 | $data = array(); |
1636 | 1636 | $data['altitude'] = $line['alt']; // altitude |
1637 | 1637 | $data['latitude'] = $line['lat']; // lat |
1638 | 1638 | $data['longitude'] = $line['lon']; // long |
1639 | - $data['datetime'] = date('Y-m-d H:i:s',substr($line['time'],0,10)); |
|
1639 | + $data['datetime'] = date('Y-m-d H:i:s', substr($line['time'], 0, 10)); |
|
1640 | 1640 | $data['id_source'] = $id_source; |
1641 | 1641 | $data['format_source'] = 'blitzortung'; |
1642 | 1642 | $SI->add($data); |
1643 | 1643 | if ($globalDebug) echo '☈ Lightning added'."\n"; |
1644 | - $Source->addLocation('',$data['latitude'],$data['longitude'],0,'','','blitzortung','weather/thunderstorm.png','lightning',$id,0,$data['datetime']); |
|
1644 | + $Source->addLocation('', $data['latitude'], $data['longitude'], 0, '', '', 'blitzortung', 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime']); |
|
1645 | 1645 | unset($data); |
1646 | 1646 | } |
1647 | 1647 | } |
@@ -1653,15 +1653,15 @@ discard block |
||
1653 | 1653 | $arr = $httpfeeds; |
1654 | 1654 | $w = $e = null; |
1655 | 1655 | if (isset($arr[$id])) { |
1656 | - $nn = stream_select($arr,$w,$e,$timeout); |
|
1656 | + $nn = stream_select($arr, $w, $e, $timeout); |
|
1657 | 1657 | if ($nn > 0) { |
1658 | 1658 | foreach ($httpfeeds as $feed) { |
1659 | - $buffer = stream_get_line($feed,2000,"\n"); |
|
1659 | + $buffer = stream_get_line($feed, 2000, "\n"); |
|
1660 | 1660 | if ($buffer === FALSE) { |
1661 | 1661 | connect_all($globalSources); |
1662 | 1662 | } |
1663 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
1664 | - $buffer = explode('\n',$buffer); |
|
1663 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
1664 | + $buffer = explode('\n', $buffer); |
|
1665 | 1665 | foreach ($buffer as $line) { |
1666 | 1666 | if ($line != '') { |
1667 | 1667 | $line = json_decode($line, true); |
@@ -1701,11 +1701,11 @@ discard block |
||
1701 | 1701 | //$value = $formats[$nb]; |
1702 | 1702 | $format = $globalSources[$nb]['format']; |
1703 | 1703 | if ($format === 'sbs' || $format === 'aprs' || $format === 'famaprs' || $format === 'raw' || $format === 'tsv' || $format === 'acarssbs3') { |
1704 | - $buffer = @socket_read($r, 6000,PHP_NORMAL_READ); |
|
1704 | + $buffer = @socket_read($r, 6000, PHP_NORMAL_READ); |
|
1705 | 1705 | } elseif ($format === 'vrstcp') { |
1706 | 1706 | $buffer = @socket_read($r, 6000); |
1707 | 1707 | } else { |
1708 | - $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
1708 | + $az = socket_recvfrom($r, $buffer, 6000, 0, $remote_ip, $remote_port); |
|
1709 | 1709 | } |
1710 | 1710 | //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
1711 | 1711 | //echo $buffer."\n"; |
@@ -1715,8 +1715,8 @@ discard block |
||
1715 | 1715 | //$SI::del(); |
1716 | 1716 | if ($buffer !== FALSE) { |
1717 | 1717 | if ($format === 'vrstcp') { |
1718 | - $buffer = explode('},{',$buffer); |
|
1719 | - } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
1718 | + $buffer = explode('},{', $buffer); |
|
1719 | + } else $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $buffer)); |
|
1720 | 1720 | } |
1721 | 1721 | // SBS format is CSV format |
1722 | 1722 | if ($buffer !== FALSE && $buffer !== '') { |
@@ -1743,7 +1743,7 @@ discard block |
||
1743 | 1743 | $ais_data = $AIS->parse_line(trim($buffer)); |
1744 | 1744 | $data = array(); |
1745 | 1745 | if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
1746 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
1746 | + if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'], -9); |
|
1747 | 1747 | if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
1748 | 1748 | if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
1749 | 1749 | if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
@@ -1754,13 +1754,13 @@ discard block |
||
1754 | 1754 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
1755 | 1755 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
1756 | 1756 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
1757 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
1757 | + if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']); |
|
1758 | 1758 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
1759 | 1759 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
1760 | 1760 | if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
1761 | 1761 | |
1762 | 1762 | if (isset($ais_data['timestamp'])) { |
1763 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
1763 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
1764 | 1764 | } else { |
1765 | 1765 | $data['datetime'] = date('Y-m-d H:i:s'); |
1766 | 1766 | } |
@@ -1771,10 +1771,10 @@ discard block |
||
1771 | 1771 | } elseif ($format === 'flightgearsp') { |
1772 | 1772 | //echo $buffer."\n"; |
1773 | 1773 | if (strlen($buffer) > 5) { |
1774 | - $line = explode(',',$buffer); |
|
1774 | + $line = explode(',', $buffer); |
|
1775 | 1775 | $data = array(); |
1776 | 1776 | //XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p |
1777 | - $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]),6,'000000',STR_PAD_LEFT),0,6); |
|
1777 | + $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
1778 | 1778 | $data['ident'] = $line[6]; |
1779 | 1779 | $data['aircraft_name'] = $line[7]; |
1780 | 1780 | $data['longitude'] = $line[1]; |
@@ -1791,25 +1791,25 @@ discard block |
||
1791 | 1791 | } elseif ($format === 'acars') { |
1792 | 1792 | if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
1793 | 1793 | $ACARS->add(trim($buffer)); |
1794 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
1794 | + socket_sendto($r, "OK ".$buffer, 100, 0, $remote_ip, $remote_port); |
|
1795 | 1795 | $ACARS->deleteLiveAcarsData(); |
1796 | 1796 | } elseif ($format === 'acarsjsonudp') { |
1797 | 1797 | if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
1798 | 1798 | $line = json_decode(trim($buffer), true); |
1799 | 1799 | if (!empty($line)) { |
1800 | - $line = array_merge(array('text' => '','tail' => '','label' => '','block_id' => '','flight' => '','msgno' => ''),$line); |
|
1800 | + $line = array_merge(array('text' => '', 'tail' => '', 'label' => '', 'block_id' => '', 'flight' => '', 'msgno' => ''), $line); |
|
1801 | 1801 | $ACARS->add(isset($line['text']) ? $line['text'] : '', array('registration' => str_replace('.', '', $line['tail']), 'ident' => $line['flight'], 'label' => $line['label'], 'block_id' => $line['block_id'], 'msg_no' => $line['msgno'], 'message' => (isset($line['text']) ? $line['text'] : ''))); |
1802 | 1802 | $ACARS->deleteLiveAcarsData(); |
1803 | 1803 | } |
1804 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
1804 | + socket_sendto($r, "OK ".$buffer, 100, 0, $remote_ip, $remote_port); |
|
1805 | 1805 | } elseif ($format === 'flightgearmp') { |
1806 | - if (substr($buffer,0,1) != '#') { |
|
1806 | + if (substr($buffer, 0, 1) != '#') { |
|
1807 | 1807 | $data = array(); |
1808 | 1808 | //echo $buffer."\n"; |
1809 | - $line = explode(' ',$buffer); |
|
1809 | + $line = explode(' ', $buffer); |
|
1810 | 1810 | if (count($line) === 11) { |
1811 | - $userserver = explode('@',$line[0]); |
|
1812 | - $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
1811 | + $userserver = explode('@', $line[0]); |
|
1812 | + $data['hex'] = substr(str_pad(bin2hex($line[0]), 6, '000000', STR_PAD_LEFT), 0, 6); // hex |
|
1813 | 1813 | $data['ident'] = $userserver[0]; |
1814 | 1814 | $data['registration'] = $userserver[0]; |
1815 | 1815 | $data['latitude'] = $line[4]; |
@@ -1817,8 +1817,8 @@ discard block |
||
1817 | 1817 | $data['altitude'] = $line[6]; |
1818 | 1818 | $data['datetime'] = date('Y-m-d H:i:s'); |
1819 | 1819 | $aircraft_type = $line[10]; |
1820 | - $aircraft_type = preg_split(':/:',$aircraft_type); |
|
1821 | - $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
1820 | + $aircraft_type = preg_split(':/:', $aircraft_type); |
|
1821 | + $data['aircraft_name'] = substr(end($aircraft_type), 0, -4); |
|
1822 | 1822 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
1823 | 1823 | if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
1824 | 1824 | } |
@@ -1827,8 +1827,8 @@ discard block |
||
1827 | 1827 | echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
1828 | 1828 | die; |
1829 | 1829 | } elseif ($format === 'vrstcp') { |
1830 | - foreach($buffer as $all_data) { |
|
1831 | - $line = json_decode('{'.$all_data.'}',true); |
|
1830 | + foreach ($buffer as $all_data) { |
|
1831 | + $line = json_decode('{'.$all_data.'}', true); |
|
1832 | 1832 | $data = array(); |
1833 | 1833 | if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex |
1834 | 1834 | if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
@@ -1854,16 +1854,16 @@ discard block |
||
1854 | 1854 | if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); |
1855 | 1855 | unset($data); |
1856 | 1856 | } |
1857 | - } elseif ($format === 'tsv' || substr($buffer,0,4) === 'clock') { |
|
1857 | + } elseif ($format === 'tsv' || substr($buffer, 0, 4) === 'clock') { |
|
1858 | 1858 | $line = explode("\t", $buffer); |
1859 | - for($k = 0; $k < count($line); $k=$k+2) { |
|
1859 | + for ($k = 0; $k < count($line); $k = $k + 2) { |
|
1860 | 1860 | $key = $line[$k]; |
1861 | - $lined[$key] = $line[$k+1]; |
|
1861 | + $lined[$key] = $line[$k + 1]; |
|
1862 | 1862 | } |
1863 | 1863 | if (count($lined) > 3) { |
1864 | 1864 | $data['hex'] = $lined['hexid']; |
1865 | 1865 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
1866 | - $data['datetime'] = date('Y-m-d H:i:s');; |
|
1866 | + $data['datetime'] = date('Y-m-d H:i:s'); ; |
|
1867 | 1867 | if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
1868 | 1868 | if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
1869 | 1869 | if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
@@ -1882,23 +1882,23 @@ discard block |
||
1882 | 1882 | } else $error = true; |
1883 | 1883 | } elseif ($format === 'aprs' && $use_aprs) { |
1884 | 1884 | if ($aprs_connect === 0) { |
1885 | - $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
|
1885 | + $send = @ socket_send($r, $aprs_login, strlen($aprs_login), 0); |
|
1886 | 1886 | $aprs_connect = 1; |
1887 | 1887 | } |
1888 | 1888 | |
1889 | - if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
1889 | + if ($aprs_keep > 60 && time() - $aprs_last_tx > $aprs_keep) { |
|
1890 | 1890 | $aprs_last_tx = time(); |
1891 | 1891 | $data_aprs = "# Keep alive"; |
1892 | - $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
|
1892 | + $send = @ socket_send($r, $data_aprs, strlen($data_aprs), 0); |
|
1893 | 1893 | } |
1894 | 1894 | |
1895 | 1895 | //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
1896 | 1896 | //echo 'APRS data : '.$buffer."\n"; |
1897 | - $buffer = str_replace('APRS <- ','',$buffer); |
|
1898 | - $buffer = str_replace('APRS -> ','',$buffer); |
|
1897 | + $buffer = str_replace('APRS <- ', '', $buffer); |
|
1898 | + $buffer = str_replace('APRS -> ', '', $buffer); |
|
1899 | 1899 | //echo $buffer."\n"; |
1900 | 1900 | date_default_timezone_set('UTC'); |
1901 | - if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
1901 | + if (substr($buffer, 0, 1) != '#' && substr($buffer, 0, 1) != '@' && substr($buffer, 0, 5) != 'APRS ') { |
|
1902 | 1902 | $line = $APRS->parse($buffer); |
1903 | 1903 | //if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) { |
1904 | 1904 | if (is_array($line) && isset($line['latitude']) && isset($line['longitude']) && (isset($line['ident']) || isset($line['address']) || isset($line['mmsi']))) { |
@@ -1913,7 +1913,7 @@ discard block |
||
1913 | 1913 | if (isset($line['arrival_date'])) $data['arrival_date'] = $line['arrival_date']; |
1914 | 1914 | if (isset($line['typeid'])) $data['type_id'] = $line['typeid']; |
1915 | 1915 | if (isset($line['statusid'])) $data['status_id'] = $line['statusid']; |
1916 | - if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
1916 | + if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s', $line['timestamp']); |
|
1917 | 1917 | else $data['datetime'] = date('Y-m-d H:i:s'); |
1918 | 1918 | //$data['datetime'] = date('Y-m-d H:i:s'); |
1919 | 1919 | if (isset($line['ident'])) $data['ident'] = $line['ident']; |
@@ -2001,29 +2001,29 @@ discard block |
||
2001 | 2001 | } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) { |
2002 | 2002 | if (!isset($data['altitude'])) $data['altitude'] = 0; |
2003 | 2003 | $Source->deleteOldLocationByType('gs'); |
2004 | - if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) { |
|
2005 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
|
2004 | + if (count($Source->getLocationInfoByNameType($data['ident'], 'gs')) > 0) { |
|
2005 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], $data['altitude'], '', '', $data['source_name'], 'antenna.png', 'gs', $id, 0, $data['datetime']); |
|
2006 | 2006 | } else { |
2007 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
|
2007 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], $data['altitude'], '', '', $data['source_name'], 'antenna.png', 'gs', $id, 0, $data['datetime']); |
|
2008 | 2008 | } |
2009 | 2009 | } elseif (isset($line['symbol']) && $line['symbol'] === 'Weather Station') { |
2010 | 2010 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
2011 | 2011 | if ($globalDebug) echo '# Weather Station added'."\n"; |
2012 | 2012 | $Source->deleteOldLocationByType('wx'); |
2013 | 2013 | $weather_data = json_encode($line); |
2014 | - if (count($Source->getLocationInfoByNameType($data['ident'],'wx')) > 0) { |
|
2015 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'wx.png','wx',$id,0,$data['datetime'],$weather_data); |
|
2014 | + if (count($Source->getLocationInfoByNameType($data['ident'], 'wx')) > 0) { |
|
2015 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'wx.png', 'wx', $id, 0, $data['datetime'], $weather_data); |
|
2016 | 2016 | } else { |
2017 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'wx.png','wx',$id,0,$data['datetime'],$weather_data); |
|
2017 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'wx.png', 'wx', $id, 0, $data['datetime'], $weather_data); |
|
2018 | 2018 | } |
2019 | 2019 | } elseif (isset($line['symbol']) && ($line['symbol'] === 'Lightning' || $line['symbol'] === 'Thunderstorm')) { |
2020 | 2020 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
2021 | 2021 | if ($globalDebug) echo '☈ Lightning added'."\n"; |
2022 | 2022 | $Source->deleteOldLocationByType('lightning'); |
2023 | - if (count($Source->getLocationInfoByNameType($data['ident'],'lightning')) > 0) { |
|
2024 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); |
|
2023 | + if (count($Source->getLocationInfoByNameType($data['ident'], 'lightning')) > 0) { |
|
2024 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime'], $data['comment']); |
|
2025 | 2025 | } else { |
2026 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); |
|
2026 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime'], $data['comment']); |
|
2027 | 2027 | } |
2028 | 2028 | } elseif ($globalDebug) { |
2029 | 2029 | echo '/!\ Not added: '.$buffer."\n"; |
@@ -2032,7 +2032,7 @@ discard block |
||
2032 | 2032 | unset($data); |
2033 | 2033 | } |
2034 | 2034 | elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
2035 | - $Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']); |
|
2035 | + $Source->updateLocationDescByName($line['ident'], $line['source'], $id, $line['comment']); |
|
2036 | 2036 | } |
2037 | 2037 | /* |
2038 | 2038 | elseif (is_array($line) && $globalDebug && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ($line['symbol'] === 'Car' || $line['symbol'] === 'Ambulance' || $line['symbol'] === 'Van' || $line['symbol'] === 'Truck' || $line['symbol'] === 'Truck (18 Wheeler)' || $line['symbol'] === 'Motorcycle')) { |
@@ -2041,7 +2041,7 @@ discard block |
||
2041 | 2041 | */ |
2042 | 2042 | //elseif ($line === false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; |
2043 | 2043 | elseif ($line === true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; |
2044 | - if (isset($Source) && isset($globalSources[$nb]['last_weather_clean']) && time()-$globalSources[$nb]['last_weather_clean'] > 60*5) { |
|
2044 | + if (isset($Source) && isset($globalSources[$nb]['last_weather_clean']) && time() - $globalSources[$nb]['last_weather_clean'] > 60*5) { |
|
2045 | 2045 | $Source->deleteOldLocationByType('lightning'); |
2046 | 2046 | $Source->deleteOldLocationByType('wx'); |
2047 | 2047 | $globalSources[$nb]['last_weather_clean'] = time(); |
@@ -2128,7 +2128,7 @@ discard block |
||
2128 | 2128 | connect_all($sourceee); |
2129 | 2129 | $sourceee = array(); |
2130 | 2130 | //connect_all($globalSources); |
2131 | - $tt[$format]=0; |
|
2131 | + $tt[$format] = 0; |
|
2132 | 2132 | break; |
2133 | 2133 | } |
2134 | 2134 | //else if ($globalDebug) echo "Trying again (".$tt[$format]."x) ".$format."..."; |
@@ -2138,14 +2138,14 @@ discard block |
||
2138 | 2138 | } else { |
2139 | 2139 | $error = socket_strerror(socket_last_error()); |
2140 | 2140 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { |
2141 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
|
2141 | + if ($globalDebug) echo "ERROR : socket_select give this error ".$error."\n"; |
|
2142 | 2142 | if (isset($globalDebug)) echo "Restarting...\n"; |
2143 | 2143 | // Restart the script if possible |
2144 | 2144 | if (is_array($sockets)) { |
2145 | 2145 | if ($globalDebug) echo "Shutdown all sockets..."; |
2146 | 2146 | |
2147 | 2147 | foreach ($sockets as $sock) { |
2148 | - @socket_shutdown($sock,2); |
|
2148 | + @socket_shutdown($sock, 2); |
|
2149 | 2149 | @socket_close($sock); |
2150 | 2150 | } |
2151 | 2151 |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $Connection = new Connection(); |
69 | 69 | $sth = $Connection->db->prepare($query); |
70 | 70 | $sth->execute(); |
71 | - } catch(PDOException $e) { |
|
71 | + } catch (PDOException $e) { |
|
72 | 72 | return "error : ".$e->getMessage(); |
73 | 73 | } |
74 | 74 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $Connection = new Connection(); |
88 | 88 | $sth = $Connection->db->prepare($query); |
89 | 89 | $sth->execute(); |
90 | - } catch(PDOException $e) { |
|
90 | + } catch (PDOException $e) { |
|
91 | 91 | return "error : ".$e->getMessage(); |
92 | 92 | } |
93 | 93 | return ''; |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | public function parse($data) { |
102 | 102 | //$data = str_replace(array('\n','\r','\r','\n'),'',$data); |
103 | 103 | $codes = implode('|', array_keys($this->texts)); |
104 | - $regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#'; |
|
104 | + $regWeather = '#^(\+|\-|VC)?('.$codes.')('.$codes.')?$#'; |
|
105 | 105 | //$pieces = explode(' ',$data); |
106 | - $pieces = preg_split('/\s/',$data); |
|
106 | + $pieces = preg_split('/\s/', $data); |
|
107 | 107 | $pos = 0; |
108 | 108 | if ($pieces[0] == 'METAR') $pos++; |
109 | 109 | elseif ($pieces[0] == 'SPECI') $pos++; |
@@ -113,25 +113,25 @@ discard block |
||
113 | 113 | $result['location'] = $pieces[$pos]; |
114 | 114 | $pos++; |
115 | 115 | if (!isset($pieces[$pos])) return $result; |
116 | - $result['dayofmonth'] = substr($pieces[$pos],0,2); |
|
117 | - $result['time'] = substr($pieces[$pos],2,4); |
|
116 | + $result['dayofmonth'] = substr($pieces[$pos], 0, 2); |
|
117 | + $result['time'] = substr($pieces[$pos], 2, 4); |
|
118 | 118 | $c = count($pieces); |
119 | - for($pos++; $pos < $c; $pos++) { |
|
119 | + for ($pos++; $pos < $c; $pos++) { |
|
120 | 120 | $piece = $pieces[$pos]; |
121 | 121 | if ($piece == 'RMK') break; |
122 | 122 | if ($piece == 'AUTO') $result['auto'] = true; |
123 | 123 | if ($piece == 'COR') $result['correction'] = true; |
124 | 124 | // Wind Speed |
125 | 125 | if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
126 | - $result['wind']['direction'] = (float)$matches[1]; |
|
126 | + $result['wind']['direction'] = (float) $matches[1]; |
|
127 | 127 | $result['wind']['unit'] = $matches[4]; |
128 | - if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
129 | - elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
130 | - elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
131 | - $result['wind']['gust'] = (float)$matches[3]; |
|
128 | + if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float) $matches[2])*0.51444444444, 2); |
|
129 | + elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float) $matches[2])*1000, 2); |
|
130 | + elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float) $matches[2]), 2); |
|
131 | + $result['wind']['gust'] = (float) $matches[3]; |
|
132 | 132 | $result['wind']['unit'] = $matches[4]; |
133 | - $result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0; |
|
134 | - $result['wind']['max_variation'] = array_key_exists(6,$matches) ? $matches[6] : 0; |
|
133 | + $result['wind']['min_variation'] = array_key_exists(5, $matches) ? $matches[5] : 0; |
|
134 | + $result['wind']['max_variation'] = array_key_exists(6, $matches) ? $matches[6] : 0; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /* if (preg_match('#^([0-9]{3})([0-9]{2})(G([0-9]{2}))?(KT|MPS)$#', $piece, $matches)) { |
@@ -152,17 +152,17 @@ discard block |
||
152 | 152 | |
153 | 153 | // Temperature |
154 | 154 | if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) { |
155 | - $temp = (float)$matches[1]; |
|
155 | + $temp = (float) $matches[1]; |
|
156 | 156 | if ($matches[1]{0} == 'M') { |
157 | - $temp = ((float)substr($matches[1], 1)) * -1; |
|
157 | + $temp = ((float) substr($matches[1], 1))*-1; |
|
158 | 158 | } |
159 | 159 | $result['temperature'] = $temp; |
160 | - $dew = (float)$matches[2]; |
|
160 | + $dew = (float) $matches[2]; |
|
161 | 161 | if ($matches[2]{0} == 'M') { |
162 | - $dew = ((float)substr($matches[2], 1)) * -1; |
|
162 | + $dew = ((float) substr($matches[2], 1))*-1; |
|
163 | 163 | } |
164 | 164 | $result['dew'] = $dew; |
165 | - $result['rh'] = round(100*(exp((17.625*$dew)/(243.04+$dew))/exp((17.625*$temp)/(243.04+$temp)))); |
|
165 | + $result['rh'] = round(100*(exp((17.625*$dew)/(243.04 + $dew))/exp((17.625*$temp)/(243.04 + $temp)))); |
|
166 | 166 | } |
167 | 167 | // QNH |
168 | 168 | if (preg_match('#^(A|Q)([0-9]{4})$#', $piece, $matches)) { |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $result['QNH'] = $matches[2]; |
173 | 173 | } else { |
174 | 174 | // inHg |
175 | - $result['QNH'] = round(($matches[2] / 100)*33.86389,2); |
|
175 | + $result['QNH'] = round(($matches[2]/100)*33.86389, 2); |
|
176 | 176 | } |
177 | 177 | /* |
178 | 178 | $result['QNH'] = $matches[1] == 'Q' ? $matches[2] : ($matches[2] / 100); |
@@ -193,12 +193,12 @@ discard block |
||
193 | 193 | // Visibility |
194 | 194 | if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) { |
195 | 195 | if (isset($matches[3]) && strlen($matches[3]) > 0) { |
196 | - $result['visibility'] = (float)$matches[3] * 1609.34; |
|
196 | + $result['visibility'] = (float) $matches[3]*1609.34; |
|
197 | 197 | } else { |
198 | 198 | if ($matches[1] == '9999') { |
199 | 199 | $result['visibility'] = '> 10000'; |
200 | 200 | } else { |
201 | - $result['visibility'] = (float)$matches[1]; |
|
201 | + $result['visibility'] = (float) $matches[1]; |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
222 | 222 | elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
223 | 223 | $cloud['type_code'] = $type; |
224 | - $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
|
224 | + $cloud['level'] = round(((float) $matches[2])*100*0.3048); |
|
225 | 225 | if (isset($matches[3])) $significant = $matches[3]; |
226 | 226 | else $significant = ''; |
227 | 227 | if ($significant == 'CB') $cloud['significant'] = 'Cumulonimbus'; |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | $rvr['runway'] = $matches[1]; |
243 | 243 | $rvr['assessment'] = $matches[2]; |
244 | 244 | $rvr['rvr'] = $matches[3]; |
245 | - $rvr['rvr_max'] = array_key_exists(4,$matches) ? $matches[4] : 0; |
|
246 | - $rvr['unit'] = array_key_exists(5,$matches) ? $matches[5] : ''; |
|
245 | + $rvr['rvr_max'] = array_key_exists(4, $matches) ? $matches[4] : 0; |
|
246 | + $rvr['unit'] = array_key_exists(5, $matches) ? $matches[5] : ''; |
|
247 | 247 | $result['RVR'] = $rvr; |
248 | 248 | } |
249 | 249 | //if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
@@ -256,12 +256,12 @@ discard block |
||
256 | 256 | $result['RVR']['friction'] = $matches[5]; |
257 | 257 | } |
258 | 258 | if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
259 | - if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
260 | - else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
259 | + if (isset($matches[5])) $range = array('exact' => (float) $matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
260 | + else $range = array('exact' => (float) $matches[2], 'unit' => 'M'); |
|
261 | 261 | if (isset($matches[3])) { |
262 | 262 | $range = Array( |
263 | - 'from' => (float)$matches[2], |
|
264 | - 'to' => (float)$matches[4], |
|
263 | + 'from' => (float) $matches[2], |
|
264 | + 'to' => (float) $matches[4], |
|
265 | 265 | 'unit' => $matches[5] ? 'FT' : 'M' |
266 | 266 | ); |
267 | 267 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | try { |
315 | 315 | $sth = $this->db->prepare($query); |
316 | 316 | $sth->execute($query_values); |
317 | - } catch(PDOException $e) { |
|
317 | + } catch (PDOException $e) { |
|
318 | 318 | return "error : ".$e->getMessage(); |
319 | 319 | } |
320 | 320 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -330,19 +330,19 @@ discard block |
||
330 | 330 | * @param String $metar METAR text |
331 | 331 | * @param String $date date of the METAR |
332 | 332 | */ |
333 | - public function addMETAR($location,$metar,$date) { |
|
333 | + public function addMETAR($location, $metar, $date) { |
|
334 | 334 | global $globalDBdriver; |
335 | - $date = date('Y-m-d H:i:s',strtotime($date)); |
|
335 | + $date = date('Y-m-d H:i:s', strtotime($date)); |
|
336 | 336 | if ($globalDBdriver == 'mysql') { |
337 | 337 | $query = "INSERT INTO metar (metar_location,metar_date,metar) VALUES (:location,:date,:metar) ON DUPLICATE KEY UPDATE metar_date = :date, metar = :metar"; |
338 | 338 | } else { |
339 | 339 | $query = "UPDATE metar SET metar_date = :date, metar = :metar WHERE metar_location = :location;INSERT INTO metar (metar_location,metar_date,metar) SELECT :location,:date,:metar WHERE NOT EXISTS (SELECT 1 FROM metar WHERE metar_location = :location);"; |
340 | 340 | } |
341 | - $query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar)); |
|
341 | + $query_values = array(':location' => $location, ':date' => $date, ':metar' => utf8_encode($metar)); |
|
342 | 342 | try { |
343 | 343 | $sth = $this->db->prepare($query); |
344 | 344 | $sth->execute($query_values); |
345 | - } catch(PDOException $e) { |
|
345 | + } catch (PDOException $e) { |
|
346 | 346 | return "error : ".$e->getMessage(); |
347 | 347 | } |
348 | 348 | return ''; |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | try { |
359 | 359 | $sth = $this->db->prepare($query); |
360 | 360 | $sth->execute($query_values); |
361 | - } catch(PDOException $e) { |
|
361 | + } catch (PDOException $e) { |
|
362 | 362 | return "error : ".$e->getMessage(); |
363 | 363 | } |
364 | 364 | return ''; |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | try { |
373 | 373 | $sth = $this->db->prepare($query); |
374 | 374 | $sth->execute(); |
375 | - } catch(PDOException $e) { |
|
375 | + } catch (PDOException $e) { |
|
376 | 376 | return "error : ".$e->getMessage(); |
377 | 377 | } |
378 | 378 | return ''; |
@@ -387,30 +387,30 @@ discard block |
||
387 | 387 | date_default_timezone_set("UTC"); |
388 | 388 | $Common = new Common(); |
389 | 389 | if (isset($globalIVAO) && $globalIVAO) { |
390 | - $Common->download('http://wx.ivao.aero/metar.php',dirname(__FILE__).'/../install/tmp/ivaometar.txt'); |
|
391 | - $handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt',"r"); |
|
390 | + $Common->download('http://wx.ivao.aero/metar.php', dirname(__FILE__).'/../install/tmp/ivaometar.txt'); |
|
391 | + $handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt', "r"); |
|
392 | 392 | } else { |
393 | - $Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT',dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT'); |
|
394 | - $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r"); |
|
393 | + $Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT', dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT'); |
|
394 | + $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT', "r"); |
|
395 | 395 | } |
396 | 396 | if ($handle) { |
397 | 397 | if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB..."; |
398 | 398 | $date = ''; |
399 | 399 | if ($globalTransaction) $this->db->beginTransaction(); |
400 | - while(($line = fgets($handle,4096)) !== false) { |
|
401 | - $line = str_replace(array("\r\n","\r", "\n"), '', $line); |
|
402 | - if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
400 | + while (($line = fgets($handle, 4096)) !== false) { |
|
401 | + $line = str_replace(array("\r\n", "\r", "\n"), '', $line); |
|
402 | + if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#', $line)) { |
|
403 | 403 | $date = $line; |
404 | 404 | } elseif (trim($line) != '') { |
405 | 405 | if ($date == '') $date = date('Y/m/d H:m'); |
406 | 406 | $pos = 0; |
407 | - $pieces = preg_split('/\s/',$line); |
|
407 | + $pieces = preg_split('/\s/', $line); |
|
408 | 408 | if ($pieces[0] == 'METAR') $pos++; |
409 | 409 | if (strlen($pieces[$pos]) != 4) $pos++; |
410 | 410 | if (isset($pieces[$pos])) { |
411 | 411 | $location = $pieces[$pos]; |
412 | 412 | //if ($location == 'LFLL') echo 'location: '.$location.' - date: '.$date.' - data: '.$line."\n"; |
413 | - echo $this->addMETAR($location,$line,$date); |
|
413 | + echo $this->addMETAR($location, $line, $date); |
|
414 | 414 | } |
415 | 415 | } |
416 | 416 | } |
@@ -430,23 +430,23 @@ discard block |
||
430 | 430 | if ($globalMETARurl == '') return array(); |
431 | 431 | date_default_timezone_set("UTC"); |
432 | 432 | $Common = new Common(); |
433 | - $url = str_replace('{icao}',$icao,$globalMETARurl); |
|
433 | + $url = str_replace('{icao}', $icao, $globalMETARurl); |
|
434 | 434 | $cycle = $Common->getData($url); |
435 | 435 | $date = ''; |
436 | - foreach(explode("\n",$cycle) as $line) { |
|
437 | - $line = str_replace(array("\r\n","\r", "\n"), '', $line); |
|
438 | - if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
436 | + foreach (explode("\n", $cycle) as $line) { |
|
437 | + $line = str_replace(array("\r\n", "\r", "\n"), '', $line); |
|
438 | + if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#', $line)) { |
|
439 | 439 | $date = $line; |
440 | 440 | } |
441 | 441 | if (trim($line) != '') { |
442 | 442 | if ($date == '') $date = date('Y/m/d H:m'); |
443 | 443 | $pos = 0; |
444 | - $pieces = preg_split('/\s/',$line); |
|
444 | + $pieces = preg_split('/\s/', $line); |
|
445 | 445 | if ($pieces[0] == 'METAR') $pos++; |
446 | 446 | if (strlen($pieces[$pos]) != 4) $pos++; |
447 | 447 | $location = $pieces[$pos]; |
448 | 448 | if (strlen($location == 4)) { |
449 | - $this->addMETAR($location,$line,$date); |
|
449 | + $this->addMETAR($location, $line, $date); |
|
450 | 450 | return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
451 | 451 | } else return array(); |
452 | 452 | } |