@@ -37,8 +37,11 @@ discard block |
||
| 37 | 37 | } else { |
| 38 | 38 | curl_setopt($ch, CURLOPT_USERAGENT, $useragent); |
| 39 | 39 | } |
| 40 | - if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
|
| 41 | - else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
|
| 40 | + if ($timeout == '') { |
|
| 41 | + curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
|
| 42 | + } else { |
|
| 43 | + curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
|
| 44 | + } |
|
| 42 | 45 | curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback")); |
| 43 | 46 | if ($type == 'post') { |
| 44 | 47 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
@@ -92,8 +95,9 @@ discard block |
||
| 92 | 95 | private function curlResponseHeaderCallback($ch, $headerLine) { |
| 93 | 96 | //global $cookies; |
| 94 | 97 | $cookies = array(); |
| 95 | - if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) |
|
| 96 | - $cookies[] = $cookie; |
|
| 98 | + if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) { |
|
| 99 | + $cookies[] = $cookie; |
|
| 100 | + } |
|
| 97 | 101 | return strlen($headerLine); // Needed by curl |
| 98 | 102 | } |
| 99 | 103 | |
@@ -104,7 +108,9 @@ discard block |
||
| 104 | 108 | curl_setopt($ch, CURLOPT_URL, $url); |
| 105 | 109 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 106 | 110 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
| 107 | - if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
| 111 | + if ($referer != '') { |
|
| 112 | + curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
| 113 | + } |
|
| 108 | 114 | if (isset($globalForceIPv4) && $globalForceIPv4) { |
| 109 | 115 | if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
| 110 | 116 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
@@ -116,7 +122,9 @@ discard block |
||
| 116 | 122 | curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
| 117 | 123 | curl_setopt($ch, CURLOPT_FILE, $fp); |
| 118 | 124 | curl_exec($ch); |
| 119 | - if (curl_errno($ch) && $globalDebug) echo 'Download error: '.curl_error($ch); |
|
| 125 | + if (curl_errno($ch) && $globalDebug) { |
|
| 126 | + echo 'Download error: '.curl_error($ch); |
|
| 127 | + } |
|
| 120 | 128 | curl_close($ch); |
| 121 | 129 | fclose($fp); |
| 122 | 130 | } |
@@ -124,12 +132,16 @@ discard block |
||
| 124 | 132 | public static function gunzip($in_file,$out_file_name = '') { |
| 125 | 133 | //echo $in_file.' -> '.$out_file_name."\n"; |
| 126 | 134 | $buffer_size = 4096; // read 4kb at a time |
| 127 | - if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
|
| 135 | + if ($out_file_name == '') { |
|
| 136 | + $out_file_name = str_replace('.gz', '', $in_file); |
|
| 137 | + } |
|
| 128 | 138 | if ($in_file != '' && file_exists($in_file)) { |
| 129 | 139 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
| 130 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
| 131 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
| 132 | - else { |
|
| 140 | + if (function_exists('gzopen')) { |
|
| 141 | + $file = gzopen($in_file,'rb'); |
|
| 142 | + } elseif (function_exists('gzopen64')) { |
|
| 143 | + $file = gzopen64($in_file,'rb'); |
|
| 144 | + } else { |
|
| 133 | 145 | echo 'gzopen not available'; |
| 134 | 146 | die; |
| 135 | 147 | } |
@@ -145,11 +157,14 @@ discard block |
||
| 145 | 157 | public static function bunzip2($in_file,$out_file_name = '') { |
| 146 | 158 | //echo $in_file.' -> '.$out_file_name."\n"; |
| 147 | 159 | $buffer_size = 4096; // read 4kb at a time |
| 148 | - if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); |
|
| 160 | + if ($out_file_name == '') { |
|
| 161 | + $out_file_name = str_replace('.bz2', '', $in_file); |
|
| 162 | + } |
|
| 149 | 163 | if ($in_file != '' && file_exists($in_file)) { |
| 150 | 164 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
| 151 | - if (function_exists('bzopen')) $file = bzopen($in_file,'rb'); |
|
| 152 | - else { |
|
| 165 | + if (function_exists('bzopen')) { |
|
| 166 | + $file = bzopen($in_file,'rb'); |
|
| 167 | + } else { |
|
| 153 | 168 | echo 'bzopen not available'; |
| 154 | 169 | die; |
| 155 | 170 | } |
@@ -168,10 +183,16 @@ discard block |
||
| 168 | 183 | * @return Array array of the tables in HTML page |
| 169 | 184 | */ |
| 170 | 185 | public function table2array($data) { |
| 171 | - if (!is_string($data)) return array(); |
|
| 172 | - if ($data == '') return array(); |
|
| 186 | + if (!is_string($data)) { |
|
| 187 | + return array(); |
|
| 188 | + } |
|
| 189 | + if ($data == '') { |
|
| 190 | + return array(); |
|
| 191 | + } |
|
| 173 | 192 | $html = str_get_html($data); |
| 174 | - if ($html === false) return array(); |
|
| 193 | + if ($html === false) { |
|
| 194 | + return array(); |
|
| 195 | + } |
|
| 175 | 196 | $tabledata=array(); |
| 176 | 197 | foreach($html->find('tr') as $element) |
| 177 | 198 | { |
@@ -206,7 +227,9 @@ discard block |
||
| 206 | 227 | */ |
| 207 | 228 | public function text2array($data) { |
| 208 | 229 | $html = str_get_html($data); |
| 209 | - if ($html === false) return array(); |
|
| 230 | + if ($html === false) { |
|
| 231 | + return array(); |
|
| 232 | + } |
|
| 210 | 233 | $tabledata=array(); |
| 211 | 234 | foreach($html->find('p') as $element) |
| 212 | 235 | { |
@@ -227,7 +250,9 @@ discard block |
||
| 227 | 250 | * @return Float Distance in $unit |
| 228 | 251 | */ |
| 229 | 252 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
| 230 | - if ($lat == $latc && $lon == $lonc) return 0; |
|
| 253 | + if ($lat == $latc && $lon == $lonc) { |
|
| 254 | + return 0; |
|
| 255 | + } |
|
| 231 | 256 | $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515; |
| 232 | 257 | if ($unit == "km") { |
| 233 | 258 | return round($dist * 1.609344); |
@@ -277,10 +302,16 @@ discard block |
||
| 277 | 302 | public function withinThreshold ($timeDifference, $distance) { |
| 278 | 303 | $x = abs($timeDifference); |
| 279 | 304 | $d = abs($distance); |
| 280 | - if ($x == 0 || $d == 0) return true; |
|
| 305 | + if ($x == 0 || $d == 0) { |
|
| 306 | + return true; |
|
| 307 | + } |
|
| 281 | 308 | // may be due to Internet jitter; distance is realistic |
| 282 | - if ($x < 0.7 && $d < 2000) return true; |
|
| 283 | - else return $d/$x < 1500*0.27778; // 1500 km/h max |
|
| 309 | + if ($x < 0.7 && $d < 2000) { |
|
| 310 | + return true; |
|
| 311 | + } else { |
|
| 312 | + return $d/$x < 1500*0.27778; |
|
| 313 | + } |
|
| 314 | + // 1500 km/h max |
|
| 284 | 315 | } |
| 285 | 316 | |
| 286 | 317 | |
@@ -308,11 +339,17 @@ discard block |
||
| 308 | 339 | |
| 309 | 340 | public function convertDM($coord,$latlong) { |
| 310 | 341 | if ($latlong == 'latitude') { |
| 311 | - if ($coord < 0) $NSEW = 'S'; |
|
| 312 | - else $NSEW = 'N'; |
|
| 342 | + if ($coord < 0) { |
|
| 343 | + $NSEW = 'S'; |
|
| 344 | + } else { |
|
| 345 | + $NSEW = 'N'; |
|
| 346 | + } |
|
| 313 | 347 | } else { |
| 314 | - if ($coord < 0) $NSEW = 'W'; |
|
| 315 | - else $NSEW = 'E'; |
|
| 348 | + if ($coord < 0) { |
|
| 349 | + $NSEW = 'W'; |
|
| 350 | + } else { |
|
| 351 | + $NSEW = 'E'; |
|
| 352 | + } |
|
| 316 | 353 | } |
| 317 | 354 | $coord = abs($coord); |
| 318 | 355 | $deg = floor($coord); |
@@ -355,7 +392,9 @@ discard block |
||
| 355 | 392 | public function hex2str($hex) { |
| 356 | 393 | $str = ''; |
| 357 | 394 | $hexln = strlen($hex); |
| 358 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
| 395 | + for($i=0;$i<$hexln;$i+=2) { |
|
| 396 | + $str .= chr(hexdec(substr($hex,$i,2))); |
|
| 397 | + } |
|
| 359 | 398 | return $str; |
| 360 | 399 | } |
| 361 | 400 | |
@@ -392,8 +431,11 @@ discard block |
||
| 392 | 431 | $b = $lat2 - $lat1; |
| 393 | 432 | $c = -($a*$lat1+$b*$lon1); |
| 394 | 433 | $d = $a*$lat3+$b*$lon3+$c; |
| 395 | - if ($d > -$approx && $d < $approx) return true; |
|
| 396 | - else return false; |
|
| 434 | + if ($d > -$approx && $d < $approx) { |
|
| 435 | + return true; |
|
| 436 | + } else { |
|
| 437 | + return false; |
|
| 438 | + } |
|
| 397 | 439 | } |
| 398 | 440 | |
| 399 | 441 | public function array_merge_noappend() { |
@@ -452,7 +494,9 @@ discard block |
||
| 452 | 494 | return $result; |
| 453 | 495 | } |
| 454 | 496 | $handle = @opendir('./locale'); |
| 455 | - if ($handle === false) return $result; |
|
| 497 | + if ($handle === false) { |
|
| 498 | + return $result; |
|
| 499 | + } |
|
| 456 | 500 | while (false !== ($file = readdir($handle))) { |
| 457 | 501 | $path = './locale'.'/'.$file.'/LC_MESSAGES/fam.mo'; |
| 458 | 502 | if ($file != "." && $file != ".." && @file_exists($path)) { |
@@ -523,8 +567,9 @@ discard block |
||
| 523 | 567 | $error = false; |
| 524 | 568 | if ($fp_out = gzopen($dest, $mode)) { |
| 525 | 569 | if ($fp_in = fopen($source,'rb')) { |
| 526 | - while (!feof($fp_in)) |
|
| 527 | - gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
| 570 | + while (!feof($fp_in)) { |
|
| 571 | + gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
| 572 | + } |
|
| 528 | 573 | fclose($fp_in); |
| 529 | 574 | } else { |
| 530 | 575 | $error = true; |
@@ -533,14 +578,17 @@ discard block |
||
| 533 | 578 | } else { |
| 534 | 579 | $error = true; |
| 535 | 580 | } |
| 536 | - if ($error) |
|
| 537 | - return false; |
|
| 538 | - else |
|
| 539 | - return $dest; |
|
| 581 | + if ($error) { |
|
| 582 | + return false; |
|
| 583 | + } else { |
|
| 584 | + return $dest; |
|
| 585 | + } |
|
| 540 | 586 | } |
| 541 | 587 | |
| 542 | 588 | public function remove_accents($string) { |
| 543 | - if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
|
| 589 | + if ( !preg_match('/[\x80-\xff]/', $string) ) { |
|
| 590 | + return $string; |
|
| 591 | + } |
|
| 544 | 592 | $chars = array( |
| 545 | 593 | // Decompositions for Latin-1 Supplement |
| 546 | 594 | chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
@@ -664,7 +712,9 @@ discard block |
||
| 664 | 712 | $ip = gethostbyname($host); |
| 665 | 713 | $s = socket_create(AF_INET, SOCK_STREAM, 0); |
| 666 | 714 | $r = @socket_connect($s, $ip, $port); |
| 667 | - if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n"; |
|
| 715 | + if (!socket_set_nonblock($s)) { |
|
| 716 | + echo "Unable to set nonblock on socket\n"; |
|
| 717 | + } |
|
| 668 | 718 | if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
| 669 | 719 | return $s; |
| 670 | 720 | } |
@@ -709,18 +759,22 @@ discard block |
||
| 709 | 759 | //NOTE: use a trailing slash for folders!!! |
| 710 | 760 | //see http://bugs.php.net/bug.php?id=27609 |
| 711 | 761 | //see http://bugs.php.net/bug.php?id=30931 |
| 712 | - if ($path{strlen($path)-1}=='/') // recursively return a temporary file path |
|
| 762 | + if ($path{strlen($path)-1}=='/') { |
|
| 763 | + // recursively return a temporary file path |
|
| 713 | 764 | return $this->is__writable($path.uniqid(mt_rand()).'.tmp'); |
| 714 | - else if (is_dir($path)) |
|
| 715 | - return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp'); |
|
| 765 | + } else if (is_dir($path)) { |
|
| 766 | + return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp'); |
|
| 767 | + } |
|
| 716 | 768 | // check tmp file for read/write capabilities |
| 717 | 769 | $rm = file_exists($path); |
| 718 | 770 | $f = @fopen($path, 'a'); |
| 719 | - if ($f===false) |
|
| 720 | - return false; |
|
| 771 | + if ($f===false) { |
|
| 772 | + return false; |
|
| 773 | + } |
|
| 721 | 774 | fclose($f); |
| 722 | - if (!$rm) |
|
| 723 | - unlink($path); |
|
| 775 | + if (!$rm) { |
|
| 776 | + unlink($path); |
|
| 777 | + } |
|
| 724 | 778 | return true; |
| 725 | 779 | } |
| 726 | 780 | } |
@@ -52,7 +52,9 @@ discard block |
||
| 52 | 52 | try { |
| 53 | 53 | $GeoidClass = new GeoidHeight(); |
| 54 | 54 | } catch(Exception $e) { |
| 55 | - if ($globalDebug) echo "Can't calculate geoid, check that you downloaded it via update_db.php (".$e.")\n"; |
|
| 55 | + if ($globalDebug) { |
|
| 56 | + echo "Can't calculate geoid, check that you downloaded it via update_db.php (".$e.")\n"; |
|
| 57 | + } |
|
| 56 | 58 | $GeoidClass = FALSE; |
| 57 | 59 | } |
| 58 | 60 | } |
@@ -71,7 +73,9 @@ discard block |
||
| 71 | 73 | $dbc = $this->db; |
| 72 | 74 | $this->all_flights[$id]['schedule_check'] = true; |
| 73 | 75 | if ($globalSchedulesFetch) { |
| 74 | - if ($globalDebug) echo 'Getting schedule info...'."\n"; |
|
| 76 | + if ($globalDebug) { |
|
| 77 | + echo 'Getting schedule info...'."\n"; |
|
| 78 | + } |
|
| 75 | 79 | $Spotter = new Spotter($dbc); |
| 76 | 80 | $Schedule = new Schedule($dbc); |
| 77 | 81 | $Translation = new Translation($dbc); |
@@ -82,7 +86,9 @@ discard block |
||
| 82 | 86 | if ($Schedule->checkSchedule($operator) == 0) { |
| 83 | 87 | $schedule = $Schedule->fetchSchedule($operator); |
| 84 | 88 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
| 85 | - if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
| 89 | + if ($globalDebug) { |
|
| 90 | + echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
| 91 | + } |
|
| 86 | 92 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
| 87 | 93 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
| 88 | 94 | // Should also check if route schedule = route from DB |
@@ -91,7 +97,9 @@ discard block |
||
| 91 | 97 | $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
| 92 | 98 | if (trim($airport_icao) != '') { |
| 93 | 99 | $this->all_flights[$id]['departure_airport'] = $airport_icao; |
| 94 | - if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
|
| 100 | + if ($globalDebug) { |
|
| 101 | + echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
|
| 102 | + } |
|
| 95 | 103 | } |
| 96 | 104 | } |
| 97 | 105 | } |
@@ -100,17 +108,25 @@ discard block |
||
| 100 | 108 | $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
| 101 | 109 | if (trim($airport_icao) != '') { |
| 102 | 110 | $this->all_flights[$id]['arrival_airport'] = $airport_icao; |
| 103 | - if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
|
| 111 | + if ($globalDebug) { |
|
| 112 | + echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
|
| 113 | + } |
|
| 104 | 114 | } |
| 105 | 115 | } |
| 106 | 116 | } |
| 107 | 117 | $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
| 108 | 118 | } |
| 109 | - } else $scheduleexist = true; |
|
| 110 | - } else $scheduleexist = true; |
|
| 119 | + } else { |
|
| 120 | + $scheduleexist = true; |
|
| 121 | + } |
|
| 122 | + } else { |
|
| 123 | + $scheduleexist = true; |
|
| 124 | + } |
|
| 111 | 125 | // close connection, at least one way will work ? |
| 112 | 126 | if ($scheduleexist) { |
| 113 | - if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
|
| 127 | + if ($globalDebug) { |
|
| 128 | + echo "-> get arrival/departure airport info for ".$ident."\n"; |
|
| 129 | + } |
|
| 114 | 130 | $sch = $Schedule->getSchedule($operator); |
| 115 | 131 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time'])); |
| 116 | 132 | } |
@@ -132,14 +148,18 @@ discard block |
||
| 132 | 148 | |
| 133 | 149 | public function checkAll() { |
| 134 | 150 | global $globalDebug, $globalNoImport; |
| 135 | - if ($globalDebug) echo "Update last seen flights data...\n"; |
|
| 151 | + if ($globalDebug) { |
|
| 152 | + echo "Update last seen flights data...\n"; |
|
| 153 | + } |
|
| 136 | 154 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 137 | 155 | foreach ($this->all_flights as $key => $flight) { |
| 138 | 156 | if (isset($this->all_flights[$key]['id'])) { |
| 139 | 157 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
| 140 | 158 | $Spotter = new Spotter($this->db); |
| 141 | 159 | $real_arrival = $this->arrival($key); |
| 142 | - if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 160 | + if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) { |
|
| 161 | + $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 162 | + } |
|
| 143 | 163 | } |
| 144 | 164 | } |
| 145 | 165 | } |
@@ -147,24 +167,32 @@ discard block |
||
| 147 | 167 | |
| 148 | 168 | public function arrival($key) { |
| 149 | 169 | global $globalClosestMinDist, $globalDebug; |
| 150 | - if ($globalDebug) echo 'Update arrival...'."\n"; |
|
| 170 | + if ($globalDebug) { |
|
| 171 | + echo 'Update arrival...'."\n"; |
|
| 172 | + } |
|
| 151 | 173 | $Spotter = new Spotter($this->db); |
| 152 | 174 | $airport_icao = ''; |
| 153 | 175 | $airport_time = ''; |
| 154 | - if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
| 176 | + if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') { |
|
| 177 | + $globalClosestMinDist = 50; |
|
| 178 | + } |
|
| 155 | 179 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 156 | 180 | $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
| 157 | 181 | if (isset($closestAirports[0])) { |
| 158 | 182 | if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
| 159 | 183 | $airport_icao = $closestAirports[0]['icao']; |
| 160 | 184 | $airport_time = $this->all_flights[$key]['datetime']; |
| 161 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 185 | + if ($globalDebug) { |
|
| 186 | + echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 187 | + } |
|
| 162 | 188 | } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
| 163 | 189 | foreach ($closestAirports as $airport) { |
| 164 | 190 | if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
| 165 | 191 | $airport_icao = $airport['icao']; |
| 166 | 192 | $airport_time = $this->all_flights[$key]['datetime']; |
| 167 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 193 | + if ($globalDebug) { |
|
| 194 | + echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 195 | + } |
|
| 168 | 196 | break; |
| 169 | 197 | } |
| 170 | 198 | } |
@@ -172,14 +200,20 @@ discard block |
||
| 172 | 200 | $airport_icao = $closestAirports[0]['icao']; |
| 173 | 201 | $airport_time = $this->all_flights[$key]['datetime']; |
| 174 | 202 | } else { |
| 175 | - if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
| 203 | + if ($globalDebug) { |
|
| 204 | + echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
| 205 | + } |
|
| 176 | 206 | } |
| 177 | 207 | } else { |
| 178 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 208 | + if ($globalDebug) { |
|
| 209 | + echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 210 | + } |
|
| 179 | 211 | } |
| 180 | 212 | |
| 181 | 213 | } else { |
| 182 | - if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
| 214 | + if ($globalDebug) { |
|
| 215 | + echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
| 216 | + } |
|
| 183 | 217 | } |
| 184 | 218 | return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
| 185 | 219 | } |
@@ -189,7 +223,9 @@ discard block |
||
| 189 | 223 | public function del() { |
| 190 | 224 | global $globalDebug, $globalNoImport, $globalNoDB; |
| 191 | 225 | // Delete old infos |
| 192 | - if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
|
| 226 | + if ($globalDebug) { |
|
| 227 | + echo 'Delete old values and update latest data...'."\n"; |
|
| 228 | + } |
|
| 193 | 229 | foreach ($this->all_flights as $key => $flight) { |
| 194 | 230 | if (isset($flight['lastupdate'])) { |
| 195 | 231 | if ($flight['lastupdate'] < (time()-1800)) { |
@@ -203,13 +239,17 @@ discard block |
||
| 203 | 239 | global $globalDebug, $globalNoImport, $globalNoDB; |
| 204 | 240 | // Delete old infos |
| 205 | 241 | if (isset($this->all_flights[$key]['id'])) { |
| 206 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
| 242 | + if ($globalDebug) { |
|
| 243 | + echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
| 244 | + } |
|
| 207 | 245 | if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
| 208 | 246 | $real_arrival = $this->arrival($key); |
| 209 | 247 | $Spotter = new Spotter($this->db); |
| 210 | 248 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 211 | 249 | $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
| 212 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
| 250 | + if ($globalDebug && $result != 'success') { |
|
| 251 | + echo '!!! ERROR : '.$result."\n"; |
|
| 252 | + } |
|
| 213 | 253 | } |
| 214 | 254 | } |
| 215 | 255 | } |
@@ -219,9 +259,13 @@ discard block |
||
| 219 | 259 | public function add($line) { |
| 220 | 260 | global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights, $globalServerAPRS, $APRSSpotter, $globalNoImport, $globalNoDB, $globalVA, $globalAircraftMaxUpdate, $globalAircraftMinUpdate, $globalLiveInterval, $GeoidClass, $globalArchive; |
| 221 | 261 | //if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE; |
| 222 | - if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.01'; |
|
| 223 | - if (!isset($globalAircraftMaxUpdate) || $globalAircraftMaxUpdate == '') $globalAircraftMaxUpdate = 3000; |
|
| 224 | -/* |
|
| 262 | + if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') { |
|
| 263 | + $globalCoordMinChange = '0.01'; |
|
| 264 | + } |
|
| 265 | + if (!isset($globalAircraftMaxUpdate) || $globalAircraftMaxUpdate == '') { |
|
| 266 | + $globalAircraftMaxUpdate = 3000; |
|
| 267 | + } |
|
| 268 | + /* |
|
| 225 | 269 | $Spotter = new Spotter(); |
| 226 | 270 | $dbc = $Spotter->db; |
| 227 | 271 | $SpotterLive = new SpotterLive($dbc); |
@@ -243,19 +287,28 @@ discard block |
||
| 243 | 287 | // SBS format is CSV format |
| 244 | 288 | if(is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
| 245 | 289 | //print_r($line); |
| 246 | - if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']); |
|
| 290 | + if (isset($line['hex'])) { |
|
| 291 | + $line['hex'] = strtoupper($line['hex']); |
|
| 292 | + } |
|
| 247 | 293 | if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) { |
| 248 | 294 | |
| 249 | 295 | // Increment message number |
| 250 | 296 | if (isset($line['sourcestats']) && $line['sourcestats'] === TRUE) { |
| 251 | 297 | $current_date = date('Y-m-d'); |
| 252 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
| 253 | - else $source = ''; |
|
| 254 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 298 | + if (isset($line['source_name'])) { |
|
| 299 | + $source = $line['source_name']; |
|
| 300 | + } else { |
|
| 301 | + $source = ''; |
|
| 302 | + } |
|
| 303 | + if ($source == '' || $line['format_source'] == 'aprs') { |
|
| 304 | + $source = $line['format_source']; |
|
| 305 | + } |
|
| 255 | 306 | if (!isset($this->stats[$current_date][$source]['msg'])) { |
| 256 | 307 | $this->stats[$current_date][$source]['msg']['date'] = time(); |
| 257 | 308 | $this->stats[$current_date][$source]['msg']['nb'] = 1; |
| 258 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 309 | + } else { |
|
| 310 | + $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 311 | + } |
|
| 259 | 312 | } |
| 260 | 313 | |
| 261 | 314 | /* |
@@ -271,23 +324,38 @@ discard block |
||
| 271 | 324 | //$this->db = $dbc; |
| 272 | 325 | |
| 273 | 326 | //$hex = trim($line['hex']); |
| 274 | - if (!isset($line['id'])) $id = trim($line['hex']); |
|
| 275 | - else $id = trim($line['id']); |
|
| 327 | + if (!isset($line['id'])) { |
|
| 328 | + $id = trim($line['hex']); |
|
| 329 | + } else { |
|
| 330 | + $id = trim($line['id']); |
|
| 331 | + } |
|
| 276 | 332 | |
| 277 | 333 | if (!isset($this->all_flights[$id])) { |
| 278 | - if ($globalDebug) echo 'New flight...'."\n"; |
|
| 334 | + if ($globalDebug) { |
|
| 335 | + echo 'New flight...'."\n"; |
|
| 336 | + } |
|
| 279 | 337 | $this->all_flights[$id] = array(); |
| 280 | 338 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
| 281 | 339 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => '')); |
| 282 | - if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 340 | + if (isset($globalDaemon) && $globalDaemon === FALSE) { |
|
| 341 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 342 | + } |
|
| 283 | 343 | if (!isset($line['id'])) { |
| 284 | - if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
| 285 | -// if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
|
| 344 | + if (!isset($globalDaemon)) { |
|
| 345 | + $globalDaemon = TRUE; |
|
| 346 | + } |
|
| 347 | + // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
|
| 286 | 348 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
| 287 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 349 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
| 350 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 351 | + } |
|
| 288 | 352 | //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 289 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 290 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 353 | + } else { |
|
| 354 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 355 | + } |
|
| 356 | + if ($globalAllFlights !== FALSE) { |
|
| 357 | + $dataFound = true; |
|
| 358 | + } |
|
| 291 | 359 | } |
| 292 | 360 | if (isset($line['source_type']) && $line['source_type'] != '') { |
| 293 | 361 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
@@ -309,12 +377,20 @@ discard block |
||
| 309 | 377 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex'])); |
| 310 | 378 | } |
| 311 | 379 | $Spotter->db = null; |
| 312 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 313 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 380 | + if ($globalDebugTimeElapsed) { |
|
| 381 | + echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 382 | + } |
|
| 383 | + if ($aircraft_icao != '') { |
|
| 384 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 385 | + } |
|
| 314 | 386 | } |
| 315 | 387 | } |
| 316 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 317 | - if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
|
| 388 | + if ($globalAllFlights !== FALSE) { |
|
| 389 | + $dataFound = true; |
|
| 390 | + } |
|
| 391 | + if ($globalDebug) { |
|
| 392 | + echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
|
| 393 | + } |
|
| 318 | 394 | } |
| 319 | 395 | if (isset($line['id']) && !isset($line['hex'])) { |
| 320 | 396 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => '')); |
@@ -323,7 +399,9 @@ discard block |
||
| 323 | 399 | $icao = $line['aircraft_icao']; |
| 324 | 400 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 325 | 401 | $Spotter = new Spotter($this->db); |
| 326 | - if (isset($Spotter->aircraft_correct_icaotype[$icao])) $icao = $Spotter->aircraft_correct_icaotype[$icao]; |
|
| 402 | + if (isset($Spotter->aircraft_correct_icaotype[$icao])) { |
|
| 403 | + $icao = $Spotter->aircraft_correct_icaotype[$icao]; |
|
| 404 | + } |
|
| 327 | 405 | $Spotter->db = null; |
| 328 | 406 | } |
| 329 | 407 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $icao)); |
@@ -334,15 +412,24 @@ discard block |
||
| 334 | 412 | $Spotter = new Spotter($this->db); |
| 335 | 413 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
| 336 | 414 | $Spotter->db = null; |
| 337 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 415 | + if ($aircraft_icao != '') { |
|
| 416 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 417 | + } |
|
| 338 | 418 | } |
| 339 | 419 | } |
| 340 | 420 | if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_type'])) { |
| 341 | - if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
|
| 342 | - elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
|
| 343 | - elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
|
| 344 | - elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
|
| 345 | - if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 421 | + if ($line['aircraft_type'] == 'PARA_GLIDER') { |
|
| 422 | + $aircraft_icao = 'GLID'; |
|
| 423 | + } elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') { |
|
| 424 | + $aircraft_icao = 'UHEL'; |
|
| 425 | + } elseif ($line['aircraft_type'] == 'TOW_PLANE') { |
|
| 426 | + $aircraft_icao = 'TOWPLANE'; |
|
| 427 | + } elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') { |
|
| 428 | + $aircraft_icao = 'POWAIRC'; |
|
| 429 | + } |
|
| 430 | + if (isset($aircraft_icao)) { |
|
| 431 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 432 | + } |
|
| 346 | 433 | } |
| 347 | 434 | if (!isset($this->all_flights[$id]['aircraft_icao'])) { |
| 348 | 435 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
@@ -352,8 +439,11 @@ discard block |
||
| 352 | 439 | if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
| 353 | 440 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 354 | 441 | } else { |
| 355 | - if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 356 | - elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 442 | + if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) { |
|
| 443 | + echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 444 | + } elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) { |
|
| 445 | + echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 446 | + } |
|
| 357 | 447 | /* |
| 358 | 448 | echo strtotime($line['datetime']).' > '.strtotime($this->all_flights[$id]['datetime']); |
| 359 | 449 | print_r($this->all_flights[$id]); |
@@ -362,16 +452,22 @@ discard block |
||
| 362 | 452 | return ''; |
| 363 | 453 | } |
| 364 | 454 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
| 365 | - if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
|
| 455 | + if ($globalDebug) { |
|
| 456 | + echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
|
| 457 | + } |
|
| 366 | 458 | return ''; |
| 367 | 459 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
| 368 | - if ($globalDebug) echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
|
| 460 | + if ($globalDebug) { |
|
| 461 | + echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
|
| 462 | + } |
|
| 369 | 463 | return ''; |
| 370 | 464 | } elseif (!isset($line['datetime'])) { |
| 371 | 465 | date_default_timezone_set('UTC'); |
| 372 | 466 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
| 373 | 467 | } else { |
| 374 | - if ($globalDebug) echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!"; |
|
| 468 | + if ($globalDebug) { |
|
| 469 | + echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!"; |
|
| 470 | + } |
|
| 375 | 471 | return ''; |
| 376 | 472 | } |
| 377 | 473 | |
@@ -392,30 +488,48 @@ discard block |
||
| 392 | 488 | |
| 393 | 489 | if ($this->all_flights[$id]['addedSpotter'] == 1) { |
| 394 | 490 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
| 395 | - if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n"; |
|
| 491 | + if ($globalDebug) { |
|
| 492 | + echo '---!!!! New ident, reset aircraft data...'."\n"; |
|
| 493 | + } |
|
| 396 | 494 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
| 397 | 495 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
| 398 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 399 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 400 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 496 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
| 497 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 498 | + } elseif (isset($line['id'])) { |
|
| 499 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 500 | + } elseif (isset($this->all_flights[$id]['ident'])) { |
|
| 501 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 502 | + } |
|
| 401 | 503 | } else { |
| 402 | 504 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
| 403 | 505 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 404 | 506 | $timeelapsed = microtime(true); |
| 405 | 507 | $Spotter = new Spotter($this->db); |
| 406 | 508 | $fromsource = NULL; |
| 407 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 408 | - elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 409 | - elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 410 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 411 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 509 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 510 | + $fromsource = $globalAirlinesSource; |
|
| 511 | + } elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') { |
|
| 512 | + $fromsource = 'vatsim'; |
|
| 513 | + } elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') { |
|
| 514 | + $fromsource = 'ivao'; |
|
| 515 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 516 | + $fromsource = 'vatsim'; |
|
| 517 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 518 | + $fromsource = 'ivao'; |
|
| 519 | + } |
|
| 412 | 520 | $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
| 413 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
| 521 | + if ($globalDebug && $result != 'success') { |
|
| 522 | + echo '!!! ERROR : '.$result."\n"; |
|
| 523 | + } |
|
| 414 | 524 | $Spotter->db = null; |
| 415 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 525 | + if ($globalDebugTimeElapsed) { |
|
| 526 | + echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 527 | + } |
|
| 416 | 528 | } |
| 417 | 529 | } |
| 418 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 530 | + } else { |
|
| 531 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 532 | + } |
|
| 419 | 533 | |
| 420 | 534 | /* |
| 421 | 535 | if (!isset($line['id'])) { |
@@ -425,7 +539,9 @@ discard block |
||
| 425 | 539 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 426 | 540 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
| 427 | 541 | */ |
| 428 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 542 | + if (!isset($this->all_flights[$id]['id'])) { |
|
| 543 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 544 | + } |
|
| 429 | 545 | |
| 430 | 546 | //$putinarchive = true; |
| 431 | 547 | if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
@@ -443,7 +559,9 @@ discard block |
||
| 443 | 559 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
| 444 | 560 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
| 445 | 561 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
| 446 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 562 | + if ($globalDebugTimeElapsed) { |
|
| 563 | + echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 564 | + } |
|
| 447 | 565 | } |
| 448 | 566 | } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
| 449 | 567 | $timeelapsed = microtime(true); |
@@ -457,7 +575,9 @@ discard block |
||
| 457 | 575 | $Translation->db = null; |
| 458 | 576 | } |
| 459 | 577 | $Spotter->db = null; |
| 460 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 578 | + if ($globalDebugTimeElapsed) { |
|
| 579 | + echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 580 | + } |
|
| 461 | 581 | } |
| 462 | 582 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
| 463 | 583 | //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
@@ -466,9 +586,13 @@ discard block |
||
| 466 | 586 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
| 467 | 587 | } |
| 468 | 588 | } |
| 469 | - if (!isset($globalFork)) $globalFork = TRUE; |
|
| 589 | + if (!isset($globalFork)) { |
|
| 590 | + $globalFork = TRUE; |
|
| 591 | + } |
|
| 470 | 592 | if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
| 471 | - if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
|
| 593 | + if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) { |
|
| 594 | + $this->get_Schedule($id,trim($line['ident'])); |
|
| 595 | + } |
|
| 472 | 596 | } |
| 473 | 597 | } |
| 474 | 598 | } |
@@ -486,9 +610,13 @@ discard block |
||
| 486 | 610 | $speed = $speed*3.6; |
| 487 | 611 | if ($speed < 1000) { |
| 488 | 612 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
| 489 | - if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
|
| 613 | + if ($globalDebug) { |
|
| 614 | + echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
|
| 615 | + } |
|
| 490 | 616 | } else { |
| 491 | - if ($globalDebug) echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
|
| 617 | + if ($globalDebug) { |
|
| 618 | + echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
|
| 619 | + } |
|
| 492 | 620 | } |
| 493 | 621 | } |
| 494 | 622 | } |
@@ -497,13 +625,21 @@ discard block |
||
| 497 | 625 | |
| 498 | 626 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
| 499 | 627 | if (ctype_digit(strval($line['latitude'])) || ctype_digit(strval($line['longitude']))) { |
| 500 | - if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
|
| 628 | + if ($globalDebug) { |
|
| 629 | + echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
|
| 630 | + } |
|
| 501 | 631 | return false; |
| 502 | 632 | } |
| 503 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 504 | - else unset($timediff); |
|
| 505 | - if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
| 506 | - else unset($timediff_archive); |
|
| 633 | + if (isset($this->all_flights[$id]['time_last_coord'])) { |
|
| 634 | + $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 635 | + } else { |
|
| 636 | + unset($timediff); |
|
| 637 | + } |
|
| 638 | + if (isset($this->all_flights[$id]['time_last_archive_coord'])) { |
|
| 639 | + $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
| 640 | + } else { |
|
| 641 | + unset($timediff_archive); |
|
| 642 | + } |
|
| 507 | 643 | if ($this->tmd > 5 |
| 508 | 644 | || (isset($line['format_source']) |
| 509 | 645 | && $line['format_source'] == 'airwhere' |
@@ -540,16 +676,25 @@ discard block |
||
| 540 | 676 | $this->all_flights[$id]['putinarchive'] = true; |
| 541 | 677 | $this->tmd = 0; |
| 542 | 678 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 543 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
| 679 | + if ($globalDebug) { |
|
| 680 | + echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
| 681 | + } |
|
| 544 | 682 | $timeelapsed = microtime(true); |
| 545 | 683 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 546 | 684 | $Spotter = new Spotter($this->db); |
| 547 | 685 | $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
| 548 | - if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
|
| 549 | - else $this->all_flights[$id]['over_country'] = ''; |
|
| 686 | + if (!empty($all_country)) { |
|
| 687 | + $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
|
| 688 | + } else { |
|
| 689 | + $this->all_flights[$id]['over_country'] = ''; |
|
| 690 | + } |
|
| 550 | 691 | $Spotter->db = null; |
| 551 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 552 | - if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
|
| 692 | + if ($globalDebugTimeElapsed) { |
|
| 693 | + echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 694 | + } |
|
| 695 | + if ($globalDebug) { |
|
| 696 | + echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
|
| 697 | + } |
|
| 553 | 698 | } |
| 554 | 699 | } |
| 555 | 700 | $this->all_flights[$id]['time_last_archive_coord'] = time(); |
@@ -595,7 +740,9 @@ discard block |
||
| 595 | 740 | */ |
| 596 | 741 | } |
| 597 | 742 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 598 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 743 | + if ($line['longitude'] > 180) { |
|
| 744 | + $line['longitude'] = $line['longitude'] - 360; |
|
| 745 | + } |
|
| 599 | 746 | //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
| 600 | 747 | if (!isset($this->all_flights[$id]['archive_longitude'])) { |
| 601 | 748 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
@@ -632,7 +779,9 @@ discard block |
||
| 632 | 779 | } |
| 633 | 780 | } |
| 634 | 781 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 635 | - if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 782 | + if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) { |
|
| 783 | + $dataFound = true; |
|
| 784 | + } |
|
| 636 | 785 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
| 637 | 786 | } |
| 638 | 787 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
@@ -654,35 +803,53 @@ discard block |
||
| 654 | 803 | // Here we force archive of flight because after ground it's a new one (or should be) |
| 655 | 804 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
| 656 | 805 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
| 657 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 658 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 659 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 806 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
| 807 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 808 | + } elseif (isset($line['id'])) { |
|
| 809 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 810 | + } elseif (isset($this->all_flights[$id]['ident'])) { |
|
| 811 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 812 | + } |
|
| 813 | + } |
|
| 814 | + if ($line['ground'] != 1) { |
|
| 815 | + $line['ground'] = 0; |
|
| 660 | 816 | } |
| 661 | - if ($line['ground'] != 1) $line['ground'] = 0; |
|
| 662 | 817 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
| 663 | 818 | //$dataFound = true; |
| 664 | 819 | } |
| 665 | 820 | if (isset($line['squawk']) && $line['squawk'] != '') { |
| 666 | 821 | if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
| 667 | - if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
|
| 822 | + if ($this->all_flights[$id]['squawk'] != $line['squawk']) { |
|
| 823 | + $this->all_flights[$id]['putinarchive'] = true; |
|
| 824 | + } |
|
| 668 | 825 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
| 669 | 826 | $highlight = ''; |
| 670 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 671 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 672 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 827 | + if ($this->all_flights[$id]['squawk'] == '7500') { |
|
| 828 | + $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 829 | + } |
|
| 830 | + if ($this->all_flights[$id]['squawk'] == '7600') { |
|
| 831 | + $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 832 | + } |
|
| 833 | + if ($this->all_flights[$id]['squawk'] == '7700') { |
|
| 834 | + $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 835 | + } |
|
| 673 | 836 | if ($highlight != '') { |
| 674 | 837 | $timeelapsed = microtime(true); |
| 675 | 838 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 676 | 839 | $Spotter = new Spotter($this->db); |
| 677 | 840 | $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
| 678 | 841 | $Spotter->db = null; |
| 679 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 842 | + if ($globalDebugTimeElapsed) { |
|
| 843 | + echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 844 | + } |
|
| 680 | 845 | } |
| 681 | 846 | //$putinarchive = true; |
| 682 | 847 | //$highlight = ''; |
| 683 | 848 | } |
| 684 | 849 | |
| 685 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 850 | + } else { |
|
| 851 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 852 | + } |
|
| 686 | 853 | //$dataFound = true; |
| 687 | 854 | } |
| 688 | 855 | |
@@ -695,19 +862,27 @@ discard block |
||
| 695 | 862 | } |
| 696 | 863 | } |
| 697 | 864 | //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
| 698 | - if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
|
| 865 | + if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) { |
|
| 866 | + $this->all_flights[$id]['putinarchive'] = true; |
|
| 867 | + } |
|
| 699 | 868 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
| 700 | 869 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
| 701 | 870 | //$dataFound = true; |
| 702 | 871 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
| 703 | 872 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) { |
| 704 | 873 | if (isset($this->all_flights[$id]['over_country']) && $this->all_flights[$id]['over_country'] != '' && isset($this->all_flights[$id]['altitude_previous']) && $this->all_flights[$id]['altitude_previous'] != '' && $this->all_flights[$id]['altitude_previous'] < $this->all_flights[$id]['altitude_real'] && isset($this->all_flights[$id]['lastupdate']) && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
| 705 | - if ($globalDebug) echo '--- Reset because of altitude'."\n"; |
|
| 874 | + if ($globalDebug) { |
|
| 875 | + echo '--- Reset because of altitude'."\n"; |
|
| 876 | + } |
|
| 706 | 877 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
| 707 | 878 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
| 708 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 709 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 710 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 879 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
| 880 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 881 | + } elseif (isset($line['id'])) { |
|
| 882 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 883 | + } elseif (isset($this->all_flights[$id]['ident'])) { |
|
| 884 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 885 | + } |
|
| 711 | 886 | } |
| 712 | 887 | } |
| 713 | 888 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude'])); |
@@ -718,22 +893,32 @@ discard block |
||
| 718 | 893 | } |
| 719 | 894 | |
| 720 | 895 | if (isset($line['heading']) && $line['heading'] != '') { |
| 721 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 896 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) { |
|
| 897 | + $this->all_flights[$id]['putinarchive'] = true; |
|
| 898 | + } |
|
| 722 | 899 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
| 723 | 900 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
| 724 | 901 | //$dataFound = true; |
| 725 | 902 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
| 726 | 903 | $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
| 727 | 904 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
| 728 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 729 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
| 905 | + if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) { |
|
| 906 | + $this->all_flights[$id]['putinarchive'] = true; |
|
| 907 | + } |
|
| 908 | + if ($globalDebug) { |
|
| 909 | + echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
| 910 | + } |
|
| 730 | 911 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
| 731 | 912 | // If not enough messages and ACARS set heading to 0 |
| 732 | 913 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
| 733 | 914 | } |
| 734 | - if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
| 735 | - elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
| 736 | - elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) $dataFound = false; |
|
| 915 | + if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) { |
|
| 916 | + $dataFound = false; |
|
| 917 | + } elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) { |
|
| 918 | + $dataFound = false; |
|
| 919 | + } elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) { |
|
| 920 | + $dataFound = false; |
|
| 921 | + } |
|
| 737 | 922 | |
| 738 | 923 | // print_r($this->all_flights[$id]); |
| 739 | 924 | //gets the callsign from the last hour |
@@ -750,23 +935,38 @@ discard block |
||
| 750 | 935 | //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
| 751 | 936 | if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
| 752 | 937 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 753 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
| 938 | + if ($globalDebug) { |
|
| 939 | + echo "Check if aircraft is already in DB..."; |
|
| 940 | + } |
|
| 754 | 941 | $timeelapsed = microtime(true); |
| 755 | 942 | $SpotterLive = new SpotterLive($this->db); |
| 756 | 943 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
| 757 | 944 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
| 758 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 945 | + if ($globalDebugTimeElapsed) { |
|
| 946 | + echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 947 | + } |
|
| 759 | 948 | } elseif (isset($line['id'])) { |
| 760 | 949 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
| 761 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 950 | + if ($globalDebugTimeElapsed) { |
|
| 951 | + echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 952 | + } |
|
| 762 | 953 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
| 763 | 954 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
| 764 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 765 | - } else $recent_ident = ''; |
|
| 955 | + if ($globalDebugTimeElapsed) { |
|
| 956 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 957 | + } |
|
| 958 | + } else { |
|
| 959 | + $recent_ident = ''; |
|
| 960 | + } |
|
| 766 | 961 | $SpotterLive->db=null; |
| 767 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 768 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 769 | - } else $recent_ident = ''; |
|
| 962 | + if ($globalDebug && $recent_ident == '') { |
|
| 963 | + echo " Not in DB.\n"; |
|
| 964 | + } elseif ($globalDebug && $recent_ident != '') { |
|
| 965 | + echo " Already in DB.\n"; |
|
| 966 | + } |
|
| 967 | + } else { |
|
| 968 | + $recent_ident = ''; |
|
| 969 | + } |
|
| 770 | 970 | } else { |
| 771 | 971 | $recent_ident = ''; |
| 772 | 972 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
@@ -774,7 +974,9 @@ discard block |
||
| 774 | 974 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
| 775 | 975 | if($recent_ident == "") |
| 776 | 976 | { |
| 777 | - if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
|
| 977 | + if ($globalDebug) { |
|
| 978 | + echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
|
| 979 | + } |
|
| 778 | 980 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 779 | 981 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 780 | 982 | //adds the spotter data for the archive |
@@ -818,31 +1020,49 @@ discard block |
||
| 818 | 1020 | |
| 819 | 1021 | if (!$ignoreImport) { |
| 820 | 1022 | $highlight = ''; |
| 821 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
| 822 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 823 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
| 824 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 1023 | + if ($this->all_flights[$id]['squawk'] == '7500') { |
|
| 1024 | + $highlight = 'Squawk 7500 : Hijack'; |
|
| 1025 | + } |
|
| 1026 | + if ($this->all_flights[$id]['squawk'] == '7600') { |
|
| 1027 | + $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 1028 | + } |
|
| 1029 | + if ($this->all_flights[$id]['squawk'] == '7700') { |
|
| 1030 | + $highlight = 'Squawk 7700 : Emergency'; |
|
| 1031 | + } |
|
| 1032 | + if (!isset($this->all_flights[$id]['id'])) { |
|
| 1033 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 1034 | + } |
|
| 825 | 1035 | $timeelapsed = microtime(true); |
| 826 | 1036 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 827 | 1037 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 828 | 1038 | $Spotter = new Spotter($this->db); |
| 829 | 1039 | $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']); |
| 830 | 1040 | $Spotter->db = null; |
| 831 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 1041 | + if ($globalDebug && isset($result)) { |
|
| 1042 | + echo $result."\n"; |
|
| 1043 | + } |
|
| 832 | 1044 | } |
| 833 | 1045 | } |
| 834 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 1046 | + if ($globalDebugTimeElapsed) { |
|
| 1047 | + echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 1048 | + } |
|
| 835 | 1049 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 836 | 1050 | |
| 837 | 1051 | // Add source stat in DB |
| 838 | 1052 | $Stats = new Stats($this->db); |
| 839 | 1053 | if (!empty($this->stats)) { |
| 840 | - if ($globalDebug) echo 'Add source stats : '; |
|
| 1054 | + if ($globalDebug) { |
|
| 1055 | + echo 'Add source stats : '; |
|
| 1056 | + } |
|
| 841 | 1057 | foreach($this->stats as $date => $data) { |
| 842 | 1058 | foreach($data as $source => $sourced) { |
| 843 | 1059 | //print_r($sourced); |
| 844 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 845 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 1060 | + if (isset($sourced['polar'])) { |
|
| 1061 | + echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 1062 | + } |
|
| 1063 | + if (isset($sourced['hist'])) { |
|
| 1064 | + echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 1065 | + } |
|
| 846 | 1066 | if (isset($sourced['msg'])) { |
| 847 | 1067 | if (time() - $sourced['msg']['date'] > 10) { |
| 848 | 1068 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
@@ -855,13 +1075,17 @@ discard block |
||
| 855 | 1075 | unset($this->stats[$date]); |
| 856 | 1076 | } |
| 857 | 1077 | } |
| 858 | - if ($globalDebug) echo 'Done'."\n"; |
|
| 1078 | + if ($globalDebug) { |
|
| 1079 | + echo 'Done'."\n"; |
|
| 1080 | + } |
|
| 859 | 1081 | |
| 860 | 1082 | } |
| 861 | 1083 | $Stats->db = null; |
| 862 | 1084 | } |
| 863 | 1085 | $this->del(); |
| 864 | - } elseif ($globalDebug) echo 'Ignore data'."\n"; |
|
| 1086 | + } elseif ($globalDebug) { |
|
| 1087 | + echo 'Ignore data'."\n"; |
|
| 1088 | + } |
|
| 865 | 1089 | //$ignoreImport = false; |
| 866 | 1090 | $this->all_flights[$id]['addedSpotter'] = 1; |
| 867 | 1091 | //print_r($this->all_flights[$id]); |
@@ -878,7 +1102,9 @@ discard block |
||
| 878 | 1102 | */ |
| 879 | 1103 | //SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']); |
| 880 | 1104 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
| 881 | - if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 1105 | + if ($globalDebug) { |
|
| 1106 | + echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 1107 | + } |
|
| 882 | 1108 | //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
| 883 | 1109 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 884 | 1110 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
@@ -887,7 +1113,9 @@ discard block |
||
| 887 | 1113 | $SpotterLive->db=null; |
| 888 | 1114 | } |
| 889 | 1115 | } |
| 890 | - if ($globalDebug) echo " Done\n"; |
|
| 1116 | + if ($globalDebug) { |
|
| 1117 | + echo " Done\n"; |
|
| 1118 | + } |
|
| 891 | 1119 | $this->last_delete = time(); |
| 892 | 1120 | } |
| 893 | 1121 | } else { |
@@ -914,11 +1142,17 @@ discard block |
||
| 914 | 1142 | //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
| 915 | 1143 | if ($globalDebug) { |
| 916 | 1144 | if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) { |
| 917 | - if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
|
| 918 | - else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n"; |
|
| 1145 | + if (isset($this->all_flights[$id]['source_name'])) { |
|
| 1146 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
|
| 1147 | + } else { |
|
| 1148 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n"; |
|
| 1149 | + } |
|
| 919 | 1150 | } else { |
| 920 | - if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
|
| 921 | - else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n"; |
|
| 1151 | + if (isset($this->all_flights[$id]['source_name'])) { |
|
| 1152 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
|
| 1153 | + } else { |
|
| 1154 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n"; |
|
| 1155 | + } |
|
| 922 | 1156 | } |
| 923 | 1157 | } |
| 924 | 1158 | $ignoreImport = false; |
@@ -964,22 +1198,30 @@ discard block |
||
| 964 | 1198 | |
| 965 | 1199 | if (!$ignoreImport) { |
| 966 | 1200 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
| 967 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 1201 | + if (!isset($this->all_flights[$id]['id'])) { |
|
| 1202 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 1203 | + } |
|
| 968 | 1204 | $timeelapsed = microtime(true); |
| 969 | 1205 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 970 | 1206 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 971 | - if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
|
| 1207 | + if ($globalDebug) { |
|
| 1208 | + echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
|
| 1209 | + } |
|
| 972 | 1210 | $SpotterLive = new SpotterLive($this->db); |
| 973 | 1211 | $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
| 974 | 1212 | $SpotterLive->db = null; |
| 975 | - if ($globalDebug) echo $result."\n"; |
|
| 1213 | + if ($globalDebug) { |
|
| 1214 | + echo $result."\n"; |
|
| 1215 | + } |
|
| 976 | 1216 | } |
| 977 | 1217 | } |
| 978 | 1218 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) { |
| 979 | 1219 | $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
| 980 | 1220 | } |
| 981 | 1221 | $this->all_flights[$id]['putinarchive'] = false; |
| 982 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 1222 | + if ($globalDebugTimeElapsed) { |
|
| 1223 | + echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 1224 | + } |
|
| 983 | 1225 | |
| 984 | 1226 | // Put statistics in $this->stats variable |
| 985 | 1227 | //if ($line['format_source'] != 'aprs') { |
@@ -987,7 +1229,9 @@ discard block |
||
| 987 | 1229 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 988 | 1230 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
| 989 | 1231 | $source = $this->all_flights[$id]['source_name']; |
| 990 | - if ($source == '') $source = $this->all_flights[$id]['format_source']; |
|
| 1232 | + if ($source == '') { |
|
| 1233 | + $source = $this->all_flights[$id]['format_source']; |
|
| 1234 | + } |
|
| 991 | 1235 | if (!isset($this->source_location[$source])) { |
| 992 | 1236 | $Location = new Source($this->db); |
| 993 | 1237 | $coord = $Location->getLocationInfobySourceName($source); |
@@ -1008,7 +1252,9 @@ discard block |
||
| 1008 | 1252 | $stats_heading = round($stats_heading/22.5); |
| 1009 | 1253 | $stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
| 1010 | 1254 | $current_date = date('Y-m-d'); |
| 1011 | - if ($stats_heading == 16) $stats_heading = 0; |
|
| 1255 | + if ($stats_heading == 16) { |
|
| 1256 | + $stats_heading = 0; |
|
| 1257 | + } |
|
| 1012 | 1258 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 1013 | 1259 | for ($i=0;$i<=15;$i++) { |
| 1014 | 1260 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
@@ -1026,7 +1272,9 @@ discard block |
||
| 1026 | 1272 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 1027 | 1273 | end($this->stats[$current_date][$source]['hist']); |
| 1028 | 1274 | $mini = key($this->stats[$current_date][$source]['hist'])+10; |
| 1029 | - } else $mini = 0; |
|
| 1275 | + } else { |
|
| 1276 | + $mini = 0; |
|
| 1277 | + } |
|
| 1030 | 1278 | for ($i=$mini;$i<=$distance;$i+=10) { |
| 1031 | 1279 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
| 1032 | 1280 | } |
@@ -1038,19 +1286,27 @@ discard block |
||
| 1038 | 1286 | } |
| 1039 | 1287 | |
| 1040 | 1288 | $this->all_flights[$id]['lastupdate'] = time(); |
| 1041 | - if ($this->all_flights[$id]['putinarchive']) $send = true; |
|
| 1289 | + if ($this->all_flights[$id]['putinarchive']) { |
|
| 1290 | + $send = true; |
|
| 1291 | + } |
|
| 1042 | 1292 | //if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
| 1043 | - } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 1293 | + } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) { |
|
| 1294 | + echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 1295 | + } |
|
| 1044 | 1296 | //$this->del(); |
| 1045 | 1297 | |
| 1046 | 1298 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
| 1047 | 1299 | if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
| 1048 | - if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
| 1300 | + if ($globalDebug) { |
|
| 1301 | + echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
| 1302 | + } |
|
| 1049 | 1303 | $SpotterLive = new SpotterLive($this->db); |
| 1050 | 1304 | $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
| 1051 | 1305 | $SpotterLive->db = null; |
| 1052 | 1306 | //SpotterLive->deleteLiveSpotterData(); |
| 1053 | - if ($globalDebug) echo " Done\n"; |
|
| 1307 | + if ($globalDebug) { |
|
| 1308 | + echo " Done\n"; |
|
| 1309 | + } |
|
| 1054 | 1310 | $this->last_delete_hourly = time(); |
| 1055 | 1311 | } else { |
| 1056 | 1312 | $this->del(); |
@@ -1062,7 +1318,9 @@ discard block |
||
| 1062 | 1318 | //$ignoreImport = false; |
| 1063 | 1319 | } |
| 1064 | 1320 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
| 1065 | - if ($send) return $this->all_flights[$id]; |
|
| 1321 | + if ($send) { |
|
| 1322 | + return $this->all_flights[$id]; |
|
| 1323 | + } |
|
| 1066 | 1324 | } |
| 1067 | 1325 | } |
| 1068 | 1326 | } |
@@ -4,11 +4,19 @@ discard block |
||
| 4 | 4 | if (isset($_SESSION['error'])) { |
| 5 | 5 | header('Content-Encoding: none;'); |
| 6 | 6 | echo 'Error : '.$_SESSION['error'].' - Resetting install... You need to fix the problem and run install again.'; |
| 7 | - if (isset($_SESSION['error'])) unset($_SESSION['error']); |
|
| 8 | - if (isset($_SESSION['errorlst'])) unset($_SESSION['errorlst']); |
|
| 9 | - if (isset($_SESSION['next'])) unset($_SESSION['next']); |
|
| 10 | - if (isset($_SESSION['install'])) unset($_SESSION['install']); |
|
| 11 | -} |
|
| 7 | + if (isset($_SESSION['error'])) { |
|
| 8 | + unset($_SESSION['error']); |
|
| 9 | + } |
|
| 10 | + if (isset($_SESSION['errorlst'])) { |
|
| 11 | + unset($_SESSION['errorlst']); |
|
| 12 | + } |
|
| 13 | + if (isset($_SESSION['next'])) { |
|
| 14 | + unset($_SESSION['next']); |
|
| 15 | + } |
|
| 16 | + if (isset($_SESSION['install'])) { |
|
| 17 | + unset($_SESSION['install']); |
|
| 18 | + } |
|
| 19 | + } |
|
| 12 | 20 | /* |
| 13 | 21 | if (isset($_SESSION['errorlst'])) { |
| 14 | 22 | header('Content-Encoding: none;'); |
@@ -159,45 +167,72 @@ discard block |
||
| 159 | 167 | </div> |
| 160 | 168 | <p> |
| 161 | 169 | <label for="dbhost">Database hostname</label> |
| 162 | - <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" /> |
|
| 170 | + <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) { |
|
| 171 | + print $globalDBhost; |
|
| 172 | +} |
|
| 173 | +?>" /> |
|
| 163 | 174 | </p> |
| 164 | 175 | <p> |
| 165 | 176 | <label for="dbport">Database port</label> |
| 166 | - <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" /> |
|
| 177 | + <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) { |
|
| 178 | + print $globalDBport; |
|
| 179 | +} |
|
| 180 | +?>" /> |
|
| 167 | 181 | <p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p> |
| 168 | 182 | </p> |
| 169 | 183 | <p> |
| 170 | 184 | <label for="dbname">Database name</label> |
| 171 | - <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" /> |
|
| 185 | + <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) { |
|
| 186 | + print $globalDBname; |
|
| 187 | +} |
|
| 188 | +?>" /> |
|
| 172 | 189 | </p> |
| 173 | 190 | <p> |
| 174 | 191 | <label for="dbuser">Database user</label> |
| 175 | - <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" /> |
|
| 192 | + <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) { |
|
| 193 | + print $globalDBuser; |
|
| 194 | +} |
|
| 195 | +?>" /> |
|
| 176 | 196 | </p> |
| 177 | 197 | <p> |
| 178 | 198 | <label for="dbuserpass">Database user password</label> |
| 179 | - <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" /> |
|
| 199 | + <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) { |
|
| 200 | + print $globalDBpass; |
|
| 201 | +} |
|
| 202 | +?>" /> |
|
| 180 | 203 | </p> |
| 181 | 204 | </fieldset> |
| 182 | 205 | <fieldset id="site"> |
| 183 | 206 | <legend>Site configuration</legend> |
| 184 | 207 | <p> |
| 185 | 208 | <label for="sitename">Site name</label> |
| 186 | - <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" /> |
|
| 209 | + <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) { |
|
| 210 | + print $globalName; |
|
| 211 | +} |
|
| 212 | +?>" /> |
|
| 187 | 213 | </p> |
| 188 | 214 | <p> |
| 189 | 215 | <label for="siteurl">Site directory</label> |
| 190 | - <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
|
| 216 | + <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) { |
|
| 217 | + print $globalURL; |
|
| 218 | +} |
|
| 219 | +?>" /> |
|
| 191 | 220 | <p class="help-block">Can be null. ex : <i>flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
| 192 | 221 | </p> |
| 193 | 222 | <p> |
| 194 | 223 | <label for="timezone">Timezone</label> |
| 195 | - <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" /> |
|
| 224 | + <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) { |
|
| 225 | + print $globalTimezone; |
|
| 226 | +} |
|
| 227 | +?>" /> |
|
| 196 | 228 | <p class="help-block">ex : UTC, Europe/Paris,...</p> |
| 197 | 229 | </p> |
| 198 | 230 | <p> |
| 199 | 231 | <label for="language">Language</label> |
| 200 | - <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" /> |
|
| 232 | + <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) { |
|
| 233 | + print $globalLanguage; |
|
| 234 | +} |
|
| 235 | +?>" /> |
|
| 201 | 236 | <p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p> |
| 202 | 237 | </p> |
| 203 | 238 | </fieldset> |
@@ -218,11 +253,17 @@ discard block |
||
| 218 | 253 | <div id="mapbox_data"> |
| 219 | 254 | <p> |
| 220 | 255 | <label for="mapboxid">Mapbox id</label> |
| 221 | - <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" /> |
|
| 256 | + <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) { |
|
| 257 | + print $globalMapboxId; |
|
| 258 | +} |
|
| 259 | +?>" /> |
|
| 222 | 260 | </p> |
| 223 | 261 | <p> |
| 224 | 262 | <label for="mapboxtoken">Mapbox token</label> |
| 225 | - <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" /> |
|
| 263 | + <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) { |
|
| 264 | + print $globalMapboxToken; |
|
| 265 | +} |
|
| 266 | +?>" /> |
|
| 226 | 267 | </p> |
| 227 | 268 | <p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p> |
| 228 | 269 | </div> |
@@ -230,7 +271,10 @@ discard block |
||
| 230 | 271 | <div id="google_data"> |
| 231 | 272 | <p> |
| 232 | 273 | <label for="googlekey">Google API key</label> |
| 233 | - <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" /> |
|
| 274 | + <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) { |
|
| 275 | + print $globalGoogleAPIKey; |
|
| 276 | +} |
|
| 277 | +?>" /> |
|
| 234 | 278 | <p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p> |
| 235 | 279 | </p> |
| 236 | 280 | </div> |
@@ -238,7 +282,10 @@ discard block |
||
| 238 | 282 | <div id="bing_data"> |
| 239 | 283 | <p> |
| 240 | 284 | <label for="bingkey">Bing Map key</label> |
| 241 | - <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" /> |
|
| 285 | + <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) { |
|
| 286 | + print $globalBingMapKey; |
|
| 287 | +} |
|
| 288 | +?>" /> |
|
| 242 | 289 | <p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p> |
| 243 | 290 | </p> |
| 244 | 291 | </div> |
@@ -246,7 +293,10 @@ discard block |
||
| 246 | 293 | <div id="mapquest_data"> |
| 247 | 294 | <p> |
| 248 | 295 | <label for="mapquestkey">MapQuest key</label> |
| 249 | - <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" /> |
|
| 296 | + <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) { |
|
| 297 | + print $globalMapQuestKey; |
|
| 298 | +} |
|
| 299 | +?>" /> |
|
| 250 | 300 | <p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p> |
| 251 | 301 | </p> |
| 252 | 302 | </div> |
@@ -254,11 +304,17 @@ discard block |
||
| 254 | 304 | <div id="here_data"> |
| 255 | 305 | <p> |
| 256 | 306 | <label for="hereappid">Here App_Id</label> |
| 257 | - <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" /> |
|
| 307 | + <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) { |
|
| 308 | + print $globalHereappId; |
|
| 309 | +} |
|
| 310 | +?>" /> |
|
| 258 | 311 | </p> |
| 259 | 312 | <p> |
| 260 | 313 | <label for="hereappcode">Here App_Code</label> |
| 261 | - <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" /> |
|
| 314 | + <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) { |
|
| 315 | + print $globalHereappCode; |
|
| 316 | +} |
|
| 317 | +?>" /> |
|
| 262 | 318 | </p> |
| 263 | 319 | <p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p> |
| 264 | 320 | </div> |
@@ -266,7 +322,10 @@ discard block |
||
| 266 | 322 | <div id="openweathermap_data"> |
| 267 | 323 | <p> |
| 268 | 324 | <label for="openweathermapkey">OpenWeatherMap key (weather layer)</label> |
| 269 | - <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" /> |
|
| 325 | + <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) { |
|
| 326 | + print $globalOpenWeatherMapKey; |
|
| 327 | +} |
|
| 328 | +?>" /> |
|
| 270 | 329 | <p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p> |
| 271 | 330 | </p> |
| 272 | 331 | </div> |
@@ -276,42 +335,86 @@ discard block |
||
| 276 | 335 | <legend>Coverage area</legend> |
| 277 | 336 | <p> |
| 278 | 337 | <label for="latitudemax">The maximum latitude (north)</label> |
| 279 | - <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" /> |
|
| 338 | + <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) { |
|
| 339 | + print $globalLatitudeMax; |
|
| 340 | +} |
|
| 341 | +?>" /> |
|
| 280 | 342 | </p> |
| 281 | 343 | <p> |
| 282 | 344 | <label for="latitudemin">The minimum latitude (south)</label> |
| 283 | - <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" /> |
|
| 345 | + <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) { |
|
| 346 | + print $globalLatitudeMin; |
|
| 347 | +} |
|
| 348 | +?>" /> |
|
| 284 | 349 | </p> |
| 285 | 350 | <p> |
| 286 | 351 | <label for="longitudemax">The maximum longitude (west)</label> |
| 287 | - <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" /> |
|
| 352 | + <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) { |
|
| 353 | + print $globalLongitudeMax; |
|
| 354 | +} |
|
| 355 | +?>" /> |
|
| 288 | 356 | </p> |
| 289 | 357 | <p> |
| 290 | 358 | <label for="longitudemin">The minimum longitude (east)</label> |
| 291 | - <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" /> |
|
| 359 | + <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) { |
|
| 360 | + print $globalLongitudeMin; |
|
| 361 | +} |
|
| 362 | +?>" /> |
|
| 292 | 363 | </p> |
| 293 | 364 | <p> |
| 294 | 365 | <label for="latitudecenter">The latitude center</label> |
| 295 | - <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" /> |
|
| 366 | + <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) { |
|
| 367 | + print $globalCenterLatitude; |
|
| 368 | +} |
|
| 369 | +?>" /> |
|
| 296 | 370 | </p> |
| 297 | 371 | <p> |
| 298 | 372 | <label for="longitudecenter">The longitude center</label> |
| 299 | - <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" /> |
|
| 373 | + <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) { |
|
| 374 | + print $globalCenterLongitude; |
|
| 375 | +} |
|
| 376 | +?>" /> |
|
| 300 | 377 | </p> |
| 301 | 378 | <p> |
| 302 | 379 | <label for="livezoom">Default Zoom on live map</label> |
| 303 | - <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" /> |
|
| 380 | + <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) { |
|
| 381 | + print $globalLiveZoom; |
|
| 382 | +} else { |
|
| 383 | + print '9'; |
|
| 384 | +} |
|
| 385 | +?>" /> |
|
| 304 | 386 | </p> |
| 305 | 387 | <p> |
| 306 | 388 | <label for="squawk_country">Country for squawk usage</label> |
| 307 | 389 | <select name="squawk_country" id="squawk_country"> |
| 308 | - <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option> |
|
| 309 | - <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option> |
|
| 310 | - <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option> |
|
| 311 | - <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option> |
|
| 312 | - <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option> |
|
| 313 | - <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option> |
|
| 314 | - <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option> |
|
| 390 | + <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') { |
|
| 391 | + print ' selected '; |
|
| 392 | +} |
|
| 393 | +?>>UK</option> |
|
| 394 | + <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') { |
|
| 395 | + print ' selected '; |
|
| 396 | +} |
|
| 397 | +?>>NZ</option> |
|
| 398 | + <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') { |
|
| 399 | + print ' selected '; |
|
| 400 | +} |
|
| 401 | +?>>US</option> |
|
| 402 | + <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') { |
|
| 403 | + print ' selected '; |
|
| 404 | +} |
|
| 405 | +?>>AU</option> |
|
| 406 | + <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') { |
|
| 407 | + print ' selected '; |
|
| 408 | +} |
|
| 409 | +?>>NL</option> |
|
| 410 | + <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') { |
|
| 411 | + print ' selected '; |
|
| 412 | +} |
|
| 413 | +?>>FR</option> |
|
| 414 | + <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') { |
|
| 415 | + print ' selected '; |
|
| 416 | +} |
|
| 417 | +?>>TR</option> |
|
| 315 | 418 | </select> |
| 316 | 419 | </p> |
| 317 | 420 | </fieldset> |
@@ -320,15 +423,24 @@ discard block |
||
| 320 | 423 | <p><i>Only put in DB flights that are inside a circle</i></p> |
| 321 | 424 | <p> |
| 322 | 425 | <label for="latitude">Center latitude</label> |
| 323 | - <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" /> |
|
| 426 | + <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) { |
|
| 427 | + echo $globalDistanceIgnore['latitude']; |
|
| 428 | +} |
|
| 429 | +?>" /> |
|
| 324 | 430 | </p> |
| 325 | 431 | <p> |
| 326 | 432 | <label for="longitude">Center longitude</label> |
| 327 | - <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" /> |
|
| 433 | + <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) { |
|
| 434 | + echo $globalDistanceIgnore['longitude']; |
|
| 435 | +} |
|
| 436 | +?>" /> |
|
| 328 | 437 | </p> |
| 329 | 438 | <p> |
| 330 | 439 | <label for="Distance">Distance (in km)</label> |
| 331 | - <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" /> |
|
| 440 | + <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) { |
|
| 441 | + echo $globalDistanceIgnore['distance']; |
|
| 442 | +} |
|
| 443 | +?>" /> |
|
| 332 | 444 | </p> |
| 333 | 445 | </fieldset> |
| 334 | 446 | <fieldset id="sourceloc"> |
@@ -441,11 +553,17 @@ discard block |
||
| 441 | 553 | <div id="flightaware_data"> |
| 442 | 554 | <p> |
| 443 | 555 | <label for="flightawareusername">FlightAware username</label> |
| 444 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
| 556 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
| 557 | + print $globalFlightAwareUsername; |
|
| 558 | +} |
|
| 559 | +?>" /> |
|
| 445 | 560 | </p> |
| 446 | 561 | <p> |
| 447 | 562 | <label for="flightawarepassword">FlightAware password/API key</label> |
| 448 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
| 563 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
| 564 | + print $globalFlightAwarePassword; |
|
| 565 | +} |
|
| 566 | +?>" /> |
|
| 449 | 567 | </p> |
| 450 | 568 | </div> |
| 451 | 569 | --> |
@@ -487,7 +605,10 @@ discard block |
||
| 487 | 605 | if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
| 488 | 606 | ?> |
| 489 | 607 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
| 490 | - <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
|
| 608 | + <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) { |
|
| 609 | + print $source['port']; |
|
| 610 | +} |
|
| 611 | +?>" /></td> |
|
| 491 | 612 | <?php |
| 492 | 613 | } else { |
| 493 | 614 | $hostport = explode(':',$source['host']); |
@@ -506,34 +627,106 @@ discard block |
||
| 506 | 627 | ?> |
| 507 | 628 | <td> |
| 508 | 629 | <select name="format[]" id="format"> |
| 509 | - <option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option> |
|
| 510 | - <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option> |
|
| 511 | - <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option> |
|
| 512 | - <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option> |
|
| 513 | - <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option> |
|
| 514 | - <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option> |
|
| 515 | - <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option> |
|
| 516 | - <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option> |
|
| 517 | - <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option> |
|
| 518 | - <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option> |
|
| 519 | - <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>Virtual Airline Operations System (VAOS)</option> |
|
| 520 | - <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option> |
|
| 521 | - <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option> |
|
| 522 | - <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option> |
|
| 523 | - <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option> |
|
| 524 | - <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
| 525 | - <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option> |
|
| 526 | - <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option> |
|
| 527 | - <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option> |
|
| 528 | - <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') print 'selected'; ?>>HidnSeek Callback</option> |
|
| 529 | - <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') print 'selected'; ?>>Blitzortung</option> |
|
| 630 | + <option value="auto" <?php if (!isset($source['format'])) { |
|
| 631 | + print 'selected'; |
|
| 632 | +} |
|
| 633 | +?>>Auto</option> |
|
| 634 | + <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') { |
|
| 635 | + print 'selected'; |
|
| 636 | +} |
|
| 637 | +?>>SBS</option> |
|
| 638 | + <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') { |
|
| 639 | + print 'selected'; |
|
| 640 | +} |
|
| 641 | +?>>TSV</option> |
|
| 642 | + <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') { |
|
| 643 | + print 'selected'; |
|
| 644 | +} |
|
| 645 | +?>>Raw</option> |
|
| 646 | + <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') { |
|
| 647 | + print 'selected'; |
|
| 648 | +} |
|
| 649 | +?>>APRS</option> |
|
| 650 | + <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') { |
|
| 651 | + print 'selected'; |
|
| 652 | +} |
|
| 653 | +?>>Radarcape deltadb.txt</option> |
|
| 654 | + <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') { |
|
| 655 | + print 'selected'; |
|
| 656 | +} |
|
| 657 | +?>>Vatsim</option> |
|
| 658 | + <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') { |
|
| 659 | + print 'selected'; |
|
| 660 | +} |
|
| 661 | +?>>Virtual Radar Server AircraftList.json</option> |
|
| 662 | + <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') { |
|
| 663 | + print 'selected'; |
|
| 664 | +} |
|
| 665 | +?>>Virtual Radar Server TCP</option> |
|
| 666 | + <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
| 667 | + print 'selected'; |
|
| 668 | +} |
|
| 669 | +?>>phpVMS</option> |
|
| 670 | + <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
| 671 | + print 'selected'; |
|
| 672 | +} |
|
| 673 | +?>>Virtual Airline Operations System (VAOS)</option> |
|
| 674 | + <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') { |
|
| 675 | + print 'selected'; |
|
| 676 | +} |
|
| 677 | +?>>Virtual Airlines Manager</option> |
|
| 678 | + <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') { |
|
| 679 | + print 'selected'; |
|
| 680 | +} |
|
| 681 | +?>>IVAO</option> |
|
| 682 | + <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') { |
|
| 683 | + print 'selected'; |
|
| 684 | +} |
|
| 685 | +?>>FlightGear Multiplayer</option> |
|
| 686 | + <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') { |
|
| 687 | + print 'selected'; |
|
| 688 | +} |
|
| 689 | +?>>FlightGear Singleplayer</option> |
|
| 690 | + <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') { |
|
| 691 | + print 'selected'; |
|
| 692 | +} |
|
| 693 | +?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
| 694 | + <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') { |
|
| 695 | + print 'selected'; |
|
| 696 | +} |
|
| 697 | +?>>ACARS SBS-3 over TCP</option> |
|
| 698 | + <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') { |
|
| 699 | + print 'selected'; |
|
| 700 | +} |
|
| 701 | +?>>NMEA AIS over TCP</option> |
|
| 702 | + <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') { |
|
| 703 | + print 'selected'; |
|
| 704 | +} |
|
| 705 | +?>>AirWhere website</option> |
|
| 706 | + <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') { |
|
| 707 | + print 'selected'; |
|
| 708 | +} |
|
| 709 | +?>>HidnSeek Callback</option> |
|
| 710 | + <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') { |
|
| 711 | + print 'selected'; |
|
| 712 | +} |
|
| 713 | +?>>Blitzortung</option> |
|
| 530 | 714 | </select> |
| 531 | 715 | </td> |
| 532 | 716 | <td> |
| 533 | - <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" /> |
|
| 717 | + <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) { |
|
| 718 | + print $source['name']; |
|
| 719 | +} |
|
| 720 | +?>" /> |
|
| 534 | 721 | </td> |
| 535 | - <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td> |
|
| 536 | - <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) print 'checked'; ?> /></td> |
|
| 722 | + <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) { |
|
| 723 | + print 'checked'; |
|
| 724 | +} |
|
| 725 | +?> /></td> |
|
| 726 | + <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) { |
|
| 727 | + print 'checked'; |
|
| 728 | +} |
|
| 729 | +?> /></td> |
|
| 537 | 730 | <td> |
| 538 | 731 | <select name="timezones[]" id="timezones"> |
| 539 | 732 | <?php |
@@ -543,7 +736,9 @@ discard block |
||
| 543 | 736 | print '<option selected>'.$timezones.'</option>'; |
| 544 | 737 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
| 545 | 738 | print '<option selected>'.$timezones.'</option>'; |
| 546 | - } else print '<option>'.$timezones.'</option>'; |
|
| 739 | + } else { |
|
| 740 | + print '<option>'.$timezones.'</option>'; |
|
| 741 | + } |
|
| 547 | 742 | } |
| 548 | 743 | ?> |
| 549 | 744 | </select> |
@@ -594,7 +789,9 @@ discard block |
||
| 594 | 789 | foreach($timezonelist as $timezones){ |
| 595 | 790 | if ($timezones == 'UTC') { |
| 596 | 791 | print '<option selected>'.$timezones.'</option>'; |
| 597 | - } else print '<option>'.$timezones.'</option>'; |
|
| 792 | + } else { |
|
| 793 | + print '<option>'.$timezones.'</option>'; |
|
| 794 | + } |
|
| 598 | 795 | } |
| 599 | 796 | ?> |
| 600 | 797 | </select> |
@@ -618,11 +815,17 @@ discard block |
||
| 618 | 815 | <p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p> |
| 619 | 816 | <p> |
| 620 | 817 | <label for="acarshost">ACARS UDP host</label> |
| 621 | - <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" /> |
|
| 818 | + <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) { |
|
| 819 | + print $globalACARSHost; |
|
| 820 | +} |
|
| 821 | +?>" /> |
|
| 622 | 822 | </p> |
| 623 | 823 | <p> |
| 624 | 824 | <label for="acarsport">ACARS UDP port</label> |
| 625 | - <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" /> |
|
| 825 | + <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) { |
|
| 826 | + print $globalACARSPort; |
|
| 827 | +} |
|
| 828 | +?>" /> |
|
| 626 | 829 | </p> |
| 627 | 830 | </fieldset> |
| 628 | 831 | </div> |
@@ -648,17 +851,38 @@ discard block |
||
| 648 | 851 | <td><input type="url" name="newsurl[]" value="<?php print $feed; ?>"/></td> |
| 649 | 852 | <td> |
| 650 | 853 | <select name="newslang[]"> |
| 651 | - <option value="en"<?php if ($lng == 'en') print ' selected'; ?>>English</option> |
|
| 652 | - <option value="fr"<?php if ($lng == 'fr') print ' selected'; ?>>French</option> |
|
| 854 | + <option value="en"<?php if ($lng == 'en') { |
|
| 855 | + print ' selected'; |
|
| 856 | +} |
|
| 857 | +?>>English</option> |
|
| 858 | + <option value="fr"<?php if ($lng == 'fr') { |
|
| 859 | + print ' selected'; |
|
| 860 | +} |
|
| 861 | +?>>French</option> |
|
| 653 | 862 | </select> |
| 654 | 863 | </td> |
| 655 | 864 | <td> |
| 656 | 865 | <select name="newstype[]"> |
| 657 | - <option value="global"<?php if ($type == 'global') print ' selected'; ?>>Global</option> |
|
| 658 | - <option value="aircraft"<?php if ($type == 'aircraft') print ' selected'; ?>>Aircraft</option> |
|
| 659 | - <option value="marine"<?php if ($type == 'marine') print ' selected'; ?>>Marine</option> |
|
| 660 | - <option value="tracker"<?php if ($type == 'tracker') print ' selected'; ?>>Tracker</option> |
|
| 661 | - <option value="satellite"<?php if ($type == 'Satellite') print ' selected'; ?>>Satellite</option> |
|
| 866 | + <option value="global"<?php if ($type == 'global') { |
|
| 867 | + print ' selected'; |
|
| 868 | +} |
|
| 869 | +?>>Global</option> |
|
| 870 | + <option value="aircraft"<?php if ($type == 'aircraft') { |
|
| 871 | + print ' selected'; |
|
| 872 | +} |
|
| 873 | +?>>Aircraft</option> |
|
| 874 | + <option value="marine"<?php if ($type == 'marine') { |
|
| 875 | + print ' selected'; |
|
| 876 | +} |
|
| 877 | +?>>Marine</option> |
|
| 878 | + <option value="tracker"<?php if ($type == 'tracker') { |
|
| 879 | + print ' selected'; |
|
| 880 | +} |
|
| 881 | +?>>Tracker</option> |
|
| 882 | + <option value="satellite"<?php if ($type == 'Satellite') { |
|
| 883 | + print ' selected'; |
|
| 884 | +} |
|
| 885 | +?>>Satellite</option> |
|
| 662 | 886 | </select> |
| 663 | 887 | </td> |
| 664 | 888 | <td><input type="button" value="Delete" onclick="deleteRowNews(this)" /> <input type="button" value="Add" onclick="insRowNews()" /></td> |
@@ -791,13 +1015,19 @@ discard block |
||
| 791 | 1015 | <div id="schedules_options"> |
| 792 | 1016 | <p> |
| 793 | 1017 | <label for="britishairways">British Airways API Key</label> |
| 794 | - <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" /> |
|
| 1018 | + <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) { |
|
| 1019 | + print $globalBritishAirwaysKey; |
|
| 1020 | +} |
|
| 1021 | +?>" /> |
|
| 795 | 1022 | <p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p> |
| 796 | 1023 | </p> |
| 797 | 1024 | <!-- |
| 798 | 1025 | <p> |
| 799 | 1026 | <label for="transavia">Transavia Test API Consumer Key</label> |
| 800 | - <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" /> |
|
| 1027 | + <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) { |
|
| 1028 | + print $globalTransaviaKey; |
|
| 1029 | +} |
|
| 1030 | +?>" /> |
|
| 801 | 1031 | <p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p> |
| 802 | 1032 | </p> |
| 803 | 1033 | --> |
@@ -806,10 +1036,16 @@ discard block |
||
| 806 | 1036 | <b>Lufthansa API Key</b> |
| 807 | 1037 | <p> |
| 808 | 1038 | <label for="lufthansakey">Key</label> |
| 809 | - <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" /> |
|
| 1039 | + <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) { |
|
| 1040 | + print $globalLufthansaKey['key']; |
|
| 1041 | +} |
|
| 1042 | +?>" /> |
|
| 810 | 1043 | </p><p> |
| 811 | 1044 | <label for="lufthansasecret">Secret</label> |
| 812 | - <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" /> |
|
| 1045 | + <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) { |
|
| 1046 | + print $globalLufthansaKey['secret']; |
|
| 1047 | +} |
|
| 1048 | +?>" /> |
|
| 813 | 1049 | </p> |
| 814 | 1050 | </div> |
| 815 | 1051 | <p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p> |
@@ -829,7 +1065,10 @@ discard block |
||
| 829 | 1065 | </p> |
| 830 | 1066 | <p> |
| 831 | 1067 | <label for="notamsource">URL of your feed from notaminfo.com</label> |
| 832 | - <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" /> |
|
| 1068 | + <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) { |
|
| 1069 | + print $globalNOTAMSource; |
|
| 1070 | +} |
|
| 1071 | +?>" /> |
|
| 833 | 1072 | <p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p> |
| 834 | 1073 | </p> |
| 835 | 1074 | <br /> |
@@ -845,14 +1084,20 @@ discard block |
||
| 845 | 1084 | <div id="metarsrc"> |
| 846 | 1085 | <p> |
| 847 | 1086 | <label for="metarsource">URL of your METAR source</label> |
| 848 | - <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" /> |
|
| 1087 | + <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) { |
|
| 1088 | + print $globalMETARurl; |
|
| 1089 | +} |
|
| 1090 | +?>" /> |
|
| 849 | 1091 | <p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p> |
| 850 | 1092 | </p> |
| 851 | 1093 | </div> |
| 852 | 1094 | <br /> |
| 853 | 1095 | <p> |
| 854 | 1096 | <label for="bitly">Bit.ly access token api (used in search page)</label> |
| 855 | - <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" /> |
|
| 1097 | + <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) { |
|
| 1098 | + print $globalBitlyAccessToken; |
|
| 1099 | +} |
|
| 1100 | +?>" /> |
|
| 856 | 1101 | </p> |
| 857 | 1102 | <br /> |
| 858 | 1103 | <p> |
@@ -868,11 +1113,26 @@ discard block |
||
| 868 | 1113 | <p> |
| 869 | 1114 | <label for="geoid_source">Geoid Source</label> |
| 870 | 1115 | <select name="geoid_source" id="geoid_source"> |
| 871 | - <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option> |
|
| 872 | - <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option> |
|
| 873 | - <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option> |
|
| 874 | - <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option> |
|
| 875 | - <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option> |
|
| 1116 | + <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') { |
|
| 1117 | + print ' selected="selected"'; |
|
| 1118 | +} |
|
| 1119 | +?>>EGM96 15' (2.1MB)</option> |
|
| 1120 | + <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') { |
|
| 1121 | + print ' selected="selected"'; |
|
| 1122 | +} |
|
| 1123 | +?>>EGM96 5' (19MB)</option> |
|
| 1124 | + <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') { |
|
| 1125 | + print ' selected="selected"'; |
|
| 1126 | +} |
|
| 1127 | +?>>EGM2008 5' (19MB)</option> |
|
| 1128 | + <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') { |
|
| 1129 | + print ' selected="selected"'; |
|
| 1130 | +} |
|
| 1131 | +?>>EGM2008 2.5' (75MB)</option> |
|
| 1132 | + <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') { |
|
| 1133 | + print ' selected="selected"'; |
|
| 1134 | +} |
|
| 1135 | +?>>EGM2008 1' (470MB)</option> |
|
| 876 | 1136 | </select> |
| 877 | 1137 | <p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p> |
| 878 | 1138 | </p> |
@@ -894,7 +1154,12 @@ discard block |
||
| 894 | 1154 | </p> |
| 895 | 1155 | <p> |
| 896 | 1156 | <label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label> |
| 897 | - <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '1'; ?>" /> |
|
| 1157 | + <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) { |
|
| 1158 | + print $globalArchiveMonths; |
|
| 1159 | +} else { |
|
| 1160 | + echo '1'; |
|
| 1161 | +} |
|
| 1162 | +?>" /> |
|
| 898 | 1163 | <p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p> |
| 899 | 1164 | </p> |
| 900 | 1165 | <p> |
@@ -904,12 +1169,22 @@ discard block |
||
| 904 | 1169 | </p> |
| 905 | 1170 | <p> |
| 906 | 1171 | <label for="archivekeepmonths">Keep flights data for xx months in archive</label> |
| 907 | - <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '1'; ?>" /> |
|
| 1172 | + <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) { |
|
| 1173 | + print $globalArchiveKeepMonths; |
|
| 1174 | +} else { |
|
| 1175 | + echo '1'; |
|
| 1176 | +} |
|
| 1177 | +?>" /> |
|
| 908 | 1178 | <p class="help-block">0 to disable</p> |
| 909 | 1179 | </p> |
| 910 | 1180 | <p> |
| 911 | 1181 | <label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label> |
| 912 | - <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '1'; ?>" /> |
|
| 1182 | + <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) { |
|
| 1183 | + print $globalArchiveKeepTrackMonths; |
|
| 1184 | +} else { |
|
| 1185 | + echo '1'; |
|
| 1186 | +} |
|
| 1187 | +?>" /> |
|
| 913 | 1188 | <p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p> |
| 914 | 1189 | </p> |
| 915 | 1190 | <br /> |
@@ -919,7 +1194,12 @@ discard block |
||
| 919 | 1194 | <p class="help-block">Uncheck if the script is running as cron job</p> |
| 920 | 1195 | <div id="cronends"> |
| 921 | 1196 | <label for="cronend">Run script for xx seconds</label> |
| 922 | - <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" /> |
|
| 1197 | + <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) { |
|
| 1198 | + print $globalCronEnd; |
|
| 1199 | +} else { |
|
| 1200 | + print '0'; |
|
| 1201 | +} |
|
| 1202 | +?>" /> |
|
| 923 | 1203 | <p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p> |
| 924 | 1204 | </div> |
| 925 | 1205 | </p> |
@@ -972,15 +1252,30 @@ discard block |
||
| 972 | 1252 | <br /> |
| 973 | 1253 | <p> |
| 974 | 1254 | <label for="refresh">Show flights detected since xxx seconds</label> |
| 975 | - <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" /> |
|
| 1255 | + <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) { |
|
| 1256 | + echo $globalLiveInterval; |
|
| 1257 | +} else { |
|
| 1258 | + echo '200'; |
|
| 1259 | +} |
|
| 1260 | +?>" /> |
|
| 976 | 1261 | </p> |
| 977 | 1262 | <p> |
| 978 | 1263 | <label for="maprefresh">Live map refresh (in seconds)</label> |
| 979 | - <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" /> |
|
| 1264 | + <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) { |
|
| 1265 | + echo $globalMapRefresh; |
|
| 1266 | +} else { |
|
| 1267 | + echo '30'; |
|
| 1268 | +} |
|
| 1269 | +?>" /> |
|
| 980 | 1270 | </p> |
| 981 | 1271 | <p> |
| 982 | 1272 | <label for="mapidle">Map idle timeout (in minutes)</label> |
| 983 | - <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" /> |
|
| 1273 | + <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) { |
|
| 1274 | + echo $globalMapIdleTimeout; |
|
| 1275 | +} else { |
|
| 1276 | + echo '30'; |
|
| 1277 | +} |
|
| 1278 | +?>" /> |
|
| 984 | 1279 | <p class="help-block">0 to disable</p> |
| 985 | 1280 | </p> |
| 986 | 1281 | <p> |
@@ -995,12 +1290,20 @@ discard block |
||
| 995 | 1290 | <br /> |
| 996 | 1291 | <p> |
| 997 | 1292 | <label for="closestmindist">Distance to airport set as arrival (in km)</label> |
| 998 | - <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" /> |
|
| 1293 | + <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) { |
|
| 1294 | + echo $globalClosestMinDist; |
|
| 1295 | +} else { |
|
| 1296 | + echo '50'; |
|
| 1297 | +} |
|
| 1298 | +?>" /> |
|
| 999 | 1299 | </p> |
| 1000 | 1300 | <br /> |
| 1001 | 1301 | <p> |
| 1002 | 1302 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
| 1003 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
| 1303 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) { |
|
| 1304 | + echo $globalAircraftSize; |
|
| 1305 | +} |
|
| 1306 | +?>" /> |
|
| 1004 | 1307 | </p> |
| 1005 | 1308 | <br /> |
| 1006 | 1309 | <p> |
@@ -1019,7 +1322,12 @@ discard block |
||
| 1019 | 1322 | if (extension_loaded('gd') && function_exists('gd_info')) { |
| 1020 | 1323 | ?> |
| 1021 | 1324 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
| 1022 | - <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
|
| 1325 | + <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) { |
|
| 1326 | + echo $globalAircraftIconColor; |
|
| 1327 | +} else { |
|
| 1328 | + echo '1a3151'; |
|
| 1329 | +} |
|
| 1330 | +?>" /> |
|
| 1023 | 1331 | <?php |
| 1024 | 1332 | if (!is_writable('../cache')) { |
| 1025 | 1333 | ?> |
@@ -1037,14 +1345,27 @@ discard block |
||
| 1037 | 1345 | <p> |
| 1038 | 1346 | <label for="airportzoom">Zoom level minimum to see airports icons</label> |
| 1039 | 1347 | <div class="range"> |
| 1040 | - <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" /> |
|
| 1041 | - <output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output> |
|
| 1348 | + <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) { |
|
| 1349 | + echo $globalAirportZoom; |
|
| 1350 | +} else { |
|
| 1351 | + echo '7'; |
|
| 1352 | +} |
|
| 1353 | +?>" /> |
|
| 1354 | + <output id="range"><?php if (isset($globalAirportZoom)) { |
|
| 1355 | + echo $globalAirportZoom; |
|
| 1356 | +} else { |
|
| 1357 | + echo '7'; |
|
| 1358 | +} |
|
| 1359 | +?></output> |
|
| 1042 | 1360 | </div> |
| 1043 | 1361 | </p> |
| 1044 | 1362 | <br /> |
| 1045 | 1363 | <p> |
| 1046 | 1364 | <label for="customcss">Custom CSS web path</label> |
| 1047 | - <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" /> |
|
| 1365 | + <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) { |
|
| 1366 | + echo $globalCustomCSS; |
|
| 1367 | +} |
|
| 1368 | +?>" /> |
|
| 1048 | 1369 | </p> |
| 1049 | 1370 | </fieldset> |
| 1050 | 1371 | <input type="submit" name="submit" value="Create/Update database & write setup" /> |
@@ -1071,8 +1392,12 @@ discard block |
||
| 1071 | 1392 | $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
| 1072 | 1393 | $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
| 1073 | 1394 | |
| 1074 | - if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
|
| 1075 | - if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
| 1395 | + if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) { |
|
| 1396 | + $error .= 'Mysql driver for PDO must be loaded'; |
|
| 1397 | + } |
|
| 1398 | + if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) { |
|
| 1399 | + $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
| 1400 | + } |
|
| 1076 | 1401 | |
| 1077 | 1402 | $_SESSION['database_root'] = $dbroot; |
| 1078 | 1403 | $_SESSION['database_rootpass'] = $dbrootpass; |
@@ -1140,15 +1465,23 @@ discard block |
||
| 1140 | 1465 | $source_city = $_POST['source_city']; |
| 1141 | 1466 | $source_country = $_POST['source_country']; |
| 1142 | 1467 | $source_ref = $_POST['source_ref']; |
| 1143 | - if (isset($source_id)) $source_id = $_POST['source_id']; |
|
| 1144 | - else $source_id = array(); |
|
| 1468 | + if (isset($source_id)) { |
|
| 1469 | + $source_id = $_POST['source_id']; |
|
| 1470 | + } else { |
|
| 1471 | + $source_id = array(); |
|
| 1472 | + } |
|
| 1145 | 1473 | |
| 1146 | 1474 | $sources = array(); |
| 1147 | 1475 | foreach ($source_name as $keys => $name) { |
| 1148 | - 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]); |
|
| 1149 | - 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]); |
|
| 1476 | + if (isset($source_id[$keys])) { |
|
| 1477 | + $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]); |
|
| 1478 | + } else { |
|
| 1479 | + $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]); |
|
| 1480 | + } |
|
| 1481 | + } |
|
| 1482 | + if (count($sources) > 0) { |
|
| 1483 | + $_SESSION['sources'] = $sources; |
|
| 1150 | 1484 | } |
| 1151 | - if (count($sources) > 0) $_SESSION['sources'] = $sources; |
|
| 1152 | 1485 | |
| 1153 | 1486 | $newsurl = $_POST['newsurl']; |
| 1154 | 1487 | $newslng = $_POST['newslang']; |
@@ -1161,7 +1494,9 @@ discard block |
||
| 1161 | 1494 | $lng = $newslng[$newskey]; |
| 1162 | 1495 | if (isset($newsfeeds[$type][$lng])) { |
| 1163 | 1496 | $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
| 1164 | - } else $newsfeeds[$type][$lng] = array($url); |
|
| 1497 | + } else { |
|
| 1498 | + $newsfeeds[$type][$lng] = array($url); |
|
| 1499 | + } |
|
| 1165 | 1500 | } |
| 1166 | 1501 | } |
| 1167 | 1502 | $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
@@ -1185,17 +1520,29 @@ discard block |
||
| 1185 | 1520 | $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
| 1186 | 1521 | |
| 1187 | 1522 | $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
| 1188 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
| 1189 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
| 1523 | + if ($globalaircraft == 'aircraft') { |
|
| 1524 | + $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
| 1525 | + } else { |
|
| 1526 | + $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
| 1527 | + } |
|
| 1190 | 1528 | $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
| 1191 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
| 1192 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
| 1529 | + if ($globaltracker == 'tracker') { |
|
| 1530 | + $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
| 1531 | + } else { |
|
| 1532 | + $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
| 1533 | + } |
|
| 1193 | 1534 | $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
| 1194 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
| 1195 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
| 1535 | + if ($globalmarine == 'marine') { |
|
| 1536 | + $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
| 1537 | + } else { |
|
| 1538 | + $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
| 1539 | + } |
|
| 1196 | 1540 | $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
| 1197 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
| 1198 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
| 1541 | + if ($globalsatellite == 'satellite') { |
|
| 1542 | + $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
| 1543 | + } else { |
|
| 1544 | + $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
| 1545 | + } |
|
| 1199 | 1546 | |
| 1200 | 1547 | /* |
| 1201 | 1548 | $globalSBS1Hosts = array(); |
@@ -1217,23 +1564,37 @@ discard block |
||
| 1217 | 1564 | $name = $_POST['name']; |
| 1218 | 1565 | $format = $_POST['format']; |
| 1219 | 1566 | $timezones = $_POST['timezones']; |
| 1220 | - if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats']; |
|
| 1221 | - else $sourcestats = array(); |
|
| 1222 | - if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive']; |
|
| 1223 | - else $noarchive = array(); |
|
| 1567 | + if (isset($_POST['sourcestats'])) { |
|
| 1568 | + $sourcestats = $_POST['sourcestats']; |
|
| 1569 | + } else { |
|
| 1570 | + $sourcestats = array(); |
|
| 1571 | + } |
|
| 1572 | + if (isset($_POST['noarchive'])) { |
|
| 1573 | + $noarchive = $_POST['noarchive']; |
|
| 1574 | + } else { |
|
| 1575 | + $noarchive = array(); |
|
| 1576 | + } |
|
| 1224 | 1577 | $gSources = array(); |
| 1225 | 1578 | $forcepilots = false; |
| 1226 | 1579 | foreach ($host as $key => $h) { |
| 1227 | - if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE'; |
|
| 1228 | - else $cov = 'FALSE'; |
|
| 1229 | - if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
|
| 1230 | - else $arch = 'FALSE'; |
|
| 1580 | + if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) { |
|
| 1581 | + $cov = 'TRUE'; |
|
| 1582 | + } else { |
|
| 1583 | + $cov = 'FALSE'; |
|
| 1584 | + } |
|
| 1585 | + if (isset($noarchive[$key]) && $noarchive[$key] == 1) { |
|
| 1586 | + $arch = 'TRUE'; |
|
| 1587 | + } else { |
|
| 1588 | + $arch = 'FALSE'; |
|
| 1589 | + } |
|
| 1231 | 1590 | if (strpos($format[$key],'_callback')) { |
| 1232 | 1591 | $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
| 1233 | 1592 | } elseif ($h != '' || $name[$key] != '') { |
| 1234 | 1593 | $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
| 1235 | 1594 | } |
| 1236 | - if ($format[$key] == 'airwhere') $forcepilots = true; |
|
| 1595 | + if ($format[$key] == 'airwhere') { |
|
| 1596 | + $forcepilots = true; |
|
| 1597 | + } |
|
| 1237 | 1598 | } |
| 1238 | 1599 | $settings = array_merge($settings,array('globalSources' => $gSources)); |
| 1239 | 1600 | |
@@ -1264,7 +1625,9 @@ discard block |
||
| 1264 | 1625 | $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
| 1265 | 1626 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
| 1266 | 1627 | $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
| 1267 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 1628 | + } else { |
|
| 1629 | + $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 1630 | + } |
|
| 1268 | 1631 | |
| 1269 | 1632 | $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
| 1270 | 1633 | $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
@@ -1303,7 +1666,9 @@ discard block |
||
| 1303 | 1666 | |
| 1304 | 1667 | // Create in settings.php keys not yet configurable if not already here |
| 1305 | 1668 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
| 1306 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1669 | + if (!isset($globalDebug)) { |
|
| 1670 | + $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1671 | + } |
|
| 1307 | 1672 | |
| 1308 | 1673 | $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
| 1309 | 1674 | if ($resetyearstats == 'resetyearstats') { |
@@ -1346,37 +1711,56 @@ discard block |
||
| 1346 | 1711 | } |
| 1347 | 1712 | */ |
| 1348 | 1713 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
| 1349 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1350 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1351 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1352 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 1714 | + if ($globalsbs == 'sbs') { |
|
| 1715 | + $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1716 | + } else { |
|
| 1717 | + $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1718 | + } |
|
| 1719 | + if ($globalaprs == 'aprs') { |
|
| 1720 | + $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1721 | + } else { |
|
| 1722 | + $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 1723 | + } |
|
| 1353 | 1724 | $va = false; |
| 1354 | 1725 | if ($globalivao == 'ivao') { |
| 1355 | 1726 | $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
| 1356 | 1727 | $va = true; |
| 1357 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 1728 | + } else { |
|
| 1729 | + $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 1730 | + } |
|
| 1358 | 1731 | if ($globalvatsim == 'vatsim') { |
| 1359 | 1732 | $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
| 1360 | 1733 | $va = true; |
| 1361 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 1734 | + } else { |
|
| 1735 | + $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 1736 | + } |
|
| 1362 | 1737 | if ($globalphpvms == 'phpvms') { |
| 1363 | 1738 | $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
| 1364 | 1739 | $va = true; |
| 1365 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 1740 | + } else { |
|
| 1741 | + $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 1742 | + } |
|
| 1366 | 1743 | if ($globalvam == 'vam') { |
| 1367 | 1744 | $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
| 1368 | 1745 | $va = true; |
| 1369 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
| 1746 | + } else { |
|
| 1747 | + $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
| 1748 | + } |
|
| 1370 | 1749 | if ($va) { |
| 1371 | 1750 | $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
| 1372 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 1751 | + } else { |
|
| 1752 | + $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 1753 | + } |
|
| 1373 | 1754 | if ($globalva == 'va' || $va) { |
| 1374 | 1755 | $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
| 1375 | 1756 | $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
| 1376 | 1757 | } else { |
| 1377 | 1758 | $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
| 1378 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
| 1379 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
| 1759 | + if ($forcepilots) { |
|
| 1760 | + $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
| 1761 | + } else { |
|
| 1762 | + $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
| 1763 | + } |
|
| 1380 | 1764 | } |
| 1381 | 1765 | |
| 1382 | 1766 | |
@@ -1577,7 +1961,9 @@ discard block |
||
| 1577 | 1961 | $settings = array_merge($settings,array('globalTSK' => 'FALSE')); |
| 1578 | 1962 | } |
| 1579 | 1963 | |
| 1580 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 1964 | + if (!isset($globalTransaction)) { |
|
| 1965 | + $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 1966 | + } |
|
| 1581 | 1967 | |
| 1582 | 1968 | // Set some defaults values... |
| 1583 | 1969 | if (!isset($globalAircraftImageSources)) { |
@@ -1592,15 +1978,23 @@ discard block |
||
| 1592 | 1978 | |
| 1593 | 1979 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
| 1594 | 1980 | |
| 1595 | - if ($error == '') settings::modify_settings($settings); |
|
| 1596 | - if ($error == '') settings::comment_settings($settings_comment); |
|
| 1981 | + if ($error == '') { |
|
| 1982 | + settings::modify_settings($settings); |
|
| 1983 | + } |
|
| 1984 | + if ($error == '') { |
|
| 1985 | + settings::comment_settings($settings_comment); |
|
| 1986 | + } |
|
| 1597 | 1987 | if ($error != '') { |
| 1598 | 1988 | print '<div class="info column">'.$error.'</div>'; |
| 1599 | 1989 | require('../footer.php'); |
| 1600 | 1990 | exit; |
| 1601 | 1991 | } else { |
| 1602 | - if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1; |
|
| 1603 | - if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1; |
|
| 1992 | + if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') { |
|
| 1993 | + $_SESSION['waypoints'] = 1; |
|
| 1994 | + } |
|
| 1995 | + if (isset($_POST['owner']) && $_POST['owner'] == 'owner') { |
|
| 1996 | + $_SESSION['owner'] = 1; |
|
| 1997 | + } |
|
| 1604 | 1998 | if (isset($_POST['createdb'])) { |
| 1605 | 1999 | $_SESSION['install'] = 'database_create'; |
| 1606 | 2000 | } else { |
@@ -1637,10 +2031,18 @@ discard block |
||
| 1637 | 2031 | $popw = false; |
| 1638 | 2032 | foreach ($_SESSION['done'] as $done) { |
| 1639 | 2033 | print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
| 1640 | - if ($done == 'Create database') $pop = true; |
|
| 1641 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
| 1642 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
| 1643 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
| 2034 | + if ($done == 'Create database') { |
|
| 2035 | + $pop = true; |
|
| 2036 | + } |
|
| 2037 | + if ($_SESSION['install'] == 'database_create') { |
|
| 2038 | + $pop = true; |
|
| 2039 | + } |
|
| 2040 | + if ($_SESSION['install'] == 'database_import') { |
|
| 2041 | + $popi = true; |
|
| 2042 | + } |
|
| 2043 | + if ($_SESSION['install'] == 'waypoints') { |
|
| 2044 | + $popw = true; |
|
| 2045 | + } |
|
| 1644 | 2046 | } |
| 1645 | 2047 | if ($pop) { |
| 1646 | 2048 | sleep(5); |
@@ -1651,7 +2053,9 @@ discard block |
||
| 1651 | 2053 | } else if ($popw) { |
| 1652 | 2054 | sleep(5); |
| 1653 | 2055 | print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
| 1654 | - } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
| 2056 | + } else { |
|
| 2057 | + print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
| 2058 | + } |
|
| 1655 | 2059 | print '</div></ul>'; |
| 1656 | 2060 | print '<div id="error"></div>'; |
| 1657 | 2061 | /* foreach ($_SESSION['done'] as $done) { |