@@ -8,7 +8,9 @@ |
||
8 | 8 | $atcid = filter_input(INPUT_GET,'atcid',FILTER_SANITIZE_NUMBER_INT); |
9 | 9 | $atcident = filter_input(INPUT_GET,'atcident',FILTER_SANITIZE_STRING); |
10 | 10 | $atc_data = $ATC->getById($atcid); |
11 | - if (!isset($atc_data[0])) $atc_data = $ATC->getByIdent($atcident); |
|
11 | + if (!isset($atc_data[0])) { |
|
12 | + $atc_data = $ATC->getByIdent($atcident); |
|
13 | + } |
|
12 | 14 | ?> |
13 | 15 | <div class="alldetails"> |
14 | 16 | <button type="button" class="close">×</button> |
@@ -88,7 +88,9 @@ discard block |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | public function addLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '', $description = '') { |
91 | - if ($last_seen == '') $last_seen = date('Y-m-d H:i:s'); |
|
91 | + if ($last_seen == '') { |
|
92 | + $last_seen = date('Y-m-d H:i:s'); |
|
93 | + } |
|
92 | 94 | $query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source,type,source_id,last_seen,location_id,description) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source,:type,:source_id,:last_seen,:location_id,:description)"; |
93 | 95 | $query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description); |
94 | 96 | try { |
@@ -100,7 +102,9 @@ discard block |
||
100 | 102 | } |
101 | 103 | |
102 | 104 | public function updateLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '',$description = '') { |
103 | - if ($last_seen == '') $last_seen = date('Y-m-d H:i:s'); |
|
105 | + if ($last_seen == '') { |
|
106 | + $last_seen = date('Y-m-d H:i:s'); |
|
107 | + } |
|
104 | 108 | $query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, source_id = :source_id, last_seen = :last_seen,location_id = :location_id, description = :description WHERE name = :name AND source = :source"; |
105 | 109 | $query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description); |
106 | 110 | try { |
@@ -123,7 +127,9 @@ discard block |
||
123 | 127 | } |
124 | 128 | |
125 | 129 | public function updateLocationByLocationID($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0, $location_id,$last_seen = '',$description = '') { |
126 | - if ($last_seen == '') $last_seen = date('Y-m-d H:i:s'); |
|
130 | + if ($last_seen == '') { |
|
131 | + $last_seen = date('Y-m-d H:i:s'); |
|
132 | + } |
|
127 | 133 | $query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, last_seen = :last_seen, description = :description WHERE location_id = :location_id AND source = :source AND source_id = :source_id"; |
128 | 134 | $query_values = array(':source_id' => $source_id,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description); |
129 | 135 | try { |
@@ -29,7 +29,9 @@ discard block |
||
29 | 29 | if (isset($filter[0]['source'])) { |
30 | 30 | $filters = array_merge($filters,$filter); |
31 | 31 | } |
32 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
32 | + if (is_array($globalFilter)) { |
|
33 | + $filter = array_merge($filter,$globalFilter); |
|
34 | + } |
|
33 | 35 | $filter_query_join = ''; |
34 | 36 | $filter_query_where = ''; |
35 | 37 | foreach($filters as $flt) { |
@@ -118,8 +120,11 @@ discard block |
||
118 | 120 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
119 | 121 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
120 | 122 | } |
121 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
122 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
123 | + if ($filter_query_where == '' && $where) { |
|
124 | + $filter_query_where = ' WHERE'; |
|
125 | + } elseif ($filter_query_where != '' && $and) { |
|
126 | + $filter_query_where .= ' AND'; |
|
127 | + } |
|
123 | 128 | if ($filter_query_where != '') { |
124 | 129 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
125 | 130 | } |
@@ -160,9 +165,13 @@ discard block |
||
160 | 165 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
161 | 166 | } |
162 | 167 | } |
163 | - if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC'; |
|
168 | + if ($orderby_query == '') { |
|
169 | + $orderby_query = ' ORDER BY date DESC'; |
|
170 | + } |
|
164 | 171 | |
165 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
172 | + if (!isset($globalLiveInterval)) { |
|
173 | + $globalLiveInterval = '200'; |
|
174 | + } |
|
166 | 175 | if ($globalDBdriver == 'mysql') { |
167 | 176 | //$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
168 | 177 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -185,7 +194,9 @@ discard block |
||
185 | 194 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
186 | 195 | date_default_timezone_set('UTC'); |
187 | 196 | $filter_query = $this->getFilter($filter,true,true); |
188 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
197 | + if (!isset($globalLiveInterval)) { |
|
198 | + $globalLiveInterval = '200'; |
|
199 | + } |
|
189 | 200 | if ($globalDBdriver == 'mysql') { |
190 | 201 | if (isset($globalArchive) && $globalArchive === TRUE) { |
191 | 202 | $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
@@ -228,7 +239,9 @@ discard block |
||
228 | 239 | |
229 | 240 | $filter_query = $this->getFilter($filter,true,true); |
230 | 241 | |
231 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
242 | + if (!isset($globalLiveInterval)) { |
|
243 | + $globalLiveInterval = '200'; |
|
244 | + } |
|
232 | 245 | if ($globalDBdriver == 'mysql') { |
233 | 246 | if (isset($globalArchive) && $globalArchive === TRUE) { |
234 | 247 | /* |
@@ -296,7 +309,9 @@ discard block |
||
296 | 309 | global $globalDBdriver, $globalLiveInterval; |
297 | 310 | $filter_query = $this->getFilter($filter,true,true); |
298 | 311 | |
299 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
312 | + if (!isset($globalLiveInterval)) { |
|
313 | + $globalLiveInterval = '200'; |
|
314 | + } |
|
300 | 315 | if ($globalDBdriver == 'mysql') { |
301 | 316 | //$query = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query; |
302 | 317 | $query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
@@ -326,7 +341,9 @@ discard block |
||
326 | 341 | { |
327 | 342 | global $globalDBdriver, $globalLiveInterval; |
328 | 343 | $Spotter = new Spotter($this->db); |
329 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
344 | + if (!isset($globalLiveInterval)) { |
|
345 | + $globalLiveInterval = '200'; |
|
346 | + } |
|
330 | 347 | $filter_query = $this->getFilter($filter); |
331 | 348 | |
332 | 349 | if (is_array($coord)) { |
@@ -334,7 +351,9 @@ discard block |
||
334 | 351 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
335 | 352 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
336 | 353 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
337 | - } else return array(); |
|
354 | + } else { |
|
355 | + return array(); |
|
356 | + } |
|
338 | 357 | if ($globalDBdriver == 'mysql') { |
339 | 358 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
340 | 359 | } else { |
@@ -355,7 +374,9 @@ discard block |
||
355 | 374 | { |
356 | 375 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
357 | 376 | $Spotter = new Spotter($this->db); |
358 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
377 | + if (!isset($globalLiveInterval)) { |
|
378 | + $globalLiveInterval = '200'; |
|
379 | + } |
|
359 | 380 | $filter_query = $this->getFilter($filter,true,true); |
360 | 381 | |
361 | 382 | if (is_array($coord)) { |
@@ -363,7 +384,9 @@ discard block |
||
363 | 384 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
364 | 385 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
365 | 386 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
366 | - } else return array(); |
|
387 | + } else { |
|
388 | + return array(); |
|
389 | + } |
|
367 | 390 | if ($globalDBdriver == 'mysql') { |
368 | 391 | if (isset($globalArchive) && $globalArchive === TRUE) { |
369 | 392 | $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
@@ -593,11 +616,15 @@ discard block |
||
593 | 616 | //$query = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date'; |
594 | 617 | if ($globalDBdriver == 'mysql') { |
595 | 618 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
596 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
619 | + if ($liveinterval) { |
|
620 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
621 | + } |
|
597 | 622 | $query .= ' ORDER BY date'; |
598 | 623 | } else { |
599 | 624 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
600 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
625 | + if ($liveinterval) { |
|
626 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
627 | + } |
|
601 | 628 | $query .= ' ORDER BY date'; |
602 | 629 | } |
603 | 630 | |
@@ -692,7 +719,9 @@ discard block |
||
692 | 719 | $i++; |
693 | 720 | $j++; |
694 | 721 | if ($j == 30) { |
695 | - if ($globalDebug) echo "."; |
|
722 | + if ($globalDebug) { |
|
723 | + echo "."; |
|
724 | + } |
|
696 | 725 | try { |
697 | 726 | |
698 | 727 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -999,7 +1028,9 @@ discard block |
||
999 | 1028 | { |
1000 | 1029 | return false; |
1001 | 1030 | } |
1002 | - } else return ''; |
|
1031 | + } else { |
|
1032 | + return ''; |
|
1033 | + } |
|
1003 | 1034 | |
1004 | 1035 | if ($longitude != '') |
1005 | 1036 | { |
@@ -1007,7 +1038,9 @@ discard block |
||
1007 | 1038 | { |
1008 | 1039 | return false; |
1009 | 1040 | } |
1010 | - } else return ''; |
|
1041 | + } else { |
|
1042 | + return ''; |
|
1043 | + } |
|
1011 | 1044 | |
1012 | 1045 | if ($waypoints != '') |
1013 | 1046 | { |
@@ -1023,14 +1056,18 @@ discard block |
||
1023 | 1056 | { |
1024 | 1057 | return false; |
1025 | 1058 | } |
1026 | - } else $altitude = 0; |
|
1059 | + } else { |
|
1060 | + $altitude = 0; |
|
1061 | + } |
|
1027 | 1062 | if ($altitude_real != '') |
1028 | 1063 | { |
1029 | 1064 | if (!is_numeric($altitude_real)) |
1030 | 1065 | { |
1031 | 1066 | return false; |
1032 | 1067 | } |
1033 | - } else $altitude_real = 0; |
|
1068 | + } else { |
|
1069 | + $altitude_real = 0; |
|
1070 | + } |
|
1034 | 1071 | |
1035 | 1072 | if ($heading != '') |
1036 | 1073 | { |
@@ -1038,7 +1075,9 @@ discard block |
||
1038 | 1075 | { |
1039 | 1076 | return false; |
1040 | 1077 | } |
1041 | - } else $heading = 0; |
|
1078 | + } else { |
|
1079 | + $heading = 0; |
|
1080 | + } |
|
1042 | 1081 | |
1043 | 1082 | if ($groundspeed != '') |
1044 | 1083 | { |
@@ -1046,9 +1085,13 @@ discard block |
||
1046 | 1085 | { |
1047 | 1086 | return false; |
1048 | 1087 | } |
1049 | - } else $groundspeed = 0; |
|
1088 | + } else { |
|
1089 | + $groundspeed = 0; |
|
1090 | + } |
|
1050 | 1091 | date_default_timezone_set('UTC'); |
1051 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
1092 | + if ($date == '') { |
|
1093 | + $date = date("Y-m-d H:i:s", time()); |
|
1094 | + } |
|
1052 | 1095 | |
1053 | 1096 | |
1054 | 1097 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -1093,14 +1136,24 @@ discard block |
||
1093 | 1136 | $arrival_airport_country = ''; |
1094 | 1137 | |
1095 | 1138 | |
1096 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1097 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1098 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1099 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1139 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) { |
|
1140 | + $squawk = NULL; |
|
1141 | + } |
|
1142 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) { |
|
1143 | + $verticalrate = NULL; |
|
1144 | + } |
|
1145 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
1146 | + $groundspeed = 0; |
|
1147 | + } |
|
1148 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
1149 | + $heading = 0; |
|
1150 | + } |
|
1100 | 1151 | |
1101 | 1152 | $query = ''; |
1102 | 1153 | if ($globalArchive) { |
1103 | - if ($globalDebug) echo '-- Delete previous data -- '; |
|
1154 | + if ($globalDebug) { |
|
1155 | + echo '-- Delete previous data -- '; |
|
1156 | + } |
|
1104 | 1157 | $query .= 'DELETE FROM spotter_live WHERE flightaware_id = :flightaware_id;'; |
1105 | 1158 | } |
1106 | 1159 | |
@@ -1117,10 +1170,14 @@ discard block |
||
1117 | 1170 | return "error : ".$e->getMessage(); |
1118 | 1171 | } |
1119 | 1172 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1120 | - if ($globalDebug) echo '(Add to SBS archive : '; |
|
1173 | + if ($globalDebug) { |
|
1174 | + echo '(Add to SBS archive : '; |
|
1175 | + } |
|
1121 | 1176 | $SpotterArchive = new SpotterArchive($this->db); |
1122 | 1177 | $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
1123 | - if ($globalDebug) echo $result.')'; |
|
1178 | + if ($globalDebug) { |
|
1179 | + echo $result.')'; |
|
1180 | + } |
|
1124 | 1181 | } elseif ($globalDebug && $putinarchive !== true) { |
1125 | 1182 | echo '(Not adding to archive)'; |
1126 | 1183 | } elseif ($globalDebug && $noarchive === true) { |
@@ -113,8 +113,11 @@ discard block |
||
113 | 113 | $data = array(); |
114 | 114 | if ($row['registration'] != '') { |
115 | 115 | $image_array = $Image->getSpotterImage($row['registration']); |
116 | - if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website'])); |
|
117 | - else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
116 | + if (count($image_array) > 0) { |
|
117 | + $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website'])); |
|
118 | + } else { |
|
119 | + $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
120 | + } |
|
118 | 121 | $aircraft_type = $Spotter->getAllAircraftTypeByRegistration($row['registration']); |
119 | 122 | $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type); |
120 | 123 | if (!empty($aircraft_info)) { |
@@ -130,17 +133,30 @@ discard block |
||
130 | 133 | $data['aircraft_base'] = $owner_data['base']; |
131 | 134 | $data['aircraft_date_first_reg'] = $owner_data['date_first_reg']; |
132 | 135 | } |
133 | - } else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
134 | - if ($row['registration'] == '') $row['registration'] = 'NA'; |
|
135 | - if ($row['ident'] == '') $row['ident'] = 'NA'; |
|
136 | + } else { |
|
137 | + $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
138 | + } |
|
139 | + if ($row['registration'] == '') { |
|
140 | + $row['registration'] = 'NA'; |
|
141 | + } |
|
142 | + if ($row['ident'] == '') { |
|
143 | + $row['ident'] = 'NA'; |
|
144 | + } |
|
136 | 145 | $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,3)); |
137 | 146 | if (isset($identicao[0])) { |
138 | 147 | if (substr($row['ident'],0,2) == 'AF') { |
139 | - if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
140 | - else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
141 | - } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
148 | + if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) { |
|
149 | + $icao = $row['ident']; |
|
150 | + } else { |
|
151 | + $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
152 | + } |
|
153 | + } else { |
|
154 | + $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
155 | + } |
|
142 | 156 | $data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name'])); |
143 | - } else $icao = $row['ident']; |
|
157 | + } else { |
|
158 | + $icao = $row['ident']; |
|
159 | + } |
|
144 | 160 | $icao = $Translation->checkTranslation($icao,false); |
145 | 161 | //$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url'])); |
146 | 162 | if ($row['airline_name'] != '' && !isset($data['airline_name'])) { |
@@ -155,10 +171,14 @@ discard block |
||
155 | 171 | //else echo 'No data...'."\n"; |
156 | 172 | } |
157 | 173 | $data = array_merge($row,$data); |
158 | - if ($data['ident'] == null) $data['ident'] = $icao; |
|
174 | + if ($data['ident'] == null) { |
|
175 | + $data['ident'] = $icao; |
|
176 | + } |
|
159 | 177 | if ($data['title'] == null) { |
160 | 178 | $data['message'] = $row['type'].' of '.$row['registration'].' at '.$row['place'].','.$row['country']; |
161 | - } else $data['message'] = strtolower($data['title']); |
|
179 | + } else { |
|
180 | + $data['message'] = strtolower($data['title']); |
|
181 | + } |
|
162 | 182 | $ids = $Spotter->getAllIDByRegistration($data['registration']); |
163 | 183 | $date = $data['date']; |
164 | 184 | if (isset($ids[$date])) { |
@@ -177,8 +197,9 @@ discard block |
||
177 | 197 | if (isset($result)) { |
178 | 198 | $result[0]['query_number_rows'] = $i; |
179 | 199 | return $result; |
200 | + } else { |
|
201 | + return array(); |
|
180 | 202 | } |
181 | - else return array(); |
|
182 | 203 | } |
183 | 204 | |
184 | 205 | /* |
@@ -222,7 +243,9 @@ discard block |
||
222 | 243 | */ |
223 | 244 | public function import($file) { |
224 | 245 | global $globalTransaction, $globalDebug; |
225 | - if ($globalDebug) echo 'Import '.$file."\n"; |
|
246 | + if ($globalDebug) { |
|
247 | + echo 'Import '.$file."\n"; |
|
248 | + } |
|
226 | 249 | $result = array(); |
227 | 250 | if (file_exists($file)) { |
228 | 251 | if (($handle = fopen($file,'r')) !== FALSE) { |
@@ -233,8 +256,11 @@ discard block |
||
233 | 256 | } |
234 | 257 | fclose($handle); |
235 | 258 | } |
236 | - if (!empty($result)) $this->add($result,true); |
|
237 | - elseif ($globalDebug) echo 'Nothing to import'; |
|
259 | + if (!empty($result)) { |
|
260 | + $this->add($result,true); |
|
261 | + } elseif ($globalDebug) { |
|
262 | + echo 'Nothing to import'; |
|
263 | + } |
|
238 | 264 | } |
239 | 265 | } |
240 | 266 | |
@@ -270,14 +296,23 @@ discard block |
||
270 | 296 | } |
271 | 297 | } |
272 | 298 | fclose($handle); |
273 | - } elseif ($globalDebug) echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5'; |
|
274 | - } elseif ($globalDebug) echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.'; |
|
299 | + } elseif ($globalDebug) { |
|
300 | + echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5'; |
|
301 | + } |
|
302 | + } elseif ($globalDebug) { |
|
303 | + echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.'; |
|
304 | + } |
|
275 | 305 | $result = $Common->arr_diff($all_md5_new,$all_md5); |
276 | - if (empty($result) && $globalDebug) echo 'Nothing to update'; |
|
306 | + if (empty($result) && $globalDebug) { |
|
307 | + echo 'Nothing to update'; |
|
308 | + } |
|
277 | 309 | foreach ($result as $file => $md5) { |
278 | 310 | $Common->download('http://data.flightairmap.fr/data/cr/'.$file,dirname(__FILE__).'/../install/tmp/'.$file); |
279 | - if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) $this->import(dirname(__FILE__).'/../install/tmp/'.$file); |
|
280 | - elseif ($globalDebug) echo 'Download '.$file.' failed'; |
|
311 | + if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) { |
|
312 | + $this->import(dirname(__FILE__).'/../install/tmp/'.$file); |
|
313 | + } elseif ($globalDebug) { |
|
314 | + echo 'Download '.$file.' failed'; |
|
315 | + } |
|
281 | 316 | } |
282 | 317 | } |
283 | 318 | |
@@ -294,13 +329,17 @@ discard block |
||
294 | 329 | $Image = new Image(); |
295 | 330 | $Spotter = new Spotter(); |
296 | 331 | |
297 | - if (empty($crash)) return false; |
|
332 | + if (empty($crash)) { |
|
333 | + return false; |
|
334 | + } |
|
298 | 335 | if (!$new) { |
299 | 336 | $query_delete = 'DELETE FROM accidents WHERE source = :source'; |
300 | 337 | $sthd = $Connection->db->prepare($query_delete); |
301 | 338 | $sthd->execute(array(':source' => $crash[0]['source'])); |
302 | 339 | } |
303 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
340 | + if ($globalTransaction) { |
|
341 | + $Connection->db->beginTransaction(); |
|
342 | + } |
|
304 | 343 | $initial_array = array('ident' => null,'type' => 'accident','url' => null,'registration' => null, 'date' => null, 'place' => null,'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '','source' => '','aircraft_manufacturer' => null,'aircraft_name' => null,'operator' => null); |
305 | 344 | $query_check = 'SELECT COUNT(*) as nb FROM accidents WHERE registration = :registration AND date = :date AND type = :type AND source = :source'; |
306 | 345 | $sth_check = $Connection->db->prepare($query_check); |
@@ -315,7 +354,9 @@ discard block |
||
315 | 354 | return $value === "" ? NULL : $value; |
316 | 355 | }, $cr); |
317 | 356 | if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/',$cr['registration'])) { |
318 | - if (strpos($cr['registration'],'-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']); |
|
357 | + if (strpos($cr['registration'],'-') === FALSE) { |
|
358 | + $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']); |
|
359 | + } |
|
319 | 360 | $query_check_values = array(':registration' => $cr['registration'],':date' => date('Y-m-d',$cr['date']),':type' => $cr['type'],':source' => $cr['source']); |
320 | 361 | $sth_check->execute($query_check_values); |
321 | 362 | $result_check = $sth_check->fetch(PDO::FETCH_ASSOC); |
@@ -324,13 +365,19 @@ discard block |
||
324 | 365 | $sth->execute($query_values); |
325 | 366 | if ($cr['date'] > time()-(30*86400)) { |
326 | 367 | if (empty($Image->getSpotterImage($cr['registration']))) { |
327 | - if ($globalDebug) echo "\t".'Get image for '.$cr['registration'].'...'; |
|
368 | + if ($globalDebug) { |
|
369 | + echo "\t".'Get image for '.$cr['registration'].'...'; |
|
370 | + } |
|
328 | 371 | $Image->addSpotterImage($cr['registration']); |
329 | - if ($globalDebug) echo "\t".'Done'."\n"; |
|
372 | + if ($globalDebug) { |
|
373 | + echo "\t".'Done'."\n"; |
|
374 | + } |
|
330 | 375 | } |
331 | 376 | // elseif ($globalDebug) echo 'Image already in DB'."\n"; |
332 | 377 | } |
333 | - if ($cr['title'] == '') $cr['title'] = $cr['registration'].' '.$cr['type']; |
|
378 | + if ($cr['title'] == '') { |
|
379 | + $cr['title'] = $cr['registration'].' '.$cr['type']; |
|
380 | + } |
|
334 | 381 | $Spotter->setHighlightFlightByRegistration($cr['registration'],$cr['title'],date('Y-m-d',$cr['date'])); |
335 | 382 | } |
336 | 383 | } |
@@ -339,9 +386,13 @@ discard block |
||
339 | 386 | $Connection->db->beginTransaction(); |
340 | 387 | } |
341 | 388 | } |
342 | - if ($globalTransaction) $Connection->db->commit(); |
|
389 | + if ($globalTransaction) { |
|
390 | + $Connection->db->commit(); |
|
391 | + } |
|
343 | 392 | } catch(PDOException $e) { |
344 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
393 | + if ($globalTransaction) { |
|
394 | + $Connection->db->rollBack(); |
|
395 | + } |
|
345 | 396 | echo $e->getMessage(); |
346 | 397 | } |
347 | 398 | $sth_check->closeCursor(); |
@@ -380,8 +431,11 @@ discard block |
||
380 | 431 | return "error : ".$e->getMessage(); |
381 | 432 | } |
382 | 433 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
383 | - if ($row['nb'] > 0) return false; |
|
384 | - else return true; |
|
434 | + if ($row['nb'] > 0) { |
|
435 | + return false; |
|
436 | + } else { |
|
437 | + return true; |
|
438 | + } |
|
385 | 439 | } |
386 | 440 | |
387 | 441 | public static function insert_last_accidents_update() { |
@@ -57,7 +57,9 @@ discard block |
||
57 | 57 | { |
58 | 58 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
59 | 59 | $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
60 | - } else $image = $spotter_item['image_thumbnail']; |
|
60 | + } else { |
|
61 | + $image = $spotter_item['image_thumbnail']; |
|
62 | + } |
|
61 | 63 | |
62 | 64 | } |
63 | 65 | /* else { |
@@ -70,8 +72,12 @@ discard block |
||
70 | 72 | } |
71 | 73 | print '<div class="right">'; |
72 | 74 | print '<div class="callsign-details">'; |
73 | -if ($spotter_item['ident'] != 'Not Available') print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>'; |
|
74 | -if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') print '<div class="airline">'.$spotter_item['airline_name'].'</div>'; |
|
75 | +if ($spotter_item['ident'] != 'Not Available') { |
|
76 | + print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>'; |
|
77 | +} |
|
78 | +if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') { |
|
79 | + print '<div class="airline">'.$spotter_item['airline_name'].'</div>'; |
|
80 | +} |
|
75 | 81 | print '</div>'; |
76 | 82 | if ($spotter_item['departure_airport'] != 'NA' && $spotter_item['arrival_airport'] != 'NA') { |
77 | 83 | print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country']; |
@@ -103,10 +109,16 @@ discard block |
||
103 | 109 | print '</div>'; |
104 | 110 | print '<div id="aircraft">'; |
105 | 111 | print '<span>'._("Aircraft").'</span>'; |
106 | -if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
|
107 | -if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
108 | -elseif (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>'; |
|
109 | -else print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name']; |
|
112 | +if (isset($spotter_item['aircraft_wiki'])) { |
|
113 | + print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
|
114 | +} |
|
115 | +if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') { |
|
116 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
117 | +} elseif (isset($spotter_item['aircraft_type'])) { |
|
118 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>'; |
|
119 | +} else { |
|
120 | + print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name']; |
|
121 | +} |
|
110 | 122 | print '</div>'; |
111 | 123 | print '<div id ="altitude"><span>'._("Altitude").'</span>'; |
112 | 124 | if (isset($globalGroundAltitude) && $globalGroundAltitude) { |
@@ -117,12 +129,18 @@ discard block |
||
117 | 129 | } |
118 | 130 | |
119 | 131 | if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
120 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')'; |
|
121 | - else print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')'; |
|
122 | -} else { |
|
123 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')'; |
|
124 | - else print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')'; |
|
125 | -} |
|
132 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
133 | + print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')'; |
|
134 | + } else { |
|
135 | + print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')'; |
|
136 | + } |
|
137 | + } else { |
|
138 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
139 | + print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')'; |
|
140 | + } else { |
|
141 | + print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')'; |
|
142 | + } |
|
143 | + } |
|
126 | 144 | |
127 | 145 | if (isset($groundAltitude) && $groundAltitude < $spotter_item['altitude']*30.48) { |
128 | 146 | print '<br>'; |
@@ -136,7 +154,9 @@ discard block |
||
136 | 154 | } |
137 | 155 | |
138 | 156 | print '</div>'; |
139 | -if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>'; |
|
157 | +if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') { |
|
158 | + print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>'; |
|
159 | +} |
|
140 | 160 | print '<div id="speed"><span>'._("Speed").'</span>'; |
141 | 161 | if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
142 | 162 | print round($spotter_item['ground_speed']*1.15078).' mph'; |
@@ -150,8 +170,11 @@ discard block |
||
150 | 170 | print '<div id="heading"><span>'._("Heading").'</span>'.$spotter_item['heading'].'°</div>'; |
151 | 171 | if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != '') { |
152 | 172 | print '<div id="pilot"><span>'._("Pilot").'</span>'; |
153 | - if (isset($spotter_item['pilot_id'])) print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
154 | - else print $spotter_item['pilot_name']; |
|
173 | + if (isset($spotter_item['pilot_id'])) { |
|
174 | + print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
175 | + } else { |
|
176 | + print $spotter_item['pilot_name']; |
|
177 | + } |
|
155 | 178 | print '</div>'; |
156 | 179 | } |
157 | 180 | |
@@ -179,10 +202,18 @@ discard block |
||
179 | 202 | print '</div>'; |
180 | 203 | print '</div>'; |
181 | 204 | |
182 | -if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
|
183 | -if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
|
184 | -if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
185 | -if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
|
205 | +if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') { |
|
206 | + print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
|
207 | +} |
|
208 | +if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') { |
|
209 | + print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
|
210 | +} |
|
211 | +if (isset($spotter_item['acars']['message'])) { |
|
212 | + print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
213 | +} |
|
214 | +if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) { |
|
215 | + print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
|
216 | +} |
|
186 | 217 | print '</div>'; |
187 | 218 | ?> |
188 | 219 | </div> |
189 | 220 | \ No newline at end of file |
@@ -1,8 +1,10 @@ discard block |
||
1 | 1 | </section> |
2 | 2 | <div class="pub onmap"> |
3 | 3 | <?php |
4 | - if (isset($globalPub)) print $globalPub; |
|
5 | -?> |
|
4 | + if (isset($globalPub)) { |
|
5 | + print $globalPub; |
|
6 | + } |
|
7 | + ?> |
|
6 | 8 | </div> |
7 | 9 | <footer class="container"> |
8 | 10 | <?php |
@@ -13,7 +15,10 @@ discard block |
||
13 | 15 | <?php |
14 | 16 | } |
15 | 17 | ?> |
16 | - <span>Developed in Barrie by <a href="http://mtru.nz/" target="_blank">Mario Trunz</a> & at <a href="http://www.zugaina.com" target="_blank">Zugaina</a> by Ycarus</span> - <span><a href="<?php if (isset($globalURL)) print $globalURL; ?>/about#source">Source & Credits</a></span> - <span><a href="https://www.flightairmap.fr/" target="_blank">Get source code</a></span> |
|
18 | + <span>Developed in Barrie by <a href="http://mtru.nz/" target="_blank">Mario Trunz</a> & at <a href="http://www.zugaina.com" target="_blank">Zugaina</a> by Ycarus</span> - <span><a href="<?php if (isset($globalURL)) { |
|
19 | + print $globalURL; |
|
20 | +} |
|
21 | +?>/about#source">Source & Credits</a></span> - <span><a href="https://www.flightairmap.fr/" target="_blank">Get source code</a></span> |
|
17 | 22 | </footer> |
18 | 23 | |
19 | 24 | <div class="notifications bottom-left"></div> |
@@ -28,7 +28,9 @@ discard block |
||
28 | 28 | private $openedFiles = []; |
29 | 29 | |
30 | 30 | public function __construct($htgFilesDestination = '', $resolution = 3) { |
31 | - if ($htgFilesDestination == '') $htgFilesDestination = dirname(__FILE__).'/../data/'; |
|
31 | + if ($htgFilesDestination == '') { |
|
32 | + $htgFilesDestination = dirname(__FILE__).'/../data/'; |
|
33 | + } |
|
32 | 34 | $this->htgFilesDestination = $htgFilesDestination; |
33 | 35 | $this->resolution = $resolution; |
34 | 36 | switch ($resolution) { |
@@ -171,16 +173,26 @@ discard block |
||
171 | 173 | $fileName = "N{$N}E{$E}.hgt"; |
172 | 174 | if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) { |
173 | 175 | $Common = new Common(); |
174 | - if ($debug) echo 'Downloading '.$fileName.'.gz ...'; |
|
176 | + if ($debug) { |
|
177 | + echo 'Downloading '.$fileName.'.gz ...'; |
|
178 | + } |
|
175 | 179 | $Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz'); |
176 | 180 | if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz')) { |
177 | - if ($debug) echo "File '{$fileName}.gz' not exists."; |
|
181 | + if ($debug) { |
|
182 | + echo "File '{$fileName}.gz' not exists."; |
|
183 | + } |
|
178 | 184 | return false; |
179 | 185 | } |
180 | - if ($debug) echo 'Done'."\n"; |
|
181 | - if ($debug) echo 'Decompress '.$fileName.' ....'; |
|
186 | + if ($debug) { |
|
187 | + echo 'Done'."\n"; |
|
188 | + } |
|
189 | + if ($debug) { |
|
190 | + echo 'Decompress '.$fileName.' ....'; |
|
191 | + } |
|
182 | 192 | $Common->gunzip($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName); |
183 | - if ($debug) echo 'Done'."\n"; |
|
193 | + if ($debug) { |
|
194 | + echo 'Done'."\n"; |
|
195 | + } |
|
184 | 196 | unlink($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz'); |
185 | 197 | } |
186 | 198 | return true; |
@@ -38,8 +38,11 @@ discard block |
||
38 | 38 | global $globalGeoidSource; |
39 | 39 | //if ($name == '') $name = dirname(__FILE__).'/../install/tmp/egm2008-1.pgm'; |
40 | 40 | if ($name == '') { |
41 | - if (isset($globalGeoidSource) && $globalGeoidSource != '') $name = dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'; |
|
42 | - else $name = dirname(__FILE__).'/../data/egm96-15.pgm'; |
|
41 | + if (isset($globalGeoidSource) && $globalGeoidSource != '') { |
|
42 | + $name = dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'; |
|
43 | + } else { |
|
44 | + $name = dirname(__FILE__).'/../data/egm96-15.pgm'; |
|
45 | + } |
|
43 | 46 | } |
44 | 47 | |
45 | 48 | $f = @fopen($name,"r"); |
@@ -156,7 +159,9 @@ discard block |
||
156 | 159 | } |
157 | 160 | } |
158 | 161 | $this->t = $t; |
159 | - } else $t = $this->t; |
|
162 | + } else { |
|
163 | + $t = $this->t; |
|
164 | + } |
|
160 | 165 | if (!($cubic)) { |
161 | 166 | $a = (((1 - $fx) * $this->v00) + ($fx * $this->v01)); |
162 | 167 | $b = (((1 - $fx) * $this->v10) + ($fx * $this->v11)); |
@@ -48,27 +48,52 @@ discard block |
||
48 | 48 | } |
49 | 49 | header('Content-Type: text/javascript'); |
50 | 50 | |
51 | -if (!isset($globalJsonCompress)) $compress = true; |
|
52 | -else $compress = $globalJsonCompress; |
|
51 | +if (!isset($globalJsonCompress)) { |
|
52 | + $compress = true; |
|
53 | +} else { |
|
54 | + $compress = $globalJsonCompress; |
|
55 | +} |
|
53 | 56 | |
54 | 57 | $from_archive = false; |
55 | 58 | $min = true; |
56 | 59 | $allhistory = false; |
57 | 60 | $filter['source'] = array(); |
58 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
59 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
60 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
61 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
62 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
63 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
64 | -if (isset($_COOKIE['filter_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); |
|
61 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
62 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
63 | +} |
|
64 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
65 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
66 | +} |
|
67 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
68 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
69 | +} |
|
70 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
71 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
72 | +} |
|
73 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
74 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
75 | +} |
|
76 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
77 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
78 | +} |
|
79 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
80 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
81 | +} |
|
82 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
83 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
84 | +} |
|
85 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
86 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
87 | +} |
|
88 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
89 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
90 | +} |
|
68 | 91 | |
69 | 92 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
70 | 93 | $min = true; |
71 | -} else $min = false; |
|
94 | +} else { |
|
95 | + $min = false; |
|
96 | +} |
|
72 | 97 | |
73 | 98 | if (isset($_GET['ident'])) { |
74 | 99 | $ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
@@ -157,21 +182,33 @@ discard block |
||
157 | 182 | } else { |
158 | 183 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
159 | 184 | } |
160 | - } else $flightcnt = count($spotter_array); |
|
161 | - if ($flightcnt == '') $flightcnt = 0; |
|
162 | -} else $flightcnt = 0; |
|
185 | + } else { |
|
186 | + $flightcnt = count($spotter_array); |
|
187 | + } |
|
188 | + if ($flightcnt == '') { |
|
189 | + $flightcnt = 0; |
|
190 | + } |
|
191 | + } else { |
|
192 | + $flightcnt = 0; |
|
193 | +} |
|
163 | 194 | |
164 | 195 | $sqltime = round(microtime(true)-$begintime,2); |
165 | 196 | |
166 | -if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
|
167 | -else $usenextlatlon = true; |
|
197 | +if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) { |
|
198 | + $usenextlatlon = false; |
|
199 | +} else { |
|
200 | + $usenextlatlon = true; |
|
201 | +} |
|
168 | 202 | $j = 0; |
169 | 203 | $prev_flightaware_id = ''; |
170 | 204 | $aircrafts_shadow = array(); |
171 | 205 | $output = '{'; |
172 | 206 | $output .= '"type": "FeatureCollection",'; |
173 | - if ($min) $output .= '"minimal": "true",'; |
|
174 | - else $output .= '"minimal": "false",'; |
|
207 | + if ($min) { |
|
208 | + $output .= '"minimal": "true",'; |
|
209 | + } else { |
|
210 | + $output .= '"minimal": "false",'; |
|
211 | + } |
|
175 | 212 | //$output .= '"fc": "'.$flightcnt.'",'; |
176 | 213 | $output .= '"sqt": "'.$sqltime.'",'; |
177 | 214 | |
@@ -215,18 +252,29 @@ discard block |
||
215 | 252 | } |
216 | 253 | $output .= '"properties": {'; |
217 | 254 | if (isset($spotter_item['flightaware_id'])) { |
218 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
219 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
255 | + if ($compress) { |
|
256 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
257 | + } else { |
|
258 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
259 | + } |
|
220 | 260 | } elseif (isset($spotter_item['famtrackid'])) { |
221 | - if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
222 | - else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
261 | + if ($compress) { |
|
262 | + $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
263 | + } else { |
|
264 | + $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
265 | + } |
|
223 | 266 | } elseif (isset($spotter_item['fammarine_id'])) { |
224 | - if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
225 | - else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
267 | + if ($compress) { |
|
268 | + $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
269 | + } else { |
|
270 | + $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
271 | + } |
|
226 | 272 | } |
227 | 273 | $output .= '"fc": "'.$flightcnt.'",'; |
228 | 274 | $output .= '"sqt": "'.$sqltime.'",'; |
229 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
275 | + if (isset($begindate)) { |
|
276 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
277 | + } |
|
230 | 278 | |
231 | 279 | /* |
232 | 280 | if ($min) $output .= '"minimal": "true",'; |
@@ -234,14 +282,22 @@ discard block |
||
234 | 282 | */ |
235 | 283 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
236 | 284 | 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']).'",'; |
|
285 | + if ($compress) { |
|
286 | + $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
287 | + } else { |
|
288 | + $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
289 | + } |
|
239 | 290 | //" |
240 | 291 | } else { |
241 | - if ($compress) $output .= '"c": "NA",'; |
|
242 | - else $output .= '"callsign": "NA",'; |
|
292 | + if ($compress) { |
|
293 | + $output .= '"c": "NA",'; |
|
294 | + } else { |
|
295 | + $output .= '"callsign": "NA",'; |
|
296 | + } |
|
297 | + } |
|
298 | + if (isset($spotter_item['registration'])) { |
|
299 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
243 | 300 | } |
244 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
245 | 301 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
246 | 302 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
247 | 303 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
@@ -254,16 +310,23 @@ discard block |
||
254 | 310 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
255 | 311 | } |
256 | 312 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker) { |
257 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
258 | - else { |
|
313 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
314 | + $spotter_item['aircraft_shadow'] = ''; |
|
315 | + } else { |
|
259 | 316 | $aircraft_icao = $spotter_item['aircraft_icao']; |
260 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
261 | - else { |
|
317 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
318 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
319 | + } else { |
|
262 | 320 | $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'] = ''; |
|
321 | + if (count($aircraft_info) > 0) { |
|
322 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
323 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
324 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
325 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
326 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
327 | + } else { |
|
328 | + $spotter_item['aircraft_shadow'] = ''; |
|
329 | + } |
|
267 | 330 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
268 | 331 | } |
269 | 332 | } |
@@ -271,73 +334,139 @@ discard block |
||
271 | 334 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
272 | 335 | if ($tracker) { |
273 | 336 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
274 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
275 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
337 | + if ($compress) { |
|
338 | + $output .= '"as": "ambulance.png",'; |
|
339 | + } else { |
|
340 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
341 | + } |
|
276 | 342 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
277 | - if ($compress) $output .= '"as": "police.png",'; |
|
278 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
343 | + if ($compress) { |
|
344 | + $output .= '"as": "police.png",'; |
|
345 | + } else { |
|
346 | + $output .= '"aircraft_shadow": "police.png",'; |
|
347 | + } |
|
279 | 348 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
280 | - if ($compress) $output .= '"as": "ship.png",'; |
|
281 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
349 | + if ($compress) { |
|
350 | + $output .= '"as": "ship.png",'; |
|
351 | + } else { |
|
352 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
353 | + } |
|
282 | 354 | } 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",'; |
|
355 | + if ($compress) { |
|
356 | + $output .= '"as": "ship.png",'; |
|
357 | + } else { |
|
358 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
359 | + } |
|
285 | 360 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
286 | - if ($compress) $output .= '"as": "ship.png",'; |
|
287 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
361 | + if ($compress) { |
|
362 | + $output .= '"as": "ship.png",'; |
|
363 | + } else { |
|
364 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
365 | + } |
|
288 | 366 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
289 | - if ($compress) $output .= '"as": "truck.png",'; |
|
290 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
367 | + if ($compress) { |
|
368 | + $output .= '"as": "truck.png",'; |
|
369 | + } else { |
|
370 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
371 | + } |
|
291 | 372 | } 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",'; |
|
373 | + if ($compress) { |
|
374 | + $output .= '"as": "truck.png",'; |
|
375 | + } else { |
|
376 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
377 | + } |
|
294 | 378 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
295 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
296 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
379 | + if ($compress) { |
|
380 | + $output .= '"as": "aircraft.png",'; |
|
381 | + } else { |
|
382 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
383 | + } |
|
297 | 384 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
298 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
299 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
385 | + if ($compress) { |
|
386 | + $output .= '"as": "aircraft.png",'; |
|
387 | + } else { |
|
388 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
389 | + } |
|
300 | 390 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
301 | - if ($compress) $output .= '"as": "helico.png",'; |
|
302 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
391 | + if ($compress) { |
|
392 | + $output .= '"as": "helico.png",'; |
|
393 | + } else { |
|
394 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
395 | + } |
|
303 | 396 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
304 | - if ($compress) $output .= '"as": "rail.png",'; |
|
305 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
397 | + if ($compress) { |
|
398 | + $output .= '"as": "rail.png",'; |
|
399 | + } else { |
|
400 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
401 | + } |
|
306 | 402 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
307 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
308 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
403 | + if ($compress) { |
|
404 | + $output .= '"as": "firetruck.png",'; |
|
405 | + } else { |
|
406 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
407 | + } |
|
309 | 408 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
310 | - if ($compress) $output .= '"as": "bus.png",'; |
|
311 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
409 | + if ($compress) { |
|
410 | + $output .= '"as": "bus.png",'; |
|
411 | + } else { |
|
412 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
413 | + } |
|
312 | 414 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
313 | - if ($compress) $output .= '"as": "phone.png",'; |
|
314 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
415 | + if ($compress) { |
|
416 | + $output .= '"as": "phone.png",'; |
|
417 | + } else { |
|
418 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
419 | + } |
|
315 | 420 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
316 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
317 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
421 | + if ($compress) { |
|
422 | + $output .= '"as": "jogger.png",'; |
|
423 | + } else { |
|
424 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
425 | + } |
|
318 | 426 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
319 | - if ($compress) $output .= '"as": "bike.png",'; |
|
320 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
427 | + if ($compress) { |
|
428 | + $output .= '"as": "bike.png",'; |
|
429 | + } else { |
|
430 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
431 | + } |
|
321 | 432 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
322 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
323 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
433 | + if ($compress) { |
|
434 | + $output .= '"as": "motorcycle.png",'; |
|
435 | + } else { |
|
436 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
437 | + } |
|
324 | 438 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
325 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
326 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
439 | + if ($compress) { |
|
440 | + $output .= '"as": "balloon.png",'; |
|
441 | + } else { |
|
442 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
443 | + } |
|
327 | 444 | } else { |
328 | - if ($compress) $output .= '"as": "car.png",'; |
|
329 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
445 | + if ($compress) { |
|
446 | + $output .= '"as": "car.png",'; |
|
447 | + } else { |
|
448 | + $output .= '"aircraft_shadow": "car.png",'; |
|
449 | + } |
|
330 | 450 | } |
331 | 451 | } elseif ($marine) { |
332 | - if ($compress) $output .= '"as": "ship.png",'; |
|
333 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
452 | + if ($compress) { |
|
453 | + $output .= '"as": "ship.png",'; |
|
454 | + } else { |
|
455 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
456 | + } |
|
334 | 457 | } else { |
335 | - if ($compress) $output .= '"as": "default.png",'; |
|
336 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
458 | + if ($compress) { |
|
459 | + $output .= '"as": "default.png",'; |
|
460 | + } else { |
|
461 | + $output .= '"aircraft_shadow": "default.png",'; |
|
462 | + } |
|
337 | 463 | } |
338 | 464 | } else { |
339 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
340 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
465 | + if ($compress) { |
|
466 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
467 | + } else { |
|
468 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
469 | + } |
|
341 | 470 | } |
342 | 471 | if (isset($spotter_item['airline_name'])) { |
343 | 472 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -345,8 +474,11 @@ discard block |
||
345 | 474 | $output .= '"airline_name": "NA",'; |
346 | 475 | } |
347 | 476 | 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'].'",'; |
|
477 | + if ($compress) { |
|
478 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
479 | + } else { |
|
480 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
481 | + } |
|
350 | 482 | } |
351 | 483 | if (isset($spotter_item['departure_airport_city'])) { |
352 | 484 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -358,8 +490,11 @@ discard block |
||
358 | 490 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
359 | 491 | } |
360 | 492 | 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'].'",'; |
|
493 | + if ($compress) { |
|
494 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
495 | + } else { |
|
496 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
497 | + } |
|
363 | 498 | } |
364 | 499 | if (isset($spotter_item['arrival_airport_city'])) { |
365 | 500 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -378,11 +513,17 @@ discard block |
||
378 | 513 | } |
379 | 514 | |
380 | 515 | if (isset($spotter_item['altitude'])) { |
381 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
382 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
516 | + if ($compress) { |
|
517 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
518 | + } else { |
|
519 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
520 | + } |
|
521 | + } |
|
522 | + if ($compress) { |
|
523 | + $output .= '"h": "'.$spotter_item['heading'].'",'; |
|
524 | + } else { |
|
525 | + $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
383 | 526 | } |
384 | - if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",'; |
|
385 | - else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
386 | 527 | |
387 | 528 | if (isset($archivespeed)) { |
388 | 529 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
@@ -392,7 +533,9 @@ discard block |
||
392 | 533 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
393 | 534 | } |
394 | 535 | |
395 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
536 | + if (!$min) { |
|
537 | + $output .= '"image": "'.$image.'",'; |
|
538 | + } |
|
396 | 539 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
397 | 540 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
398 | 541 | } |
@@ -400,8 +543,11 @@ discard block |
||
400 | 543 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
401 | 544 | } |
402 | 545 | if (isset($spotter_item['squawk'])) { |
403 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
404 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
546 | + if ($compress) { |
|
547 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
548 | + } else { |
|
549 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
550 | + } |
|
405 | 551 | } |
406 | 552 | if (isset($spotter_item['squawk_usage'])) { |
407 | 553 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -420,14 +566,23 @@ discard block |
||
420 | 566 | } |
421 | 567 | // type when not aircraft ? |
422 | 568 | if (isset($spotter_item['type'])) { |
423 | - if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
|
424 | - else $output .= '"type": "'.$spotter_item['type'].'"'; |
|
569 | + if ($compress) { |
|
570 | + $output .= '"t": "'.$spotter_item['type'].'"'; |
|
571 | + } else { |
|
572 | + $output .= '"type": "'.$spotter_item['type'].'"'; |
|
573 | + } |
|
425 | 574 | } elseif ($marine) { |
426 | - if ($compress) $output .= '"t": "ship"'; |
|
427 | - else $output .= '"type": "ship"'; |
|
575 | + if ($compress) { |
|
576 | + $output .= '"t": "ship"'; |
|
577 | + } else { |
|
578 | + $output .= '"type": "ship"'; |
|
579 | + } |
|
428 | 580 | } else { |
429 | - if ($compress) $output .= '"t": "aircraft"'; |
|
430 | - else $output .= '"type": "aircraft"'; |
|
581 | + if ($compress) { |
|
582 | + $output .= '"t": "aircraft"'; |
|
583 | + } else { |
|
584 | + $output .= '"type": "aircraft"'; |
|
585 | + } |
|
431 | 586 | } |
432 | 587 | $output .= '},'; |
433 | 588 | $output .= '"geometry": {'; |
@@ -495,7 +650,9 @@ discard block |
||
495 | 650 | } |
496 | 651 | */ |
497 | 652 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
498 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
653 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
654 | + $history = $_COOKIE['history']; |
|
655 | + } |
|
499 | 656 | |
500 | 657 | if ( |
501 | 658 | (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -539,8 +696,11 @@ discard block |
||
539 | 696 | $output_history .= ']}},'; |
540 | 697 | $output .= $output_history; |
541 | 698 | } |
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": ['; |
|
699 | + if ($compress) { |
|
700 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
701 | + } else { |
|
702 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
703 | + } |
|
544 | 704 | } |
545 | 705 | $output_history .= '['; |
546 | 706 | $output_history .= $spotter_history['longitude'].', '; |
@@ -559,9 +719,14 @@ discard block |
||
559 | 719 | $prev_alt = $alt; |
560 | 720 | } else { |
561 | 721 | if ($d == false) { |
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; |
|
722 | + if ($compress) { |
|
723 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
724 | + } else { |
|
725 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
726 | + } |
|
727 | + } else { |
|
728 | + $d = true; |
|
729 | + } |
|
565 | 730 | $output_history .= '['; |
566 | 731 | $output_history .= $spotter_history['longitude'].', '; |
567 | 732 | $output_history .= $spotter_history['latitude']; |
@@ -582,7 +747,9 @@ discard block |
||
582 | 747 | $output_historyd = '['; |
583 | 748 | $output_historyd .= $spotter_item['longitude'].', '; |
584 | 749 | $output_historyd .= $spotter_item['latitude']; |
585 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
750 | + if (isset($spotter_history['altitude'])) { |
|
751 | + $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
752 | + } |
|
586 | 753 | $output_historyd .= '],'; |
587 | 754 | //$output_history = $output_historyd.$output_history; |
588 | 755 | $output_history = $output_history.$output_historyd; |
@@ -604,8 +771,11 @@ discard block |
||
604 | 771 | && $spotter_item['arrival_airport'] != 'NA' |
605 | 772 | && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
606 | 773 | || (!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": ['; |
|
774 | + if ($compress) { |
|
775 | + $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
776 | + } else { |
|
777 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
778 | + } |
|
609 | 779 | if (isset($spotter_item['departure_airport_latitude'])) { |
610 | 780 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
611 | 781 | } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
@@ -638,8 +808,11 @@ discard block |
||
638 | 808 | || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) |
639 | 809 | || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
640 | 810 | $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": ['; |
|
811 | + if ($compress) { |
|
812 | + $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
813 | + } else { |
|
814 | + $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
815 | + } |
|
643 | 816 | $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
644 | 817 | |
645 | 818 | if (isset($spotter_item['arrival_airport_latitude'])) { |
@@ -654,7 +827,9 @@ discard block |
||
654 | 827 | } |
655 | 828 | //$output_dest = substr($output_dest, 0, -1); |
656 | 829 | $output_dest .= ']}},'; |
657 | - if ($havedata) $output .= $output_dest; |
|
830 | + if ($havedata) { |
|
831 | + $output .= $output_dest; |
|
832 | + } |
|
658 | 833 | unset($output_dest); |
659 | 834 | } |
660 | 835 | } |
@@ -662,7 +837,9 @@ discard block |
||
662 | 837 | $output .= ']'; |
663 | 838 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
664 | 839 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
665 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
840 | + if (isset($begindate)) { |
|
841 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
842 | + } |
|
666 | 843 | $output .= '"fc": "'.$j.'"'; |
667 | 844 | } else { |
668 | 845 | $output .= '"features": '; |