@@ -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,16 +73,16 @@ 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_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
83 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
84 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
85 | -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_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
83 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
84 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
85 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
86 | 86 | /* |
87 | 87 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
88 | 88 | $min = true; |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | $from_archive = true; |
130 | 130 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
131 | 131 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
132 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
133 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
134 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
135 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
136 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
137 | - $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
|
132 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
133 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
134 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
135 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
136 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
137 | + $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter); |
|
138 | 138 | } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) { |
139 | 139 | $from_archive = true; |
140 | 140 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
@@ -144,34 +144,34 @@ discard block |
||
144 | 144 | $begindate = $_COOKIE['archive_begin']; |
145 | 145 | $enddate = $_COOKIE['archive_end']; |
146 | 146 | |
147 | - $archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT); |
|
148 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
149 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
147 | + $archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT); |
|
148 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
149 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
150 | 150 | // echo 'Begin : '.$begindate.' - End : '.$enddate."\n"; |
151 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
151 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
152 | 152 | } elseif ($tracker) { |
153 | 153 | $coord = array(); |
154 | 154 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
155 | - $coord = explode(',',$_GET['coord']); |
|
155 | + $coord = explode(',', $_GET['coord']); |
|
156 | 156 | } |
157 | - $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true); |
|
157 | + $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true); |
|
158 | 158 | } elseif ($marine) { |
159 | 159 | $coord = array(); |
160 | 160 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
161 | - $coord = explode(',',$_GET['coord']); |
|
161 | + $coord = explode(',', $_GET['coord']); |
|
162 | 162 | } |
163 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true); |
|
163 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true); |
|
164 | 164 | } else { |
165 | 165 | $coord = array(); |
166 | 166 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
167 | - $coord = explode(',',$_GET['coord']); |
|
167 | + $coord = explode(',', $_GET['coord']); |
|
168 | 168 | } |
169 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true); |
|
169 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true); |
|
170 | 170 | } |
171 | 171 | //print_r($spotter_array); |
172 | 172 | if (!empty($spotter_array) && isset($coord)) { |
173 | 173 | if (isset($_GET['archive'])) { |
174 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
174 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
175 | 175 | } elseif ($tracker) { |
176 | 176 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
177 | 177 | } elseif ($marine) { |
@@ -182,15 +182,15 @@ discard block |
||
182 | 182 | if ($flightcnt == '') $flightcnt = 0; |
183 | 183 | } else $flightcnt = 0; |
184 | 184 | |
185 | -$sqltime = round(microtime(true)-$begintime,2); |
|
185 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
186 | 186 | $minitime = time(); |
187 | 187 | $maxitime = 0; |
188 | -$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT); |
|
188 | +$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT); |
|
189 | 189 | $modelsdb = array(); |
190 | 190 | if (file_exists(dirname(__FILE__).'/models/modelsdb')) { |
191 | - if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) { |
|
192 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
193 | - if (isset($row[1]) ){ |
|
191 | + if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) { |
|
192 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
193 | + if (isset($row[1])) { |
|
194 | 194 | $model = $row[0]; |
195 | 195 | $modelsdb[$model] = $row[1]; |
196 | 196 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | if (!empty($spotter_array) && is_array($spotter_array)) |
228 | 228 | { |
229 | 229 | $nblatlong = 0; |
230 | - foreach($spotter_array as $spotter_item) |
|
230 | + foreach ($spotter_array as $spotter_item) |
|
231 | 231 | { |
232 | 232 | $j++; |
233 | 233 | //if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND'; |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | $output .= '"lastupdate": "'.$lastupdate.'",'; |
268 | 268 | $output .= '"format": "'.$spotter_item['format_source'].'",'; |
269 | 269 | if ($tracker) { |
270 | - $output.= '"type": "tracker"'; |
|
270 | + $output .= '"type": "tracker"'; |
|
271 | 271 | } elseif ($marine) { |
272 | - $output.= '"type": "marine"'; |
|
272 | + $output .= '"type": "marine"'; |
|
273 | 273 | } else { |
274 | - $output.= '"type": "flight"'; |
|
274 | + $output .= '"type": "flight"'; |
|
275 | 275 | } |
276 | 276 | $output .= '},'; |
277 | 277 | |
@@ -615,8 +615,8 @@ discard block |
||
615 | 615 | $output .= '},'; |
616 | 616 | } |
617 | 617 | } |
618 | - if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output); |
|
619 | - else $output = str_replace('%onground%','false',$output); |
|
618 | + if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output); |
|
619 | + else $output = str_replace('%onground%', 'false', $output); |
|
620 | 620 | |
621 | 621 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
622 | 622 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | $output .= '"cartographicDegrees": ['; |
632 | 632 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
633 | 633 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
634 | - $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
634 | + $output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
635 | 635 | $output .= $spotter_item['longitude'].', '; |
636 | 636 | $output .= $spotter_item['latitude']; |
637 | 637 | $prevlong = $spotter_item['longitude']; |
@@ -659,8 +659,8 @@ discard block |
||
659 | 659 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
660 | 660 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
661 | 661 | } else { |
662 | - $nblatlong = $nblatlong+1; |
|
663 | - $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
662 | + $nblatlong = $nblatlong + 1; |
|
663 | + $output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
664 | 664 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
665 | 665 | if ($spotter_item['ground_speed'] == 0) { |
666 | 666 | $output .= $prevlong.', '; |
@@ -700,15 +700,15 @@ discard block |
||
700 | 700 | } |
701 | 701 | $output .= ']'; |
702 | 702 | if (isset($globalArchive) && $globalArchive === TRUE) { |
703 | - if ((time()-$globalLiveInterval) > $minitime) { |
|
704 | - if (time()-$globalLiveInterval > $maxitime) { |
|
705 | - $output = str_replace('%minitime%',date("c",$maxitime),$output); |
|
703 | + if ((time() - $globalLiveInterval) > $minitime) { |
|
704 | + if (time() - $globalLiveInterval > $maxitime) { |
|
705 | + $output = str_replace('%minitime%', date("c", $maxitime), $output); |
|
706 | 706 | } else { |
707 | - $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
707 | + $output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output); |
|
708 | 708 | } |
709 | 709 | } |
710 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
711 | -} else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
712 | -$output = str_replace('%maxitime%',date("c",$maxitime),$output); |
|
710 | + else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
711 | +} else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
712 | +$output = str_replace('%maxitime%', date("c", $maxitime), $output); |
|
713 | 713 | print $output; |
714 | 714 | ?> |