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 | $tracker = false; |
||
| 5 | $marine = false; |
||
| 6 | $usecoord = false; |
||
| 7 | if (isset($_GET['tracker'])) { |
||
| 8 | $tracker = true; |
||
| 9 | } |
||
| 10 | if (isset($_GET['marine'])) { |
||
| 11 | $marine = true; |
||
| 12 | } |
||
| 13 | if ($tracker) { |
||
| 14 | require_once('require/class.Tracker.php'); |
||
| 15 | require_once('require/class.TrackerLive.php'); |
||
| 16 | require_once('require/class.TrackerArchive.php'); |
||
| 17 | } elseif ($marine) { |
||
| 18 | require_once('require/class.Marine.php'); |
||
| 19 | require_once('require/class.MarineLive.php'); |
||
| 20 | require_once('require/class.MarineArchive.php'); |
||
| 21 | } else { |
||
| 22 | require_once('require/class.Spotter.php'); |
||
| 23 | require_once('require/class.SpotterLive.php'); |
||
| 24 | require_once('require/class.SpotterArchive.php'); |
||
| 25 | } |
||
| 26 | |||
| 27 | $begintime = microtime(true); |
||
| 28 | if ($tracker) { |
||
| 29 | $TrackerLive = new TrackerLive(); |
||
| 30 | $Tracker = new Tracker(); |
||
| 31 | $TrackerArchive = new TrackerArchive(); |
||
| 32 | } elseif ($marine) { |
||
| 33 | $MarineLive = new MarineLive(); |
||
| 34 | $Marine = new Marine(); |
||
| 35 | $MarineArchive = new MarineArchive(); |
||
| 36 | } else { |
||
| 37 | $SpotterLive = new SpotterLive(); |
||
| 38 | $Spotter = new Spotter(); |
||
| 39 | $SpotterArchive = new SpotterArchive(); |
||
| 40 | } |
||
| 41 | $Common = new Common(); |
||
| 42 | |||
| 43 | if (isset($_GET['download'])) { |
||
| 44 | if ($_GET['download'] == "true") |
||
| 45 | { |
||
| 46 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
||
| 47 | } |
||
| 48 | } |
||
| 49 | header('Content-Type: text/javascript'); |
||
| 50 | |||
| 51 | if (!isset($globalJsonCompress)) $compress = true; |
||
| 52 | else $compress = $globalJsonCompress; |
||
| 53 | |||
| 54 | $from_archive = false; |
||
| 55 | $min = true; |
||
| 56 | $allhistory = false; |
||
| 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_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
||
| 65 | if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
||
| 66 | if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
||
| 67 | if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
||
| 68 | |||
| 69 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
||
| 70 | $min = true; |
||
| 71 | } else $min = false; |
||
| 72 | |||
| 73 | if (isset($_GET['ident'])) { |
||
| 74 | $ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
||
| 75 | if ($tracker) { |
||
| 76 | $spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident); |
||
| 77 | } elseif ($marine) { |
||
| 78 | $spotter_array = $MarineLive->getLastLiveMarineDataByIdent($ident); |
||
| 79 | } else { |
||
| 80 | $spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident); |
||
| 81 | if (empty($spotter_array)) { |
||
| 82 | $from_archive = true; |
||
| 83 | $spotter_array = $SpotterArchive->getLastArchiveSpotterDataByIdent($ident); |
||
| 84 | } |
||
| 85 | } |
||
| 86 | $allhistory = true; |
||
| 87 | } elseif (isset($_GET['flightaware_id'])) { |
||
| 88 | $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
||
| 89 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
||
| 90 | if (empty($spotter_array)) { |
||
| 91 | $from_archive = true; |
||
| 92 | $spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id); |
||
| 93 | } |
||
| 94 | $allhistory = true; |
||
| 95 | } elseif (isset($_GET['famtrack_id'])) { |
||
| 96 | $famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING)); |
||
| 97 | $spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id); |
||
| 98 | $allhistory = true; |
||
| 99 | } elseif (isset($_GET['fammarine_id'])) { |
||
| 100 | $fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING)); |
||
| 101 | $spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id); |
||
| 102 | $allhistory = true; |
||
| 103 | } elseif (isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) { |
||
| 104 | //} elseif (isset($_GET['coord'])) { |
||
| 105 | $usecoord = true; |
||
| 106 | $coord = explode(',',$_GET['coord']); |
||
| 107 | if ($tracker) { |
||
| 108 | $spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter); |
||
| 109 | } elseif ($marine) { |
||
| 110 | $spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord,$filter); |
||
| 111 | } else { |
||
| 112 | $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter); |
||
| 113 | } |
||
| 114 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) { |
||
| 115 | $usecoord = true; |
||
| 116 | $coord = explode(',',$_GET['coord']); |
||
| 117 | if ($tracker) { |
||
| 118 | $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter); |
||
| 119 | } elseif ($marine) { |
||
| 120 | $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter); |
||
| 121 | } else { |
||
| 122 | $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter); |
||
| 123 | } |
||
| 124 | } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed']) && !isset($_GET['tracker']) && !isset($_GET['marine'])) { |
||
| 125 | $from_archive = true; |
||
| 126 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
||
| 127 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
||
| 128 | $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
||
| 129 | $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
||
| 130 | $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
||
| 131 | $begindate = date('Y-m-d H:i:s',$begindate); |
||
| 132 | $enddate = date('Y-m-d H:i:s',$enddate); |
||
| 133 | $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
||
| 134 | } elseif ($min) { |
||
| 135 | if ($tracker) { |
||
| 136 | $spotter_array = $TrackerLive->getMinLiveTrackerData($filter); |
||
| 137 | } elseif ($marine) { |
||
| 138 | $spotter_array = $MarineLive->getMinLiveMarineData($filter); |
||
| 139 | } else { |
||
| 140 | $spotter_array = $SpotterLive->getMinLiveSpotterData($filter); |
||
| 141 | } |
||
| 142 | # $min = true; |
||
| 143 | } else { |
||
| 144 | if ($tracker) { |
||
| 145 | $spotter_array = $TrackerLive->getLiveTrackerData('','',$filter); |
||
| 146 | } elseif ($marine) { |
||
| 147 | $spotter_array = $marineLive->getLiveMarineData('','',$filter); |
||
| 148 | } else { |
||
| 149 | $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
||
| 150 | } |
||
| 151 | } |
||
| 152 | |||
| 153 | if (!empty($spotter_array) || $usecoord) { |
||
| 154 | if ($usecoord) { |
||
| 155 | if (isset($_GET['archive'])) { |
||
| 156 | $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
||
| 157 | } else { |
||
| 158 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
||
| 159 | } |
||
| 160 | } else $flightcnt = count($spotter_array); |
||
| 161 | if ($flightcnt == '') $flightcnt = 0; |
||
| 162 | } else $flightcnt = 0; |
||
| 163 | |||
| 164 | $sqltime = round(microtime(true)-$begintime,2); |
||
| 165 | |||
| 166 | if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
||
| 167 | else $usenextlatlon = true; |
||
| 168 | $j = 0; |
||
| 169 | $prev_flightaware_id = ''; |
||
| 170 | $aircrafts_shadow = array(); |
||
| 171 | $output = '{'; |
||
| 172 | $output .= '"type": "FeatureCollection",'; |
||
| 173 | if ($min) $output .= '"minimal": "true",'; |
||
| 174 | else $output .= '"minimal": "false",'; |
||
| 175 | //$output .= '"fc": "'.$flightcnt.'",'; |
||
| 176 | $output .= '"sqt": "'.$sqltime.'",'; |
||
| 177 | |||
| 178 | if (!empty($spotter_array) && is_array($spotter_array)) |
||
| 179 | { |
||
| 180 | $output .= '"features": ['; |
||
| 181 | foreach($spotter_array as $spotter_item) |
||
| 182 | { |
||
| 183 | $j++; |
||
| 184 | date_default_timezone_set('UTC'); |
||
| 185 | |||
| 186 | if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "") |
||
| 187 | { |
||
| 188 | $image = $spotter_item['image_thumbnail']; |
||
| 189 | } else { |
||
| 190 | $image = "images/placeholder_thumb.png"; |
||
| 191 | } |
||
| 192 | |||
| 193 | /* |
||
| 194 | if ($prev_flightaware_id != $spotter_item['flightaware_id']) { |
||
| 195 | if ($prev_flightaware_id != '') { |
||
| 196 | $output .= ']'; |
||
| 197 | $output .= '}'; |
||
| 198 | $output .= '},'; |
||
| 199 | } |
||
| 200 | $prev_flightaware_id = $spotter_item['flightaware_id']; |
||
| 201 | */ |
||
| 202 | |||
| 203 | //location of aircraft |
||
| 204 | // print_r($spotter_item); |
||
| 205 | $output .= '{'; |
||
| 206 | $output .= '"type": "Feature",'; |
||
| 207 | //$output .= '"fc": "'.$flightcnt.'",'; |
||
| 208 | //$output .= '"sqt": "'.$sqltime.'",'; |
||
| 209 | if (isset($spotter_item['flightaware_id'])) { |
||
| 210 | $output .= '"id": "'.$spotter_item['flightaware_id'].'",'; |
||
| 211 | } elseif (isset($spotter_item['famtrackid'])) { |
||
| 212 | $output .= '"id": "'.$spotter_item['famtrackid'].'",'; |
||
| 213 | } elseif (isset($spotter_item['fammarine_id'])) { |
||
| 214 | $output .= '"id": "'.$spotter_item['fammarine_id'].'",'; |
||
| 215 | } |
||
| 216 | $output .= '"properties": {'; |
||
| 217 | if (isset($spotter_item['flightaware_id'])) { |
||
| 218 | if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
||
| 219 | else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
||
| 220 | } elseif (isset($spotter_item['famtrackid'])) { |
||
| 221 | if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
||
| 222 | else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
||
| 223 | } elseif (isset($spotter_item['fammarine_id'])) { |
||
| 224 | if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
||
| 225 | else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
||
| 226 | } |
||
| 227 | $output .= '"fc": "'.$flightcnt.'",'; |
||
| 228 | $output .= '"sqt": "'.$sqltime.'",'; |
||
| 229 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
||
| 230 | |||
| 231 | /* |
||
| 232 | if ($min) $output .= '"minimal": "true",'; |
||
| 233 | else $output .= '"minimal": "false",'; |
||
| 234 | */ |
||
| 235 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
||
| 236 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
||
| 237 | if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
||
| 238 | else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
||
| 239 | //" |
||
| 240 | } else { |
||
| 241 | if ($compress) $output .= '"c": "NA",'; |
||
| 242 | else $output .= '"callsign": "NA",'; |
||
| 243 | } |
||
| 244 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
||
| 245 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
||
| 246 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
||
| 247 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
||
| 248 | } elseif (isset($spotter_item['aircraft_type'])) { |
||
| 249 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
||
| 250 | } elseif (!$min) { |
||
| 251 | $output .= '"aircraft_name": "NA",'; |
||
| 252 | } |
||
| 253 | if (!$min && isset($spotter_item['aircraft_icao'])) { |
||
| 254 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
||
| 255 | } |
||
| 256 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker) { |
||
| 257 | if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
||
| 258 | else { |
||
| 259 | $aircraft_icao = $spotter_item['aircraft_icao']; |
||
| 260 | if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
||
| 261 | else { |
||
| 262 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
||
| 263 | if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
||
| 264 | elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
||
| 265 | elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
||
| 266 | else $spotter_item['aircraft_shadow'] = ''; |
||
| 267 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
||
| 268 | } |
||
| 269 | } |
||
| 270 | } |
||
| 271 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
||
| 272 | if ($tracker) { |
||
| 273 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
||
| 274 | if ($compress) $output .= '"as": "ambulance.png",'; |
||
| 275 | else $output .= '"aircraft_shadow": "ambulance.png",'; |
||
| 276 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
||
| 277 | if ($compress) $output .= '"as": "police.png",'; |
||
| 278 | else $output .= '"aircraft_shadow": "police.png",'; |
||
| 279 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
||
| 280 | if ($compress) $output .= '"as": "ship.png",'; |
||
| 281 | else $output .= '"aircraft_shadow": "ship.png",'; |
||
| 282 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
||
| 283 | if ($compress) $output .= '"as": "ship.png",'; |
||
| 284 | else $output .= '"aircraft_shadow": "ship.png",'; |
||
| 285 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
||
| 286 | if ($compress) $output .= '"as": "ship.png",'; |
||
| 287 | else $output .= '"aircraft_shadow": "ship.png",'; |
||
| 288 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
||
| 289 | if ($compress) $output .= '"as": "truck.png",'; |
||
| 290 | else $output .= '"aircraft_shadow": "truck.png",'; |
||
| 291 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
||
| 292 | if ($compress) $output .= '"as": "truck.png",'; |
||
| 293 | else $output .= '"aircraft_shadow": "truck.png",'; |
||
| 294 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
||
| 295 | if ($compress) $output .= '"as": "aircraft.png",'; |
||
| 296 | else $output .= '"aircraft_shadow": "aircraft.png",'; |
||
| 297 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
||
| 298 | if ($compress) $output .= '"as": "aircraft.png",'; |
||
| 299 | else $output .= '"aircraft_shadow": "aircraft.png",'; |
||
| 300 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
||
| 301 | if ($compress) $output .= '"as": "helico.png",'; |
||
| 302 | else $output .= '"aircraft_shadow": "helico.png",'; |
||
| 303 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
||
| 304 | if ($compress) $output .= '"as": "rail.png",'; |
||
| 305 | else $output .= '"aircraft_shadow": "rail.png",'; |
||
| 306 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
||
| 307 | if ($compress) $output .= '"as": "firetruck.png",'; |
||
| 308 | else $output .= '"aircraft_shadow": "firetruck.png",'; |
||
| 309 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
||
| 310 | if ($compress) $output .= '"as": "bus.png",'; |
||
| 311 | else $output .= '"aircraft_shadow": "bus.png",'; |
||
| 312 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
||
| 313 | if ($compress) $output .= '"as": "phone.png",'; |
||
| 314 | else $output .= '"aircraft_shadow": "phone.png",'; |
||
| 315 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
||
| 316 | if ($compress) $output .= '"as": "jogger.png",'; |
||
| 317 | else $output .= '"aircraft_shadow": "jogger.png",'; |
||
| 318 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
||
| 319 | if ($compress) $output .= '"as": "bike.png",'; |
||
| 320 | else $output .= '"aircraft_shadow": "bike.png",'; |
||
| 321 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
||
| 322 | if ($compress) $output .= '"as": "motorcycle.png",'; |
||
| 323 | else $output .= '"aircraft_shadow": "motorcycle.png",'; |
||
| 324 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
||
| 325 | if ($compress) $output .= '"as": "balloon.png",'; |
||
| 326 | else $output .= '"aircraft_shadow": "balloon.png",'; |
||
| 327 | } else { |
||
| 328 | if ($compress) $output .= '"as": "car.png",'; |
||
| 329 | else $output .= '"aircraft_shadow": "car.png",'; |
||
| 330 | } |
||
| 331 | } elseif ($marine) { |
||
| 332 | if ($compress) $output .= '"as": "ship.png",'; |
||
| 333 | else $output .= '"aircraft_shadow": "ship.png",'; |
||
| 334 | } else { |
||
| 335 | if ($compress) $output .= '"as": "default.png",'; |
||
| 336 | else $output .= '"aircraft_shadow": "default.png",'; |
||
| 337 | } |
||
| 338 | } else { |
||
| 339 | if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
||
| 340 | else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
||
| 341 | } |
||
| 342 | if (isset($spotter_item['airline_name'])) { |
||
| 343 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
||
| 344 | } elseif (!$min) { |
||
| 345 | $output .= '"airline_name": "NA",'; |
||
| 346 | } |
||
| 347 | if (isset($spotter_item['departure_airport'])) { |
||
| 348 | if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
||
| 349 | else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
||
| 350 | } |
||
| 351 | if (isset($spotter_item['departure_airport_city'])) { |
||
| 352 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
||
| 353 | } |
||
| 354 | if (isset($spotter_item['departure_airport_time'])) { |
||
| 355 | $output .= '"departure_airport_time": "'.$spotter_item['departure_airport_time'].'",'; |
||
| 356 | } |
||
| 357 | if (isset($spotter_item['arrival_airport_time'])) { |
||
| 358 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
||
| 359 | } |
||
| 360 | if (isset($spotter_item['arrival_airport'])) { |
||
| 361 | if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
||
| 362 | else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
||
| 363 | } |
||
| 364 | if (isset($spotter_item['arrival_airport_city'])) { |
||
| 365 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
||
| 366 | } |
||
| 367 | |||
| 368 | if (isset($spotter_item['date_iso_8601'])) { |
||
| 369 | $output .= '"date_update": "'.date("M j, Y, g:i a T", strtotime($spotter_item['date_iso_8601'])).'",'; |
||
| 370 | } |
||
| 371 | if (isset($spotter_item['date'])) { |
||
| 372 | $output .= '"lu": "'.strtotime($spotter_item['date']).'",'; |
||
| 373 | } |
||
| 374 | if (!$min) { |
||
| 375 | $output .= '"latitude": "'.$spotter_item['latitude'].'",'; |
||
| 376 | $output .= '"longitude": "'.$spotter_item['longitude'].'",'; |
||
| 377 | $output .= '"ground_speed": "'.$spotter_item['ground_speed'].'",'; |
||
| 378 | } |
||
| 379 | |||
| 380 | if (isset($spotter_item['altitude'])) { |
||
| 381 | if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
||
| 382 | else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
||
| 383 | } |
||
| 384 | if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",'; |
||
| 385 | else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
||
| 386 | |||
| 387 | if (isset($archivespeed)) { |
||
| 388 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
||
| 389 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
||
| 390 | } elseif ($usenextlatlon) { |
||
| 391 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']); |
||
| 392 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
||
| 393 | } |
||
| 394 | |||
| 395 | if (!$min) $output .= '"image": "'.$image.'",'; |
||
| 396 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
||
| 397 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
||
| 398 | } |
||
| 399 | if (isset($spotter_item['image_source_website'])) { |
||
| 400 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
||
| 401 | } |
||
| 402 | if (isset($spotter_item['squawk'])) { |
||
| 403 | if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
||
| 404 | else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
||
| 405 | } |
||
| 406 | if (isset($spotter_item['squawk_usage'])) { |
||
| 407 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
||
| 408 | } |
||
| 409 | if (isset($spotter_item['pilot_id'])) { |
||
| 410 | $output .= '"pilot_id": "'.$spotter_item['pilot_id'].'",'; |
||
| 411 | } |
||
| 412 | if (isset($spotter_item['pilot_name'])) { |
||
| 413 | $output .= '"pilot_name": "'.$spotter_item['pilot_name'].'",'; |
||
| 414 | } |
||
| 415 | if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') { |
||
| 416 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
||
| 417 | } |
||
| 418 | if (isset($spotter_item['acars'])) { |
||
| 419 | $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
||
| 420 | } |
||
| 421 | // type when not aircraft ? |
||
| 422 | if (isset($spotter_item['type'])) { |
||
| 423 | if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
||
| 424 | else $output .= '"type": "'.$spotter_item['type'].'"'; |
||
| 425 | } elseif ($marine) { |
||
| 426 | if ($compress) $output .= '"t": "ship"'; |
||
| 427 | else $output .= '"type": "ship"'; |
||
| 428 | } else { |
||
| 429 | if ($compress) $output .= '"t": "aircraft"'; |
||
| 430 | else $output .= '"type": "aircraft"'; |
||
| 431 | } |
||
| 432 | $output .= '},'; |
||
| 433 | $output .= '"geometry": {'; |
||
| 434 | $output .= '"type": "Point",'; |
||
| 435 | $output .= '"coordinates": ['; |
||
| 436 | $output .= $spotter_item['longitude'].', '; |
||
| 437 | $output .= $spotter_item['latitude']; |
||
| 438 | /* |
||
| 439 | .', '; |
||
| 440 | $output .= $spotter_item['altitude']*30.48; |
||
| 441 | $output .= ', '.strtotime($spotter_item['date']); |
||
| 442 | */ |
||
| 443 | $output .= ']'; |
||
| 444 | $output .= '}'; |
||
| 445 | $output .= '},'; |
||
| 446 | |||
| 447 | /* } else { |
||
| 448 | $output .= ', '; |
||
| 449 | $output .= $spotter_item['longitude'].', '; |
||
| 450 | $output .= $spotter_item['latitude'].', '; |
||
| 451 | $output .= $spotter_item['altitude']*30.48; |
||
| 452 | $output .= ', '.strtotime($spotter_item['date']); |
||
| 453 | |||
| 454 | } |
||
| 455 | */ |
||
| 456 | |||
| 457 | /* |
||
| 458 | //previous location history of aircraft |
||
| 459 | $output .= '{'; |
||
| 460 | $output .= '"type": "Feature",'; |
||
| 461 | $output .= '"properties": {'; |
||
| 462 | $output .= '"callsign": "'.$spotter_item['ident'].'",'; |
||
| 463 | $output .= '"type": "history"'; |
||
| 464 | $output .= '},'; |
||
| 465 | $output .= '"geometry": {'; |
||
| 466 | $output .= '"type": "LineString",'; |
||
| 467 | $output .= '"coordinates": ['; |
||
| 468 | //$spotter_history_array = SpotterLive::getAllLiveSpotterDataByIdent($spotter_item['ident']); |
||
| 469 | if ($from_archive) { |
||
| 470 | $spotter_history_array = SpotterArchive::getAllArchiveSpotterDataById($spotter_item['flightaware_id']); |
||
| 471 | } else { |
||
| 472 | $spotter_history_array = SpotterLive::getAllLiveSpotterDataById($spotter_item['flightaware_id']); |
||
| 473 | } |
||
| 474 | $d = false; |
||
| 475 | $neg = false; |
||
| 476 | $history_output = ''; |
||
| 477 | foreach ($spotter_history_array as $key => $spotter_history) |
||
| 478 | { |
||
| 479 | if (abs($spotter_history['longitude']-$spotter_item['longitude']) > 200 || $d==true) { |
||
| 480 | if ($d == false) $d = true; |
||
| 481 | } else { |
||
| 482 | $history_output .= '['; |
||
| 483 | $history_output .= $spotter_history['longitude'].', '; |
||
| 484 | $history_output .= $spotter_history['latitude'].','; |
||
| 485 | $history_output .= $spotter_history['altitude']; |
||
| 486 | $history_output .= '],'; |
||
| 487 | |||
| 488 | } |
||
| 489 | } |
||
| 490 | if ($history_output != '') $output .= substr($history_output, 0, -1); |
||
| 491 | $output .= ']'; |
||
| 492 | $output .= '}'; |
||
| 493 | $output .= '},'; |
||
| 494 | |||
| 495 | } |
||
| 496 | */ |
||
| 497 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
||
| 498 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
||
| 499 | |||
| 500 | if ( |
||
| 501 | (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
||
| 502 | || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
||
| 503 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
||
| 504 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
||
| 505 | || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
||
| 506 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
||
| 507 | || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
||
| 508 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
||
| 509 | || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
||
| 510 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
||
| 511 | ) { |
||
| 512 | if ($tracker) { |
||
| 513 | if ($from_archive || $globalArchive) { |
||
| 514 | $spotter_history_array = $TrackerArchive->getAllArchiveTrackerDataById($spotter_item['famtrackid']); |
||
| 515 | } else { |
||
| 516 | $spotter_history_array = $TrackerLive->getAllLiveTrackerDataById($spotter_item['famtrackid']); |
||
| 517 | } |
||
| 518 | } elseif ($marine) { |
||
| 519 | if ($from_archive || $globalArchive) { |
||
| 520 | $spotter_history_array = $MarineArchive->getAllArchiveMarineDataById($spotter_item['fammarine_id']); |
||
| 521 | } else { |
||
| 522 | $spotter_history_array = $MarineLive->getAllLiveMarineDataById($spotter_item['fammarine_id']); |
||
| 523 | } |
||
| 524 | } else { |
||
| 525 | if ($from_archive || $globalArchive) { |
||
| 526 | $spotter_history_array = $SpotterArchive->getAllArchiveSpotterDataById($spotter_item['flightaware_id']); |
||
| 527 | } else { |
||
| 528 | $spotter_history_array = $SpotterLive->getAllLiveSpotterDataById($spotter_item['flightaware_id']); |
||
| 529 | } |
||
| 530 | } |
||
| 531 | $d = false; |
||
| 532 | foreach ($spotter_history_array as $key => $spotter_history) |
||
| 533 | { |
||
| 534 | if (isset($spotter_history['altitude'])) { |
||
| 535 | $alt = round($spotter_history['altitude']/10)*10; |
||
| 536 | if (!isset($prev_alt) || $prev_alt != $alt) { |
||
| 537 | if (isset($prev_alt)) { |
||
| 538 | $output_history .= '['.$spotter_history['longitude'].', '.$spotter_history['latitude'].', '.$spotter_history['altitude'].']'; |
||
| 539 | $output_history .= ']}},'; |
||
| 540 | $output .= $output_history; |
||
| 541 | } |
||
| 542 | if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
||
| 543 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
||
| 544 | } |
||
| 545 | $output_history .= '['; |
||
| 546 | $output_history .= $spotter_history['longitude'].', '; |
||
| 547 | $output_history .= $spotter_history['latitude'].', '; |
||
| 548 | $output_history .= $spotter_history['altitude']*30.48; |
||
| 549 | $output_history .= '],'; |
||
| 550 | /* |
||
| 551 | if ($from_archive === false) { |
||
| 552 | $output_history .= '['; |
||
| 553 | $output_history .= $spotter_item['longitude'].', '; |
||
| 554 | $output_history .= $spotter_item['latitude'].', '; |
||
| 555 | $output_history .= $spotter_item['altitude']*30.48; |
||
| 556 | $output_history .= '],'; |
||
| 557 | } |
||
| 558 | */ |
||
| 559 | $prev_alt = $alt; |
||
| 560 | } else { |
||
| 561 | if ($d == false) { |
||
|
0 ignored issues
–
show
|
|||
| 562 | if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
||
| 563 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
||
| 564 | } else $d = true; |
||
| 565 | $output_history .= '['; |
||
| 566 | $output_history .= $spotter_history['longitude'].', '; |
||
| 567 | $output_history .= $spotter_history['latitude']; |
||
| 568 | $output_history .= '],'; |
||
| 569 | /* |
||
| 570 | if ($from_archive === false) { |
||
| 571 | $output_history .= '['; |
||
| 572 | $output_history .= $spotter_item['longitude'].', '; |
||
| 573 | $output_history .= $spotter_item['latitude']; |
||
| 574 | $output_history .= '],'; |
||
| 575 | } |
||
| 576 | */ |
||
| 577 | } |
||
| 578 | } |
||
| 579 | if (isset($output_history)) { |
||
| 580 | |||
| 581 | if ($from_archive === false) { |
||
| 582 | $output_historyd = '['; |
||
| 583 | $output_historyd .= $spotter_item['longitude'].', '; |
||
| 584 | $output_historyd .= $spotter_item['latitude']; |
||
| 585 | if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
||
| 586 | $output_historyd .= '],'; |
||
| 587 | //$output_history = $output_historyd.$output_history; |
||
| 588 | $output_history = $output_history.$output_historyd; |
||
| 589 | } |
||
| 590 | |||
| 591 | $output_history = substr($output_history, 0, -1); |
||
| 592 | $output_history .= ']}},'; |
||
| 593 | $output .= $output_history; |
||
| 594 | unset($prev_alt); |
||
| 595 | unset($output_history); |
||
| 596 | } |
||
| 597 | } |
||
| 598 | |||
| 599 | if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
||
| 600 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
||
| 601 | && (isset($spotter_item['departure_airport']) |
||
| 602 | && $spotter_item['departure_airport'] != 'NA' |
||
| 603 | && isset($spotter_item['arrival_airport']) |
||
| 604 | && $spotter_item['arrival_airport'] != 'NA' |
||
| 605 | && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
||
| 606 | || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
||
| 607 | if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
||
| 608 | else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
||
| 609 | if (isset($spotter_item['departure_airport_latitude'])) { |
||
| 610 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
||
| 611 | } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
||
| 612 | $dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']); |
||
| 613 | if (isset($dairport[0]['latitude'])) { |
||
| 614 | $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],'; |
||
| 615 | } |
||
| 616 | } |
||
| 617 | if (isset($spotter_item['arrival_airport_latitude'])) { |
||
| 618 | $output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].'],'; |
||
| 619 | } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
||
| 620 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
||
| 621 | if (isset($aairport[0]['latitude'])) { |
||
| 622 | $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],'; |
||
| 623 | } |
||
| 624 | } |
||
| 625 | $output_air = substr($output_air, 0, -1); |
||
| 626 | $output_air .= ']}},'; |
||
| 627 | $output .= $output_air; |
||
| 628 | unset($output_air); |
||
| 629 | } |
||
| 630 | |||
| 631 | //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))))) { |
||
| 632 | //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))))) { |
||
| 633 | if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
||
| 634 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
||
| 635 | && (isset($spotter_item['arrival_airport']) |
||
| 636 | && $spotter_item['arrival_airport'] != 'NA' |
||
| 637 | && ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") |
||
| 638 | || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) |
||
| 639 | || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
||
| 640 | $havedata = false; |
||
| 641 | if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
||
| 642 | else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
||
| 643 | $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
||
| 644 | |||
| 645 | if (isset($spotter_item['arrival_airport_latitude'])) { |
||
| 646 | $output_dest .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']'; |
||
| 647 | $havedata = true; |
||
| 648 | } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
||
| 649 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
||
| 650 | if (isset($aairport[0]['latitude'])) { |
||
| 651 | $output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']'; |
||
| 652 | $havedata = true; |
||
| 653 | } |
||
| 654 | } |
||
| 655 | //$output_dest = substr($output_dest, 0, -1); |
||
| 656 | $output_dest .= ']}},'; |
||
| 657 | if ($havedata) $output .= $output_dest; |
||
| 658 | unset($output_dest); |
||
| 659 | } |
||
| 660 | } |
||
| 661 | $output = substr($output, 0, -1); |
||
| 662 | $output .= ']'; |
||
| 663 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
||
| 664 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
||
| 665 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
||
| 666 | $output .= '"fc": "'.$j.'"'; |
||
| 667 | } else { |
||
| 668 | $output .= '"features": '; |
||
| 669 | $output .= '{'; |
||
| 670 | $output .= '"type": "Feature",'; |
||
| 671 | $output .= '"properties": {'; |
||
| 672 | $output .= '"fc": "'.$flightcnt.'"}}'; |
||
| 673 | } |
||
| 674 | |||
| 675 | $output .= '}'; |
||
| 676 | |||
| 677 | print $output; |
||
| 678 | |||
| 679 | ?> |
||
| 680 |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.