@@ -39,30 +39,30 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | |
| 41 | 41 | function quaternionrotate($heading, $attitude = 0, $bank = 0) { |
| 42 | - // Assuming the angles are in radians. |
|
| 43 | - $c1 = cos($heading/2); |
|
| 44 | - $s1 = sin($heading/2); |
|
| 45 | - $c2 = cos($attitude/2); |
|
| 46 | - $s2 = sin($attitude/2); |
|
| 47 | - $c3 = cos($bank/2); |
|
| 48 | - $s3 = sin($bank/2); |
|
| 49 | - $c1c2 = $c1*$c2; |
|
| 50 | - $s1s2 = $s1*$s2; |
|
| 51 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
| 52 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
| 53 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
| 54 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
| 55 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
| 42 | + // Assuming the angles are in radians. |
|
| 43 | + $c1 = cos($heading/2); |
|
| 44 | + $s1 = sin($heading/2); |
|
| 45 | + $c2 = cos($attitude/2); |
|
| 46 | + $s2 = sin($attitude/2); |
|
| 47 | + $c3 = cos($bank/2); |
|
| 48 | + $s3 = sin($bank/2); |
|
| 49 | + $c1c2 = $c1*$c2; |
|
| 50 | + $s1s2 = $s1*$s2; |
|
| 51 | + $w =$c1c2*$c3 - $s1s2*$s3; |
|
| 52 | + $x =$c1c2*$s3 + $s1s2*$c3; |
|
| 53 | + $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
| 54 | + $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
| 55 | + return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
| 56 | 56 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
| 57 | 57 | |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | if (isset($_GET['download'])) { |
| 62 | - if ($_GET['download'] == "true") |
|
| 63 | - { |
|
| 62 | + if ($_GET['download'] == "true") |
|
| 63 | + { |
|
| 64 | 64 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
| 65 | - } |
|
| 65 | + } |
|
| 66 | 66 | } |
| 67 | 67 | header('Content-Type: text/javascript'); |
| 68 | 68 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
| 156 | 156 | $coord = explode(',',$_GET['coord']); |
| 157 | 157 | if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
| 158 | - && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
| 158 | + && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
| 159 | 159 | $coord = array(); |
| 160 | 160 | } |
| 161 | 161 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
| 166 | 166 | $coord = explode(',',$_GET['coord']); |
| 167 | 167 | if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
| 168 | - && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
| 168 | + && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
| 169 | 169 | $coord = array(); |
| 170 | 170 | } |
| 171 | 171 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
| 176 | 176 | $coord = explode(',',$_GET['coord']); |
| 177 | 177 | if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
| 178 | - && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
| 178 | + && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
| 179 | 179 | $coord = array(); |
| 180 | 180 | } |
| 181 | 181 | } |
@@ -265,10 +265,10 @@ discard block |
||
| 265 | 265 | $image = "images/placeholder_thumb.png"; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
| 269 | - elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
| 270 | - elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
| 271 | - if ($prev_flightaware_id != $id) { |
|
| 268 | + if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
| 269 | + elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
| 270 | + elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
| 271 | + if ($prev_flightaware_id != $id) { |
|
| 272 | 272 | if ($prev_flightaware_id != '') { |
| 273 | 273 | /* |
| 274 | 274 | if ($nblatlong == 1) { |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
| 349 | 349 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
| 350 | 350 | } else $aircraft_shadow = ''; |
| 351 | - $output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5'; |
|
| 351 | + $output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5'; |
|
| 352 | 352 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
| 353 | 353 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
| 354 | 354 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
| 380 | 380 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
| 381 | 381 | } |
| 382 | - $output .= '},'; |
|
| 382 | + $output .= '},'; |
|
| 383 | 383 | } elseif (isset($modelsdb[$aircraft_icao]) && $aircraft_icao != '') { |
| 384 | 384 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_icao].'","scale" : 1.0,"minimumPixelSize": 20'; |
| 385 | 385 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
| 388 | 388 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
| 389 | 389 | } |
| 390 | - $output .= '},'; |
|
| 390 | + $output .= '},'; |
|
| 391 | 391 | } elseif ($aircraft_icao != '') { |
| 392 | 392 | $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao); |
| 393 | 393 | if (isset($aircraft_info[0]['engine_type'])) { |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | $s3 = sin($bank/2); |
| 49 | 49 | $c1c2 = $c1*$c2; |
| 50 | 50 | $s1s2 = $s1*$s2; |
| 51 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
| 52 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
| 53 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
| 54 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
| 55 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
| 51 | + $w = $c1c2*$c3 - $s1s2*$s3; |
|
| 52 | + $x = $c1c2*$s3 + $s1s2*$c3; |
|
| 53 | + $y = $s1*$c2*$c3 + $c1*$s2*$s3; |
|
| 54 | + $z = $c1*$s2*$c3 - $s1*$c2*$s3; |
|
| 55 | + return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w); |
|
| 56 | 56 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
| 57 | 57 | |
| 58 | 58 | } |
@@ -73,17 +73,17 @@ discard block |
||
| 73 | 73 | $min = false; |
| 74 | 74 | $allhistory = false; |
| 75 | 75 | $filter['source'] = array(); |
| 76 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 77 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 78 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 79 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
| 80 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 81 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 82 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
| 83 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 84 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 85 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 86 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 76 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
| 77 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
| 78 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
| 79 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
| 80 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
| 81 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
| 82 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
| 83 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
| 84 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
| 85 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
| 86 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
| 87 | 87 | /* |
| 88 | 88 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
| 89 | 89 | $min = true; |
@@ -130,12 +130,12 @@ discard block |
||
| 130 | 130 | $from_archive = true; |
| 131 | 131 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
| 132 | 132 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
| 133 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
| 134 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
| 135 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
| 136 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
| 137 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
| 138 | - $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
|
| 133 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
| 134 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
| 135 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
| 136 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
| 137 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
| 138 | + $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter); |
|
| 139 | 139 | } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) { |
| 140 | 140 | $from_archive = true; |
| 141 | 141 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
@@ -145,46 +145,46 @@ discard block |
||
| 145 | 145 | $begindate = $_COOKIE['archive_begin']; |
| 146 | 146 | $enddate = $_COOKIE['archive_end']; |
| 147 | 147 | |
| 148 | - $archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT); |
|
| 149 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
| 150 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
| 148 | + $archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT); |
|
| 149 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
| 150 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
| 151 | 151 | // echo 'Begin : '.$begindate.' - End : '.$enddate."\n"; |
| 152 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
| 152 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
| 153 | 153 | } elseif ($tracker) { |
| 154 | 154 | $coord = array(); |
| 155 | 155 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
| 156 | - $coord = explode(',',$_GET['coord']); |
|
| 157 | - if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
| 156 | + $coord = explode(',', $_GET['coord']); |
|
| 157 | + if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
| 158 | 158 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
| 159 | 159 | $coord = array(); |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | - $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true); |
|
| 162 | + $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true); |
|
| 163 | 163 | } elseif ($marine) { |
| 164 | 164 | $coord = array(); |
| 165 | 165 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
| 166 | - $coord = explode(',',$_GET['coord']); |
|
| 167 | - if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
| 166 | + $coord = explode(',', $_GET['coord']); |
|
| 167 | + if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
| 168 | 168 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
| 169 | 169 | $coord = array(); |
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true); |
|
| 172 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true); |
|
| 173 | 173 | } else { |
| 174 | 174 | $coord = array(); |
| 175 | 175 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
| 176 | - $coord = explode(',',$_GET['coord']); |
|
| 177 | - if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
| 176 | + $coord = explode(',', $_GET['coord']); |
|
| 177 | + if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
| 178 | 178 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
| 179 | 179 | $coord = array(); |
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true); |
|
| 182 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true); |
|
| 183 | 183 | } |
| 184 | 184 | //print_r($spotter_array); |
| 185 | 185 | if (!empty($spotter_array) && isset($coord)) { |
| 186 | 186 | if (isset($_GET['archive'])) { |
| 187 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
| 187 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
| 188 | 188 | } elseif ($tracker) { |
| 189 | 189 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
| 190 | 190 | } elseif ($marine) { |
@@ -195,15 +195,15 @@ discard block |
||
| 195 | 195 | if ($flightcnt == '') $flightcnt = 0; |
| 196 | 196 | } else $flightcnt = 0; |
| 197 | 197 | |
| 198 | -$sqltime = round(microtime(true)-$begintime,2); |
|
| 198 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
| 199 | 199 | $minitime = time(); |
| 200 | 200 | $maxitime = 0; |
| 201 | -$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT); |
|
| 201 | +$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT); |
|
| 202 | 202 | $modelsdb = array(); |
| 203 | 203 | if (file_exists(dirname(__FILE__).'/models/modelsdb')) { |
| 204 | - if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) { |
|
| 205 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
| 206 | - if (isset($row[1]) ){ |
|
| 204 | + if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) { |
|
| 205 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
| 206 | + if (isset($row[1])) { |
|
| 207 | 207 | $model = $row[0]; |
| 208 | 208 | $modelsdb[$model] = $row[1]; |
| 209 | 209 | } |
@@ -213,9 +213,9 @@ discard block |
||
| 213 | 213 | } |
| 214 | 214 | $modelsdb2 = array(); |
| 215 | 215 | if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) { |
| 216 | - if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) { |
|
| 217 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
| 218 | - if (isset($row[1]) ){ |
|
| 216 | + if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb', 'r')) !== FALSE) { |
|
| 217 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
| 218 | + if (isset($row[1])) { |
|
| 219 | 219 | $model = $row[0]; |
| 220 | 220 | $modelsdb2[$model] = $row[1]; |
| 221 | 221 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | if (!empty($spotter_array) && is_array($spotter_array)) |
| 254 | 254 | { |
| 255 | 255 | $nblatlong = 0; |
| 256 | - foreach($spotter_array as $spotter_item) |
|
| 256 | + foreach ($spotter_array as $spotter_item) |
|
| 257 | 257 | { |
| 258 | 258 | $j++; |
| 259 | 259 | //if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND'; |
@@ -295,9 +295,9 @@ discard block |
||
| 295 | 295 | $output .= '"lastupdate": "'.$lastupdate.'",'; |
| 296 | 296 | $output .= '"format": "'.$spotter_item['format_source'].'",'; |
| 297 | 297 | if ($tracker) { |
| 298 | - $output.= '"type": "tracker"'; |
|
| 298 | + $output .= '"type": "tracker"'; |
|
| 299 | 299 | } elseif ($marine) { |
| 300 | - $output.= '"type": "marine"'; |
|
| 300 | + $output .= '"type": "marine"'; |
|
| 301 | 301 | } else { |
| 302 | 302 | if (isset($globalMap3DLiveries) && $globalMap3DLiveries) { |
| 303 | 303 | $aircraft_icao = $spotter_item['aircraft_icao']; |
@@ -311,14 +311,14 @@ discard block |
||
| 311 | 311 | if (isset($airline_icao)) { |
| 312 | 312 | $imagefile = $aircraft_icao.'-'.$airline_icao.'.png'; |
| 313 | 313 | if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) { |
| 314 | - $output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
| 314 | + $output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
| 315 | 315 | } |
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | - if ($ident != '') $output.= '"ident": "'.$ident.'",'; |
|
| 318 | + if ($ident != '') $output .= '"ident": "'.$ident.'",'; |
|
| 319 | 319 | } |
| 320 | - $output.= '"gltf2": %gltf2%,'; |
|
| 321 | - $output.= '"type": "flight"'; |
|
| 320 | + $output .= '"gltf2": %gltf2%,'; |
|
| 321 | + $output .= '"type": "flight"'; |
|
| 322 | 322 | } |
| 323 | 323 | $output .= '},'; |
| 324 | 324 | |
@@ -671,8 +671,8 @@ discard block |
||
| 671 | 671 | $output .= '},'; |
| 672 | 672 | } |
| 673 | 673 | } |
| 674 | - if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output); |
|
| 675 | - else $output = str_replace('%onground%','false',$output); |
|
| 674 | + if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output); |
|
| 675 | + else $output = str_replace('%onground%', 'false', $output); |
|
| 676 | 676 | |
| 677 | 677 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
| 678 | 678 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | $output .= '"cartographicDegrees": ['; |
| 688 | 688 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
| 689 | 689 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
| 690 | - $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
| 690 | + $output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
| 691 | 691 | $output .= $spotter_item['longitude'].', '; |
| 692 | 692 | $output .= $spotter_item['latitude']; |
| 693 | 693 | $prevlong = $spotter_item['longitude']; |
@@ -715,8 +715,8 @@ discard block |
||
| 715 | 715 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
| 716 | 716 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
| 717 | 717 | } else { |
| 718 | - $nblatlong = $nblatlong+1; |
|
| 719 | - $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
| 718 | + $nblatlong = $nblatlong + 1; |
|
| 719 | + $output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
| 720 | 720 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
| 721 | 721 | if ($spotter_item['ground_speed'] == 0) { |
| 722 | 722 | $output .= $prevlong.', '; |
@@ -756,17 +756,17 @@ discard block |
||
| 756 | 756 | } |
| 757 | 757 | $output .= ']'; |
| 758 | 758 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 759 | - if ((time()-$globalLiveInterval) > $minitime) { |
|
| 760 | - if (time()-$globalLiveInterval > $maxitime) { |
|
| 761 | - $output = str_replace('%minitime%',date("c",$maxitime),$output); |
|
| 759 | + if ((time() - $globalLiveInterval) > $minitime) { |
|
| 760 | + if (time() - $globalLiveInterval > $maxitime) { |
|
| 761 | + $output = str_replace('%minitime%', date("c", $maxitime), $output); |
|
| 762 | 762 | } else { |
| 763 | - $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
| 763 | + $output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output); |
|
| 764 | 764 | } |
| 765 | 765 | } |
| 766 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
| 767 | -} else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
| 768 | -$output = str_replace('%maxitime%',date("c",$maxitime),$output); |
|
| 769 | -if ($gltf2) $output = str_replace('%gltf2%','true',$output); |
|
| 770 | -else $output = str_replace('%gltf2%','false',$output); |
|
| 766 | + else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
| 767 | +} else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
| 768 | +$output = str_replace('%maxitime%', date("c", $maxitime), $output); |
|
| 769 | +if ($gltf2) $output = str_replace('%gltf2%', 'true', $output); |
|
| 770 | +else $output = str_replace('%gltf2%', 'false', $output); |
|
| 771 | 771 | print $output; |
| 772 | 772 | ?> |
@@ -5,23 +5,23 @@ discard block |
||
| 5 | 5 | $marine = false; |
| 6 | 6 | $usecoord = false; |
| 7 | 7 | if (isset($_GET['tracker'])) { |
| 8 | - $tracker = true; |
|
| 8 | + $tracker = true; |
|
| 9 | 9 | } |
| 10 | 10 | if (isset($_GET['marine'])) { |
| 11 | - $marine = true; |
|
| 11 | + $marine = true; |
|
| 12 | 12 | } |
| 13 | 13 | if ($tracker) { |
| 14 | - require_once('require/class.Tracker.php'); |
|
| 15 | - require_once('require/class.TrackerLive.php'); |
|
| 16 | - require_once('require/class.TrackerArchive.php'); |
|
| 14 | + require_once('require/class.Tracker.php'); |
|
| 15 | + require_once('require/class.TrackerLive.php'); |
|
| 16 | + require_once('require/class.TrackerArchive.php'); |
|
| 17 | 17 | } elseif ($marine) { |
| 18 | - require_once('require/class.Marine.php'); |
|
| 19 | - require_once('require/class.MarineLive.php'); |
|
| 20 | - require_once('require/class.MarineArchive.php'); |
|
| 18 | + require_once('require/class.Marine.php'); |
|
| 19 | + require_once('require/class.MarineLive.php'); |
|
| 20 | + require_once('require/class.MarineArchive.php'); |
|
| 21 | 21 | } else { |
| 22 | - require_once('require/class.Spotter.php'); |
|
| 23 | - require_once('require/class.SpotterLive.php'); |
|
| 24 | - require_once('require/class.SpotterArchive.php'); |
|
| 22 | + require_once('require/class.Spotter.php'); |
|
| 23 | + require_once('require/class.SpotterLive.php'); |
|
| 24 | + require_once('require/class.SpotterArchive.php'); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | $begintime = microtime(true); |
@@ -41,10 +41,10 @@ discard block |
||
| 41 | 41 | $Common = new Common(); |
| 42 | 42 | |
| 43 | 43 | if (isset($_GET['download'])) { |
| 44 | - if ($_GET['download'] == "true") |
|
| 45 | - { |
|
| 44 | + if ($_GET['download'] == "true") |
|
| 45 | + { |
|
| 46 | 46 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
| 47 | - } |
|
| 47 | + } |
|
| 48 | 48 | } |
| 49 | 49 | header('Content-Type: text/javascript'); |
| 50 | 50 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $usecoord = true; |
| 109 | 109 | $coord = explode(',',$_GET['coord']); |
| 110 | 110 | if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
| 111 | - && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) { |
|
| 111 | + && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) { |
|
| 112 | 112 | if ($tracker) { |
| 113 | 113 | $spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter); |
| 114 | 114 | } elseif ($marine) { |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $usecoord = true; |
| 122 | 122 | $coord = explode(',',$_GET['coord']); |
| 123 | 123 | if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
| 124 | - && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) { |
|
| 124 | + && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) { |
|
| 125 | 125 | if ($tracker) { |
| 126 | 126 | $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter); |
| 127 | 127 | } elseif ($marine) { |
@@ -538,17 +538,17 @@ discard block |
||
| 538 | 538 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
| 539 | 539 | |
| 540 | 540 | if ( |
| 541 | - (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
|
| 542 | - || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
|
| 541 | + (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
|
| 542 | + || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
|
| 543 | 543 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
| 544 | 544 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
| 545 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
| 546 | - || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
|
| 547 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
| 548 | - || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
|
| 549 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
| 550 | - || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
|
| 551 | - ) { |
|
| 545 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
| 546 | + || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
|
| 547 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
| 548 | + || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
|
| 549 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
| 550 | + || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
|
| 551 | + ) { |
|
| 552 | 552 | if ($tracker) { |
| 553 | 553 | if ($from_archive || $globalArchive) { |
| 554 | 554 | $spotter_history_array = $TrackerArchive->getAllArchiveTrackerDataById($spotter_item['famtrackid']); |
@@ -637,65 +637,65 @@ discard block |
||
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
| 640 | - || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
|
| 641 | - && (isset($spotter_item['departure_airport']) |
|
| 642 | - && $spotter_item['departure_airport'] != 'NA' |
|
| 643 | - && isset($spotter_item['arrival_airport']) |
|
| 644 | - && $spotter_item['arrival_airport'] != 'NA' |
|
| 645 | - && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
|
| 646 | - || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
|
| 647 | - if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 648 | - else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 649 | - if (isset($spotter_item['departure_airport_latitude'])) { |
|
| 640 | + || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
|
| 641 | + && (isset($spotter_item['departure_airport']) |
|
| 642 | + && $spotter_item['departure_airport'] != 'NA' |
|
| 643 | + && isset($spotter_item['arrival_airport']) |
|
| 644 | + && $spotter_item['arrival_airport'] != 'NA' |
|
| 645 | + && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
|
| 646 | + || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
|
| 647 | + if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 648 | + else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 649 | + if (isset($spotter_item['departure_airport_latitude'])) { |
|
| 650 | 650 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
| 651 | - } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
|
| 651 | + } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
|
| 652 | 652 | $dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']); |
| 653 | 653 | if (isset($dairport[0]['latitude'])) { |
| 654 | - $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],'; |
|
| 654 | + $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],'; |
|
| 655 | 655 | } |
| 656 | - } |
|
| 657 | - if (isset($spotter_item['arrival_airport_latitude'])) { |
|
| 656 | + } |
|
| 657 | + if (isset($spotter_item['arrival_airport_latitude'])) { |
|
| 658 | 658 | $output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].'],'; |
| 659 | - } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
| 659 | + } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
| 660 | 660 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
| 661 | 661 | if (isset($aairport[0]['latitude'])) { |
| 662 | - $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],'; |
|
| 662 | + $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],'; |
|
| 663 | 663 | } |
| 664 | - } |
|
| 665 | - $output_air = substr($output_air, 0, -1); |
|
| 666 | - $output_air .= ']}},'; |
|
| 667 | - $output .= $output_air; |
|
| 668 | - unset($output_air); |
|
| 664 | + } |
|
| 665 | + $output_air = substr($output_air, 0, -1); |
|
| 666 | + $output_air .= ']}},'; |
|
| 667 | + $output .= $output_air; |
|
| 668 | + unset($output_air); |
|
| 669 | 669 | } |
| 670 | 670 | |
| 671 | 671 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
| 672 | 672 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
| 673 | 673 | if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
| 674 | - || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
|
| 675 | - && (isset($spotter_item['arrival_airport']) |
|
| 676 | - && $spotter_item['arrival_airport'] != 'NA' |
|
| 677 | - && ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") |
|
| 678 | - || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) |
|
| 679 | - || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
|
| 680 | - $havedata = false; |
|
| 681 | - if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 682 | - else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 683 | - $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
|
| 674 | + || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
|
| 675 | + && (isset($spotter_item['arrival_airport']) |
|
| 676 | + && $spotter_item['arrival_airport'] != 'NA' |
|
| 677 | + && ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") |
|
| 678 | + || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) |
|
| 679 | + || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
|
| 680 | + $havedata = false; |
|
| 681 | + if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 682 | + else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 683 | + $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
|
| 684 | 684 | |
| 685 | - if (isset($spotter_item['arrival_airport_latitude'])) { |
|
| 685 | + if (isset($spotter_item['arrival_airport_latitude'])) { |
|
| 686 | 686 | $output_dest .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']'; |
| 687 | 687 | $havedata = true; |
| 688 | - } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
| 688 | + } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
| 689 | 689 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
| 690 | 690 | if (isset($aairport[0]['latitude'])) { |
| 691 | - $output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']'; |
|
| 692 | - $havedata = true; |
|
| 691 | + $output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']'; |
|
| 692 | + $havedata = true; |
|
| 693 | 693 | } |
| 694 | - } |
|
| 695 | - //$output_dest = substr($output_dest, 0, -1); |
|
| 696 | - $output_dest .= ']}},'; |
|
| 697 | - if ($havedata) $output .= $output_dest; |
|
| 698 | - unset($output_dest); |
|
| 694 | + } |
|
| 695 | + //$output_dest = substr($output_dest, 0, -1); |
|
| 696 | + $output_dest .= ']}},'; |
|
| 697 | + if ($havedata) $output .= $output_dest; |
|
| 698 | + unset($output_dest); |
|
| 699 | 699 | } |
| 700 | 700 | } |
| 701 | 701 | $output = substr($output, 0, -1); |
@@ -55,17 +55,17 @@ discard block |
||
| 55 | 55 | $min = true; |
| 56 | 56 | $allhistory = false; |
| 57 | 57 | $filter['source'] = array(); |
| 58 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 59 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 60 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 61 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
| 62 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 63 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 64 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
| 65 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 66 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 67 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 68 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 58 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
| 59 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
| 60 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
| 61 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
| 62 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
| 63 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
| 64 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
| 65 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
| 66 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
| 67 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
| 68 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
| 69 | 69 | |
| 70 | 70 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
| 71 | 71 | $min = true; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $spotter_array = array(); |
| 75 | 75 | |
| 76 | 76 | if (isset($_GET['ident'])) { |
| 77 | - $ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
|
| 77 | + $ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING)); |
|
| 78 | 78 | if ($tracker) { |
| 79 | 79 | $spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident); |
| 80 | 80 | } elseif ($marine) { |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | $allhistory = true; |
| 90 | 90 | } elseif (isset($_GET['flightaware_id'])) { |
| 91 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
| 91 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
| 92 | 92 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
| 93 | 93 | if (empty($spotter_array)) { |
| 94 | 94 | $from_archive = true; |
@@ -96,50 +96,50 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | $allhistory = true; |
| 98 | 98 | } elseif (isset($_GET['famtrack_id'])) { |
| 99 | - $famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING)); |
|
| 99 | + $famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING)); |
|
| 100 | 100 | $spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id); |
| 101 | 101 | $allhistory = true; |
| 102 | 102 | } elseif (isset($_GET['fammarine_id'])) { |
| 103 | - $fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING)); |
|
| 103 | + $fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING)); |
|
| 104 | 104 | $spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id); |
| 105 | 105 | $allhistory = true; |
| 106 | 106 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) { |
| 107 | 107 | //} elseif (isset($_GET['coord'])) { |
| 108 | 108 | $usecoord = true; |
| 109 | - $coord = explode(',',$_GET['coord']); |
|
| 110 | - if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
| 109 | + $coord = explode(',', $_GET['coord']); |
|
| 110 | + if (filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
| 111 | 111 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) { |
| 112 | 112 | if ($tracker) { |
| 113 | - $spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter); |
|
| 113 | + $spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord, $filter); |
|
| 114 | 114 | } elseif ($marine) { |
| 115 | - $spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord,$filter); |
|
| 115 | + $spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord, $filter); |
|
| 116 | 116 | } else { |
| 117 | - $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter); |
|
| 117 | + $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter); |
|
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) { |
| 121 | 121 | $usecoord = true; |
| 122 | - $coord = explode(',',$_GET['coord']); |
|
| 123 | - if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
| 122 | + $coord = explode(',', $_GET['coord']); |
|
| 123 | + if (filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
| 124 | 124 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) { |
| 125 | 125 | if ($tracker) { |
| 126 | - $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter); |
|
| 126 | + $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter); |
|
| 127 | 127 | } elseif ($marine) { |
| 128 | - $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter); |
|
| 128 | + $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter); |
|
| 129 | 129 | } else { |
| 130 | - $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter); |
|
| 130 | + $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed']) && !isset($_GET['tracker']) && !isset($_GET['marine'])) { |
| 134 | 134 | $from_archive = true; |
| 135 | 135 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
| 136 | 136 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
| 137 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
| 138 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
| 139 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
| 140 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
| 141 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
| 142 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
| 137 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
| 138 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
| 139 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
| 140 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
| 141 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
| 142 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
| 143 | 143 | } elseif ($min) { |
| 144 | 144 | if ($tracker) { |
| 145 | 145 | $spotter_array = $TrackerLive->getMinLiveTrackerData($filter); |
@@ -151,17 +151,17 @@ discard block |
||
| 151 | 151 | # $min = true; |
| 152 | 152 | } else { |
| 153 | 153 | if ($tracker) { |
| 154 | - $spotter_array = $TrackerLive->getLiveTrackerData('','',$filter); |
|
| 154 | + $spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter); |
|
| 155 | 155 | } elseif ($marine) { |
| 156 | - $spotter_array = $marineLive->getLiveMarineData('','',$filter); |
|
| 156 | + $spotter_array = $marineLive->getLiveMarineData('', '', $filter); |
|
| 157 | 157 | } else { |
| 158 | - $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
|
| 158 | + $spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter); |
|
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | if ($usecoord) { |
| 163 | 163 | if (isset($_GET['archive'])) { |
| 164 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
| 164 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
| 165 | 165 | } else { |
| 166 | 166 | if ($tracker) { |
| 167 | 167 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
@@ -174,9 +174,9 @@ discard block |
||
| 174 | 174 | if ($flightcnt == '') $flightcnt = 0; |
| 175 | 175 | } else $flightcnt = 0; |
| 176 | 176 | |
| 177 | -$sqltime = round(microtime(true)-$begintime,2); |
|
| 177 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
| 178 | 178 | |
| 179 | -$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
| 179 | +$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
| 180 | 180 | if ($currenttime != '') $currenttime = round($currenttime/1000); |
| 181 | 181 | |
| 182 | 182 | if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | if (!empty($spotter_array) && is_array($spotter_array)) |
| 196 | 196 | { |
| 197 | 197 | $output .= '"features": ['; |
| 198 | - foreach($spotter_array as $spotter_item) |
|
| 198 | + foreach ($spotter_array as $spotter_item) |
|
| 199 | 199 | { |
| 200 | 200 | $j++; |
| 201 | 201 | date_default_timezone_set('UTC'); |
@@ -251,8 +251,8 @@ discard block |
||
| 251 | 251 | */ |
| 252 | 252 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
| 253 | 253 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
| 254 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 255 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 254 | + if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
| 255 | + else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
| 256 | 256 | //" |
| 257 | 257 | } else { |
| 258 | 258 | if ($compress) $output .= '"c": "NA",'; |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
| 262 | 262 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
| 263 | 263 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
| 264 | - $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
|
| 264 | + $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",'; |
|
| 265 | 265 | } elseif (isset($spotter_item['aircraft_type'])) { |
| 266 | 266 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
| 267 | 267 | } elseif (!$min) { |
@@ -404,26 +404,26 @@ discard block |
||
| 404 | 404 | if ($currenttime != '') { |
| 405 | 405 | if (strtotime($spotter_item['date']) < $currenttime) { |
| 406 | 406 | if (isset($archivespeed)) { |
| 407 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
| 407 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
| 408 | 408 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 409 | 409 | } elseif ($usenextlatlon) { |
| 410 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
| 410 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
| 411 | 411 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 412 | 412 | } |
| 413 | 413 | } |
| 414 | 414 | } else { |
| 415 | 415 | if (isset($archivespeed)) { |
| 416 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
|
| 416 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed); |
|
| 417 | 417 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 418 | 418 | } elseif ($usenextlatlon) { |
| 419 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']); |
|
| 419 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']); |
|
| 420 | 420 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 421 | 421 | } |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | if (!$min) $output .= '"image": "'.$image.'",'; |
| 425 | 425 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
| 426 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
| 426 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
| 427 | 427 | } |
| 428 | 428 | if (isset($spotter_item['image_source_website'])) { |
| 429 | 429 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
| 446 | 446 | } |
| 447 | 447 | if (isset($spotter_item['acars'])) { |
| 448 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
| 448 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
| 449 | 449 | } |
| 450 | 450 | // type when not aircraft ? |
| 451 | 451 | if (isset($spotter_item['type'])) { |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | if ($currenttime != '') { |
| 466 | 466 | if (strtotime($spotter_item['date']) < $currenttime) { |
| 467 | 467 | if (!isset($archivespeed)) $archivespeed = 1; |
| 468 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,$currenttime-strtotime($spotter_item['date'])); |
|
| 468 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed, $currenttime - strtotime($spotter_item['date'])); |
|
| 469 | 469 | $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
| 470 | 470 | } else { |
| 471 | 471 | $output .= $spotter_item['longitude'].', '; |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | |
| 535 | 535 | } |
| 536 | 536 | */ |
| 537 | - $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
|
| 537 | + $history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING); |
|
| 538 | 538 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
| 539 | 539 | |
| 540 | 540 | if ( |
@@ -542,11 +542,11 @@ discard block |
||
| 542 | 542 | || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
| 543 | 543 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
| 544 | 544 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
| 545 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
| 545 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
| 546 | 546 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
| 547 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
| 547 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id'])) |
|
| 548 | 548 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
| 549 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
| 549 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid'])) |
|
| 550 | 550 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
| 551 | 551 | ) { |
| 552 | 552 | if ($tracker) { |
@@ -583,9 +583,9 @@ discard block |
||
| 583 | 583 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
| 584 | 584 | } |
| 585 | 585 | $output_history .= '['; |
| 586 | - $output_history .= $spotter_history['longitude'].', '; |
|
| 587 | - $output_history .= $spotter_history['latitude'].', '; |
|
| 588 | - $output_history .= $spotter_history['altitude']*30.48; |
|
| 586 | + $output_history .= $spotter_history['longitude'].', '; |
|
| 587 | + $output_history .= $spotter_history['latitude'].', '; |
|
| 588 | + $output_history .= $spotter_history['altitude']*30.48; |
|
| 589 | 589 | $output_history .= '],'; |
| 590 | 590 | /* |
| 591 | 591 | if ($from_archive === false) { |
@@ -603,8 +603,8 @@ discard block |
||
| 603 | 603 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
| 604 | 604 | } else $d = true; |
| 605 | 605 | $output_history .= '['; |
| 606 | - $output_history .= $spotter_history['longitude'].', '; |
|
| 607 | - $output_history .= $spotter_history['latitude']; |
|
| 606 | + $output_history .= $spotter_history['longitude'].', '; |
|
| 607 | + $output_history .= $spotter_history['latitude']; |
|
| 608 | 608 | $output_history .= '],'; |
| 609 | 609 | /* |
| 610 | 610 | if ($from_archive === false) { |
@@ -620,9 +620,9 @@ discard block |
||
| 620 | 620 | |
| 621 | 621 | if ($from_archive === false) { |
| 622 | 622 | $output_historyd = '['; |
| 623 | - $output_historyd .= $spotter_item['longitude'].', '; |
|
| 624 | - $output_historyd .= $spotter_item['latitude']; |
|
| 625 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
| 623 | + $output_historyd .= $spotter_item['longitude'].', '; |
|
| 624 | + $output_historyd .= $spotter_item['latitude']; |
|
| 625 | + if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
| 626 | 626 | $output_historyd .= '],'; |
| 627 | 627 | //$output_history = $output_historyd.$output_history; |
| 628 | 628 | $output_history = $output_history.$output_historyd; |
@@ -636,7 +636,7 @@ discard block |
||
| 636 | 636 | } |
| 637 | 637 | } |
| 638 | 638 | |
| 639 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
| 639 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
| 640 | 640 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
| 641 | 641 | && (isset($spotter_item['departure_airport']) |
| 642 | 642 | && $spotter_item['departure_airport'] != 'NA' |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | |
| 671 | 671 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
| 672 | 672 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
| 673 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
| 673 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
| 674 | 674 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
| 675 | 675 | && (isset($spotter_item['arrival_airport']) |
| 676 | 676 | && $spotter_item['arrival_airport'] != 'NA' |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | $output = substr($output, 0, -1); |
| 702 | 702 | $output .= ']'; |
| 703 | 703 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
| 704 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
| 704 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
| 705 | 705 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
| 706 | 706 | $output .= '"fc": "'.$j.'"'; |
| 707 | 707 | } else { |
@@ -48,28 +48,55 @@ discard block |
||
| 48 | 48 | } |
| 49 | 49 | header('Content-Type: text/javascript'); |
| 50 | 50 | |
| 51 | -if (!isset($globalJsonCompress)) $compress = true; |
|
| 52 | -else $compress = $globalJsonCompress; |
|
| 51 | +if (!isset($globalJsonCompress)) { |
|
| 52 | + $compress = true; |
|
| 53 | +} else { |
|
| 54 | + $compress = $globalJsonCompress; |
|
| 55 | +} |
|
| 53 | 56 | |
| 54 | 57 | $from_archive = false; |
| 55 | 58 | $min = true; |
| 56 | 59 | $allhistory = false; |
| 57 | 60 | $filter['source'] = array(); |
| 58 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 59 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 60 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 61 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
| 62 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 63 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 64 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
| 65 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 66 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 67 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 68 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 61 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
| 62 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 63 | +} |
|
| 64 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
| 65 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 66 | +} |
|
| 67 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
| 68 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 69 | +} |
|
| 70 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
| 71 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
| 72 | +} |
|
| 73 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
| 74 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 75 | +} |
|
| 76 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
| 77 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 78 | +} |
|
| 79 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
| 80 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
| 81 | +} |
|
| 82 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
| 83 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 84 | +} |
|
| 85 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
| 86 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 87 | +} |
|
| 88 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
| 89 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 90 | +} |
|
| 91 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
| 92 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 93 | +} |
|
| 69 | 94 | |
| 70 | 95 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
| 71 | 96 | $min = true; |
| 72 | -} else $min = false; |
|
| 97 | +} else { |
|
| 98 | + $min = false; |
|
| 99 | +} |
|
| 73 | 100 | |
| 74 | 101 | $spotter_array = array(); |
| 75 | 102 | |
@@ -171,24 +198,38 @@ discard block |
||
| 171 | 198 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
| 172 | 199 | } |
| 173 | 200 | } |
| 174 | - if ($flightcnt == '') $flightcnt = 0; |
|
| 175 | -} else $flightcnt = 0; |
|
| 201 | + if ($flightcnt == '') { |
|
| 202 | + $flightcnt = 0; |
|
| 203 | + } |
|
| 204 | + } else { |
|
| 205 | + $flightcnt = 0; |
|
| 206 | +} |
|
| 176 | 207 | |
| 177 | 208 | $sqltime = round(microtime(true)-$begintime,2); |
| 178 | 209 | |
| 179 | 210 | $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
| 180 | -if ($currenttime != '') $currenttime = round($currenttime/1000); |
|
| 211 | +if ($currenttime != '') { |
|
| 212 | + $currenttime = round($currenttime/1000); |
|
| 213 | +} |
|
| 181 | 214 | |
| 182 | -if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
|
| 183 | -else $usenextlatlon = true; |
|
| 184 | -if ($usenextlatlon === false) $currenttime = ''; |
|
| 215 | +if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) { |
|
| 216 | + $usenextlatlon = false; |
|
| 217 | +} else { |
|
| 218 | + $usenextlatlon = true; |
|
| 219 | +} |
|
| 220 | +if ($usenextlatlon === false) { |
|
| 221 | + $currenttime = ''; |
|
| 222 | +} |
|
| 185 | 223 | $j = 0; |
| 186 | 224 | $prev_flightaware_id = ''; |
| 187 | 225 | $aircrafts_shadow = array(); |
| 188 | 226 | $output = '{'; |
| 189 | 227 | $output .= '"type": "FeatureCollection",'; |
| 190 | - if ($min) $output .= '"minimal": "true",'; |
|
| 191 | - else $output .= '"minimal": "false",'; |
|
| 228 | + if ($min) { |
|
| 229 | + $output .= '"minimal": "true",'; |
|
| 230 | + } else { |
|
| 231 | + $output .= '"minimal": "false",'; |
|
| 232 | + } |
|
| 192 | 233 | //$output .= '"fc": "'.$flightcnt.'",'; |
| 193 | 234 | $output .= '"sqt": "'.$sqltime.'",'; |
| 194 | 235 | |
@@ -232,18 +273,29 @@ discard block |
||
| 232 | 273 | } |
| 233 | 274 | $output .= '"properties": {'; |
| 234 | 275 | if (isset($spotter_item['flightaware_id'])) { |
| 235 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
| 236 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
| 276 | + if ($compress) { |
|
| 277 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
| 278 | + } else { |
|
| 279 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
| 280 | + } |
|
| 237 | 281 | } elseif (isset($spotter_item['famtrackid'])) { |
| 238 | - if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
| 239 | - else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
| 282 | + if ($compress) { |
|
| 283 | + $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
| 284 | + } else { |
|
| 285 | + $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
| 286 | + } |
|
| 240 | 287 | } elseif (isset($spotter_item['fammarine_id'])) { |
| 241 | - if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
| 242 | - else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
| 288 | + if ($compress) { |
|
| 289 | + $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
| 290 | + } else { |
|
| 291 | + $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
| 292 | + } |
|
| 243 | 293 | } |
| 244 | 294 | $output .= '"fc": "'.$flightcnt.'",'; |
| 245 | 295 | $output .= '"sqt": "'.$sqltime.'",'; |
| 246 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 296 | + if (isset($begindate)) { |
|
| 297 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 298 | + } |
|
| 247 | 299 | |
| 248 | 300 | /* |
| 249 | 301 | if ($min) $output .= '"minimal": "true",'; |
@@ -251,14 +303,22 @@ discard block |
||
| 251 | 303 | */ |
| 252 | 304 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
| 253 | 305 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
| 254 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 255 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 306 | + if ($compress) { |
|
| 307 | + $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 308 | + } else { |
|
| 309 | + $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 310 | + } |
|
| 256 | 311 | //" |
| 257 | 312 | } else { |
| 258 | - if ($compress) $output .= '"c": "NA",'; |
|
| 259 | - else $output .= '"callsign": "NA",'; |
|
| 313 | + if ($compress) { |
|
| 314 | + $output .= '"c": "NA",'; |
|
| 315 | + } else { |
|
| 316 | + $output .= '"callsign": "NA",'; |
|
| 317 | + } |
|
| 318 | + } |
|
| 319 | + if (isset($spotter_item['registration'])) { |
|
| 320 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
| 260 | 321 | } |
| 261 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
| 262 | 322 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
| 263 | 323 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
| 264 | 324 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
@@ -271,16 +331,23 @@ discard block |
||
| 271 | 331 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
| 272 | 332 | } |
| 273 | 333 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker) { |
| 274 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
| 275 | - else { |
|
| 334 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
| 335 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 336 | + } else { |
|
| 276 | 337 | $aircraft_icao = $spotter_item['aircraft_icao']; |
| 277 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
| 278 | - else { |
|
| 338 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
| 339 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
| 340 | + } else { |
|
| 279 | 341 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
| 280 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 281 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
| 282 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
| 283 | - else $spotter_item['aircraft_shadow'] = ''; |
|
| 342 | + if (count($aircraft_info) > 0) { |
|
| 343 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 344 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
| 345 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
| 346 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
| 347 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
| 348 | + } else { |
|
| 349 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 350 | + } |
|
| 284 | 351 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
| 285 | 352 | } |
| 286 | 353 | } |
@@ -288,73 +355,139 @@ discard block |
||
| 288 | 355 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
| 289 | 356 | if ($tracker) { |
| 290 | 357 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
| 291 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
| 292 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
| 358 | + if ($compress) { |
|
| 359 | + $output .= '"as": "ambulance.png",'; |
|
| 360 | + } else { |
|
| 361 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
| 362 | + } |
|
| 293 | 363 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
| 294 | - if ($compress) $output .= '"as": "police.png",'; |
|
| 295 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
| 364 | + if ($compress) { |
|
| 365 | + $output .= '"as": "police.png",'; |
|
| 366 | + } else { |
|
| 367 | + $output .= '"aircraft_shadow": "police.png",'; |
|
| 368 | + } |
|
| 296 | 369 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
| 297 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 298 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 370 | + if ($compress) { |
|
| 371 | + $output .= '"as": "ship.png",'; |
|
| 372 | + } else { |
|
| 373 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 374 | + } |
|
| 299 | 375 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
| 300 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 301 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 376 | + if ($compress) { |
|
| 377 | + $output .= '"as": "ship.png",'; |
|
| 378 | + } else { |
|
| 379 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 380 | + } |
|
| 302 | 381 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
| 303 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 304 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 382 | + if ($compress) { |
|
| 383 | + $output .= '"as": "ship.png",'; |
|
| 384 | + } else { |
|
| 385 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 386 | + } |
|
| 305 | 387 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
| 306 | - if ($compress) $output .= '"as": "truck.png",'; |
|
| 307 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
| 388 | + if ($compress) { |
|
| 389 | + $output .= '"as": "truck.png",'; |
|
| 390 | + } else { |
|
| 391 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
| 392 | + } |
|
| 308 | 393 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
| 309 | - if ($compress) $output .= '"as": "truck.png",'; |
|
| 310 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
| 394 | + if ($compress) { |
|
| 395 | + $output .= '"as": "truck.png",'; |
|
| 396 | + } else { |
|
| 397 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
| 398 | + } |
|
| 311 | 399 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
| 312 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
| 313 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 400 | + if ($compress) { |
|
| 401 | + $output .= '"as": "aircraft.png",'; |
|
| 402 | + } else { |
|
| 403 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 404 | + } |
|
| 314 | 405 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
| 315 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
| 316 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 406 | + if ($compress) { |
|
| 407 | + $output .= '"as": "aircraft.png",'; |
|
| 408 | + } else { |
|
| 409 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 410 | + } |
|
| 317 | 411 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
| 318 | - if ($compress) $output .= '"as": "helico.png",'; |
|
| 319 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
| 412 | + if ($compress) { |
|
| 413 | + $output .= '"as": "helico.png",'; |
|
| 414 | + } else { |
|
| 415 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
| 416 | + } |
|
| 320 | 417 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
| 321 | - if ($compress) $output .= '"as": "rail.png",'; |
|
| 322 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
| 418 | + if ($compress) { |
|
| 419 | + $output .= '"as": "rail.png",'; |
|
| 420 | + } else { |
|
| 421 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
| 422 | + } |
|
| 323 | 423 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
| 324 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
| 325 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
| 424 | + if ($compress) { |
|
| 425 | + $output .= '"as": "firetruck.png",'; |
|
| 426 | + } else { |
|
| 427 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
| 428 | + } |
|
| 326 | 429 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
| 327 | - if ($compress) $output .= '"as": "bus.png",'; |
|
| 328 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
| 430 | + if ($compress) { |
|
| 431 | + $output .= '"as": "bus.png",'; |
|
| 432 | + } else { |
|
| 433 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
| 434 | + } |
|
| 329 | 435 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
| 330 | - if ($compress) $output .= '"as": "phone.png",'; |
|
| 331 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
| 436 | + if ($compress) { |
|
| 437 | + $output .= '"as": "phone.png",'; |
|
| 438 | + } else { |
|
| 439 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
| 440 | + } |
|
| 332 | 441 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
| 333 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
| 334 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
| 442 | + if ($compress) { |
|
| 443 | + $output .= '"as": "jogger.png",'; |
|
| 444 | + } else { |
|
| 445 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
| 446 | + } |
|
| 335 | 447 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
| 336 | - if ($compress) $output .= '"as": "bike.png",'; |
|
| 337 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
| 448 | + if ($compress) { |
|
| 449 | + $output .= '"as": "bike.png",'; |
|
| 450 | + } else { |
|
| 451 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
| 452 | + } |
|
| 338 | 453 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
| 339 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
| 340 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
| 454 | + if ($compress) { |
|
| 455 | + $output .= '"as": "motorcycle.png",'; |
|
| 456 | + } else { |
|
| 457 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
| 458 | + } |
|
| 341 | 459 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
| 342 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
| 343 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
| 460 | + if ($compress) { |
|
| 461 | + $output .= '"as": "balloon.png",'; |
|
| 462 | + } else { |
|
| 463 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
| 464 | + } |
|
| 344 | 465 | } else { |
| 345 | - if ($compress) $output .= '"as": "car.png",'; |
|
| 346 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
| 466 | + if ($compress) { |
|
| 467 | + $output .= '"as": "car.png",'; |
|
| 468 | + } else { |
|
| 469 | + $output .= '"aircraft_shadow": "car.png",'; |
|
| 470 | + } |
|
| 347 | 471 | } |
| 348 | 472 | } elseif ($marine) { |
| 349 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 350 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 473 | + if ($compress) { |
|
| 474 | + $output .= '"as": "ship.png",'; |
|
| 475 | + } else { |
|
| 476 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 477 | + } |
|
| 351 | 478 | } else { |
| 352 | - if ($compress) $output .= '"as": "default.png",'; |
|
| 353 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
| 479 | + if ($compress) { |
|
| 480 | + $output .= '"as": "default.png",'; |
|
| 481 | + } else { |
|
| 482 | + $output .= '"aircraft_shadow": "default.png",'; |
|
| 483 | + } |
|
| 354 | 484 | } |
| 355 | 485 | } else { |
| 356 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 357 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 486 | + if ($compress) { |
|
| 487 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 488 | + } else { |
|
| 489 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 490 | + } |
|
| 358 | 491 | } |
| 359 | 492 | if (isset($spotter_item['airline_name'])) { |
| 360 | 493 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -362,8 +495,11 @@ discard block |
||
| 362 | 495 | $output .= '"airline_name": "NA",'; |
| 363 | 496 | } |
| 364 | 497 | if (isset($spotter_item['departure_airport'])) { |
| 365 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
| 366 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
| 498 | + if ($compress) { |
|
| 499 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
| 500 | + } else { |
|
| 501 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
| 502 | + } |
|
| 367 | 503 | } |
| 368 | 504 | if (isset($spotter_item['departure_airport_city'])) { |
| 369 | 505 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -375,8 +511,11 @@ discard block |
||
| 375 | 511 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
| 376 | 512 | } |
| 377 | 513 | if (isset($spotter_item['arrival_airport'])) { |
| 378 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
| 379 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
| 514 | + if ($compress) { |
|
| 515 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
| 516 | + } else { |
|
| 517 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
| 518 | + } |
|
| 380 | 519 | } |
| 381 | 520 | if (isset($spotter_item['arrival_airport_city'])) { |
| 382 | 521 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -395,11 +534,17 @@ discard block |
||
| 395 | 534 | } |
| 396 | 535 | |
| 397 | 536 | if (isset($spotter_item['altitude'])) { |
| 398 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
| 399 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
| 537 | + if ($compress) { |
|
| 538 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
| 539 | + } else { |
|
| 540 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
| 541 | + } |
|
| 542 | + } |
|
| 543 | + if ($compress) { |
|
| 544 | + $output .= '"h": "'.$spotter_item['heading'].'",'; |
|
| 545 | + } else { |
|
| 546 | + $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
| 400 | 547 | } |
| 401 | - if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",'; |
|
| 402 | - else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
| 403 | 548 | |
| 404 | 549 | if ($currenttime != '') { |
| 405 | 550 | if (strtotime($spotter_item['date']) < $currenttime) { |
@@ -421,7 +566,9 @@ discard block |
||
| 421 | 566 | } |
| 422 | 567 | } |
| 423 | 568 | |
| 424 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
| 569 | + if (!$min) { |
|
| 570 | + $output .= '"image": "'.$image.'",'; |
|
| 571 | + } |
|
| 425 | 572 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
| 426 | 573 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
| 427 | 574 | } |
@@ -429,8 +576,11 @@ discard block |
||
| 429 | 576 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
| 430 | 577 | } |
| 431 | 578 | if (isset($spotter_item['squawk'])) { |
| 432 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
| 433 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
| 579 | + if ($compress) { |
|
| 580 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
| 581 | + } else { |
|
| 582 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
| 583 | + } |
|
| 434 | 584 | } |
| 435 | 585 | if (isset($spotter_item['squawk_usage'])) { |
| 436 | 586 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -449,14 +599,23 @@ discard block |
||
| 449 | 599 | } |
| 450 | 600 | // type when not aircraft ? |
| 451 | 601 | if (isset($spotter_item['type'])) { |
| 452 | - if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
|
| 453 | - else $output .= '"type": "'.$spotter_item['type'].'"'; |
|
| 602 | + if ($compress) { |
|
| 603 | + $output .= '"t": "'.$spotter_item['type'].'"'; |
|
| 604 | + } else { |
|
| 605 | + $output .= '"type": "'.$spotter_item['type'].'"'; |
|
| 606 | + } |
|
| 454 | 607 | } elseif ($marine) { |
| 455 | - if ($compress) $output .= '"t": "ship"'; |
|
| 456 | - else $output .= '"type": "ship"'; |
|
| 608 | + if ($compress) { |
|
| 609 | + $output .= '"t": "ship"'; |
|
| 610 | + } else { |
|
| 611 | + $output .= '"type": "ship"'; |
|
| 612 | + } |
|
| 457 | 613 | } else { |
| 458 | - if ($compress) $output .= '"t": "aircraft"'; |
|
| 459 | - else $output .= '"type": "aircraft"'; |
|
| 614 | + if ($compress) { |
|
| 615 | + $output .= '"t": "aircraft"'; |
|
| 616 | + } else { |
|
| 617 | + $output .= '"type": "aircraft"'; |
|
| 618 | + } |
|
| 460 | 619 | } |
| 461 | 620 | $output .= '},'; |
| 462 | 621 | $output .= '"geometry": {'; |
@@ -464,7 +623,9 @@ discard block |
||
| 464 | 623 | $output .= '"coordinates": ['; |
| 465 | 624 | if ($currenttime != '') { |
| 466 | 625 | if (strtotime($spotter_item['date']) < $currenttime) { |
| 467 | - if (!isset($archivespeed)) $archivespeed = 1; |
|
| 626 | + if (!isset($archivespeed)) { |
|
| 627 | + $archivespeed = 1; |
|
| 628 | + } |
|
| 468 | 629 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,$currenttime-strtotime($spotter_item['date'])); |
| 469 | 630 | $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
| 470 | 631 | } else { |
@@ -535,7 +696,9 @@ discard block |
||
| 535 | 696 | } |
| 536 | 697 | */ |
| 537 | 698 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
| 538 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
| 699 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
| 700 | + $history = $_COOKIE['history']; |
|
| 701 | + } |
|
| 539 | 702 | |
| 540 | 703 | if ( |
| 541 | 704 | (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -579,8 +742,11 @@ discard block |
||
| 579 | 742 | $output_history .= ']}},'; |
| 580 | 743 | $output .= $output_history; |
| 581 | 744 | } |
| 582 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 583 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 745 | + if ($compress) { |
|
| 746 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 747 | + } else { |
|
| 748 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 749 | + } |
|
| 584 | 750 | } |
| 585 | 751 | $output_history .= '['; |
| 586 | 752 | $output_history .= $spotter_history['longitude'].', '; |
@@ -599,9 +765,14 @@ discard block |
||
| 599 | 765 | $prev_alt = $alt; |
| 600 | 766 | } else { |
| 601 | 767 | if ($d == false) { |
| 602 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 603 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 604 | - } else $d = true; |
|
| 768 | + if ($compress) { |
|
| 769 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 770 | + } else { |
|
| 771 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 772 | + } |
|
| 773 | + } else { |
|
| 774 | + $d = true; |
|
| 775 | + } |
|
| 605 | 776 | $output_history .= '['; |
| 606 | 777 | $output_history .= $spotter_history['longitude'].', '; |
| 607 | 778 | $output_history .= $spotter_history['latitude']; |
@@ -622,7 +793,9 @@ discard block |
||
| 622 | 793 | $output_historyd = '['; |
| 623 | 794 | $output_historyd .= $spotter_item['longitude'].', '; |
| 624 | 795 | $output_historyd .= $spotter_item['latitude']; |
| 625 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
| 796 | + if (isset($spotter_history['altitude'])) { |
|
| 797 | + $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
| 798 | + } |
|
| 626 | 799 | $output_historyd .= '],'; |
| 627 | 800 | //$output_history = $output_historyd.$output_history; |
| 628 | 801 | $output_history = $output_history.$output_historyd; |
@@ -644,8 +817,11 @@ discard block |
||
| 644 | 817 | && $spotter_item['arrival_airport'] != 'NA' |
| 645 | 818 | && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
| 646 | 819 | || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
| 647 | - if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 648 | - else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 820 | + if ($compress) { |
|
| 821 | + $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 822 | + } else { |
|
| 823 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 824 | + } |
|
| 649 | 825 | if (isset($spotter_item['departure_airport_latitude'])) { |
| 650 | 826 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
| 651 | 827 | } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
@@ -678,8 +854,11 @@ discard block |
||
| 678 | 854 | || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) |
| 679 | 855 | || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
| 680 | 856 | $havedata = false; |
| 681 | - if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 682 | - else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 857 | + if ($compress) { |
|
| 858 | + $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 859 | + } else { |
|
| 860 | + $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 861 | + } |
|
| 683 | 862 | $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
| 684 | 863 | |
| 685 | 864 | if (isset($spotter_item['arrival_airport_latitude'])) { |
@@ -694,7 +873,9 @@ discard block |
||
| 694 | 873 | } |
| 695 | 874 | //$output_dest = substr($output_dest, 0, -1); |
| 696 | 875 | $output_dest .= ']}},'; |
| 697 | - if ($havedata) $output .= $output_dest; |
|
| 876 | + if ($havedata) { |
|
| 877 | + $output .= $output_dest; |
|
| 878 | + } |
|
| 698 | 879 | unset($output_dest); |
| 699 | 880 | } |
| 700 | 881 | } |
@@ -702,7 +883,9 @@ discard block |
||
| 702 | 883 | $output .= ']'; |
| 703 | 884 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
| 704 | 885 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
| 705 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 886 | + if (isset($begindate)) { |
|
| 887 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 888 | + } |
|
| 706 | 889 | $output .= '"fc": "'.$j.'"'; |
| 707 | 890 | } else { |
| 708 | 891 | $output .= '"features": '; |
@@ -9,25 +9,25 @@ discard block |
||
| 9 | 9 | require_once(dirname(__FILE__).'/class.Stats.php'); |
| 10 | 10 | require_once(dirname(__FILE__).'/class.Source.php'); |
| 11 | 11 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
| 12 | - require_once(dirname(__FILE__).'/class.APRS.php'); |
|
| 12 | + require_once(dirname(__FILE__).'/class.APRS.php'); |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | class MarineImport { |
| 16 | - private $all_tracked = array(); |
|
| 17 | - private $last_delete_hourly = 0; |
|
| 18 | - private $last_delete = 0; |
|
| 19 | - private $stats = array(); |
|
| 20 | - private $tmd = 0; |
|
| 21 | - private $source_location = array(); |
|
| 22 | - public $db = null; |
|
| 23 | - public $nb = 0; |
|
| 16 | + private $all_tracked = array(); |
|
| 17 | + private $last_delete_hourly = 0; |
|
| 18 | + private $last_delete = 0; |
|
| 19 | + private $stats = array(); |
|
| 20 | + private $tmd = 0; |
|
| 21 | + private $source_location = array(); |
|
| 22 | + public $db = null; |
|
| 23 | + public $nb = 0; |
|
| 24 | 24 | |
| 25 | - public function __construct($dbc = null) { |
|
| 25 | + public function __construct($dbc = null) { |
|
| 26 | 26 | global $globalBeta, $globalServerAPRS, $APRSMarine, $globalNoDB; |
| 27 | 27 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 28 | - $Connection = new Connection($dbc); |
|
| 29 | - $this->db = $Connection->db(); |
|
| 30 | - date_default_timezone_set('UTC'); |
|
| 28 | + $Connection = new Connection($dbc); |
|
| 29 | + $this->db = $Connection->db(); |
|
| 30 | + date_default_timezone_set('UTC'); |
|
| 31 | 31 | } |
| 32 | 32 | // Get previous source stats |
| 33 | 33 | /* |
@@ -46,57 +46,57 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | */ |
| 48 | 48 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
| 49 | - $APRSMarine = new APRSMarine(); |
|
| 50 | - //$APRSSpotter->connect(); |
|
| 49 | + $APRSMarine = new APRSMarine(); |
|
| 50 | + //$APRSSpotter->connect(); |
|
| 51 | + } |
|
| 51 | 52 | } |
| 52 | - } |
|
| 53 | 53 | |
| 54 | - public function checkAll() { |
|
| 54 | + public function checkAll() { |
|
| 55 | 55 | global $globalDebug, $globalNoDB; |
| 56 | 56 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 57 | - if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
| 58 | - foreach ($this->all_tracked as $key => $flight) { |
|
| 57 | + if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
| 58 | + foreach ($this->all_tracked as $key => $flight) { |
|
| 59 | 59 | if (isset($this->all_tracked[$key]['id'])) { |
| 60 | - //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
|
| 61 | - $Marine = new Marine($this->db); |
|
| 62 | - $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
| 60 | + //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
|
| 61 | + $Marine = new Marine($this->db); |
|
| 62 | + $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
| 63 | 63 | } |
| 64 | - } |
|
| 64 | + } |
|
| 65 | + } |
|
| 65 | 66 | } |
| 66 | - } |
|
| 67 | 67 | |
| 68 | - public function del() { |
|
| 68 | + public function del() { |
|
| 69 | 69 | global $globalDebug, $globalNoDB, $globalNoImport; |
| 70 | 70 | // Delete old infos |
| 71 | 71 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
| 72 | 72 | foreach ($this->all_tracked as $key => $flight) { |
| 73 | - if (isset($flight['lastupdate'])) { |
|
| 74 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
| 75 | - if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
| 76 | - if (isset($this->all_tracked[$key]['id'])) { |
|
| 77 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
| 78 | - /* |
|
| 73 | + if (isset($flight['lastupdate'])) { |
|
| 74 | + if ($flight['lastupdate'] < (time()-3000)) { |
|
| 75 | + if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
| 76 | + if (isset($this->all_tracked[$key]['id'])) { |
|
| 77 | + if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
| 78 | + /* |
|
| 79 | 79 | $MarineLive = new MarineLive(); |
| 80 | 80 | $MarineLive->deleteLiveMarineDataById($this->all_tracked[$key]['id']); |
| 81 | 81 | $MarineLive->db = null; |
| 82 | 82 | */ |
| 83 | - //$real_arrival = $this->arrival($key); |
|
| 84 | - $Marine = new Marine($this->db); |
|
| 85 | - if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
| 83 | + //$real_arrival = $this->arrival($key); |
|
| 84 | + $Marine = new Marine($this->db); |
|
| 85 | + if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
| 86 | 86 | $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
| 87 | 87 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 88 | - } |
|
| 89 | - // Put in archive |
|
| 88 | + } |
|
| 89 | + // Put in archive |
|
| 90 | 90 | // $Marine->db = null; |
| 91 | 91 | } |
| 92 | - } |
|
| 93 | - unset($this->all_tracked[$key]); |
|
| 94 | - } |
|
| 95 | - } |
|
| 96 | - } |
|
| 97 | - } |
|
| 92 | + } |
|
| 93 | + unset($this->all_tracked[$key]); |
|
| 94 | + } |
|
| 95 | + } |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - public function add($line) { |
|
| 99 | + public function add($line) { |
|
| 100 | 100 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine; |
| 101 | 101 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
| 102 | 102 | date_default_timezone_set('UTC'); |
@@ -105,83 +105,83 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | // SBS format is CSV format |
| 107 | 107 | if(is_array($line) && isset($line['mmsi'])) { |
| 108 | - //print_r($line); |
|
| 109 | - if (isset($line['mmsi'])) { |
|
| 108 | + //print_r($line); |
|
| 109 | + if (isset($line['mmsi'])) { |
|
| 110 | 110 | |
| 111 | 111 | |
| 112 | 112 | // Increment message number |
| 113 | 113 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
| 114 | - $current_date = date('Y-m-d'); |
|
| 115 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
| 116 | - else $source = ''; |
|
| 117 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 118 | - if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
| 119 | - $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
| 120 | - $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
| 121 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 114 | + $current_date = date('Y-m-d'); |
|
| 115 | + if (isset($line['source_name'])) $source = $line['source_name']; |
|
| 116 | + else $source = ''; |
|
| 117 | + if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 118 | + if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
| 119 | + $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
| 120 | + $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
| 121 | + } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | |
| 125 | 125 | $Common = new Common(); |
| 126 | 126 | $AIS = new AIS(); |
| 127 | - if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
| 128 | - else $id = trim($line['id']); |
|
| 127 | + if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
| 128 | + else $id = trim($line['id']); |
|
| 129 | 129 | |
| 130 | 130 | if (!isset($this->all_tracked[$id])) { |
| 131 | - $this->all_tracked[$id] = array(); |
|
| 132 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
| 133 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '')); |
|
| 134 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
| 135 | - if (!isset($line['id'])) { |
|
| 131 | + $this->all_tracked[$id] = array(); |
|
| 132 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
| 133 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '')); |
|
| 134 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
| 135 | + if (!isset($line['id'])) { |
|
| 136 | 136 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 137 | 137 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
| 138 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
| 139 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
| 138 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
| 139 | + if ($globalAllTracked !== FALSE) $dataFound = true; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) { |
| 143 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
| 144 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 143 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
| 144 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 145 | 145 | $Marine = new Marine($this->db); |
| 146 | 146 | $identity = $Marine->getIdentity($line['mmsi']); |
| 147 | 147 | if ($identity != '') { |
| 148 | - $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
|
| 149 | - $this->all_tracked[$id]['type'] = $identity['type']; |
|
| 148 | + $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
|
| 149 | + $this->all_tracked[$id]['type'] = $identity['type']; |
|
| 150 | 150 | } |
| 151 | 151 | //print_r($identity); |
| 152 | 152 | unset($Marine); |
| 153 | 153 | //$dataFound = true; |
| 154 | - } |
|
| 154 | + } |
|
| 155 | 155 | } |
| 156 | 156 | if (isset($line['type_id'])) { |
| 157 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
| 158 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id'])); |
|
| 157 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
| 158 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id'])); |
|
| 159 | 159 | } |
| 160 | 160 | if (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] == '') { |
| 161 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
| 161 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
| 162 | 162 | } |
| 163 | 163 | if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') { |
| 164 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
| 164 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
| 165 | 165 | } |
| 166 | 166 | if (isset($line['imo']) && $line['imo'] != '') { |
| 167 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
| 167 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
| 168 | 168 | } |
| 169 | 169 | if (isset($line['callsign']) && $line['callsign'] != '') { |
| 170 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
| 170 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
| 171 | 171 | } |
| 172 | 172 | if (isset($line['arrival_code']) && $line['arrival_code'] != '') { |
| 173 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
|
| 173 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
|
| 174 | 174 | } |
| 175 | 175 | if (isset($line['arrival_date']) && $line['arrival_date'] != '') { |
| 176 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
| 176 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | //if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { |
| 180 | 180 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
| 181 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
| 182 | - if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 181 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
| 182 | + if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 183 | 183 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 184 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 184 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 185 | 185 | $timeelapsed = microtime(true); |
| 186 | 186 | $Marine = new Marine($this->db); |
| 187 | 187 | $fromsource = NULL; |
@@ -190,20 +190,20 @@ discard block |
||
| 190 | 190 | $Marine->addIdentity($this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['type']); |
| 191 | 191 | $Marine->db = null; |
| 192 | 192 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 193 | - } |
|
| 193 | + } |
|
| 194 | 194 | } |
| 195 | - } |
|
| 196 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 195 | + } |
|
| 196 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-30*60 && strtotime($line['datetime']) < time()+20*60) { |
| 200 | - if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
|
| 200 | + if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
|
| 201 | 201 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
| 202 | - } else { |
|
| 202 | + } else { |
|
| 203 | 203 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n"; |
| 204 | 204 | elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
| 205 | 205 | return ''; |
| 206 | - } |
|
| 206 | + } |
|
| 207 | 207 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time()-30*60) { |
| 208 | 208 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
| 209 | 209 | return ''; |
@@ -220,24 +220,24 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | |
| 222 | 222 | if (isset($line['speed'])) { |
| 223 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
| 224 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
| 223 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
| 224 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
| 225 | 225 | } else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
| 226 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
| 227 | - if ($distance > 1000 && $distance < 10000) { |
|
| 226 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
| 227 | + if ($distance > 1000 && $distance < 10000) { |
|
| 228 | 228 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
| 229 | 229 | $speed = $speed*3.6; |
| 230 | 230 | if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
| 231 | 231 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
| 232 | - } |
|
| 232 | + } |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
| 236 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 237 | - else unset($timediff); |
|
| 238 | - if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
| 235 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
| 236 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 237 | + else unset($timediff); |
|
| 238 | + if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
| 239 | 239 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
| 240 | - if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
| 240 | + if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
| 241 | 241 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
| 242 | 242 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 243 | 243 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -245,211 +245,211 @@ discard block |
||
| 245 | 245 | if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
| 246 | 246 | $timeelapsed = microtime(true); |
| 247 | 247 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 248 | - $Marine = new Marine($this->db); |
|
| 249 | - $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
| 250 | - if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
| 251 | - $Marine->db = null; |
|
| 252 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 248 | + $Marine = new Marine($this->db); |
|
| 249 | + $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
| 250 | + if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
| 251 | + $Marine->db = null; |
|
| 252 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 253 | 253 | } |
| 254 | 254 | $this->tmd = 0; |
| 255 | 255 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
| 256 | - } |
|
| 256 | + } |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 260 | 260 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
| 261 | 261 | if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
| 262 | - $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
| 263 | - $dataFound = true; |
|
| 264 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 262 | + $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
| 263 | + $dataFound = true; |
|
| 264 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 265 | 265 | } |
| 266 | 266 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
| 267 | 267 | } |
| 268 | 268 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 269 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 269 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 270 | 270 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 271 | 271 | if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
| 272 | - $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
| 273 | - $dataFound = true; |
|
| 274 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 272 | + $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
| 273 | + $dataFound = true; |
|
| 274 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 275 | 275 | } |
| 276 | 276 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - } else if ($globalDebug && $timediff > 20) { |
|
| 279 | + } else if ($globalDebug && $timediff > 20) { |
|
| 280 | 280 | $this->tmd = $this->tmd + 1; |
| 281 | 281 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
| 282 | 282 | echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
| 283 | 283 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
| 284 | 284 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
| 285 | - } |
|
| 285 | + } |
|
| 286 | 286 | } |
| 287 | 287 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 288 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 289 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
| 288 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 289 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
| 290 | 290 | } |
| 291 | 291 | if (isset($line['format_source']) && $line['format_source'] != '') { |
| 292 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
| 292 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
| 293 | 293 | } |
| 294 | 294 | if (isset($line['source_name']) && $line['source_name'] != '') { |
| 295 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
| 295 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
| 296 | 296 | } |
| 297 | 297 | if (isset($line['status']) && $line['status'] != '') { |
| 298 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
| 298 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
| 299 | 299 | } |
| 300 | 300 | if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) { |
| 301 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
| 302 | - if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 301 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
| 302 | + if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 303 | 303 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 304 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 304 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 305 | 305 | $Marine = new Marine($this->db); |
| 306 | 306 | $Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']); |
| 307 | 307 | unset($Marine); |
| 308 | - } |
|
| 308 | + } |
|
| 309 | + } |
|
| 309 | 310 | } |
| 310 | - } |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
| 314 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
| 314 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | if (isset($line['heading']) && $line['heading'] != '') { |
| 318 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 319 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
| 320 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
| 321 | - //$dataFound = true; |
|
| 318 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 319 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
| 320 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
| 321 | + //$dataFound = true; |
|
| 322 | 322 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
| 323 | - $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
| 324 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
| 325 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 326 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
| 323 | + $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
| 324 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
| 325 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 326 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
| 327 | 327 | } |
| 328 | 328 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
| 329 | 329 | |
| 330 | 330 | |
| 331 | 331 | |
| 332 | 332 | if ($dataFound === true && isset($this->all_tracked[$id]['mmsi'])) { |
| 333 | - $this->all_tracked[$id]['lastupdate'] = time(); |
|
| 334 | - if ($this->all_tracked[$id]['addedMarine'] == 0) { |
|
| 335 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 336 | - if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
| 333 | + $this->all_tracked[$id]['lastupdate'] = time(); |
|
| 334 | + if ($this->all_tracked[$id]['addedMarine'] == 0) { |
|
| 335 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 336 | + if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
| 337 | 337 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 338 | - if ($globalDebug) echo "Check if vessel is already in DB..."; |
|
| 339 | - $timeelapsed = microtime(true); |
|
| 340 | - $MarineLive = new MarineLive($this->db); |
|
| 341 | - if (isset($line['id'])) { |
|
| 338 | + if ($globalDebug) echo "Check if vessel is already in DB..."; |
|
| 339 | + $timeelapsed = microtime(true); |
|
| 340 | + $MarineLive = new MarineLive($this->db); |
|
| 341 | + if (isset($line['id'])) { |
|
| 342 | 342 | $recent_ident = $MarineLive->checkIdRecent($line['id']); |
| 343 | 343 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 344 | - } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
|
| 344 | + } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
|
| 345 | 345 | $recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']); |
| 346 | 346 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 347 | - } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
| 347 | + } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
| 348 | 348 | $recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
| 349 | 349 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 350 | - } else $recent_ident = ''; |
|
| 351 | - $MarineLive->db=null; |
|
| 352 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 353 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 350 | + } else $recent_ident = ''; |
|
| 351 | + $MarineLive->db=null; |
|
| 352 | + if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 353 | + elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 354 | 354 | } else $recent_ident = ''; |
| 355 | - } else { |
|
| 355 | + } else { |
|
| 356 | 356 | $recent_ident = ''; |
| 357 | 357 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
| 358 | - } |
|
| 359 | - //if there was no vessel with the same callsign within the last hour and go post it into the archive |
|
| 360 | - if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') |
|
| 361 | - { |
|
| 358 | + } |
|
| 359 | + //if there was no vessel with the same callsign within the last hour and go post it into the archive |
|
| 360 | + if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') |
|
| 361 | + { |
|
| 362 | 362 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
| 363 | 363 | //adds the spotter data for the archive |
| 364 | - $highlight = ''; |
|
| 365 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
| 366 | - if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 364 | + $highlight = ''; |
|
| 365 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
| 366 | + if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 367 | 367 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 368 | - $timeelapsed = microtime(true); |
|
| 369 | - $Marine = new Marine($this->db); |
|
| 370 | - $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
| 371 | - $Marine->db = null; |
|
| 372 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 373 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 368 | + $timeelapsed = microtime(true); |
|
| 369 | + $Marine = new Marine($this->db); |
|
| 370 | + $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
| 371 | + $Marine->db = null; |
|
| 372 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 373 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 374 | + } |
|
| 374 | 375 | } |
| 375 | - } |
|
| 376 | - if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
|
| 376 | + if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
|
| 377 | 377 | // Add source stat in DB |
| 378 | 378 | $Stats = new Stats($this->db); |
| 379 | 379 | if (!empty($this->stats)) { |
| 380 | - if ($globalDebug) echo 'Add source stats : '; |
|
| 381 | - foreach($this->stats as $date => $data) { |
|
| 380 | + if ($globalDebug) echo 'Add source stats : '; |
|
| 381 | + foreach($this->stats as $date => $data) { |
|
| 382 | 382 | foreach($data as $source => $sourced) { |
| 383 | - //print_r($sourced); |
|
| 384 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
| 385 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
| 386 | - if (isset($sourced['msg'])) { |
|
| 387 | - if (time() - $sourced['msg']['date'] > 10) { |
|
| 388 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
| 389 | - echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
| 390 | - unset($this->stats[$date][$source]['msg']); |
|
| 391 | - } |
|
| 392 | - } |
|
| 393 | - } |
|
| 394 | - if ($date != date('Y-m-d')) { |
|
| 395 | - unset($this->stats[$date]); |
|
| 396 | - } |
|
| 397 | - } |
|
| 398 | - if ($globalDebug) echo 'Done'."\n"; |
|
| 383 | + //print_r($sourced); |
|
| 384 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
| 385 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
| 386 | + if (isset($sourced['msg'])) { |
|
| 387 | + if (time() - $sourced['msg']['date'] > 10) { |
|
| 388 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
| 389 | + echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
| 390 | + unset($this->stats[$date][$source]['msg']); |
|
| 391 | + } |
|
| 392 | + } |
|
| 393 | + } |
|
| 394 | + if ($date != date('Y-m-d')) { |
|
| 395 | + unset($this->stats[$date]); |
|
| 396 | + } |
|
| 397 | + } |
|
| 398 | + if ($globalDebug) echo 'Done'."\n"; |
|
| 399 | 399 | } |
| 400 | 400 | $Stats->db = null; |
| 401 | - } |
|
| 401 | + } |
|
| 402 | 402 | |
| 403 | - $this->del(); |
|
| 403 | + $this->del(); |
|
| 404 | 404 | //$ignoreImport = false; |
| 405 | 405 | $this->all_tracked[$id]['addedMarine'] = 1; |
| 406 | 406 | //print_r($this->all_tracked[$id]); |
| 407 | 407 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
| 408 | - if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
| 409 | - //MarineLive->deleteLiveMarineDataNotUpdated(); |
|
| 410 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 408 | + if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
| 409 | + //MarineLive->deleteLiveMarineDataNotUpdated(); |
|
| 410 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 411 | 411 | $MarineLive = new MarineLive($this->db); |
| 412 | 412 | $MarineLive->deleteLiveMarineData(); |
| 413 | 413 | $MarineLive->db=null; |
| 414 | 414 | if ($globalDebug) echo " Done\n"; |
| 415 | - } |
|
| 416 | - $this->last_delete = time(); |
|
| 415 | + } |
|
| 416 | + $this->last_delete = time(); |
|
| 417 | 417 | } |
| 418 | - } elseif ($recent_ident != '') { |
|
| 418 | + } elseif ($recent_ident != '') { |
|
| 419 | 419 | $this->all_tracked[$id]['id'] = $recent_ident; |
| 420 | 420 | $this->all_tracked[$id]['addedMarine'] = 1; |
| 421 | 421 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 422 | - if (isset($globalDaemon) && !$globalDaemon) { |
|
| 422 | + if (isset($globalDaemon) && !$globalDaemon) { |
|
| 423 | 423 | $Marine = new Marine($this->db); |
| 424 | 424 | $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime']); |
| 425 | 425 | $Marine->db = null; |
| 426 | - } |
|
| 426 | + } |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | - } |
|
| 429 | + } |
|
| 430 | + } |
|
| 430 | 431 | } |
| 431 | - } |
|
| 432 | - //adds the spotter LIVE data |
|
| 433 | - if ($globalDebug) { |
|
| 432 | + //adds the spotter LIVE data |
|
| 433 | + if ($globalDebug) { |
|
| 434 | 434 | echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n"; |
| 435 | - } |
|
| 436 | - $ignoreImport = false; |
|
| 435 | + } |
|
| 436 | + $ignoreImport = false; |
|
| 437 | 437 | |
| 438 | - if (!$ignoreImport) { |
|
| 438 | + if (!$ignoreImport) { |
|
| 439 | 439 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
| 440 | 440 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
| 441 | 441 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 442 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 442 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 443 | 443 | $timeelapsed = microtime(true); |
| 444 | 444 | $MarineLive = new MarineLive($this->db); |
| 445 | 445 | $result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
| 446 | 446 | $MarineLive->db = null; |
| 447 | 447 | if ($globalDebug) echo $result."\n"; |
| 448 | 448 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 449 | - } |
|
| 449 | + } |
|
| 450 | 450 | } |
| 451 | 451 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) { |
| 452 | - $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
|
| 452 | + $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
|
| 453 | 453 | } |
| 454 | 454 | $this->all_tracked[$id]['putinarchive'] = false; |
| 455 | 455 | |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | if ($stats_heading == 16) $stats_heading = 0; |
| 482 | 482 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 483 | 483 | for ($i=0;$i<=15;$i++) { |
| 484 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
| 484 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
| 485 | 485 | } |
| 486 | 486 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
| 487 | 487 | } else { |
@@ -494,11 +494,11 @@ discard block |
||
| 494 | 494 | //var_dump($this->stats); |
| 495 | 495 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
| 496 | 496 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 497 | - end($this->stats[$current_date][$source]['hist']); |
|
| 498 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 497 | + end($this->stats[$current_date][$source]['hist']); |
|
| 498 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 499 | 499 | } else $mini = 0; |
| 500 | 500 | for ($i=$mini;$i<=$distance;$i+=10) { |
| 501 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
| 501 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
| 502 | 502 | } |
| 503 | 503 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
| 504 | 504 | } else { |
@@ -514,24 +514,24 @@ discard block |
||
| 514 | 514 | |
| 515 | 515 | |
| 516 | 516 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
| 517 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 517 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 518 | 518 | if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour..."; |
| 519 | 519 | $MarineLive = new MarineLive($this->db); |
| 520 | 520 | $MarineLive->deleteLiveMarineDataNotUpdated(); |
| 521 | 521 | $MarineLive->db = null; |
| 522 | 522 | //MarineLive->deleteLiveMarineData(); |
| 523 | 523 | if ($globalDebug) echo " Done\n"; |
| 524 | - } |
|
| 525 | - $this->last_delete_hourly = time(); |
|
| 524 | + } |
|
| 525 | + $this->last_delete_hourly = time(); |
|
| 526 | 526 | } |
| 527 | 527 | |
| 528 | - } |
|
| 529 | - //$ignoreImport = false; |
|
| 528 | + } |
|
| 529 | + //$ignoreImport = false; |
|
| 530 | 530 | } |
| 531 | 531 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
| 532 | 532 | if ($send) return $this->all_tracked[$id]; |
| 533 | - } |
|
| 533 | + } |
|
| 534 | + } |
|
| 534 | 535 | } |
| 535 | - } |
|
| 536 | 536 | } |
| 537 | 537 | ?> |