@@ -25,30 +25,30 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | function quaternionrotate($heading, $attitude = 0, $bank = 0) { |
| 28 | - // Assuming the angles are in radians. |
|
| 29 | - $c1 = cos($heading/2); |
|
| 30 | - $s1 = sin($heading/2); |
|
| 31 | - $c2 = cos($attitude/2); |
|
| 32 | - $s2 = sin($attitude/2); |
|
| 33 | - $c3 = cos($bank/2); |
|
| 34 | - $s3 = sin($bank/2); |
|
| 35 | - $c1c2 = $c1*$c2; |
|
| 36 | - $s1s2 = $s1*$s2; |
|
| 37 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
| 38 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
| 39 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
| 40 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
| 41 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
| 28 | + // Assuming the angles are in radians. |
|
| 29 | + $c1 = cos($heading/2); |
|
| 30 | + $s1 = sin($heading/2); |
|
| 31 | + $c2 = cos($attitude/2); |
|
| 32 | + $s2 = sin($attitude/2); |
|
| 33 | + $c3 = cos($bank/2); |
|
| 34 | + $s3 = sin($bank/2); |
|
| 35 | + $c1c2 = $c1*$c2; |
|
| 36 | + $s1s2 = $s1*$s2; |
|
| 37 | + $w =$c1c2*$c3 - $s1s2*$s3; |
|
| 38 | + $x =$c1c2*$s3 + $s1s2*$c3; |
|
| 39 | + $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
| 40 | + $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
| 41 | + return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
| 42 | 42 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
| 43 | 43 | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
| 47 | 47 | if (isset($_GET['download'])) { |
| 48 | - if ($_GET['download'] == "true") |
|
| 49 | - { |
|
| 48 | + if ($_GET['download'] == "true") |
|
| 49 | + { |
|
| 50 | 50 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
| 51 | - } |
|
| 51 | + } |
|
| 52 | 52 | } |
| 53 | 53 | header('Content-Type: text/javascript'); |
| 54 | 54 | |
@@ -205,8 +205,8 @@ discard block |
||
| 205 | 205 | $image = "images/placeholder_thumb.png"; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
| 209 | - elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
| 208 | + if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
| 209 | + elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
| 210 | 210 | if ($prev_flightaware_id != $id) { |
| 211 | 211 | if ($prev_flightaware_id != '') { |
| 212 | 212 | $output .= ']'; |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | $s3 = sin($bank/2); |
| 35 | 35 | $c1c2 = $c1*$c2; |
| 36 | 36 | $s1s2 = $s1*$s2; |
| 37 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
| 38 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
| 39 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
| 40 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
| 41 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
| 37 | + $w = $c1c2*$c3 - $s1s2*$s3; |
|
| 38 | + $x = $c1c2*$s3 + $s1s2*$c3; |
|
| 39 | + $y = $s1*$c2*$c3 + $c1*$s2*$s3; |
|
| 40 | + $z = $c1*$s2*$c3 - $s1*$c2*$s3; |
|
| 41 | + return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w); |
|
| 42 | 42 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
| 43 | 43 | |
| 44 | 44 | } |
@@ -59,16 +59,16 @@ discard block |
||
| 59 | 59 | $min = false; |
| 60 | 60 | $allhistory = false; |
| 61 | 61 | $filter['source'] = array(); |
| 62 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 63 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 64 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 65 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
| 66 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 67 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 68 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 69 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 70 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 71 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 62 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
| 63 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
| 64 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
| 65 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs')); |
|
| 66 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
| 67 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
| 68 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
| 69 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
| 70 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
| 71 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
| 72 | 72 | /* |
| 73 | 73 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
| 74 | 74 | $min = true; |
@@ -115,12 +115,12 @@ discard block |
||
| 115 | 115 | $from_archive = true; |
| 116 | 116 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
| 117 | 117 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
| 118 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
| 119 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
| 120 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
| 121 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
| 122 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
| 123 | - $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
|
| 118 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
| 119 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
| 120 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
| 121 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
| 122 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
| 123 | + $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter); |
|
| 124 | 124 | } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) { |
| 125 | 125 | $from_archive = true; |
| 126 | 126 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | $begindate = $_COOKIE['archive_begin']; |
| 131 | 131 | $enddate = $_COOKIE['archive_end']; |
| 132 | 132 | |
| 133 | - $archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT); |
|
| 134 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
| 135 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
| 133 | + $archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT); |
|
| 134 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
| 135 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
| 136 | 136 | // echo 'Begin : '.$begindate.' - End : '.$enddate."\n"; |
| 137 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
| 137 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
| 138 | 138 | } elseif ($tracker) { |
| 139 | 139 | $spotter_array = $TrackerLive->getMinLastLiveTrackerData($filter); |
| 140 | 140 | } else { |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | if (!empty($spotter_array)) { |
| 145 | 145 | if (isset($_GET['archive'])) { |
| 146 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
| 146 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
| 147 | 147 | } elseif ($tracker) { |
| 148 | 148 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
| 149 | 149 | } else { |
@@ -152,16 +152,16 @@ discard block |
||
| 152 | 152 | if ($flightcnt == '') $flightcnt = 0; |
| 153 | 153 | } else $flightcnt = 0; |
| 154 | 154 | |
| 155 | -$sqltime = round(microtime(true)-$begintime,2); |
|
| 155 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
| 156 | 156 | $minitime = time(); |
| 157 | 157 | $maxitime = 0; |
| 158 | 158 | |
| 159 | 159 | |
| 160 | 160 | $modelsdb = array(); |
| 161 | 161 | if (file_exists('models/modelsdb')) { |
| 162 | - if (($handle = fopen('models/modelsdb','r')) !== FALSE) { |
|
| 163 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
| 164 | - if (isset($row[1]) ){ |
|
| 162 | + if (($handle = fopen('models/modelsdb', 'r')) !== FALSE) { |
|
| 163 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
| 164 | + if (isset($row[1])) { |
|
| 165 | 165 | $model = $row[0]; |
| 166 | 166 | $modelsdb[$model] = $row[1]; |
| 167 | 167 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $output .= '},'; |
| 195 | 195 | if (!empty($spotter_array) && is_array($spotter_array)) |
| 196 | 196 | { |
| 197 | - foreach($spotter_array as $spotter_item) |
|
| 197 | + foreach ($spotter_array as $spotter_item) |
|
| 198 | 198 | { |
| 199 | 199 | $j++; |
| 200 | 200 | date_default_timezone_set('UTC'); |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | $output .= '"cartographicDegrees": ['; |
| 429 | 429 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
| 430 | 430 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
| 431 | - $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
| 431 | + $output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
| 432 | 432 | $output .= $spotter_item['longitude'].', '; |
| 433 | 433 | $output .= $spotter_item['latitude']; |
| 434 | 434 | $prevlong = $spotter_item['longitude']; |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
| 443 | 443 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
| 444 | 444 | } else { |
| 445 | - $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
| 445 | + $output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
| 446 | 446 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
| 447 | 447 | if ($spotter_item['ground_speed'] == 0) { |
| 448 | 448 | $output .= $prevlong.', '; |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | $output = substr($output, 0, -1); |
| 475 | 475 | } |
| 476 | 476 | $output .= ']'; |
| 477 | -$output = str_replace('%minitime%',date("c",$minitime),$output); |
|
| 478 | -$output = str_replace('%maxitime%',date("c",$maxitime),$output); |
|
| 477 | +$output = str_replace('%minitime%', date("c", $minitime), $output); |
|
| 478 | +$output = str_replace('%maxitime%', date("c", $maxitime), $output); |
|
| 479 | 479 | print $output; |
| 480 | 480 | ?> |