Ysurac /
FlightAirMap
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | require_once('require/class.Connection.php'); |
||
| 3 | require_once('require/class.Common.php'); |
||
| 4 | if (isset($globalProtect) && $globalProtect) { |
||
| 5 | @session_start(); |
||
| 6 | if (!isset($_SESSION['protect']) || !isset($_SERVER['HTTP_REFERER'])) { |
||
| 7 | echo 'You must access this page using the right way.'; |
||
| 8 | die(); |
||
| 9 | } |
||
| 10 | } |
||
| 11 | |||
| 12 | $no3dmodels = false; // Only for testing |
||
| 13 | $one3dmodel = false; // Only for testing |
||
| 14 | if ((isset($globalMap3DForceModel) && $globalMap3DForceModel != '') || (isset($globalMap3DOneModel) && $globalMap3DOneModel)) { |
||
| 15 | $one3dmodel = true; |
||
| 16 | } |
||
| 17 | if (isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') { |
||
| 18 | $one3dmodel = true; |
||
| 19 | } |
||
| 20 | $tracker = false; |
||
| 21 | $marine = false; |
||
| 22 | if (isset($_GET['tracker'])) $tracker = true; |
||
| 23 | if (isset($_GET['marine'])) $marine = true; |
||
| 24 | if ($tracker) { |
||
| 25 | require_once('require/class.Tracker.php'); |
||
| 26 | require_once('require/class.TrackerLive.php'); |
||
| 27 | //require_once('require/class.TrackerArchive.php'); |
||
| 28 | $TrackerLive = new TrackerLive(); |
||
| 29 | $Tracker = new Tracker(); |
||
| 30 | // $TrackerArchive = new TrackerArchive(); |
||
| 31 | } elseif ($marine) { |
||
| 32 | require_once('require/class.Marine.php'); |
||
| 33 | require_once('require/class.MarineLive.php'); |
||
| 34 | //require_once('require/class.MarineArchive.php'); |
||
| 35 | $MarineLive = new MarineLive(); |
||
| 36 | $Marine = new Marine(); |
||
| 37 | // $MarineArchive = new MarineArchive(); |
||
| 38 | } else { |
||
| 39 | require_once('require/class.Spotter.php'); |
||
| 40 | require_once('require/class.SpotterLive.php'); |
||
| 41 | require_once('require/class.SpotterArchive.php'); |
||
| 42 | $SpotterLive = new SpotterLive(); |
||
| 43 | $Spotter = new Spotter(); |
||
| 44 | $SpotterArchive = new SpotterArchive(); |
||
| 45 | } |
||
| 46 | |||
| 47 | date_default_timezone_set('UTC'); |
||
| 48 | $begintime = microtime(true); |
||
| 49 | $Common = new Common(); |
||
| 50 | |||
| 51 | |||
| 52 | function quaternionrotate($heading, $attitude = 0, $bank = 0) { |
||
| 53 | // Assuming the angles are in radians. |
||
| 54 | $c1 = cos($heading/2); |
||
| 55 | $s1 = sin($heading/2); |
||
| 56 | $c2 = cos($attitude/2); |
||
| 57 | $s2 = sin($attitude/2); |
||
| 58 | $c3 = cos($bank/2); |
||
| 59 | $s3 = sin($bank/2); |
||
| 60 | $c1c2 = $c1*$c2; |
||
| 61 | $s1s2 = $s1*$s2; |
||
| 62 | $w =$c1c2*$c3 - $s1s2*$s3; |
||
| 63 | $x =$c1c2*$s3 + $s1s2*$c3; |
||
| 64 | $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
||
| 65 | $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
||
| 66 | return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
||
| 67 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
||
| 68 | |||
| 69 | } |
||
| 70 | |||
| 71 | |||
| 72 | if (isset($_GET['download'])) { |
||
| 73 | if ($_GET['download'] == "true") |
||
| 74 | { |
||
| 75 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
||
| 76 | } |
||
| 77 | } |
||
| 78 | header('Content-Type: text/javascript'); |
||
| 79 | |||
| 80 | if (!isset($globalJsonCompress)) $compress = true; |
||
| 81 | else $compress = $globalJsonCompress; |
||
| 82 | |||
| 83 | $from_archive = false; |
||
| 84 | $min = false; |
||
| 85 | $allhistory = false; |
||
| 86 | $filter['source'] = array(); |
||
| 87 | if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
||
| 88 | if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
||
| 89 | if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
||
| 90 | if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
||
| 91 | if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
||
| 92 | if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
||
| 93 | if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
||
| 94 | if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
||
| 95 | if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
||
| 96 | if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
||
| 97 | if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
||
| 98 | /* |
||
| 99 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
||
| 100 | $min = true; |
||
| 101 | } |
||
| 102 | |||
| 103 | if (isset($_GET['ident'])) { |
||
| 104 | $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
||
| 105 | $spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident); |
||
| 106 | if (empty($spotter_array)) { |
||
| 107 | $from_archive = true; |
||
| 108 | $spotter_array = $SpotterArchive->getLastArchiveSpotterDataByIdent($ident); |
||
| 109 | } |
||
| 110 | $allhistory = true; |
||
| 111 | } elseif (isset($_GET['flightaware_id'])) { |
||
| 112 | $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
||
| 113 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
||
| 114 | if (empty($spotter_array)) { |
||
| 115 | $from_archive = true; |
||
| 116 | $spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id); |
||
| 117 | } |
||
| 118 | $allhistory = true; |
||
| 119 | } elseif (isset($_GET['coord'])) { |
||
| 120 | $coord = explode(',',$_GET['coord']); |
||
| 121 | $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter); |
||
| 122 | } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
||
| 123 | $from_archive = true; |
||
| 124 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
||
| 125 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
||
| 126 | $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
||
| 127 | $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
||
| 128 | $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
||
| 129 | $begindate = date('Y-m-d H:i:s',$begindate); |
||
| 130 | $enddate = date('Y-m-d H:i:s',$enddate); |
||
| 131 | $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
||
| 132 | } elseif ($min) { |
||
| 133 | //$spotter_array = $SpotterLive->getMinLiveSpotterData($filter); |
||
| 134 | $spotter_array = $SpotterLive->getMinLastLiveSpotterData($filter); |
||
| 135 | # $min = true; |
||
| 136 | } else { |
||
| 137 | $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
||
| 138 | } |
||
| 139 | */ |
||
| 140 | if (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
||
| 141 | $from_archive = true; |
||
| 142 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
||
| 143 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
||
| 144 | $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
||
| 145 | $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
||
| 146 | $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
||
| 147 | $begindate = date('Y-m-d H:i:s',$begindate); |
||
| 148 | $enddate = date('Y-m-d H:i:s',$enddate); |
||
| 149 | if ($tracker) { |
||
| 150 | $spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate,$enddate,$filter); |
||
| 151 | } elseif ($marine) { |
||
| 152 | $spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate,$enddate,$filter); |
||
| 153 | } else { |
||
| 154 | $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
||
| 155 | } |
||
| 156 | } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) { |
||
| 157 | $from_archive = true; |
||
| 158 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
||
| 159 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
||
| 160 | // $begindate = filter_var($_COOKIE['archive_begin'],FILTER_SANITIZE_NUMBER_INT); |
||
| 161 | // $enddate = filter_var($_COOKIE['archive_end'],FILTER_SANITIZE_NUMBER_INT); |
||
| 162 | $begindate = $_COOKIE['archive_begin']; |
||
| 163 | $begindateinitial = $_COOKIE['archive_begin']; |
||
| 164 | if (isset($globalAircraftMaxUpdate)) { |
||
| 165 | $begindate = $begindate - $globalAircraftMaxUpdate; |
||
| 166 | } else { |
||
| 167 | $begindate = $begindate - 3000; |
||
| 168 | } |
||
| 169 | $enddate = $_COOKIE['archive_end']; |
||
| 170 | $enddateinitial = $_COOKIE['archive_end']; |
||
| 171 | $archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT); |
||
| 172 | $begindate = date('Y-m-d H:i:s',$begindate); |
||
| 173 | $enddate = date('Y-m-d H:i:s',$enddate); |
||
| 174 | //echo 'Begin : '.$begindate.' - End : '.$enddate."\n"; |
||
| 175 | if ($tracker) { |
||
| 176 | $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter); |
||
| 177 | } elseif ($marine) { |
||
| 178 | $spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter); |
||
| 179 | } else { |
||
| 180 | $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
||
| 181 | } |
||
| 182 | } elseif ($tracker) { |
||
| 183 | $coord = array(); |
||
| 184 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
||
| 185 | $coord = explode(',',$_GET['coord']); |
||
| 186 | 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) |
||
| 187 | && $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)) { |
||
| 188 | $coord = array(); |
||
| 189 | } |
||
| 190 | } |
||
| 191 | $previous_filter = $filter; |
||
| 192 | if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackTracker']) && $_COOKIE['MapTrackTracker'] != '')) { |
||
| 193 | $filter = array_merge($filter,array('id' => $_COOKIE['MapTrackTracker'])); |
||
| 194 | $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true); |
||
| 195 | /* |
||
| 196 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) { |
||
| 197 | $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true,$_COOKIE['MapTrack']); |
||
| 198 | */ |
||
| 199 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
||
| 200 | $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true); |
||
| 201 | } else { |
||
| 202 | $spotter_array = array(); |
||
| 203 | } |
||
| 204 | $filter = $previous_filter; |
||
| 205 | } elseif ($marine) { |
||
| 206 | $coord = array(); |
||
| 207 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
||
| 208 | $coord = explode(',',$_GET['coord']); |
||
| 209 | 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) |
||
| 210 | && $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)) { |
||
| 211 | $coord = array(); |
||
| 212 | } |
||
| 213 | } |
||
| 214 | $previous_filter = $filter; |
||
| 215 | if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) { |
||
| 216 | $filter = array_merge($filter,array('id' => $_COOKIE['MapTrackMarine'])); |
||
| 217 | $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true); |
||
| 218 | /* |
||
| 219 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) { |
||
| 220 | $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true,$_COOKIE['MapTrack']); |
||
| 221 | */ |
||
| 222 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
||
| 223 | $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true); |
||
| 224 | } else { |
||
| 225 | $spotter_array = array(); |
||
| 226 | } |
||
| 227 | $filter = $previous_filter; |
||
| 228 | } else { |
||
| 229 | $coord = array(); |
||
| 230 | if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') { |
||
| 231 | $coord = explode(',',$_GET['coord']); |
||
| 232 | 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) |
||
| 233 | && $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)) { |
||
| 234 | $coord = array(); |
||
| 235 | } |
||
| 236 | } |
||
| 237 | $previous_filter = $filter; |
||
| 238 | if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) { |
||
| 239 | $filter = array_merge($filter,array('id' => $_COOKIE['MapTrack'])); |
||
| 240 | $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true); |
||
| 241 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) { |
||
| 242 | $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true,$_COOKIE['MapTrack']); |
||
| 243 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
||
| 244 | $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true); |
||
| 245 | } else { |
||
| 246 | $spotter_array = array(); |
||
| 247 | } |
||
| 248 | $filter = $previous_filter; |
||
| 249 | } |
||
| 250 | //print_r($spotter_array); |
||
| 251 | if (!empty($spotter_array) && isset($coord)) { |
||
| 252 | if ($tracker) { |
||
| 253 | if (isset($_GET['archive'])) { |
||
| 254 | $flightcnt = $TrackerLive->getLiveTrackerCount($begindate,$enddate,$filter); |
||
|
0 ignored issues
–
show
The call to
TrackerLive::getLiveTrackerCount() has too many arguments starting with $enddate.
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. In this case you can add the Loading history...
|
|||
| 255 | } else { |
||
| 256 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
||
| 257 | } |
||
| 258 | } elseif ($marine) { |
||
| 259 | if (isset($_GET['archive'])) { |
||
| 260 | $flightcnt = $MarineLive->getLiveMarineCount($begindate,$enddate,$filter); |
||
|
0 ignored issues
–
show
$begindate is of type string, but the function expects a array.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
The call to
MarineLive::getLiveMarineCount() has too many arguments starting with $enddate.
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. In this case you can add the Loading history...
|
|||
| 261 | } else { |
||
| 262 | $flightcnt = $MarineLive->getLiveMarineCount($filter); |
||
| 263 | } |
||
| 264 | } else { |
||
| 265 | if (isset($_GET['archive'])) { |
||
| 266 | $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
||
| 267 | } else { |
||
| 268 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
||
| 269 | } |
||
| 270 | } |
||
| 271 | if ($flightcnt == '') $flightcnt = 0; |
||
| 272 | } else $flightcnt = 0; |
||
| 273 | |||
| 274 | $sqltime = round(microtime(true)-$begintime,2); |
||
| 275 | $minitime = time(); |
||
| 276 | $minitracktime_begin = time(); |
||
| 277 | $minitracktime = $minitracktime_begin; |
||
| 278 | $maxitime = 0; |
||
| 279 | $lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT); |
||
| 280 | $modelsdb = array(); |
||
| 281 | if (file_exists(dirname(__FILE__).'/models/modelsdb')) { |
||
| 282 | if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) { |
||
| 283 | while (($row = fgetcsv($handle,1000)) !== FALSE) { |
||
| 284 | if (isset($row[1]) ){ |
||
| 285 | $model = $row[0]; |
||
| 286 | $modelsdb[$model] = $row[1]; |
||
| 287 | } |
||
| 288 | } |
||
| 289 | fclose($handle); |
||
| 290 | } |
||
| 291 | } |
||
| 292 | $modelsdb2 = array(); |
||
| 293 | if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) { |
||
| 294 | if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) { |
||
| 295 | while (($row = fgetcsv($handle,1000)) !== FALSE) { |
||
| 296 | if (isset($row[1]) ){ |
||
| 297 | $model = $row[0]; |
||
| 298 | $glb = $row[1]; |
||
| 299 | if (isset($row[2])) { |
||
| 300 | $minisize = $row[2]; |
||
| 301 | $modelsdb2[$model] = array('glb' => $row[1], 'size' => $minisize); |
||
| 302 | } else { |
||
| 303 | $modelsdb2[$model] = array('glb' => $row[1], 'size' => 20); |
||
| 304 | } |
||
| 305 | } |
||
| 306 | } |
||
| 307 | fclose($handle); |
||
| 308 | } |
||
| 309 | } |
||
| 310 | $heightrelative = 'NONE'; |
||
| 311 | //$heightrelative = 'RELATIVE_TO_GROUND'; |
||
| 312 | $j = 0; |
||
| 313 | $prev_flightaware_id = ''; |
||
| 314 | $speed = 1; |
||
| 315 | $gltf2 = false; |
||
| 316 | $scale = 1.0; |
||
| 317 | $minimumpixelsize = 20; |
||
| 318 | if (isset($archivespeed)) $speed = $archivespeed; |
||
| 319 | $output = '['; |
||
| 320 | if ($tracker) { |
||
| 321 | $output .= '{"id" : "document", "name" : "tracker","version" : "1.0"'; |
||
| 322 | } elseif ($marine) { |
||
| 323 | $output .= '{"id" : "document", "name" : "marine","version" : "1.0"'; |
||
| 324 | } else { |
||
| 325 | $output .= '{"id" : "document", "name" : "fam","version" : "1.0"'; |
||
| 326 | } |
||
| 327 | // $output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "LOOP_STOP","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
||
| 328 | |||
| 329 | // $output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
||
| 330 | //$output .= ',"clock": {"currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
||
| 331 | if ($from_archive === true) { |
||
| 332 | $output .= ',"clock": {"currentTime" : "%minitime%","multiplier" : '.$speed.',"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER","interval": "%minitime%/%maxitime%"}'; |
||
| 333 | } else { |
||
| 334 | $output .= ',"clock": {"currentTime" : "%minitime%","multiplier" : '.$speed.',"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
||
| 335 | } |
||
| 336 | |||
| 337 | // $output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
||
| 338 | $output .= '},'; |
||
| 339 | if (!empty($spotter_array) && is_array($spotter_array)) |
||
| 340 | { |
||
| 341 | $nblatlong = 0; |
||
| 342 | foreach($spotter_array as $spotter_item) |
||
| 343 | { |
||
| 344 | $j++; |
||
| 345 | //if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND'; |
||
| 346 | date_default_timezone_set('UTC'); |
||
| 347 | if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "") |
||
| 348 | { |
||
| 349 | $image = $spotter_item['image_thumbnail']; |
||
| 350 | } else { |
||
| 351 | $image = "images/placeholder_thumb.png"; |
||
| 352 | } |
||
| 353 | |||
| 354 | if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
||
| 355 | elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
||
| 356 | elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
||
| 357 | if ($prev_flightaware_id != $id) { |
||
| 358 | if ($prev_flightaware_id != '') { |
||
| 359 | /* |
||
| 360 | if ($nblatlong == 1) { |
||
| 361 | $output .= ',"'.date("c").'", '; |
||
| 362 | $output .= $prevlong.', '; |
||
| 363 | $output .= $prevlat; |
||
| 364 | if (!$marine) $output .= ', '.$prevalt; |
||
| 365 | else $output .= ', 0'; |
||
| 366 | } |
||
| 367 | */ |
||
| 368 | $output .= ']'; |
||
| 369 | $output .= '}'; |
||
| 370 | //$output .= ', '.$orientation.']}'; |
||
| 371 | $output .= '},'; |
||
| 372 | } |
||
| 373 | $orientation = ''; |
||
| 374 | $prev_flightaware_id = $id; |
||
| 375 | $nblatlong = 0; |
||
| 376 | $output .= '{'; |
||
| 377 | $output .= '"id": "'.$id.'",'; |
||
| 378 | $output .= '"properties": {'; |
||
| 379 | $output .= '"flightcnt": "'.$flightcnt.'",'; |
||
| 380 | $output .= '"onground": %onground%,'; |
||
| 381 | $output .= '"lastupdate": "'.$lastupdate.'",'; |
||
| 382 | if (isset($spotter_item['aircraft_icao'])) { |
||
| 383 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
||
| 384 | } |
||
| 385 | if (isset($spotter_item['departure_airport'])) { |
||
| 386 | $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
||
| 387 | } |
||
| 388 | if (isset($spotter_item['arrival_airport'])) { |
||
| 389 | $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
||
| 390 | } |
||
| 391 | if (isset($spotter_item['squawk'])) { |
||
| 392 | $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
||
| 393 | } |
||
| 394 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
||
| 395 | if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",'; |
||
| 396 | if (isset($spotter_item['ident'])) $output.= '"ident": "'.$spotter_item['ident'].'",'; |
||
| 397 | if ($tracker) { |
||
| 398 | if (isset($spotter_item['type'])) $output .= '"tracker_type": "'.$spotter_item['type'].'",'; |
||
| 399 | $output.= '"type": "tracker"'; |
||
| 400 | } elseif ($marine) { |
||
| 401 | if (isset($spotter_item['type'])) $output .= '"marine_type": "'.$spotter_item['type'].'",'; |
||
| 402 | $output.= '"type": "marine"'; |
||
| 403 | } else { |
||
| 404 | if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) { |
||
| 405 | $aircraft_icao = $spotter_item['aircraft_icao']; |
||
| 406 | $ident = $spotter_item['ident']; |
||
| 407 | if ($ident != '') { |
||
| 408 | if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
||
| 409 | $airline_icao = substr($ident, 0, 2); |
||
| 410 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
||
| 411 | $airline_icao = substr($ident, 0, 3); |
||
| 412 | } |
||
| 413 | if (isset($airline_icao)) { |
||
| 414 | $imagefile = $aircraft_icao.'-'.$airline_icao.'.png'; |
||
| 415 | if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) { |
||
| 416 | $output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
||
| 417 | } |
||
| 418 | } |
||
| 419 | } |
||
| 420 | //if ($ident != '') $output.= '"ident": "'.$ident.'",'; |
||
| 421 | } |
||
| 422 | $output.= '"gltf2": %gltf2%,'; |
||
| 423 | $output.= '"type": "flight"'; |
||
| 424 | } |
||
| 425 | $output .= '},'; |
||
| 426 | |||
| 427 | $output .= '"path" : { '; |
||
| 428 | $output .= '"show" : false, '; |
||
| 429 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
||
| 430 | $output .= '"material" : { '; |
||
| 431 | $output .= '"polylineOutline" : { '; |
||
| 432 | $output .= '"color" : { "rgba" : [238, 250, 255, 255] }, '; |
||
| 433 | $output .= '"outlineColor" : { "rgba" : [200, 209, 214, 255] }, '; |
||
| 434 | $output .= '"outlineWidth" : 5, '; |
||
| 435 | $output .= '"polylineGlow" : { "color" : { "rgba" : [214, 208, 214, 255] }, "glowPower" : 3 } '; |
||
| 436 | $output .= '}'; |
||
| 437 | $output .= '}, '; |
||
| 438 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
||
| 439 | $output .= '"width" : 6, "leadTime" : 0, "trailTime" : 100000000, "resolution" : 20 },'; |
||
| 440 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
||
| 441 | //$output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5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oUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 1.5},'; |
||
| 442 | if ($no3dmodels) { |
||
| 443 | if (isset($spotter_item['aircraft_icao'])) { |
||
| 444 | $aircraft_icao = $spotter_item['aircraft_icao']; |
||
| 445 | if ($aircraft_icao != '') { |
||
| 446 | $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao); |
||
| 447 | if (isset($aircraft_info[0]['engine_type'])) { |
||
| 448 | $aircraft_shadow = $aircraft_info[0]['aircraft_shadow']; |
||
| 449 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; |
||
| 450 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
||
| 451 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
||
| 452 | } else $aircraft_shadow = ''; |
||
| 453 | $output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5'; |
||
| 454 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
||
| 455 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
||
| 456 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 457 | } |
||
| 458 | $output .= '},'; |
||
| 459 | } |
||
| 460 | } else $output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj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HZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},'; |
||
| 461 | } elseif ($one3dmodel) { |
||
| 462 | if (isset($globalMap3DForceModel) && $globalMap3DForceModel != '') { |
||
| 463 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$globalMap3DForceModel.'","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
||
| 464 | } else { |
||
| 465 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/737.glb","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
||
| 466 | } |
||
| 467 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 468 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
||
| 469 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
||
| 470 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 471 | } |
||
| 472 | $output .= '},'; |
||
| 473 | } else { |
||
| 474 | if (isset($spotter_item['aircraft_icao'])) { |
||
| 475 | $aircraft_icao = $spotter_item['aircraft_icao']; |
||
| 476 | if (isset($modelsdb2[$aircraft_icao]) && $aircraft_icao != '') { |
||
| 477 | $gltf2 = true; |
||
| 478 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/gltf2/'.$modelsdb2[$aircraft_icao]['glb'].'","scale" : '.$scale.',"minimumPixelSize": '.$modelsdb2[$aircraft_icao]['size']; |
||
| 479 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 480 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
||
| 481 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
||
| 482 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 483 | } |
||
| 484 | $output .= '},'; |
||
| 485 | } elseif (isset($modelsdb[$aircraft_icao]) && $aircraft_icao != '') { |
||
| 486 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_icao].'","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
||
| 487 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 488 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
||
| 489 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
||
| 490 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 491 | } |
||
| 492 | $output .= '},'; |
||
| 493 | } elseif ($aircraft_icao != '') { |
||
| 494 | $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao); |
||
| 495 | if (isset($aircraft_info[0]['engine_type'])) { |
||
| 496 | $aircraft_shadow = $aircraft_info[0]['aircraft_shadow']; |
||
| 497 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; |
||
| 498 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
||
| 499 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
||
| 500 | } else $aircraft_shadow = ''; |
||
| 501 | if ($aircraft_shadow != '') { |
||
| 502 | if (isset($modelsdb2[$aircraft_shadow])) { |
||
| 503 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/gltf2/'.$modelsdb2[$aircraft_shadow]['glb'].'","scale" : '.$scale.',"minimumPixelSize": '.$modelsdb2[$aircraft_shadow]['size']; |
||
| 504 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 505 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
||
| 506 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
||
| 507 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 508 | } |
||
| 509 | $output .= '},'; |
||
| 510 | $modelsdb2[$aircraft_icao] = $modelsdb2[$aircraft_shadow]; |
||
| 511 | } elseif (isset($modelsdb[$aircraft_shadow])) { |
||
| 512 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_shadow].'","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
||
| 513 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 514 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
||
| 515 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
||
| 516 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 517 | } |
||
| 518 | $output .= '},'; |
||
| 519 | $modelsdb[$aircraft_icao] = $modelsdb[$aircraft_shadow]; |
||
| 520 | } elseif ($spotter_item['engine_type'] == 'Jet') { |
||
| 521 | if ($spotter_item['engine_count'] == '1') { |
||
| 522 | if ($spotter_item['wake_category'] == 'M') { |
||
| 523 | $model = 'J1M'; |
||
| 524 | } elseif ($spotter_item['wake_category'] == 'L') { |
||
| 525 | $model = ''; |
||
| 526 | } |
||
| 527 | } elseif ($spotter_item['engine_count'] == '2') { |
||
| 528 | if ($spotter_item['wake_category'] == 'M') { |
||
| 529 | $model = 'J2M'; |
||
| 530 | } elseif ($spotter_item['wake_category'] == 'H') { |
||
| 531 | $model = 'J2H'; |
||
| 532 | } elseif ($spotter_item['wake_category'] == 'L') { |
||
| 533 | $model = 'J2L'; |
||
| 534 | } |
||
| 535 | } elseif ($spotter_item['engine_count'] == '3') { |
||
| 536 | if ($spotter_item['wake_category'] == 'M') { |
||
| 537 | $model = 'J3M'; |
||
| 538 | } elseif ($spotter_item['wake_category'] == 'H') { |
||
| 539 | $model = 'J3H'; |
||
| 540 | } |
||
| 541 | } elseif ($spotter_item['engine_count'] == '4') { |
||
| 542 | if ($spotter_item['wake_category'] == 'M') { |
||
| 543 | $model = 'J4M'; |
||
| 544 | } elseif ($spotter_item['wake_category'] == 'H') { |
||
| 545 | $model = 'J4H'; |
||
| 546 | } |
||
| 547 | } |
||
| 548 | if (isset($modelsdb2[$model])) { |
||
| 549 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/gltf2/'.$modelsdb2[$model]['glb'].'","scale" : '.$scale.',"minimumPixelSize": '.$modelsdb2[$model]['size']; |
||
| 550 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 551 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
||
| 552 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
||
| 553 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 554 | } |
||
| 555 | $output .= '},'; |
||
| 556 | $modelsdb2[$aircraft_icao] = $modelsdb2[$model]; |
||
| 557 | } elseif (isset($modelsdb[$model])) { |
||
| 558 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$model].'","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
||
| 559 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 560 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
||
| 561 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
||
| 562 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 563 | } |
||
| 564 | $output .= '},'; |
||
| 565 | $modelsdb[$aircraft_icao] = $modelsdb[$model]; |
||
| 566 | } else { |
||
| 567 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
||
| 568 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 569 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
||
| 570 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
||
| 571 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 572 | } |
||
| 573 | $output .= '},'; |
||
| 574 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
||
| 575 | } |
||
| 576 | } elseif ($spotter_item['engine_type'] == 'Turboprop') { |
||
| 577 | if ($spotter_item['engine_count'] == '1') { |
||
| 578 | if ($spotter_item['wake_category'] == 'L') { |
||
| 579 | $model = 'T1L'; |
||
| 580 | } |
||
| 581 | } elseif ($spotter_item['engine_count'] == '2') { |
||
| 582 | if ($spotter_item['wake_category'] == 'M') { |
||
| 583 | $model = 'T2M'; |
||
| 584 | } elseif ($spotter_item['wake_category'] == 'L') { |
||
| 585 | $model = 'T2L'; |
||
| 586 | } |
||
| 587 | } elseif ($spotter_item['engine_count'] == '4') { |
||
| 588 | if ($spotter_item['wake_category'] == 'M') { |
||
| 589 | } elseif ($spotter_item['wake_category'] == 'H') { |
||
| 590 | $model = 'T4H'; |
||
| 591 | } |
||
| 592 | } |
||
| 593 | if (isset($modelsdb[$model])) { |
||
| 594 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$model].'","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
||
| 595 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 596 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
||
| 597 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
||
| 598 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 599 | } |
||
| 600 | $output .= '},'; |
||
| 601 | $modelsdb[$aircraft_icao] = $modelsdb[$model]; |
||
| 602 | } else { |
||
| 603 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
||
| 604 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 605 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
||
| 606 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
||
| 607 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 608 | } |
||
| 609 | $output .= '},'; |
||
| 610 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
||
| 611 | } |
||
| 612 | } elseif ($spotter_item['engine_type'] == 'Piston') { |
||
| 613 | if ($spotter_item['engine_count'] == '1') { |
||
| 614 | if ($spotter_item['wake_category'] == 'L') { |
||
| 615 | $model = 'P1L'; |
||
| 616 | } elseif ($spotter_item['wake_category'] == 'M') { |
||
| 617 | $model = 'P1M'; |
||
| 618 | } |
||
| 619 | } elseif ($spotter_item['engine_count'] == '2') { |
||
| 620 | if ($spotter_item['wake_category'] == 'M') { |
||
| 621 | $model = 'P2M'; |
||
| 622 | } elseif ($spotter_item['wake_category'] == 'L') { |
||
| 623 | $model = 'P2L'; |
||
| 624 | } |
||
| 625 | // ju52 = P3M |
||
| 626 | } |
||
| 627 | if (isset($modelsdb[$model])) { |
||
| 628 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$model].'","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
||
| 629 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 630 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
||
| 631 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
||
| 632 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 633 | } |
||
| 634 | $output .= '},'; |
||
| 635 | $modelsdb[$aircraft_icao] = $modelsdb[$model]; |
||
| 636 | } else { |
||
| 637 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
||
| 638 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 639 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
||
| 640 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
||
| 641 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 642 | } |
||
| 643 | $output .= '},'; |
||
| 644 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
||
| 645 | } |
||
| 646 | } else { |
||
| 647 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
||
| 648 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 649 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
||
| 650 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
||
| 651 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 652 | } |
||
| 653 | $output .= '},'; |
||
| 654 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
||
| 655 | if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
||
| 656 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
||
| 657 | } |
||
| 658 | } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
||
| 659 | $aircraft_shadow = 'PA18'; |
||
| 660 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_shadow].'","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
||
| 661 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 662 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
||
| 663 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
||
| 664 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 665 | } |
||
| 666 | $output .= '},'; |
||
| 667 | $modelsdb[$aircraft_icao] = $modelsdb[$aircraft_shadow]; |
||
| 668 | } else { |
||
| 669 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
||
| 670 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 671 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
||
| 672 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
||
| 673 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 674 | } |
||
| 675 | $output .= '},'; |
||
| 676 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
||
| 677 | if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
||
| 678 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
||
| 679 | } |
||
| 680 | } else { |
||
| 681 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
||
| 682 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 683 | //$output .= ',"color": {"rgba" : [255,0,0,255]}'; |
||
| 684 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
||
| 685 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
||
| 686 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 687 | } |
||
| 688 | $output .= '},'; |
||
| 689 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
||
| 690 | if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
||
| 691 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
||
| 692 | } |
||
| 693 | } elseif ($tracker && isset($spotter_item['type'])) { |
||
| 694 | if ($spotter_item['type'] == 'Car' || $spotter_item['type'] == 'Van') { |
||
| 695 | $onground = true; |
||
| 696 | //$output .= '"model": {"gltf" : "'.$globalURL.'/models/vehicules/car.glb","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.','; |
||
| 697 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/vehicules/car.gltf","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
||
| 698 | //$output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 699 | $output .= ',"heightReference": "CLAMP_TO_GROUND"'; |
||
| 700 | if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true' && isset($_COOKIE['TrackerIconColor'])) { |
||
| 701 | $rgb = $Common->hex2rgb($_COOKIE['TrackerIconColor']); |
||
| 702 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 703 | $output .= ',"colorBlendMode" : "MIX"'; |
||
| 704 | } |
||
| 705 | $output .= '},'; |
||
| 706 | } elseif ($spotter_item['type'] == 'Truck' || $spotter_item['type'] == 'Truck (18 Wheeler)') { |
||
| 707 | $onground = true; |
||
| 708 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/vehicules/truck.gltf","scale" : '.$scale.',"minimumPixelSize": 10'; |
||
| 709 | //$output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 710 | $output .= ',"heightReference": "CLAMP_TO_GROUND"'; |
||
| 711 | if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true' && isset($_COOKIE['TrackerIconColor'])) { |
||
| 712 | $rgb = $Common->hex2rgb($_COOKIE['TrackerIconColor']); |
||
| 713 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 714 | $output .= ',"colorBlendMode" : "MIX"'; |
||
| 715 | } |
||
| 716 | $output .= '},'; |
||
| 717 | } elseif ($spotter_item['type'] == 'Firetruck') { |
||
| 718 | $onground = true; |
||
| 719 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/vehicules/firetruck.glb","scale" : '.$scale.',"minimumPixelSize": 0'; |
||
| 720 | //$output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 721 | $output .= ',"heightReference": "CLAMP_TO_GROUND"'; |
||
| 722 | if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true' && isset($_COOKIE['TrackerIconColor'])) { |
||
| 723 | $rgb = $Common->hex2rgb($_COOKIE['TrackerIconColor']); |
||
| 724 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 725 | $output .= ',"colorBlendMode" : "MIX"'; |
||
| 726 | } |
||
| 727 | $output .= '},'; |
||
| 728 | } elseif ($spotter_item['type'] == 'Bike') { |
||
| 729 | $onground = true; |
||
| 730 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/vehicules/cycle.glb","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
||
| 731 | //$output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 732 | $output .= ',"heightReference": "CLAMP_TO_GROUND"'; |
||
| 733 | if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true' && isset($_COOKIE['TrackerIconColor'])) { |
||
| 734 | $rgb = $Common->hex2rgb($_COOKIE['TrackerIconColor']); |
||
| 735 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 736 | $output .= ',"colorBlendMode" : "MIX"'; |
||
| 737 | } |
||
| 738 | $output .= '},'; |
||
| 739 | } elseif ($spotter_item['type'] == 'Police') { |
||
| 740 | $onground = true; |
||
| 741 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/vehicules/police.glb","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
||
| 742 | //$output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 743 | $output .= ',"heightReference": "CLAMP_TO_GROUND"'; |
||
| 744 | if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true' && isset($_COOKIE['TrackerIconColor'])) { |
||
| 745 | $rgb = $Common->hex2rgb($_COOKIE['TrackerIconColor']); |
||
| 746 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 747 | $output .= ',"colorBlendMode" : "MIX"'; |
||
| 748 | } |
||
| 749 | $output .= '},'; |
||
| 750 | } elseif ($spotter_item['type'] == 'Balloon') { |
||
| 751 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/vehicules/ball.glb","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
||
| 752 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 753 | if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true' && isset($_COOKIE['TrackerIconColor'])) { |
||
| 754 | $rgb = $Common->hex2rgb($_COOKIE['TrackerIconColor']); |
||
| 755 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 756 | $output .= ',"colorBlendMode" : "MIX"'; |
||
| 757 | } |
||
| 758 | $output .= '},'; |
||
| 759 | } elseif ($spotter_item['type'] == 'Ship (Power Boat)' || $spotter_item['type'] == 'Yatch (Sail)') { |
||
| 760 | $onground = true; |
||
| 761 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/vehicules/boat.glb","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
||
| 762 | //$output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 763 | $output .= ',"heightReference": "CLAMP_TO_GROUND"'; |
||
| 764 | if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true' && isset($_COOKIE['TrackerIconColor'])) { |
||
| 765 | $rgb = $Common->hex2rgb($_COOKIE['TrackerIconColor']); |
||
| 766 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 767 | $output .= ',"colorBlendMode" : "MIX"'; |
||
| 768 | } |
||
| 769 | $output .= '},'; |
||
| 770 | } else { |
||
| 771 | $onground = true; |
||
| 772 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/vehicules/car.gltf","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
||
| 773 | //$output .= '"model": {"gltf" : "'.$globalURL.'/models/vehicules/Cesium_Ground.glb","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
||
| 774 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 775 | if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true' && isset($_COOKIE['TrackerIconColor'])) { |
||
| 776 | $rgb = $Common->hex2rgb($_COOKIE['TrackerIconColor']); |
||
| 777 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 778 | $output .= ',"colorBlendMode" : "MIX"'; |
||
| 779 | } |
||
| 780 | $output .= '},'; |
||
| 781 | } |
||
| 782 | } elseif ($marine) { |
||
| 783 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/vehicules/boat.glb","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
||
| 784 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
||
| 785 | //$output .= ',"heightReference": "CLAMP_TO_GROUND"'; |
||
| 786 | if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true' && isset($_COOKIE['MarineIconColor'])) { |
||
| 787 | $rgb = $Common->hex2rgb($_COOKIE['MarineIconColor']); |
||
| 788 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
||
| 789 | $output .= ',"colorBlendMode" : "MIX"'; |
||
| 790 | } |
||
| 791 | $output .= '},'; |
||
| 792 | } |
||
| 793 | } |
||
| 794 | if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output); |
||
| 795 | else $output = str_replace('%onground%','false',$output); |
||
| 796 | |||
| 797 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
||
| 798 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
||
| 799 | // $output .= '"heightReference": "NONE",'; |
||
| 800 | $output .= '"position": {'; |
||
| 801 | $output .= '"interpolationAlgorithm":"HERMITE","interpolationDegree":3,'; |
||
| 802 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
||
| 803 | $output .= '"type": "Point",'; |
||
| 804 | // $output .= '"interpolationAlgorithm" : "LAGRANGE",'; |
||
| 805 | // $output .= '"interpolationDegree" : 5,'; |
||
| 806 | // $output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", '; |
||
| 807 | $output .= '"cartographicDegrees": ['; |
||
| 808 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
||
| 809 | if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']); |
||
| 810 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
||
| 811 | $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
||
| 812 | $output .= $spotter_item['longitude'].', '; |
||
| 813 | $output .= $spotter_item['latitude']; |
||
| 814 | $prevlong = $spotter_item['longitude']; |
||
| 815 | $prevlat = $spotter_item['latitude']; |
||
| 816 | //if (!$tracker && !$marine) { |
||
| 817 | //if (!$marine && (!isset($onground) || !$onground)) { |
||
| 818 | if (!$marine) { |
||
| 819 | if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
||
| 820 | $output .= ', '.round($spotter_item['real_altitude']*0.3048); |
||
| 821 | if ($tracker) { |
||
| 822 | $prevalt = round($spotter_item['real_altitude']*0.3048); |
||
| 823 | } else { |
||
| 824 | $prevalt = round($spotter_item['real_altitude']*30.48); |
||
| 825 | } |
||
| 826 | } elseif ($tracker) { |
||
| 827 | $output .= ', '.round($spotter_item['altitude']*0.3048); |
||
| 828 | $prevalt = round($spotter_item['altitude']*0.3048); |
||
| 829 | } else { |
||
| 830 | $output .= ', '.round($spotter_item['altitude']*30.48); |
||
| 831 | $prevalt = round($spotter_item['altitude']*30.48); |
||
| 832 | } |
||
| 833 | } else $output .= ', 0'; |
||
| 834 | //$orientation = '"orientation" : { '; |
||
| 835 | //$orientation .= '"unitQuaternion": ['; |
||
| 836 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
||
| 837 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
||
| 838 | } else { |
||
| 839 | $nblatlong = $nblatlong+1; |
||
| 840 | $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
||
| 841 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
||
| 842 | if ($spotter_item['ground_speed'] == 0) { |
||
| 843 | $output .= $prevlong.', '; |
||
| 844 | $output .= $prevlat; |
||
| 845 | //if (!$marine && (!isset($onground) || !$onground)) $output .= ', '.$prevalt; |
||
| 846 | if (!$marine) $output .= ', '.$prevalt; |
||
| 847 | else $output .= ', 0'; |
||
| 848 | } else { |
||
| 849 | $output .= $spotter_item['longitude'].', '; |
||
| 850 | $output .= $spotter_item['latitude']; |
||
| 851 | //if (!$marine && (!isset($onground) || !$onground)) { |
||
| 852 | if (!$marine) { |
||
| 853 | if ($spotter_item['altitude'] == '') { |
||
| 854 | if ($prevalt != '') { |
||
| 855 | $output .= ', '.$prevalt; |
||
| 856 | } else { |
||
| 857 | $output .= ', 0'; |
||
| 858 | } |
||
| 859 | } else { |
||
| 860 | if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') $output .= ', '.round($spotter_item['real_altitude']*0.3048); |
||
| 861 | elseif ($tracker) { |
||
| 862 | $output .= ', '.round($spotter_item['altitude']*0.3048); |
||
| 863 | } else { |
||
| 864 | $output .= ', '.round($spotter_item['altitude']*30.48); |
||
| 865 | } |
||
| 866 | } |
||
| 867 | } else $output .= ', 0'; |
||
| 868 | } |
||
| 869 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
||
| 870 | //$orientation .= ',"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
||
| 871 | } |
||
| 872 | } |
||
| 873 | //$output = substr($output, 0, -1); |
||
| 874 | $output .= ']}}'; |
||
| 875 | } else { |
||
| 876 | $output = substr($output, 0, -1); |
||
| 877 | } |
||
| 878 | $output .= ']'; |
||
| 879 | if (isset($globalArchive) && $globalArchive === TRUE) { |
||
| 880 | if (isset($begindateinitial)) { |
||
| 881 | $output = str_replace('%minitime%',date("c",$begindateinitial),$output); |
||
| 882 | } elseif ((time()-$globalLiveInterval) > $minitime) { |
||
| 883 | if (time()-$globalLiveInterval > $maxitime) { |
||
| 884 | $output = str_replace('%minitime%',date("c",$maxitime),$output); |
||
| 885 | } else { |
||
| 886 | $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
||
| 887 | } |
||
| 888 | } |
||
| 889 | else $output = str_replace('%minitime%',date("c",$minitime),$output); |
||
| 890 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) { |
||
| 891 | $output = str_replace('%minitime%',date("c",$minitracktime),$output); |
||
| 892 | } else { |
||
| 893 | $output = str_replace('%minitime%',date("c",$minitime),$output); |
||
| 894 | } |
||
| 895 | if (isset($enddateinitial)) { |
||
| 896 | $output = str_replace('%maxitime%',date("c",$enddateinitial),$output); |
||
| 897 | } else { |
||
| 898 | $output = str_replace('%maxitime%',date("c",$maxitime),$output); |
||
| 899 | } |
||
| 900 | if ($gltf2) $output = str_replace('%gltf2%','true',$output); |
||
| 901 | else $output = str_replace('%gltf2%','false',$output); |
||
| 902 | print $output; |
||
| 903 | ?> |
||
| 904 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: