@@ -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) { |
@@ -76,8 +78,11 @@ discard block |
||
76 | 78 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
77 | 79 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
78 | 80 | } |
79 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
80 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
81 | + if ($filter_query_where == '' && $where) { |
|
82 | + $filter_query_where = ' WHERE'; |
|
83 | + } elseif ($filter_query_where != '' && $and) { |
|
84 | + $filter_query_where .= ' AND'; |
|
85 | + } |
|
81 | 86 | if ($filter_query_where != '') { |
82 | 87 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
83 | 88 | } |
@@ -119,7 +124,9 @@ discard block |
||
119 | 124 | } |
120 | 125 | } |
121 | 126 | |
122 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
127 | + if (!isset($globalLiveInterval)) { |
|
128 | + $globalLiveInterval = '200'; |
|
129 | + } |
|
123 | 130 | if ($globalDBdriver == 'mysql') { |
124 | 131 | //$query = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate"; |
125 | 132 | $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -144,7 +151,9 @@ discard block |
||
144 | 151 | |
145 | 152 | $filter_query = $this->getFilter($filter,true,true); |
146 | 153 | |
147 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
154 | + if (!isset($globalLiveInterval)) { |
|
155 | + $globalLiveInterval = '200'; |
|
156 | + } |
|
148 | 157 | if ($globalDBdriver == 'mysql') { |
149 | 158 | $query = 'SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
150 | 159 | FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query." tracker_live.latitude <> 0 AND tracker_live.longitude <> 0"; |
@@ -182,7 +191,9 @@ discard block |
||
182 | 191 | |
183 | 192 | $filter_query = $this->getFilter($filter,true,true); |
184 | 193 | |
185 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
194 | + if (!isset($globalLiveInterval)) { |
|
195 | + $globalLiveInterval = '200'; |
|
196 | + } |
|
186 | 197 | if ($globalDBdriver == 'mysql') { |
187 | 198 | $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
188 | 199 | FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' |
@@ -215,7 +226,9 @@ discard block |
||
215 | 226 | global $globalDBdriver, $globalLiveInterval; |
216 | 227 | $filter_query = $this->getFilter($filter,true,true); |
217 | 228 | |
218 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
229 | + if (!isset($globalLiveInterval)) { |
|
230 | + $globalLiveInterval = '200'; |
|
231 | + } |
|
219 | 232 | if ($globalDBdriver == 'mysql') { |
220 | 233 | $query = 'SELECT COUNT(DISTINCT tracker_live.famtrackid) as nb FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
221 | 234 | } else { |
@@ -243,7 +256,9 @@ discard block |
||
243 | 256 | { |
244 | 257 | global $globalDBdriver, $globalLiveInterval; |
245 | 258 | $Spotter = new Spotter($this->db); |
246 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
259 | + if (!isset($globalLiveInterval)) { |
|
260 | + $globalLiveInterval = '200'; |
|
261 | + } |
|
247 | 262 | $filter_query = $this->getFilter($filter); |
248 | 263 | |
249 | 264 | if (is_array($coord)) { |
@@ -251,7 +266,9 @@ discard block |
||
251 | 266 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
252 | 267 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
253 | 268 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
254 | - } else return array(); |
|
269 | + } else { |
|
270 | + return array(); |
|
271 | + } |
|
255 | 272 | if ($globalDBdriver == 'mysql') { |
256 | 273 | $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query; |
257 | 274 | } else { |
@@ -271,7 +288,9 @@ discard block |
||
271 | 288 | { |
272 | 289 | global $globalDBdriver, $globalLiveInterval; |
273 | 290 | $Spotter = new Spotter($this->db); |
274 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
291 | + if (!isset($globalLiveInterval)) { |
|
292 | + $globalLiveInterval = '200'; |
|
293 | + } |
|
275 | 294 | $filter_query = $this->getFilter($filter); |
276 | 295 | |
277 | 296 | if (is_array($coord)) { |
@@ -279,7 +298,9 @@ discard block |
||
279 | 298 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
280 | 299 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
281 | 300 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
282 | - } else return array(); |
|
301 | + } else { |
|
302 | + return array(); |
|
303 | + } |
|
283 | 304 | if ($globalDBdriver == 'mysql') { |
284 | 305 | $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
285 | 306 | FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' AND tracker_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong." |
@@ -472,11 +493,15 @@ discard block |
||
472 | 493 | //$query = self::$global_query.' WHERE tracker_live.famtrackid = :id ORDER BY date'; |
473 | 494 | if ($globalDBdriver == 'mysql') { |
474 | 495 | $query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id'; |
475 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
496 | + if ($liveinterval) { |
|
497 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
498 | + } |
|
476 | 499 | $query .= ' ORDER BY date'; |
477 | 500 | } else { |
478 | 501 | $query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id'; |
479 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
502 | + if ($liveinterval) { |
|
503 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
504 | + } |
|
480 | 505 | $query .= ' ORDER BY date'; |
481 | 506 | } |
482 | 507 | |
@@ -571,7 +596,9 @@ discard block |
||
571 | 596 | $i++; |
572 | 597 | $j++; |
573 | 598 | if ($j == 30) { |
574 | - if ($globalDebug) echo "."; |
|
599 | + if ($globalDebug) { |
|
600 | + echo "."; |
|
601 | + } |
|
575 | 602 | try { |
576 | 603 | |
577 | 604 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -818,7 +845,9 @@ discard block |
||
818 | 845 | { |
819 | 846 | return false; |
820 | 847 | } |
821 | - } else return ''; |
|
848 | + } else { |
|
849 | + return ''; |
|
850 | + } |
|
822 | 851 | |
823 | 852 | if ($longitude != '') |
824 | 853 | { |
@@ -826,7 +855,9 @@ discard block |
||
826 | 855 | { |
827 | 856 | return false; |
828 | 857 | } |
829 | - } else return ''; |
|
858 | + } else { |
|
859 | + return ''; |
|
860 | + } |
|
830 | 861 | |
831 | 862 | if ($altitude != '') |
832 | 863 | { |
@@ -834,7 +865,9 @@ discard block |
||
834 | 865 | { |
835 | 866 | return false; |
836 | 867 | } |
837 | - } else $altitude = 0; |
|
868 | + } else { |
|
869 | + $altitude = 0; |
|
870 | + } |
|
838 | 871 | |
839 | 872 | if ($heading != '') |
840 | 873 | { |
@@ -842,7 +875,9 @@ discard block |
||
842 | 875 | { |
843 | 876 | return false; |
844 | 877 | } |
845 | - } else $heading = 0; |
|
878 | + } else { |
|
879 | + $heading = 0; |
|
880 | + } |
|
846 | 881 | |
847 | 882 | if ($groundspeed != '') |
848 | 883 | { |
@@ -850,9 +885,13 @@ discard block |
||
850 | 885 | { |
851 | 886 | return false; |
852 | 887 | } |
853 | - } else $groundspeed = 0; |
|
888 | + } else { |
|
889 | + $groundspeed = 0; |
|
890 | + } |
|
854 | 891 | date_default_timezone_set('UTC'); |
855 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
892 | + if ($date == '') { |
|
893 | + $date = date("Y-m-d H:i:s", time()); |
|
894 | + } |
|
856 | 895 | |
857 | 896 | |
858 | 897 | $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
@@ -868,8 +907,12 @@ discard block |
||
868 | 907 | $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
869 | 908 | $type = filter_var($type,FILTER_SANITIZE_STRING); |
870 | 909 | |
871 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
872 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
910 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
911 | + $groundspeed = 0; |
|
912 | + } |
|
913 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
914 | + $heading = 0; |
|
915 | + } |
|
873 | 916 | |
874 | 917 | $query = 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
875 | 918 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; |
@@ -5,8 +5,11 @@ discard block |
||
5 | 5 | setcookie("MapFormat",'2d'); |
6 | 6 | |
7 | 7 | // Compressed GeoJson is used if true |
8 | -if (!isset($globalJsonCompress)) $compress = true; |
|
9 | -else $compress = $globalJsonCompress; |
|
8 | +if (!isset($globalJsonCompress)) { |
|
9 | + $compress = true; |
|
10 | +} else { |
|
11 | + $compress = $globalJsonCompress; |
|
12 | +} |
|
10 | 13 | ?> |
11 | 14 | |
12 | 15 | |
@@ -142,9 +145,13 @@ discard block |
||
142 | 145 | if (callsign != ""){ markerMarineLabel += callsign; } |
143 | 146 | if (type != ""){ markerMarineLabel += ' - '+type; } |
144 | 147 | <?php |
145 | - if (isset($_COOKIE['MarineIconColor'])) $MarineIconColor = $_COOKIE['MarineIconColor']; |
|
146 | - elseif (isset($globalMarineIconColor)) $MarineIconColor = $globalMarineIconColor; |
|
147 | - else $MarineIconColor = '1a3151'; |
|
148 | + if (isset($_COOKIE['MarineIconColor'])) { |
|
149 | + $MarineIconColor = $_COOKIE['MarineIconColor']; |
|
150 | + } elseif (isset($globalMarineIconColor)) { |
|
151 | + $MarineIconColor = $globalMarineIconColor; |
|
152 | + } else { |
|
153 | + $MarineIconColor = '1a3151'; |
|
154 | + } |
|
148 | 155 | if (!isset($ident) && !isset($fammarine_id)) { |
149 | 156 | ?> |
150 | 157 | info_marine_update(feature.properties.fc); |
@@ -179,7 +186,12 @@ discard block |
||
179 | 186 | <?php |
180 | 187 | } else { |
181 | 188 | ?> |
182 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
189 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
190 | + print $archiveupdatetime*1000; |
|
191 | +} else { |
|
192 | + print $globalMapRefresh*1000+20000; |
|
193 | +} |
|
194 | +?>+feature.properties.sqt*1000); |
|
183 | 195 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
184 | 196 | <?php |
185 | 197 | } |
@@ -228,7 +240,12 @@ discard block |
||
228 | 240 | <?php |
229 | 241 | } else { |
230 | 242 | ?> |
231 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
243 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
244 | + print $archiveupdatetime*1000; |
|
245 | +} else { |
|
246 | + print $globalMapRefresh*1000+20000; |
|
247 | +} |
|
248 | +?>+feature.properties.sqt*1000); |
|
232 | 249 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
233 | 250 | <?php |
234 | 251 | } |
@@ -276,7 +293,12 @@ discard block |
||
276 | 293 | <?php |
277 | 294 | } else { |
278 | 295 | ?> |
279 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
296 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
297 | + print $archiveupdatetime*1000; |
|
298 | +} else { |
|
299 | + print $globalMapRefresh*1000+20000; |
|
300 | +} |
|
301 | +?>+feature.properties.sqt*1000); |
|
280 | 302 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
281 | 303 | <?php |
282 | 304 | } |
@@ -559,14 +581,24 @@ discard block |
||
559 | 581 | if (isset($archive) && $archive) { |
560 | 582 | ?> |
561 | 583 | //then load it again every 30 seconds |
562 | -// var reload = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>); |
|
584 | +// var reload = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) { |
|
585 | + print ($globalMapRefresh*1000)/2; |
|
586 | +} else { |
|
587 | + print '15000'; |
|
588 | +} |
|
589 | +?>); |
|
563 | 590 | reloadMarinePage = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php print $archiveupdatetime*1000; ?>); |
564 | 591 | <?php |
565 | 592 | } else { |
566 | 593 | ?> |
567 | 594 | //then load it again every 30 seconds |
568 | 595 | reloadMarinePage = setInterval( |
569 | - function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>); |
|
596 | + function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) { |
|
597 | + print $globalMapRefresh*1000; |
|
598 | +} else { |
|
599 | + print '30000'; |
|
600 | +} |
|
601 | +?>); |
|
570 | 602 | <?php |
571 | 603 | } |
572 | 604 | ?> |
@@ -16,7 +16,9 @@ discard block |
||
16 | 16 | curl_setopt($ch, CURLOPT_URL, $url); |
17 | 17 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
18 | 18 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
19 | - if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
19 | + if ($referer != '') { |
|
20 | + curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
21 | + } |
|
20 | 22 | curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
21 | 23 | curl_setopt($ch, CURLOPT_FILE, $fp); |
22 | 24 | curl_exec($ch); |
@@ -27,12 +29,16 @@ discard block |
||
27 | 29 | public static function gunzip($in_file,$out_file_name = '') { |
28 | 30 | //echo $in_file.' -> '.$out_file_name."\n"; |
29 | 31 | $buffer_size = 4096; // read 4kb at a time |
30 | - if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
|
32 | + if ($out_file_name == '') { |
|
33 | + $out_file_name = str_replace('.gz', '', $in_file); |
|
34 | + } |
|
31 | 35 | if ($in_file != '' && file_exists($in_file)) { |
32 | 36 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
33 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
34 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
35 | - else { |
|
37 | + if (function_exists('gzopen')) { |
|
38 | + $file = gzopen($in_file,'rb'); |
|
39 | + } elseif (function_exists('gzopen64')) { |
|
40 | + $file = gzopen64($in_file,'rb'); |
|
41 | + } else { |
|
36 | 42 | echo 'gzopen not available'; |
37 | 43 | die; |
38 | 44 | } |
@@ -53,8 +59,12 @@ discard block |
||
53 | 59 | if ($res === TRUE) { |
54 | 60 | $zip->extractTo($path); |
55 | 61 | $zip->close(); |
56 | - } else return false; |
|
57 | - } else return false; |
|
62 | + } else { |
|
63 | + return false; |
|
64 | + } |
|
65 | + } else { |
|
66 | + return false; |
|
67 | + } |
|
58 | 68 | } |
59 | 69 | |
60 | 70 | public static function connect_sqlite($database) { |
@@ -69,7 +79,9 @@ discard block |
||
69 | 79 | public static function retrieve_route_sqlite_to_dest($database_file) { |
70 | 80 | global $globalDebug, $globalTransaction; |
71 | 81 | //$query = 'TRUNCATE TABLE routes'; |
72 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
82 | + if ($globalDebug) { |
|
83 | + echo " - Delete previous routes from DB -"; |
|
84 | + } |
|
73 | 85 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
74 | 86 | $Connection = new Connection(); |
75 | 87 | try { |
@@ -80,7 +92,9 @@ discard block |
||
80 | 92 | return "error : ".$e->getMessage(); |
81 | 93 | } |
82 | 94 | |
83 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
95 | + if ($globalDebug) { |
|
96 | + echo " - Add routes to DB -"; |
|
97 | + } |
|
84 | 98 | update_db::connect_sqlite($database_file); |
85 | 99 | //$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID'; |
86 | 100 | $query = "select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao, rstp.allstop AS AllStop from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID LEFT JOIN (select RouteId,GROUP_CONCAT(icao,' ') as allstop from routestop left join Airport as air ON routestop.AirportId = air.AirportID group by RouteID) AS rstp ON Route.RouteID = rstp.RouteID"; |
@@ -95,15 +109,21 @@ discard block |
||
95 | 109 | $Connection = new Connection(); |
96 | 110 | $sth_dest = $Connection->db->prepare($query_dest); |
97 | 111 | try { |
98 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
112 | + if ($globalTransaction) { |
|
113 | + $Connection->db->beginTransaction(); |
|
114 | + } |
|
99 | 115 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
100 | 116 | //$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
101 | 117 | $query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
102 | 118 | $sth_dest->execute($query_dest_values); |
103 | 119 | } |
104 | - if ($globalTransaction) $Connection->db->commit(); |
|
120 | + if ($globalTransaction) { |
|
121 | + $Connection->db->commit(); |
|
122 | + } |
|
105 | 123 | } catch(PDOException $e) { |
106 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
124 | + if ($globalTransaction) { |
|
125 | + $Connection->db->rollBack(); |
|
126 | + } |
|
107 | 127 | return "error : ".$e->getMessage(); |
108 | 128 | } |
109 | 129 | return ''; |
@@ -111,7 +131,9 @@ discard block |
||
111 | 131 | public static function retrieve_route_oneworld($database_file) { |
112 | 132 | global $globalDebug, $globalTransaction; |
113 | 133 | //$query = 'TRUNCATE TABLE routes'; |
114 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
134 | + if ($globalDebug) { |
|
135 | + echo " - Delete previous routes from DB -"; |
|
136 | + } |
|
115 | 137 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
116 | 138 | $Connection = new Connection(); |
117 | 139 | try { |
@@ -122,14 +144,18 @@ discard block |
||
122 | 144 | return "error : ".$e->getMessage(); |
123 | 145 | } |
124 | 146 | |
125 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
147 | + if ($globalDebug) { |
|
148 | + echo " - Add routes to DB -"; |
|
149 | + } |
|
126 | 150 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
127 | 151 | $Spotter = new Spotter(); |
128 | 152 | if ($fh = fopen($database_file,"r")) { |
129 | 153 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
130 | 154 | $Connection = new Connection(); |
131 | 155 | $sth_dest = $Connection->db->prepare($query_dest); |
132 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
156 | + if ($globalTransaction) { |
|
157 | + $Connection->db->beginTransaction(); |
|
158 | + } |
|
133 | 159 | while (!feof($fh)) { |
134 | 160 | $line = fgetcsv($fh,9999,','); |
135 | 161 | if ($line[0] != '') { |
@@ -138,13 +164,17 @@ discard block |
||
138 | 164 | $query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld'); |
139 | 165 | $sth_dest->execute($query_dest_values); |
140 | 166 | } catch(PDOException $e) { |
141 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
167 | + if ($globalTransaction) { |
|
168 | + $Connection->db->rollBack(); |
|
169 | + } |
|
142 | 170 | return "error : ".$e->getMessage(); |
143 | 171 | } |
144 | 172 | } |
145 | 173 | } |
146 | 174 | } |
147 | - if ($globalTransaction) $Connection->db->commit(); |
|
175 | + if ($globalTransaction) { |
|
176 | + $Connection->db->commit(); |
|
177 | + } |
|
148 | 178 | } |
149 | 179 | return ''; |
150 | 180 | } |
@@ -152,7 +182,9 @@ discard block |
||
152 | 182 | public static function retrieve_route_skyteam($database_file) { |
153 | 183 | global $globalDebug, $globalTransaction; |
154 | 184 | //$query = 'TRUNCATE TABLE routes'; |
155 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
185 | + if ($globalDebug) { |
|
186 | + echo " - Delete previous routes from DB -"; |
|
187 | + } |
|
156 | 188 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
157 | 189 | $Connection = new Connection(); |
158 | 190 | try { |
@@ -163,7 +195,9 @@ discard block |
||
163 | 195 | return "error : ".$e->getMessage(); |
164 | 196 | } |
165 | 197 | |
166 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
198 | + if ($globalDebug) { |
|
199 | + echo " - Add routes to DB -"; |
|
200 | + } |
|
167 | 201 | |
168 | 202 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
169 | 203 | $Spotter = new Spotter(); |
@@ -172,7 +206,9 @@ discard block |
||
172 | 206 | $Connection = new Connection(); |
173 | 207 | $sth_dest = $Connection->db->prepare($query_dest); |
174 | 208 | try { |
175 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
209 | + if ($globalTransaction) { |
|
210 | + $Connection->db->beginTransaction(); |
|
211 | + } |
|
176 | 212 | while (!feof($fh)) { |
177 | 213 | $line = fgetcsv($fh,9999,','); |
178 | 214 | if ($line[0] != '') { |
@@ -183,9 +219,13 @@ discard block |
||
183 | 219 | } |
184 | 220 | } |
185 | 221 | } |
186 | - if ($globalTransaction) $Connection->db->commit(); |
|
222 | + if ($globalTransaction) { |
|
223 | + $Connection->db->commit(); |
|
224 | + } |
|
187 | 225 | } catch(PDOException $e) { |
188 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
226 | + if ($globalTransaction) { |
|
227 | + $Connection->db->rollBack(); |
|
228 | + } |
|
189 | 229 | return "error : ".$e->getMessage(); |
190 | 230 | } |
191 | 231 | } |
@@ -228,11 +268,16 @@ discard block |
||
228 | 268 | $sth_dest = $Connection->db->prepare($query_dest); |
229 | 269 | $sth_dest_owner = $Connection->db->prepare($query_dest_owner); |
230 | 270 | try { |
231 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
271 | + if ($globalTransaction) { |
|
272 | + $Connection->db->beginTransaction(); |
|
273 | + } |
|
232 | 274 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
233 | 275 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
234 | - if ($values['UserString4'] == 'M') $type = 'military'; |
|
235 | - else $type = null; |
|
276 | + if ($values['UserString4'] == 'M') { |
|
277 | + $type = 'military'; |
|
278 | + } else { |
|
279 | + $type = null; |
|
280 | + } |
|
236 | 281 | $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
237 | 282 | $sth_dest->execute($query_dest_values); |
238 | 283 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
@@ -240,7 +285,9 @@ discard block |
||
240 | 285 | $sth_dest_owner->execute($query_dest_owner_values); |
241 | 286 | } |
242 | 287 | } |
243 | - if ($globalTransaction) $Connection->db->commit(); |
|
288 | + if ($globalTransaction) { |
|
289 | + $Connection->db->commit(); |
|
290 | + } |
|
244 | 291 | } catch(PDOException $e) { |
245 | 292 | return "error : ".$e->getMessage(); |
246 | 293 | } |
@@ -277,7 +324,9 @@ discard block |
||
277 | 324 | $Connection = new Connection(); |
278 | 325 | $sth_dest = $Connection->db->prepare($query_dest); |
279 | 326 | try { |
280 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
327 | + if ($globalTransaction) { |
|
328 | + $Connection->db->beginTransaction(); |
|
329 | + } |
|
281 | 330 | while (!feof($fh)) { |
282 | 331 | $values = array(); |
283 | 332 | $line = $Common->hex2str(fgets($fh,9999)); |
@@ -288,7 +337,9 @@ discard block |
||
288 | 337 | // Check if we can find ICAO, else set it to GLID |
289 | 338 | $aircraft_name_split = explode(' ',$aircraft_name); |
290 | 339 | $search_more = ''; |
291 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
340 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
341 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
342 | + } |
|
292 | 343 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
293 | 344 | $sth_search = $Connection->db->prepare($query_search); |
294 | 345 | try { |
@@ -301,7 +352,9 @@ discard block |
||
301 | 352 | } catch(PDOException $e) { |
302 | 353 | return "error : ".$e->getMessage(); |
303 | 354 | } |
304 | - if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
|
355 | + if (!isset($values['ICAOTypeCode'])) { |
|
356 | + $values['ICAOTypeCode'] = 'GLID'; |
|
357 | + } |
|
305 | 358 | // Add data to db |
306 | 359 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
307 | 360 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
@@ -310,7 +363,9 @@ discard block |
||
310 | 363 | $sth_dest->execute($query_dest_values); |
311 | 364 | } |
312 | 365 | } |
313 | - if ($globalTransaction) $Connection->db->commit(); |
|
366 | + if ($globalTransaction) { |
|
367 | + $Connection->db->commit(); |
|
368 | + } |
|
314 | 369 | } catch(PDOException $e) { |
315 | 370 | return "error : ".$e->getMessage(); |
316 | 371 | } |
@@ -346,7 +401,9 @@ discard block |
||
346 | 401 | $Connection = new Connection(); |
347 | 402 | $sth_dest = $Connection->db->prepare($query_dest); |
348 | 403 | try { |
349 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
404 | + if ($globalTransaction) { |
|
405 | + $Connection->db->beginTransaction(); |
|
406 | + } |
|
350 | 407 | $tmp = fgetcsv($fh,9999,',',"'"); |
351 | 408 | while (!feof($fh)) { |
352 | 409 | $line = fgetcsv($fh,9999,',',"'"); |
@@ -359,13 +416,17 @@ discard block |
||
359 | 416 | // Check if we can find ICAO, else set it to GLID |
360 | 417 | $aircraft_name_split = explode(' ',$aircraft_name); |
361 | 418 | $search_more = ''; |
362 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
419 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
420 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
421 | + } |
|
363 | 422 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
364 | 423 | $sth_search = $Connection->db->prepare($query_search); |
365 | 424 | try { |
366 | 425 | $sth_search->execute(); |
367 | 426 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
368 | - if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
427 | + if (isset($result['icao']) && $result['icao'] != '') { |
|
428 | + $values['ICAOTypeCode'] = $result['icao']; |
|
429 | + } |
|
369 | 430 | } catch(PDOException $e) { |
370 | 431 | return "error : ".$e->getMessage(); |
371 | 432 | } |
@@ -378,7 +439,9 @@ discard block |
||
378 | 439 | $sth_dest->execute($query_dest_values); |
379 | 440 | } |
380 | 441 | } |
381 | - if ($globalTransaction) $Connection->db->commit(); |
|
442 | + if ($globalTransaction) { |
|
443 | + $Connection->db->commit(); |
|
444 | + } |
|
382 | 445 | } catch(PDOException $e) { |
383 | 446 | return "error : ".$e->getMessage(); |
384 | 447 | } |
@@ -417,7 +480,9 @@ discard block |
||
417 | 480 | $sth_dest = $Connection->db->prepare($query_dest); |
418 | 481 | $sth_modes = $Connection->db->prepare($query_modes); |
419 | 482 | try { |
420 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
483 | + if ($globalTransaction) { |
|
484 | + $Connection->db->beginTransaction(); |
|
485 | + } |
|
421 | 486 | $tmp = fgetcsv($fh,9999,',','"'); |
422 | 487 | while (!feof($fh)) { |
423 | 488 | $line = fgetcsv($fh,9999,',','"'); |
@@ -427,16 +492,22 @@ discard block |
||
427 | 492 | $values['registration'] = $line[0]; |
428 | 493 | $values['base'] = $line[4]; |
429 | 494 | $values['owner'] = $line[5]; |
430 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
431 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
495 | + if ($line[6] == '') { |
|
496 | + $values['date_first_reg'] = null; |
|
497 | + } else { |
|
498 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
499 | + } |
|
432 | 500 | $values['cancel'] = $line[7]; |
433 | 501 | } elseif ($country == 'EI') { |
434 | 502 | // TODO : add modeS & reg to aircraft_modes |
435 | 503 | $values['registration'] = $line[0]; |
436 | 504 | $values['base'] = $line[3]; |
437 | 505 | $values['owner'] = $line[2]; |
438 | - if ($line[1] == '') $values['date_first_reg'] = null; |
|
439 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
506 | + if ($line[1] == '') { |
|
507 | + $values['date_first_reg'] = null; |
|
508 | + } else { |
|
509 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
510 | + } |
|
440 | 511 | $values['cancel'] = ''; |
441 | 512 | $values['modes'] = $line[7]; |
442 | 513 | $values['icao'] = $line[8]; |
@@ -455,16 +526,22 @@ discard block |
||
455 | 526 | $values['registration'] = $line[3]; |
456 | 527 | $values['base'] = null; |
457 | 528 | $values['owner'] = $line[5]; |
458 | - if ($line[18] == '') $values['date_first_reg'] = null; |
|
459 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
529 | + if ($line[18] == '') { |
|
530 | + $values['date_first_reg'] = null; |
|
531 | + } else { |
|
532 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
533 | + } |
|
460 | 534 | $values['cancel'] = ''; |
461 | 535 | } elseif ($country == 'VH') { |
462 | 536 | // TODO : add modeS & reg to aircraft_modes |
463 | 537 | $values['registration'] = $line[0]; |
464 | 538 | $values['base'] = null; |
465 | 539 | $values['owner'] = $line[12]; |
466 | - if ($line[28] == '') $values['date_first_reg'] = null; |
|
467 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
540 | + if ($line[28] == '') { |
|
541 | + $values['date_first_reg'] = null; |
|
542 | + } else { |
|
543 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
544 | + } |
|
468 | 545 | |
469 | 546 | $values['cancel'] = $line[39]; |
470 | 547 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -483,29 +560,41 @@ discard block |
||
483 | 560 | $values['registration'] = $line[0]; |
484 | 561 | $values['base'] = null; |
485 | 562 | $values['owner'] = $line[8]; |
486 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
487 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
563 | + if ($line[7] == '') { |
|
564 | + $values['date_first_reg'] = null; |
|
565 | + } else { |
|
566 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
567 | + } |
|
488 | 568 | $values['cancel'] = ''; |
489 | 569 | } elseif ($country == 'PP') { |
490 | 570 | $values['registration'] = $line[0]; |
491 | 571 | $values['base'] = null; |
492 | 572 | $values['owner'] = $line[4]; |
493 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
494 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
573 | + if ($line[6] == '') { |
|
574 | + $values['date_first_reg'] = null; |
|
575 | + } else { |
|
576 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
577 | + } |
|
495 | 578 | $values['cancel'] = $line[7]; |
496 | 579 | } elseif ($country == 'E7') { |
497 | 580 | $values['registration'] = $line[0]; |
498 | 581 | $values['base'] = null; |
499 | 582 | $values['owner'] = $line[4]; |
500 | - if ($line[5] == '') $values['date_first_reg'] = null; |
|
501 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
583 | + if ($line[5] == '') { |
|
584 | + $values['date_first_reg'] = null; |
|
585 | + } else { |
|
586 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
587 | + } |
|
502 | 588 | $values['cancel'] = ''; |
503 | 589 | } elseif ($country == '8Q') { |
504 | 590 | $values['registration'] = $line[0]; |
505 | 591 | $values['base'] = null; |
506 | 592 | $values['owner'] = $line[3]; |
507 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
508 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
593 | + if ($line[7] == '') { |
|
594 | + $values['date_first_reg'] = null; |
|
595 | + } else { |
|
596 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
597 | + } |
|
509 | 598 | $values['cancel'] = ''; |
510 | 599 | } elseif ($country == 'ZK') { |
511 | 600 | $values['registration'] = $line[0]; |
@@ -550,7 +639,9 @@ discard block |
||
550 | 639 | $sth_modes->execute($query_modes_values); |
551 | 640 | } |
552 | 641 | } |
553 | - if ($globalTransaction) $Connection->db->commit(); |
|
642 | + if ($globalTransaction) { |
|
643 | + $Connection->db->commit(); |
|
644 | + } |
|
554 | 645 | } catch(PDOException $e) { |
555 | 646 | return "error : ".$e->getMessage(); |
556 | 647 | } |
@@ -684,25 +775,45 @@ discard block |
||
684 | 775 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)"; |
685 | 776 | $Connection = new Connection(); |
686 | 777 | $sth_dest = $Connection->db->prepare($query_dest); |
687 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
778 | + if ($globalTransaction) { |
|
779 | + $Connection->db->beginTransaction(); |
|
780 | + } |
|
688 | 781 | |
689 | 782 | $i = 0; |
690 | 783 | while($row = sparql_fetch_array($result)) |
691 | 784 | { |
692 | 785 | if ($i >= 1) { |
693 | 786 | //print_r($row); |
694 | - if (!isset($row['iata'])) $row['iata'] = ''; |
|
695 | - if (!isset($row['icao'])) $row['icao'] = ''; |
|
696 | - if (!isset($row['type'])) $row['type'] = ''; |
|
697 | - if (!isset($row['altitude'])) $row['altitude'] = ''; |
|
787 | + if (!isset($row['iata'])) { |
|
788 | + $row['iata'] = ''; |
|
789 | + } |
|
790 | + if (!isset($row['icao'])) { |
|
791 | + $row['icao'] = ''; |
|
792 | + } |
|
793 | + if (!isset($row['type'])) { |
|
794 | + $row['type'] = ''; |
|
795 | + } |
|
796 | + if (!isset($row['altitude'])) { |
|
797 | + $row['altitude'] = ''; |
|
798 | + } |
|
698 | 799 | if (isset($row['city_bis'])) { |
699 | 800 | $row['city'] = $row['city_bis']; |
700 | 801 | } |
701 | - if (!isset($row['city'])) $row['city'] = ''; |
|
702 | - if (!isset($row['country'])) $row['country'] = ''; |
|
703 | - if (!isset($row['homepage'])) $row['homepage'] = ''; |
|
704 | - if (!isset($row['wikipedia_page'])) $row['wikipedia_page'] = ''; |
|
705 | - if (!isset($row['name'])) continue; |
|
802 | + if (!isset($row['city'])) { |
|
803 | + $row['city'] = ''; |
|
804 | + } |
|
805 | + if (!isset($row['country'])) { |
|
806 | + $row['country'] = ''; |
|
807 | + } |
|
808 | + if (!isset($row['homepage'])) { |
|
809 | + $row['homepage'] = ''; |
|
810 | + } |
|
811 | + if (!isset($row['wikipedia_page'])) { |
|
812 | + $row['wikipedia_page'] = ''; |
|
813 | + } |
|
814 | + if (!isset($row['name'])) { |
|
815 | + continue; |
|
816 | + } |
|
706 | 817 | if (!isset($row['image'])) { |
707 | 818 | $row['image'] = ''; |
708 | 819 | $row['image_thumb'] = ''; |
@@ -738,7 +849,9 @@ discard block |
||
738 | 849 | |
739 | 850 | $i++; |
740 | 851 | } |
741 | - if ($globalTransaction) $Connection->db->commit(); |
|
852 | + if ($globalTransaction) { |
|
853 | + $Connection->db->commit(); |
|
854 | + } |
|
742 | 855 | echo "Delete duplicate rows...\n"; |
743 | 856 | $query = 'ALTER IGNORE TABLE airport ADD UNIQUE INDEX icaoidx (icao)'; |
744 | 857 | try { |
@@ -750,7 +863,9 @@ discard block |
||
750 | 863 | } |
751 | 864 | |
752 | 865 | |
753 | - if ($globalDebug) echo "Insert Not available Airport...\n"; |
|
866 | + if ($globalDebug) { |
|
867 | + echo "Insert Not available Airport...\n"; |
|
868 | + } |
|
754 | 869 | $query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image`,`image_thumb`) |
755 | 870 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image, :image_thumb)"; |
756 | 871 | $query_values = array(':airport_id' => $i, ':name' => 'Not available',':iata' => 'NA',':icao' => 'NA',':latitude' => '0',':longitude' => '0',':altitude' => '0',':type' => 'NA',':city' => 'N/A',':country' => 'N/A',':home_link' => '',':wikipedia_link' => '',':image' => '',':image_thumb' => ''); |
@@ -777,7 +892,9 @@ discard block |
||
777 | 892 | $delimiter = ','; |
778 | 893 | $out_file = $tmp_dir.'airports.csv'; |
779 | 894 | update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
780 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
895 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
896 | + return FALSE; |
|
897 | + } |
|
781 | 898 | echo "Add data from ourairports.com...\n"; |
782 | 899 | |
783 | 900 | $header = NULL; |
@@ -787,8 +904,9 @@ discard block |
||
787 | 904 | //$Connection->db->beginTransaction(); |
788 | 905 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
789 | 906 | { |
790 | - if(!$header) $header = $row; |
|
791 | - else { |
|
907 | + if(!$header) { |
|
908 | + $header = $row; |
|
909 | + } else { |
|
792 | 910 | $data = array(); |
793 | 911 | $data = array_combine($header, $row); |
794 | 912 | try { |
@@ -826,7 +944,9 @@ discard block |
||
826 | 944 | echo "Download data from another free database...\n"; |
827 | 945 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
828 | 946 | update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
829 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
947 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
948 | + return FALSE; |
|
949 | + } |
|
830 | 950 | update_db::unzip($out_file); |
831 | 951 | $header = NULL; |
832 | 952 | echo "Add data from another free database...\n"; |
@@ -837,8 +957,9 @@ discard block |
||
837 | 957 | //$Connection->db->beginTransaction(); |
838 | 958 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
839 | 959 | { |
840 | - if(!$header) $header = $row; |
|
841 | - else { |
|
960 | + if(!$header) { |
|
961 | + $header = $row; |
|
962 | + } else { |
|
842 | 963 | $data = $row; |
843 | 964 | |
844 | 965 | $query = 'UPDATE airport SET `city` = :city, `country` = :country WHERE icao = :icao'; |
@@ -1014,7 +1135,9 @@ discard block |
||
1014 | 1135 | if (($handle = fopen($tmp_dir.'MASTER.txt', 'r')) !== FALSE) |
1015 | 1136 | { |
1016 | 1137 | $i = 0; |
1017 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1138 | + if ($globalTransaction) { |
|
1139 | + $Connection->db->beginTransaction(); |
|
1140 | + } |
|
1018 | 1141 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1019 | 1142 | { |
1020 | 1143 | if ($i > 0) { |
@@ -1027,7 +1150,9 @@ discard block |
||
1027 | 1150 | } |
1028 | 1151 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
1029 | 1152 | if (!empty($result_search)) { |
1030 | - if ($globalDebug) echo '.'; |
|
1153 | + if ($globalDebug) { |
|
1154 | + echo '.'; |
|
1155 | + } |
|
1031 | 1156 | //if ($globalDBdriver == 'mysql') { |
1032 | 1157 | // $queryi = 'INSERT INTO faamfr (mfr,icao) VALUES (:mfr,:icao) ON DUPLICATE KEY UPDATE icao = :icao'; |
1033 | 1158 | //} else { |
@@ -1049,8 +1174,12 @@ discard block |
||
1049 | 1174 | } |
1050 | 1175 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
1051 | 1176 | if (!empty($result_search_mfr)) { |
1052 | - if (trim($data[16]) == '' && trim($data[23]) != '') $data[16] = $data[23]; |
|
1053 | - if (trim($data[16]) == '' && trim($data[15]) != '') $data[16] = $data[15]; |
|
1177 | + if (trim($data[16]) == '' && trim($data[23]) != '') { |
|
1178 | + $data[16] = $data[23]; |
|
1179 | + } |
|
1180 | + if (trim($data[16]) == '' && trim($data[15]) != '') { |
|
1181 | + $data[16] = $data[15]; |
|
1182 | + } |
|
1054 | 1183 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
1055 | 1184 | try { |
1056 | 1185 | $sthf = $Connection->db->prepare($queryf); |
@@ -1061,7 +1190,9 @@ discard block |
||
1061 | 1190 | } |
1062 | 1191 | } |
1063 | 1192 | if (strtotime($data[29]) > time()) { |
1064 | - if ($globalDebug) echo 'i'; |
|
1193 | + if ($globalDebug) { |
|
1194 | + echo 'i'; |
|
1195 | + } |
|
1065 | 1196 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
1066 | 1197 | try { |
1067 | 1198 | $sth = $Connection->db->prepare($query); |
@@ -1072,13 +1203,19 @@ discard block |
||
1072 | 1203 | } |
1073 | 1204 | } |
1074 | 1205 | if ($i % 90 == 0) { |
1075 | - if ($globalTransaction) $Connection->db->commit(); |
|
1076 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1206 | + if ($globalTransaction) { |
|
1207 | + $Connection->db->commit(); |
|
1208 | + } |
|
1209 | + if ($globalTransaction) { |
|
1210 | + $Connection->db->beginTransaction(); |
|
1211 | + } |
|
1077 | 1212 | } |
1078 | 1213 | $i++; |
1079 | 1214 | } |
1080 | 1215 | fclose($handle); |
1081 | - if ($globalTransaction) $Connection->db->commit(); |
|
1216 | + if ($globalTransaction) { |
|
1217 | + $Connection->db->commit(); |
|
1218 | + } |
|
1082 | 1219 | } |
1083 | 1220 | print_r($mfr); |
1084 | 1221 | return ''; |
@@ -1103,11 +1240,15 @@ discard block |
||
1103 | 1240 | $i = 0; |
1104 | 1241 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
1105 | 1242 | //$Connection->db->beginTransaction(); |
1106 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1243 | + if ($globalTransaction) { |
|
1244 | + $Connection->db->beginTransaction(); |
|
1245 | + } |
|
1107 | 1246 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1108 | 1247 | { |
1109 | 1248 | if ($i > 0) { |
1110 | - if ($data[1] == 'NULL') $data[1] = $data[0]; |
|
1249 | + if ($data[1] == 'NULL') { |
|
1250 | + $data[1] = $data[0]; |
|
1251 | + } |
|
1111 | 1252 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
1112 | 1253 | try { |
1113 | 1254 | $sth = $Connection->db->prepare($query); |
@@ -1119,7 +1260,9 @@ discard block |
||
1119 | 1260 | $i++; |
1120 | 1261 | } |
1121 | 1262 | fclose($handle); |
1122 | - if ($globalTransaction) $Connection->db->commit(); |
|
1263 | + if ($globalTransaction) { |
|
1264 | + $Connection->db->commit(); |
|
1265 | + } |
|
1123 | 1266 | } |
1124 | 1267 | return ''; |
1125 | 1268 | } |
@@ -1140,7 +1283,9 @@ discard block |
||
1140 | 1283 | if (($handle = fopen($tmp_dir.'owners.tsv', 'r')) !== FALSE) |
1141 | 1284 | { |
1142 | 1285 | $i = 0; |
1143 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1286 | + if ($globalTransaction) { |
|
1287 | + $Connection->db->beginTransaction(); |
|
1288 | + } |
|
1144 | 1289 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1145 | 1290 | { |
1146 | 1291 | if ($i > 0) { |
@@ -1156,7 +1301,9 @@ discard block |
||
1156 | 1301 | $i++; |
1157 | 1302 | } |
1158 | 1303 | fclose($handle); |
1159 | - if ($globalTransaction) $Connection->db->commit(); |
|
1304 | + if ($globalTransaction) { |
|
1305 | + $Connection->db->commit(); |
|
1306 | + } |
|
1160 | 1307 | } |
1161 | 1308 | return ''; |
1162 | 1309 | } |
@@ -1181,7 +1328,9 @@ discard block |
||
1181 | 1328 | $i = 0; |
1182 | 1329 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
1183 | 1330 | //$Connection->db->beginTransaction(); |
1184 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1331 | + if ($globalTransaction) { |
|
1332 | + $Connection->db->beginTransaction(); |
|
1333 | + } |
|
1185 | 1334 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1186 | 1335 | { |
1187 | 1336 | if ($i > 0) { |
@@ -1196,7 +1345,9 @@ discard block |
||
1196 | 1345 | $i++; |
1197 | 1346 | } |
1198 | 1347 | fclose($handle); |
1199 | - if ($globalTransaction) $Connection->db->commit(); |
|
1348 | + if ($globalTransaction) { |
|
1349 | + $Connection->db->commit(); |
|
1350 | + } |
|
1200 | 1351 | } |
1201 | 1352 | return ''; |
1202 | 1353 | } |
@@ -1221,7 +1372,9 @@ discard block |
||
1221 | 1372 | $i = 0; |
1222 | 1373 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
1223 | 1374 | //$Connection->db->beginTransaction(); |
1224 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1375 | + if ($globalTransaction) { |
|
1376 | + $Connection->db->beginTransaction(); |
|
1377 | + } |
|
1225 | 1378 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1226 | 1379 | { |
1227 | 1380 | if ($i > 0) { |
@@ -1236,7 +1389,9 @@ discard block |
||
1236 | 1389 | $i++; |
1237 | 1390 | } |
1238 | 1391 | fclose($handle); |
1239 | - if ($globalTransaction) $Connection->db->commit(); |
|
1392 | + if ($globalTransaction) { |
|
1393 | + $Connection->db->commit(); |
|
1394 | + } |
|
1240 | 1395 | } |
1241 | 1396 | return ''; |
1242 | 1397 | } |
@@ -1255,7 +1410,9 @@ discard block |
||
1255 | 1410 | $Connection = new Connection(); |
1256 | 1411 | if (($handle = fopen($tmp_dir.'ban_eu.csv', 'r')) !== FALSE) |
1257 | 1412 | { |
1258 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1413 | + if ($globalTransaction) { |
|
1414 | + $Connection->db->beginTransaction(); |
|
1415 | + } |
|
1259 | 1416 | while (($data = fgetcsv($handle, 1000)) !== FALSE) |
1260 | 1417 | { |
1261 | 1418 | $query = 'UPDATE airlines SET ban_eu = 1 WHERE icao = :icao AND forsource IS NULL'; |
@@ -1270,7 +1427,9 @@ discard block |
||
1270 | 1427 | } |
1271 | 1428 | } |
1272 | 1429 | fclose($handle); |
1273 | - if ($globalTransaction) $Connection->db->commit(); |
|
1430 | + if ($globalTransaction) { |
|
1431 | + $Connection->db->commit(); |
|
1432 | + } |
|
1274 | 1433 | } |
1275 | 1434 | return ''; |
1276 | 1435 | } |
@@ -1421,7 +1580,9 @@ discard block |
||
1421 | 1580 | if (($handle = fopen($filename, 'r')) !== FALSE) |
1422 | 1581 | { |
1423 | 1582 | $i = 0; |
1424 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1583 | + if ($globalTransaction) { |
|
1584 | + $Connection->db->beginTransaction(); |
|
1585 | + } |
|
1425 | 1586 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1426 | 1587 | { |
1427 | 1588 | $i++; |
@@ -1449,7 +1610,9 @@ discard block |
||
1449 | 1610 | } |
1450 | 1611 | } |
1451 | 1612 | fclose($handle); |
1452 | - if ($globalTransaction) $Connection->db->commit(); |
|
1613 | + if ($globalTransaction) { |
|
1614 | + $Connection->db->commit(); |
|
1615 | + } |
|
1453 | 1616 | } |
1454 | 1617 | return ''; |
1455 | 1618 | } |
@@ -1472,7 +1635,9 @@ discard block |
||
1472 | 1635 | $Connection = new Connection(); |
1473 | 1636 | if (($handle = fopen($filename, 'r')) !== FALSE) |
1474 | 1637 | { |
1475 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1638 | + if ($globalTransaction) { |
|
1639 | + $Connection->db->beginTransaction(); |
|
1640 | + } |
|
1476 | 1641 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1477 | 1642 | { |
1478 | 1643 | if(count($row) > 1) { |
@@ -1486,7 +1651,9 @@ discard block |
||
1486 | 1651 | } |
1487 | 1652 | } |
1488 | 1653 | fclose($handle); |
1489 | - if ($globalTransaction) $Connection->db->commit(); |
|
1654 | + if ($globalTransaction) { |
|
1655 | + $Connection->db->commit(); |
|
1656 | + } |
|
1490 | 1657 | } |
1491 | 1658 | return ''; |
1492 | 1659 | } |
@@ -1506,8 +1673,9 @@ discard block |
||
1506 | 1673 | } |
1507 | 1674 | |
1508 | 1675 | |
1509 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1510 | - else { |
|
1676 | + if ($globalDBdriver == 'mysql') { |
|
1677 | + update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1678 | + } else { |
|
1511 | 1679 | update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
1512 | 1680 | $query = "CREATE EXTENSION postgis"; |
1513 | 1681 | $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
@@ -1526,20 +1694,30 @@ discard block |
||
1526 | 1694 | global $tmp_dir, $globalDebug; |
1527 | 1695 | include_once('class.create_db.php'); |
1528 | 1696 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
1529 | - if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
|
1697 | + if ($globalDebug) { |
|
1698 | + echo "NOTAM from FlightAirMap website : Download..."; |
|
1699 | + } |
|
1530 | 1700 | update_db::download('http://data.flightairmap.fr/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
1531 | 1701 | $error = ''; |
1532 | 1702 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
1533 | - if ($globalDebug) echo "Gunzip..."; |
|
1703 | + if ($globalDebug) { |
|
1704 | + echo "Gunzip..."; |
|
1705 | + } |
|
1534 | 1706 | update_db::gunzip($tmp_dir.'notam.txt.gz'); |
1535 | - if ($globalDebug) echo "Add to DB..."; |
|
1707 | + if ($globalDebug) { |
|
1708 | + echo "Add to DB..."; |
|
1709 | + } |
|
1536 | 1710 | //$error = create_db::import_file($tmp_dir.'notam.sql'); |
1537 | 1711 | $NOTAM = new NOTAM(); |
1538 | 1712 | $NOTAM->updateNOTAMfromTextFile($tmp_dir.'notam.txt'); |
1539 | - } else $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
1713 | + } else { |
|
1714 | + $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
1715 | + } |
|
1540 | 1716 | if ($error != '') { |
1541 | 1717 | return $error; |
1542 | - } elseif ($globalDebug) echo "Done\n"; |
|
1718 | + } elseif ($globalDebug) { |
|
1719 | + echo "Done\n"; |
|
1720 | + } |
|
1543 | 1721 | return ''; |
1544 | 1722 | } |
1545 | 1723 | |
@@ -1593,67 +1771,111 @@ discard block |
||
1593 | 1771 | //if ($globalDebug) echo "IVAO : Download..."; |
1594 | 1772 | //update_db::download('http://fr.mirror.ivao.aero/software/ivae_feb2013.zip',$tmp_dir.'ivae_feb2013.zip'); |
1595 | 1773 | if (file_exists($tmp_dir.'ivae_feb2013.zip')) { |
1596 | - if ($globalDebug) echo "Unzip..."; |
|
1774 | + if ($globalDebug) { |
|
1775 | + echo "Unzip..."; |
|
1776 | + } |
|
1597 | 1777 | update_db::unzip($tmp_dir.'ivae_feb2013.zip'); |
1598 | - if ($globalDebug) echo "Add to DB..."; |
|
1778 | + if ($globalDebug) { |
|
1779 | + echo "Add to DB..."; |
|
1780 | + } |
|
1599 | 1781 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
1600 | - if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
|
1782 | + if ($globalDebug) { |
|
1783 | + echo "Copy airlines logos to airlines images directory..."; |
|
1784 | + } |
|
1601 | 1785 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
1602 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1603 | - } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
1604 | - } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
1786 | + if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) { |
|
1787 | + $error = "Failed to copy airlines logo."; |
|
1788 | + } |
|
1789 | + } else { |
|
1790 | + $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
1791 | + } |
|
1792 | + } else { |
|
1793 | + $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
1794 | + } |
|
1605 | 1795 | if ($error != '') { |
1606 | 1796 | return $error; |
1607 | - } elseif ($globalDebug) echo "Done\n"; |
|
1797 | + } elseif ($globalDebug) { |
|
1798 | + echo "Done\n"; |
|
1799 | + } |
|
1608 | 1800 | return ''; |
1609 | 1801 | } |
1610 | 1802 | |
1611 | 1803 | public static function update_routes() { |
1612 | 1804 | global $tmp_dir, $globalDebug; |
1613 | 1805 | $error = ''; |
1614 | - if ($globalDebug) echo "Routes : Download..."; |
|
1806 | + if ($globalDebug) { |
|
1807 | + echo "Routes : Download..."; |
|
1808 | + } |
|
1615 | 1809 | update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
1616 | 1810 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
1617 | - if ($globalDebug) echo "Gunzip..."; |
|
1811 | + if ($globalDebug) { |
|
1812 | + echo "Gunzip..."; |
|
1813 | + } |
|
1618 | 1814 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
1619 | - if ($globalDebug) echo "Add to DB..."; |
|
1815 | + if ($globalDebug) { |
|
1816 | + echo "Add to DB..."; |
|
1817 | + } |
|
1620 | 1818 | $error = update_db::retrieve_route_sqlite_to_dest($tmp_dir.'StandingData.sqb'); |
1621 | - } else $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
1819 | + } else { |
|
1820 | + $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
1821 | + } |
|
1622 | 1822 | if ($error != '') { |
1623 | 1823 | return $error; |
1624 | - } elseif ($globalDebug) echo "Done\n"; |
|
1824 | + } elseif ($globalDebug) { |
|
1825 | + echo "Done\n"; |
|
1826 | + } |
|
1625 | 1827 | return ''; |
1626 | 1828 | } |
1627 | 1829 | public static function update_oneworld() { |
1628 | 1830 | global $tmp_dir, $globalDebug; |
1629 | 1831 | $error = ''; |
1630 | - if ($globalDebug) echo "Schedules Oneworld : Download..."; |
|
1832 | + if ($globalDebug) { |
|
1833 | + echo "Schedules Oneworld : Download..."; |
|
1834 | + } |
|
1631 | 1835 | update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
1632 | 1836 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
1633 | - if ($globalDebug) echo "Gunzip..."; |
|
1837 | + if ($globalDebug) { |
|
1838 | + echo "Gunzip..."; |
|
1839 | + } |
|
1634 | 1840 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
1635 | - if ($globalDebug) echo "Add to DB..."; |
|
1841 | + if ($globalDebug) { |
|
1842 | + echo "Add to DB..."; |
|
1843 | + } |
|
1636 | 1844 | $error = update_db::retrieve_route_oneworld($tmp_dir.'oneworld.csv'); |
1637 | - } else $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
1845 | + } else { |
|
1846 | + $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
1847 | + } |
|
1638 | 1848 | if ($error != '') { |
1639 | 1849 | return $error; |
1640 | - } elseif ($globalDebug) echo "Done\n"; |
|
1850 | + } elseif ($globalDebug) { |
|
1851 | + echo "Done\n"; |
|
1852 | + } |
|
1641 | 1853 | return ''; |
1642 | 1854 | } |
1643 | 1855 | public static function update_skyteam() { |
1644 | 1856 | global $tmp_dir, $globalDebug; |
1645 | 1857 | $error = ''; |
1646 | - if ($globalDebug) echo "Schedules Skyteam : Download..."; |
|
1858 | + if ($globalDebug) { |
|
1859 | + echo "Schedules Skyteam : Download..."; |
|
1860 | + } |
|
1647 | 1861 | update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
1648 | 1862 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
1649 | - if ($globalDebug) echo "Gunzip..."; |
|
1863 | + if ($globalDebug) { |
|
1864 | + echo "Gunzip..."; |
|
1865 | + } |
|
1650 | 1866 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
1651 | - if ($globalDebug) echo "Add to DB..."; |
|
1867 | + if ($globalDebug) { |
|
1868 | + echo "Add to DB..."; |
|
1869 | + } |
|
1652 | 1870 | $error = update_db::retrieve_route_skyteam($tmp_dir.'skyteam.csv'); |
1653 | - } else $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
1871 | + } else { |
|
1872 | + $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
1873 | + } |
|
1654 | 1874 | if ($error != '') { |
1655 | 1875 | return $error; |
1656 | - } elseif ($globalDebug) echo "Done\n"; |
|
1876 | + } elseif ($globalDebug) { |
|
1877 | + echo "Done\n"; |
|
1878 | + } |
|
1657 | 1879 | return ''; |
1658 | 1880 | } |
1659 | 1881 | public static function update_ModeS() { |
@@ -1670,355 +1892,619 @@ discard block |
||
1670 | 1892 | exit; |
1671 | 1893 | } elseif ($globalDebug) echo "Done\n"; |
1672 | 1894 | */ |
1673 | - if ($globalDebug) echo "Modes : Download..."; |
|
1674 | -// update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
1895 | + if ($globalDebug) { |
|
1896 | + echo "Modes : Download..."; |
|
1897 | + } |
|
1898 | + // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
1675 | 1899 | update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
1676 | 1900 | |
1677 | 1901 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
1678 | 1902 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
1679 | - if ($globalDebug) echo "Unzip..."; |
|
1680 | -// update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
1903 | + if ($globalDebug) { |
|
1904 | + echo "Unzip..."; |
|
1905 | + } |
|
1906 | + // update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
1681 | 1907 | update_db::gunzip($tmp_dir.'BaseStation.sqb.gz'); |
1682 | - if ($globalDebug) echo "Add to DB..."; |
|
1908 | + if ($globalDebug) { |
|
1909 | + echo "Add to DB..."; |
|
1910 | + } |
|
1683 | 1911 | $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'BaseStation.sqb'); |
1684 | 1912 | // $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'basestation.sqb'); |
1685 | - } else $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
1913 | + } else { |
|
1914 | + $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
1915 | + } |
|
1686 | 1916 | if ($error != '') { |
1687 | 1917 | return $error; |
1688 | - } elseif ($globalDebug) echo "Done\n"; |
|
1918 | + } elseif ($globalDebug) { |
|
1919 | + echo "Done\n"; |
|
1920 | + } |
|
1689 | 1921 | return ''; |
1690 | 1922 | } |
1691 | 1923 | |
1692 | 1924 | public static function update_ModeS_faa() { |
1693 | 1925 | global $tmp_dir, $globalDebug; |
1694 | - if ($globalDebug) echo "Modes FAA: Download..."; |
|
1926 | + if ($globalDebug) { |
|
1927 | + echo "Modes FAA: Download..."; |
|
1928 | + } |
|
1695 | 1929 | update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
1696 | 1930 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
1697 | - if ($globalDebug) echo "Unzip..."; |
|
1931 | + if ($globalDebug) { |
|
1932 | + echo "Unzip..."; |
|
1933 | + } |
|
1698 | 1934 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
1699 | - if ($globalDebug) echo "Add to DB..."; |
|
1935 | + if ($globalDebug) { |
|
1936 | + echo "Add to DB..."; |
|
1937 | + } |
|
1700 | 1938 | $error = update_db::modes_faa(); |
1701 | - } else $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
1939 | + } else { |
|
1940 | + $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
1941 | + } |
|
1702 | 1942 | if ($error != '') { |
1703 | 1943 | return $error; |
1704 | - } elseif ($globalDebug) echo "Done\n"; |
|
1944 | + } elseif ($globalDebug) { |
|
1945 | + echo "Done\n"; |
|
1946 | + } |
|
1705 | 1947 | return ''; |
1706 | 1948 | } |
1707 | 1949 | |
1708 | 1950 | public static function update_ModeS_flarm() { |
1709 | 1951 | global $tmp_dir, $globalDebug; |
1710 | - if ($globalDebug) echo "Modes Flarmnet: Download..."; |
|
1952 | + if ($globalDebug) { |
|
1953 | + echo "Modes Flarmnet: Download..."; |
|
1954 | + } |
|
1711 | 1955 | update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
1712 | 1956 | if (file_exists($tmp_dir.'data.fln')) { |
1713 | - if ($globalDebug) echo "Add to DB..."; |
|
1957 | + if ($globalDebug) { |
|
1958 | + echo "Add to DB..."; |
|
1959 | + } |
|
1714 | 1960 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
1715 | - } else $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
1961 | + } else { |
|
1962 | + $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
1963 | + } |
|
1716 | 1964 | if ($error != '') { |
1717 | 1965 | return $error; |
1718 | - } elseif ($globalDebug) echo "Done\n"; |
|
1966 | + } elseif ($globalDebug) { |
|
1967 | + echo "Done\n"; |
|
1968 | + } |
|
1719 | 1969 | return ''; |
1720 | 1970 | } |
1721 | 1971 | |
1722 | 1972 | public static function update_ModeS_ogn() { |
1723 | 1973 | global $tmp_dir, $globalDebug; |
1724 | - if ($globalDebug) echo "Modes OGN: Download..."; |
|
1974 | + if ($globalDebug) { |
|
1975 | + echo "Modes OGN: Download..."; |
|
1976 | + } |
|
1725 | 1977 | update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
1726 | 1978 | if (file_exists($tmp_dir.'ogn.csv')) { |
1727 | - if ($globalDebug) echo "Add to DB..."; |
|
1979 | + if ($globalDebug) { |
|
1980 | + echo "Add to DB..."; |
|
1981 | + } |
|
1728 | 1982 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
1729 | - } else $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
1983 | + } else { |
|
1984 | + $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
1985 | + } |
|
1730 | 1986 | if ($error != '') { |
1731 | 1987 | return $error; |
1732 | - } elseif ($globalDebug) echo "Done\n"; |
|
1988 | + } elseif ($globalDebug) { |
|
1989 | + echo "Done\n"; |
|
1990 | + } |
|
1733 | 1991 | return ''; |
1734 | 1992 | } |
1735 | 1993 | |
1736 | 1994 | public static function update_owner() { |
1737 | 1995 | global $tmp_dir, $globalDebug, $globalMasterSource; |
1738 | 1996 | |
1739 | - if ($globalDebug) echo "Owner France: Download..."; |
|
1997 | + if ($globalDebug) { |
|
1998 | + echo "Owner France: Download..."; |
|
1999 | + } |
|
1740 | 2000 | update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
1741 | 2001 | if (file_exists($tmp_dir.'owner_f.csv')) { |
1742 | - if ($globalDebug) echo "Add to DB..."; |
|
2002 | + if ($globalDebug) { |
|
2003 | + echo "Add to DB..."; |
|
2004 | + } |
|
1743 | 2005 | $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
1744 | - } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
2006 | + } else { |
|
2007 | + $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
2008 | + } |
|
1745 | 2009 | if ($error != '') { |
1746 | 2010 | return $error; |
1747 | - } elseif ($globalDebug) echo "Done\n"; |
|
2011 | + } elseif ($globalDebug) { |
|
2012 | + echo "Done\n"; |
|
2013 | + } |
|
1748 | 2014 | |
1749 | - if ($globalDebug) echo "Owner Ireland: Download..."; |
|
2015 | + if ($globalDebug) { |
|
2016 | + echo "Owner Ireland: Download..."; |
|
2017 | + } |
|
1750 | 2018 | update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
1751 | 2019 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
1752 | - if ($globalDebug) echo "Add to DB..."; |
|
2020 | + if ($globalDebug) { |
|
2021 | + echo "Add to DB..."; |
|
2022 | + } |
|
1753 | 2023 | $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
1754 | - } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
2024 | + } else { |
|
2025 | + $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
2026 | + } |
|
1755 | 2027 | if ($error != '') { |
1756 | 2028 | return $error; |
1757 | - } elseif ($globalDebug) echo "Done\n"; |
|
1758 | - if ($globalDebug) echo "Owner Switzerland: Download..."; |
|
2029 | + } elseif ($globalDebug) { |
|
2030 | + echo "Done\n"; |
|
2031 | + } |
|
2032 | + if ($globalDebug) { |
|
2033 | + echo "Owner Switzerland: Download..."; |
|
2034 | + } |
|
1759 | 2035 | update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
1760 | 2036 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
1761 | - if ($globalDebug) echo "Add to DB..."; |
|
2037 | + if ($globalDebug) { |
|
2038 | + echo "Add to DB..."; |
|
2039 | + } |
|
1762 | 2040 | $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
1763 | - } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
2041 | + } else { |
|
2042 | + $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
2043 | + } |
|
1764 | 2044 | if ($error != '') { |
1765 | 2045 | return $error; |
1766 | - } elseif ($globalDebug) echo "Done\n"; |
|
1767 | - if ($globalDebug) echo "Owner Czech Republic: Download..."; |
|
2046 | + } elseif ($globalDebug) { |
|
2047 | + echo "Done\n"; |
|
2048 | + } |
|
2049 | + if ($globalDebug) { |
|
2050 | + echo "Owner Czech Republic: Download..."; |
|
2051 | + } |
|
1768 | 2052 | update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
1769 | 2053 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
1770 | - if ($globalDebug) echo "Add to DB..."; |
|
2054 | + if ($globalDebug) { |
|
2055 | + echo "Add to DB..."; |
|
2056 | + } |
|
1771 | 2057 | $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
1772 | - } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
2058 | + } else { |
|
2059 | + $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
2060 | + } |
|
1773 | 2061 | if ($error != '') { |
1774 | 2062 | return $error; |
1775 | - } elseif ($globalDebug) echo "Done\n"; |
|
1776 | - if ($globalDebug) echo "Owner Australia: Download..."; |
|
2063 | + } elseif ($globalDebug) { |
|
2064 | + echo "Done\n"; |
|
2065 | + } |
|
2066 | + if ($globalDebug) { |
|
2067 | + echo "Owner Australia: Download..."; |
|
2068 | + } |
|
1777 | 2069 | update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
1778 | 2070 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
1779 | - if ($globalDebug) echo "Add to DB..."; |
|
2071 | + if ($globalDebug) { |
|
2072 | + echo "Add to DB..."; |
|
2073 | + } |
|
1780 | 2074 | $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
1781 | - } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
2075 | + } else { |
|
2076 | + $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
2077 | + } |
|
1782 | 2078 | if ($error != '') { |
1783 | 2079 | return $error; |
1784 | - } elseif ($globalDebug) echo "Done\n"; |
|
1785 | - if ($globalDebug) echo "Owner Austria: Download..."; |
|
2080 | + } elseif ($globalDebug) { |
|
2081 | + echo "Done\n"; |
|
2082 | + } |
|
2083 | + if ($globalDebug) { |
|
2084 | + echo "Owner Austria: Download..."; |
|
2085 | + } |
|
1786 | 2086 | update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
1787 | 2087 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
1788 | - if ($globalDebug) echo "Add to DB..."; |
|
2088 | + if ($globalDebug) { |
|
2089 | + echo "Add to DB..."; |
|
2090 | + } |
|
1789 | 2091 | $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
1790 | - } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
2092 | + } else { |
|
2093 | + $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
2094 | + } |
|
1791 | 2095 | if ($error != '') { |
1792 | 2096 | return $error; |
1793 | - } elseif ($globalDebug) echo "Done\n"; |
|
1794 | - if ($globalDebug) echo "Owner Chile: Download..."; |
|
2097 | + } elseif ($globalDebug) { |
|
2098 | + echo "Done\n"; |
|
2099 | + } |
|
2100 | + if ($globalDebug) { |
|
2101 | + echo "Owner Chile: Download..."; |
|
2102 | + } |
|
1795 | 2103 | update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
1796 | 2104 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
1797 | - if ($globalDebug) echo "Add to DB..."; |
|
2105 | + if ($globalDebug) { |
|
2106 | + echo "Add to DB..."; |
|
2107 | + } |
|
1798 | 2108 | $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
1799 | - } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
2109 | + } else { |
|
2110 | + $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
2111 | + } |
|
1800 | 2112 | if ($error != '') { |
1801 | 2113 | return $error; |
1802 | - } elseif ($globalDebug) echo "Done\n"; |
|
1803 | - if ($globalDebug) echo "Owner Colombia: Download..."; |
|
2114 | + } elseif ($globalDebug) { |
|
2115 | + echo "Done\n"; |
|
2116 | + } |
|
2117 | + if ($globalDebug) { |
|
2118 | + echo "Owner Colombia: Download..."; |
|
2119 | + } |
|
1804 | 2120 | update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
1805 | 2121 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
1806 | - if ($globalDebug) echo "Add to DB..."; |
|
2122 | + if ($globalDebug) { |
|
2123 | + echo "Add to DB..."; |
|
2124 | + } |
|
1807 | 2125 | $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
1808 | - } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
2126 | + } else { |
|
2127 | + $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
2128 | + } |
|
1809 | 2129 | if ($error != '') { |
1810 | 2130 | return $error; |
1811 | - } elseif ($globalDebug) echo "Done\n"; |
|
1812 | - if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
|
2131 | + } elseif ($globalDebug) { |
|
2132 | + echo "Done\n"; |
|
2133 | + } |
|
2134 | + if ($globalDebug) { |
|
2135 | + echo "Owner Bosnia Herzegobina: Download..."; |
|
2136 | + } |
|
1813 | 2137 | update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
1814 | 2138 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
1815 | - if ($globalDebug) echo "Add to DB..."; |
|
2139 | + if ($globalDebug) { |
|
2140 | + echo "Add to DB..."; |
|
2141 | + } |
|
1816 | 2142 | $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
1817 | - } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
2143 | + } else { |
|
2144 | + $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
2145 | + } |
|
1818 | 2146 | if ($error != '') { |
1819 | 2147 | return $error; |
1820 | - } elseif ($globalDebug) echo "Done\n"; |
|
1821 | - if ($globalDebug) echo "Owner Brazil: Download..."; |
|
2148 | + } elseif ($globalDebug) { |
|
2149 | + echo "Done\n"; |
|
2150 | + } |
|
2151 | + if ($globalDebug) { |
|
2152 | + echo "Owner Brazil: Download..."; |
|
2153 | + } |
|
1822 | 2154 | update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
1823 | 2155 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
1824 | - if ($globalDebug) echo "Add to DB..."; |
|
2156 | + if ($globalDebug) { |
|
2157 | + echo "Add to DB..."; |
|
2158 | + } |
|
1825 | 2159 | $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
1826 | - } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
2160 | + } else { |
|
2161 | + $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
2162 | + } |
|
1827 | 2163 | if ($error != '') { |
1828 | 2164 | return $error; |
1829 | - } elseif ($globalDebug) echo "Done\n"; |
|
1830 | - if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
|
2165 | + } elseif ($globalDebug) { |
|
2166 | + echo "Done\n"; |
|
2167 | + } |
|
2168 | + if ($globalDebug) { |
|
2169 | + echo "Owner Cayman Islands: Download..."; |
|
2170 | + } |
|
1831 | 2171 | update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
1832 | 2172 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
1833 | - if ($globalDebug) echo "Add to DB..."; |
|
2173 | + if ($globalDebug) { |
|
2174 | + echo "Add to DB..."; |
|
2175 | + } |
|
1834 | 2176 | $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
1835 | - } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
2177 | + } else { |
|
2178 | + $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
2179 | + } |
|
1836 | 2180 | if ($error != '') { |
1837 | 2181 | return $error; |
1838 | - } elseif ($globalDebug) echo "Done\n"; |
|
1839 | - if ($globalDebug) echo "Owner Croatia: Download..."; |
|
2182 | + } elseif ($globalDebug) { |
|
2183 | + echo "Done\n"; |
|
2184 | + } |
|
2185 | + if ($globalDebug) { |
|
2186 | + echo "Owner Croatia: Download..."; |
|
2187 | + } |
|
1840 | 2188 | update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
1841 | 2189 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
1842 | - if ($globalDebug) echo "Add to DB..."; |
|
2190 | + if ($globalDebug) { |
|
2191 | + echo "Add to DB..."; |
|
2192 | + } |
|
1843 | 2193 | $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
1844 | - } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
2194 | + } else { |
|
2195 | + $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
2196 | + } |
|
1845 | 2197 | if ($error != '') { |
1846 | 2198 | return $error; |
1847 | - } elseif ($globalDebug) echo "Done\n"; |
|
1848 | - if ($globalDebug) echo "Owner Luxembourg: Download..."; |
|
2199 | + } elseif ($globalDebug) { |
|
2200 | + echo "Done\n"; |
|
2201 | + } |
|
2202 | + if ($globalDebug) { |
|
2203 | + echo "Owner Luxembourg: Download..."; |
|
2204 | + } |
|
1849 | 2205 | update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
1850 | 2206 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
1851 | - if ($globalDebug) echo "Add to DB..."; |
|
2207 | + if ($globalDebug) { |
|
2208 | + echo "Add to DB..."; |
|
2209 | + } |
|
1852 | 2210 | $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
1853 | - } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
2211 | + } else { |
|
2212 | + $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
2213 | + } |
|
1854 | 2214 | if ($error != '') { |
1855 | 2215 | return $error; |
1856 | - } elseif ($globalDebug) echo "Done\n"; |
|
1857 | - if ($globalDebug) echo "Owner Maldives: Download..."; |
|
2216 | + } elseif ($globalDebug) { |
|
2217 | + echo "Done\n"; |
|
2218 | + } |
|
2219 | + if ($globalDebug) { |
|
2220 | + echo "Owner Maldives: Download..."; |
|
2221 | + } |
|
1858 | 2222 | update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
1859 | 2223 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
1860 | - if ($globalDebug) echo "Add to DB..."; |
|
2224 | + if ($globalDebug) { |
|
2225 | + echo "Add to DB..."; |
|
2226 | + } |
|
1861 | 2227 | $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
1862 | - } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
2228 | + } else { |
|
2229 | + $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
2230 | + } |
|
1863 | 2231 | if ($error != '') { |
1864 | 2232 | return $error; |
1865 | - } elseif ($globalDebug) echo "Done\n"; |
|
1866 | - if ($globalDebug) echo "Owner New Zealand: Download..."; |
|
2233 | + } elseif ($globalDebug) { |
|
2234 | + echo "Done\n"; |
|
2235 | + } |
|
2236 | + if ($globalDebug) { |
|
2237 | + echo "Owner New Zealand: Download..."; |
|
2238 | + } |
|
1867 | 2239 | update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
1868 | 2240 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
1869 | - if ($globalDebug) echo "Add to DB..."; |
|
2241 | + if ($globalDebug) { |
|
2242 | + echo "Add to DB..."; |
|
2243 | + } |
|
1870 | 2244 | $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
1871 | - } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
2245 | + } else { |
|
2246 | + $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
2247 | + } |
|
1872 | 2248 | if ($error != '') { |
1873 | 2249 | return $error; |
1874 | - } elseif ($globalDebug) echo "Done\n"; |
|
1875 | - if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
|
2250 | + } elseif ($globalDebug) { |
|
2251 | + echo "Done\n"; |
|
2252 | + } |
|
2253 | + if ($globalDebug) { |
|
2254 | + echo "Owner Papua New Guinea: Download..."; |
|
2255 | + } |
|
1876 | 2256 | update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
1877 | 2257 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
1878 | - if ($globalDebug) echo "Add to DB..."; |
|
2258 | + if ($globalDebug) { |
|
2259 | + echo "Add to DB..."; |
|
2260 | + } |
|
1879 | 2261 | $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
1880 | - } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
2262 | + } else { |
|
2263 | + $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
2264 | + } |
|
1881 | 2265 | if ($error != '') { |
1882 | 2266 | return $error; |
1883 | - } elseif ($globalDebug) echo "Done\n"; |
|
1884 | - if ($globalDebug) echo "Owner Slovakia: Download..."; |
|
2267 | + } elseif ($globalDebug) { |
|
2268 | + echo "Done\n"; |
|
2269 | + } |
|
2270 | + if ($globalDebug) { |
|
2271 | + echo "Owner Slovakia: Download..."; |
|
2272 | + } |
|
1885 | 2273 | update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
1886 | 2274 | if (file_exists($tmp_dir.'owner_om.csv')) { |
1887 | - if ($globalDebug) echo "Add to DB..."; |
|
2275 | + if ($globalDebug) { |
|
2276 | + echo "Add to DB..."; |
|
2277 | + } |
|
1888 | 2278 | $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
1889 | - } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
2279 | + } else { |
|
2280 | + $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
2281 | + } |
|
1890 | 2282 | if ($error != '') { |
1891 | 2283 | return $error; |
1892 | - } elseif ($globalDebug) echo "Done\n"; |
|
1893 | - if ($globalDebug) echo "Owner Ecuador: Download..."; |
|
2284 | + } elseif ($globalDebug) { |
|
2285 | + echo "Done\n"; |
|
2286 | + } |
|
2287 | + if ($globalDebug) { |
|
2288 | + echo "Owner Ecuador: Download..."; |
|
2289 | + } |
|
1894 | 2290 | update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
1895 | 2291 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
1896 | - if ($globalDebug) echo "Add to DB..."; |
|
2292 | + if ($globalDebug) { |
|
2293 | + echo "Add to DB..."; |
|
2294 | + } |
|
1897 | 2295 | $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
1898 | - } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
2296 | + } else { |
|
2297 | + $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
2298 | + } |
|
1899 | 2299 | if ($error != '') { |
1900 | 2300 | return $error; |
1901 | - } elseif ($globalDebug) echo "Done\n"; |
|
1902 | - if ($globalDebug) echo "Owner Iceland: Download..."; |
|
2301 | + } elseif ($globalDebug) { |
|
2302 | + echo "Done\n"; |
|
2303 | + } |
|
2304 | + if ($globalDebug) { |
|
2305 | + echo "Owner Iceland: Download..."; |
|
2306 | + } |
|
1903 | 2307 | update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
1904 | 2308 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
1905 | - if ($globalDebug) echo "Add to DB..."; |
|
2309 | + if ($globalDebug) { |
|
2310 | + echo "Add to DB..."; |
|
2311 | + } |
|
1906 | 2312 | $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
1907 | - } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
2313 | + } else { |
|
2314 | + $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
2315 | + } |
|
1908 | 2316 | if ($error != '') { |
1909 | 2317 | return $error; |
1910 | - } elseif ($globalDebug) echo "Done\n"; |
|
1911 | - if ($globalDebug) echo "Owner Isle of Man: Download..."; |
|
2318 | + } elseif ($globalDebug) { |
|
2319 | + echo "Done\n"; |
|
2320 | + } |
|
2321 | + if ($globalDebug) { |
|
2322 | + echo "Owner Isle of Man: Download..."; |
|
2323 | + } |
|
1912 | 2324 | update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
1913 | 2325 | if (file_exists($tmp_dir.'owner_m.csv')) { |
1914 | - if ($globalDebug) echo "Add to DB..."; |
|
2326 | + if ($globalDebug) { |
|
2327 | + echo "Add to DB..."; |
|
2328 | + } |
|
1915 | 2329 | $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
1916 | - } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
2330 | + } else { |
|
2331 | + $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
2332 | + } |
|
1917 | 2333 | if ($error != '') { |
1918 | 2334 | return $error; |
1919 | - } elseif ($globalDebug) echo "Done\n"; |
|
2335 | + } elseif ($globalDebug) { |
|
2336 | + echo "Done\n"; |
|
2337 | + } |
|
1920 | 2338 | if ($globalMasterSource) { |
1921 | - if ($globalDebug) echo "ModeS Netherlands: Download..."; |
|
2339 | + if ($globalDebug) { |
|
2340 | + echo "ModeS Netherlands: Download..."; |
|
2341 | + } |
|
1922 | 2342 | update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
1923 | 2343 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
1924 | - if ($globalDebug) echo "Add to DB..."; |
|
2344 | + if ($globalDebug) { |
|
2345 | + echo "Add to DB..."; |
|
2346 | + } |
|
1925 | 2347 | $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
1926 | - } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
2348 | + } else { |
|
2349 | + $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
2350 | + } |
|
1927 | 2351 | if ($error != '') { |
1928 | 2352 | return $error; |
1929 | - } elseif ($globalDebug) echo "Done\n"; |
|
1930 | - if ($globalDebug) echo "ModeS Denmark: Download..."; |
|
2353 | + } elseif ($globalDebug) { |
|
2354 | + echo "Done\n"; |
|
2355 | + } |
|
2356 | + if ($globalDebug) { |
|
2357 | + echo "ModeS Denmark: Download..."; |
|
2358 | + } |
|
1931 | 2359 | update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
1932 | 2360 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
1933 | - if ($globalDebug) echo "Add to DB..."; |
|
2361 | + if ($globalDebug) { |
|
2362 | + echo "Add to DB..."; |
|
2363 | + } |
|
1934 | 2364 | $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
1935 | - } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
2365 | + } else { |
|
2366 | + $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
2367 | + } |
|
1936 | 2368 | if ($error != '') { |
1937 | 2369 | return $error; |
1938 | - } elseif ($globalDebug) echo "Done\n"; |
|
1939 | - } elseif ($globalDebug) echo "Done\n"; |
|
2370 | + } elseif ($globalDebug) { |
|
2371 | + echo "Done\n"; |
|
2372 | + } |
|
2373 | + } elseif ($globalDebug) { |
|
2374 | + echo "Done\n"; |
|
2375 | + } |
|
1940 | 2376 | return ''; |
1941 | 2377 | } |
1942 | 2378 | |
1943 | 2379 | public static function update_translation() { |
1944 | 2380 | global $tmp_dir, $globalDebug; |
1945 | 2381 | $error = ''; |
1946 | - if ($globalDebug) echo "Translation : Download..."; |
|
2382 | + if ($globalDebug) { |
|
2383 | + echo "Translation : Download..."; |
|
2384 | + } |
|
1947 | 2385 | update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
1948 | 2386 | if (file_exists($tmp_dir.'translation.zip')) { |
1949 | - if ($globalDebug) echo "Unzip..."; |
|
2387 | + if ($globalDebug) { |
|
2388 | + echo "Unzip..."; |
|
2389 | + } |
|
1950 | 2390 | update_db::unzip($tmp_dir.'translation.zip'); |
1951 | - if ($globalDebug) echo "Add to DB..."; |
|
2391 | + if ($globalDebug) { |
|
2392 | + echo "Add to DB..."; |
|
2393 | + } |
|
1952 | 2394 | $error = update_db::translation(); |
1953 | - } else $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
2395 | + } else { |
|
2396 | + $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
2397 | + } |
|
1954 | 2398 | if ($error != '') { |
1955 | 2399 | return $error; |
1956 | - } elseif ($globalDebug) echo "Done\n"; |
|
2400 | + } elseif ($globalDebug) { |
|
2401 | + echo "Done\n"; |
|
2402 | + } |
|
1957 | 2403 | return ''; |
1958 | 2404 | } |
1959 | 2405 | |
1960 | 2406 | public static function update_translation_fam() { |
1961 | 2407 | global $tmp_dir, $globalDebug; |
1962 | - if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
|
2408 | + if ($globalDebug) { |
|
2409 | + echo "Translation from FlightAirMap website : Download..."; |
|
2410 | + } |
|
1963 | 2411 | update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
1964 | 2412 | if (file_exists($tmp_dir.'translation.tsv.gz')) { |
1965 | - if ($globalDebug) echo "Gunzip..."; |
|
2413 | + if ($globalDebug) { |
|
2414 | + echo "Gunzip..."; |
|
2415 | + } |
|
1966 | 2416 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
1967 | - if ($globalDebug) echo "Add to DB..."; |
|
2417 | + if ($globalDebug) { |
|
2418 | + echo "Add to DB..."; |
|
2419 | + } |
|
1968 | 2420 | $error = update_db::translation_fam(); |
1969 | - } else $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
2421 | + } else { |
|
2422 | + $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
2423 | + } |
|
1970 | 2424 | if ($error != '') { |
1971 | 2425 | return $error; |
1972 | - } elseif ($globalDebug) echo "Done\n"; |
|
2426 | + } elseif ($globalDebug) { |
|
2427 | + echo "Done\n"; |
|
2428 | + } |
|
1973 | 2429 | return ''; |
1974 | 2430 | } |
1975 | 2431 | public static function update_ModeS_fam() { |
1976 | 2432 | global $tmp_dir, $globalDebug; |
1977 | - if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
|
2433 | + if ($globalDebug) { |
|
2434 | + echo "ModeS from FlightAirMap website : Download..."; |
|
2435 | + } |
|
1978 | 2436 | update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
1979 | 2437 | if (file_exists($tmp_dir.'modes.tsv.gz')) { |
1980 | - if ($globalDebug) echo "Gunzip..."; |
|
2438 | + if ($globalDebug) { |
|
2439 | + echo "Gunzip..."; |
|
2440 | + } |
|
1981 | 2441 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
1982 | - if ($globalDebug) echo "Add to DB..."; |
|
2442 | + if ($globalDebug) { |
|
2443 | + echo "Add to DB..."; |
|
2444 | + } |
|
1983 | 2445 | $error = update_db::modes_fam(); |
1984 | - } else $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
2446 | + } else { |
|
2447 | + $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
2448 | + } |
|
1985 | 2449 | if ($error != '') { |
1986 | 2450 | return $error; |
1987 | - } elseif ($globalDebug) echo "Done\n"; |
|
2451 | + } elseif ($globalDebug) { |
|
2452 | + echo "Done\n"; |
|
2453 | + } |
|
1988 | 2454 | return ''; |
1989 | 2455 | } |
1990 | 2456 | public static function update_owner_fam() { |
1991 | 2457 | global $tmp_dir, $globalDebug, $globalOwner; |
1992 | - if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
|
2458 | + if ($globalDebug) { |
|
2459 | + echo "owner from FlightAirMap website : Download..."; |
|
2460 | + } |
|
1993 | 2461 | if ($globalOwner === TRUE) { |
1994 | 2462 | update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
1995 | 2463 | } else { |
1996 | 2464 | update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
1997 | 2465 | } |
1998 | 2466 | if (file_exists($tmp_dir.'owners.tsv.gz')) { |
1999 | - if ($globalDebug) echo "Gunzip..."; |
|
2467 | + if ($globalDebug) { |
|
2468 | + echo "Gunzip..."; |
|
2469 | + } |
|
2000 | 2470 | update_db::gunzip($tmp_dir.'owners.tsv.gz'); |
2001 | - if ($globalDebug) echo "Add to DB..."; |
|
2471 | + if ($globalDebug) { |
|
2472 | + echo "Add to DB..."; |
|
2473 | + } |
|
2002 | 2474 | $error = update_db::owner_fam(); |
2003 | - } else $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
2475 | + } else { |
|
2476 | + $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
2477 | + } |
|
2004 | 2478 | if ($error != '') { |
2005 | 2479 | return $error; |
2006 | - } elseif ($globalDebug) echo "Done\n"; |
|
2480 | + } elseif ($globalDebug) { |
|
2481 | + echo "Done\n"; |
|
2482 | + } |
|
2007 | 2483 | return ''; |
2008 | 2484 | } |
2009 | 2485 | public static function update_routes_fam() { |
2010 | 2486 | global $tmp_dir, $globalDebug; |
2011 | - if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
|
2487 | + if ($globalDebug) { |
|
2488 | + echo "Routes from FlightAirMap website : Download..."; |
|
2489 | + } |
|
2012 | 2490 | update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
2013 | 2491 | if (file_exists($tmp_dir.'routes.tsv.gz')) { |
2014 | - if ($globalDebug) echo "Gunzip..."; |
|
2492 | + if ($globalDebug) { |
|
2493 | + echo "Gunzip..."; |
|
2494 | + } |
|
2015 | 2495 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
2016 | - if ($globalDebug) echo "Add to DB..."; |
|
2496 | + if ($globalDebug) { |
|
2497 | + echo "Add to DB..."; |
|
2498 | + } |
|
2017 | 2499 | $error = update_db::routes_fam(); |
2018 | - } else $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
2500 | + } else { |
|
2501 | + $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
2502 | + } |
|
2019 | 2503 | if ($error != '') { |
2020 | 2504 | return $error; |
2021 | - } elseif ($globalDebug) echo "Done\n"; |
|
2505 | + } elseif ($globalDebug) { |
|
2506 | + echo "Done\n"; |
|
2507 | + } |
|
2022 | 2508 | return ''; |
2023 | 2509 | } |
2024 | 2510 | public static function update_marine_identity_fam() { |
@@ -2028,14 +2514,22 @@ discard block |
||
2028 | 2514 | $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
2029 | 2515 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
2030 | 2516 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
2031 | - if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
|
2517 | + if ($globalDebug) { |
|
2518 | + echo "Marine identity from FlightAirMap website : Download..."; |
|
2519 | + } |
|
2032 | 2520 | update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
2033 | 2521 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
2034 | - if ($globalDebug) echo "Gunzip..."; |
|
2522 | + if ($globalDebug) { |
|
2523 | + echo "Gunzip..."; |
|
2524 | + } |
|
2035 | 2525 | update_db::gunzip($tmp_dir.'marine_identity.tsv.gz'); |
2036 | - if ($globalDebug) echo "Add to DB..."; |
|
2526 | + if ($globalDebug) { |
|
2527 | + echo "Add to DB..."; |
|
2528 | + } |
|
2037 | 2529 | $error = update_db::marine_identity_fam(); |
2038 | - } else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
2530 | + } else { |
|
2531 | + $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
2532 | + } |
|
2039 | 2533 | if ($error != '') { |
2040 | 2534 | return $error; |
2041 | 2535 | } elseif ($globalDebug) { |
@@ -2048,17 +2542,25 @@ discard block |
||
2048 | 2542 | } |
2049 | 2543 | public static function update_banned_fam() { |
2050 | 2544 | global $tmp_dir, $globalDebug; |
2051 | - if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
2545 | + if ($globalDebug) { |
|
2546 | + echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
2547 | + } |
|
2052 | 2548 | update_db::download('http://data.flightairmap.fr/data/ban_eu.csv',$tmp_dir.'ban_eu.csv'); |
2053 | 2549 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
2054 | 2550 | //if ($globalDebug) echo "Gunzip..."; |
2055 | 2551 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
2056 | - if ($globalDebug) echo "Add to DB..."; |
|
2552 | + if ($globalDebug) { |
|
2553 | + echo "Add to DB..."; |
|
2554 | + } |
|
2057 | 2555 | $error = update_db::banned_fam(); |
2058 | - } else $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
2556 | + } else { |
|
2557 | + $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
2558 | + } |
|
2059 | 2559 | if ($error != '') { |
2060 | 2560 | return $error; |
2061 | - } elseif ($globalDebug) echo "Done\n"; |
|
2561 | + } elseif ($globalDebug) { |
|
2562 | + echo "Done\n"; |
|
2563 | + } |
|
2062 | 2564 | return ''; |
2063 | 2565 | } |
2064 | 2566 | |
@@ -2066,7 +2568,9 @@ discard block |
||
2066 | 2568 | global $tmp_dir, $globalDebug, $globalDBdriver; |
2067 | 2569 | include_once('class.create_db.php'); |
2068 | 2570 | $error = ''; |
2069 | - if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
|
2571 | + if ($globalDebug) { |
|
2572 | + echo "Airspace from FlightAirMap website : Download..."; |
|
2573 | + } |
|
2070 | 2574 | if ($globalDBdriver == 'mysql') { |
2071 | 2575 | update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
2072 | 2576 | } else { |
@@ -2082,9 +2586,13 @@ discard block |
||
2082 | 2586 | update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
2083 | 2587 | } |
2084 | 2588 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
2085 | - if ($globalDebug) echo "Gunzip..."; |
|
2589 | + if ($globalDebug) { |
|
2590 | + echo "Gunzip..."; |
|
2591 | + } |
|
2086 | 2592 | update_db::gunzip($tmp_dir.'airspace.sql.gz'); |
2087 | - if ($globalDebug) echo "Add to DB..."; |
|
2593 | + if ($globalDebug) { |
|
2594 | + echo "Add to DB..."; |
|
2595 | + } |
|
2088 | 2596 | $Connection = new Connection(); |
2089 | 2597 | if ($Connection->tableExists('airspace')) { |
2090 | 2598 | $query = 'DROP TABLE airspace'; |
@@ -2097,31 +2605,47 @@ discard block |
||
2097 | 2605 | } |
2098 | 2606 | $error = create_db::import_file($tmp_dir.'airspace.sql'); |
2099 | 2607 | update_db::insert_airspace_version($airspace_md5); |
2100 | - } else $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed."; |
|
2608 | + } else { |
|
2609 | + $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed."; |
|
2610 | + } |
|
2101 | 2611 | } |
2102 | - } else $error = "File ".$tmp_dir.'airpsace.sql.gz.md5'." doesn't exist. Download failed."; |
|
2612 | + } else { |
|
2613 | + $error = "File ".$tmp_dir.'airpsace.sql.gz.md5'." doesn't exist. Download failed."; |
|
2614 | + } |
|
2103 | 2615 | if ($error != '') { |
2104 | 2616 | return $error; |
2105 | - } elseif ($globalDebug) echo "Done\n"; |
|
2617 | + } elseif ($globalDebug) { |
|
2618 | + echo "Done\n"; |
|
2619 | + } |
|
2106 | 2620 | return ''; |
2107 | 2621 | } |
2108 | 2622 | |
2109 | 2623 | public static function update_tle() { |
2110 | 2624 | global $tmp_dir, $globalDebug; |
2111 | - if ($globalDebug) echo "Download TLE : Download..."; |
|
2625 | + if ($globalDebug) { |
|
2626 | + echo "Download TLE : Download..."; |
|
2627 | + } |
|
2112 | 2628 | $alltle = array('stations.txt','gps-ops.txt','glo-ops.txt','galileo.txt','weather.txt','noaa.txt','goes.txt','resource.txt','dmc.txt','tdrss.txt','geo.txt','intelsat.txt','gorizont.txt', |
2113 | 2629 | 'raduga.txt','molniya.txt','iridium.txt','orbcomm.txt','globalstar.txt','amateur.txt','x-comm.txt','other-comm.txt','sbas.txt','nnss.txt','musson.txt','science.txt','geodetic.txt', |
2114 | 2630 | 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt'); |
2115 | 2631 | foreach ($alltle as $filename) { |
2116 | - if ($globalDebug) echo "downloading ".$filename.'...'; |
|
2632 | + if ($globalDebug) { |
|
2633 | + echo "downloading ".$filename.'...'; |
|
2634 | + } |
|
2117 | 2635 | update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
2118 | 2636 | if (file_exists($tmp_dir.$filename)) { |
2119 | - if ($globalDebug) echo "Add to DB ".$filename."..."; |
|
2637 | + if ($globalDebug) { |
|
2638 | + echo "Add to DB ".$filename."..."; |
|
2639 | + } |
|
2120 | 2640 | $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
2121 | - } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
2641 | + } else { |
|
2642 | + $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
2643 | + } |
|
2122 | 2644 | if ($error != '') { |
2123 | 2645 | echo $error."\n"; |
2124 | - } elseif ($globalDebug) echo "Done\n"; |
|
2646 | + } elseif ($globalDebug) { |
|
2647 | + echo "Done\n"; |
|
2648 | + } |
|
2125 | 2649 | } |
2126 | 2650 | return ''; |
2127 | 2651 | } |
@@ -2129,10 +2653,14 @@ discard block |
||
2129 | 2653 | public static function update_models() { |
2130 | 2654 | global $tmp_dir, $globalDebug; |
2131 | 2655 | $error = ''; |
2132 | - if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
|
2656 | + if ($globalDebug) { |
|
2657 | + echo "Models from FlightAirMap website : Download..."; |
|
2658 | + } |
|
2133 | 2659 | update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
2134 | 2660 | if (file_exists($tmp_dir.'models.md5sum')) { |
2135 | - if ($globalDebug) echo "Check files...\n"; |
|
2661 | + if ($globalDebug) { |
|
2662 | + echo "Check files...\n"; |
|
2663 | + } |
|
2136 | 2664 | $newmodelsdb = array(); |
2137 | 2665 | if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
2138 | 2666 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2151,25 +2679,35 @@ discard block |
||
2151 | 2679 | } |
2152 | 2680 | $diff = array_diff($newmodelsdb,$modelsdb); |
2153 | 2681 | foreach ($diff as $key => $value) { |
2154 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
2682 | + if ($globalDebug) { |
|
2683 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
2684 | + } |
|
2155 | 2685 | update_db::download('http://data.flightairmap.fr/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
2156 | 2686 | |
2157 | 2687 | } |
2158 | 2688 | update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
2159 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
2689 | + } else { |
|
2690 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
2691 | + } |
|
2160 | 2692 | if ($error != '') { |
2161 | 2693 | return $error; |
2162 | - } elseif ($globalDebug) echo "Done\n"; |
|
2694 | + } elseif ($globalDebug) { |
|
2695 | + echo "Done\n"; |
|
2696 | + } |
|
2163 | 2697 | return ''; |
2164 | 2698 | } |
2165 | 2699 | |
2166 | 2700 | public static function update_space_models() { |
2167 | 2701 | global $tmp_dir, $globalDebug; |
2168 | 2702 | $error = ''; |
2169 | - if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
|
2703 | + if ($globalDebug) { |
|
2704 | + echo "Space models from FlightAirMap website : Download..."; |
|
2705 | + } |
|
2170 | 2706 | update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
2171 | 2707 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
2172 | - if ($globalDebug) echo "Check files...\n"; |
|
2708 | + if ($globalDebug) { |
|
2709 | + echo "Check files...\n"; |
|
2710 | + } |
|
2173 | 2711 | $newmodelsdb = array(); |
2174 | 2712 | if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
2175 | 2713 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2188,25 +2726,35 @@ discard block |
||
2188 | 2726 | } |
2189 | 2727 | $diff = array_diff($newmodelsdb,$modelsdb); |
2190 | 2728 | foreach ($diff as $key => $value) { |
2191 | - if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
|
2729 | + if ($globalDebug) { |
|
2730 | + echo 'Downloading space model '.$key.' ...'."\n"; |
|
2731 | + } |
|
2192 | 2732 | update_db::download('http://data.flightairmap.fr/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
2193 | 2733 | |
2194 | 2734 | } |
2195 | 2735 | update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
2196 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
2736 | + } else { |
|
2737 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
2738 | + } |
|
2197 | 2739 | if ($error != '') { |
2198 | 2740 | return $error; |
2199 | - } elseif ($globalDebug) echo "Done\n"; |
|
2741 | + } elseif ($globalDebug) { |
|
2742 | + echo "Done\n"; |
|
2743 | + } |
|
2200 | 2744 | return ''; |
2201 | 2745 | } |
2202 | 2746 | |
2203 | 2747 | public static function update_vehicules_models() { |
2204 | 2748 | global $tmp_dir, $globalDebug; |
2205 | 2749 | $error = ''; |
2206 | - if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
|
2750 | + if ($globalDebug) { |
|
2751 | + echo "Vehicules models from FlightAirMap website : Download..."; |
|
2752 | + } |
|
2207 | 2753 | update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
2208 | 2754 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
2209 | - if ($globalDebug) echo "Check files...\n"; |
|
2755 | + if ($globalDebug) { |
|
2756 | + echo "Check files...\n"; |
|
2757 | + } |
|
2210 | 2758 | $newmodelsdb = array(); |
2211 | 2759 | if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
2212 | 2760 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2225,15 +2773,21 @@ discard block |
||
2225 | 2773 | } |
2226 | 2774 | $diff = array_diff($newmodelsdb,$modelsdb); |
2227 | 2775 | foreach ($diff as $key => $value) { |
2228 | - if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
2776 | + if ($globalDebug) { |
|
2777 | + echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
2778 | + } |
|
2229 | 2779 | update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
2230 | 2780 | |
2231 | 2781 | } |
2232 | 2782 | update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
2233 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
2783 | + } else { |
|
2784 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
2785 | + } |
|
2234 | 2786 | if ($error != '') { |
2235 | 2787 | return $error; |
2236 | - } elseif ($globalDebug) echo "Done\n"; |
|
2788 | + } elseif ($globalDebug) { |
|
2789 | + echo "Done\n"; |
|
2790 | + } |
|
2237 | 2791 | return ''; |
2238 | 2792 | } |
2239 | 2793 | |
@@ -2276,7 +2830,9 @@ discard block |
||
2276 | 2830 | } |
2277 | 2831 | |
2278 | 2832 | $error = ''; |
2279 | - if ($globalDebug) echo "Notam : Download..."; |
|
2833 | + if ($globalDebug) { |
|
2834 | + echo "Notam : Download..."; |
|
2835 | + } |
|
2280 | 2836 | update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
2281 | 2837 | if (file_exists($tmp_dir.'notam.rss')) { |
2282 | 2838 | $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
@@ -2291,14 +2847,30 @@ discard block |
||
2291 | 2847 | $data['fir'] = $q[0]; |
2292 | 2848 | $data['code'] = $q[1]; |
2293 | 2849 | $ifrvfr = $q[2]; |
2294 | - if ($ifrvfr == 'IV') $data['rules'] = 'IFR/VFR'; |
|
2295 | - if ($ifrvfr == 'I') $data['rules'] = 'IFR'; |
|
2296 | - if ($ifrvfr == 'V') $data['rules'] = 'VFR'; |
|
2297 | - if ($q[4] == 'A') $data['scope'] = 'Airport warning'; |
|
2298 | - if ($q[4] == 'E') $data['scope'] = 'Enroute warning'; |
|
2299 | - if ($q[4] == 'W') $data['scope'] = 'Navigation warning'; |
|
2300 | - if ($q[4] == 'AE') $data['scope'] = 'Airport/Enroute warning'; |
|
2301 | - if ($q[4] == 'AW') $data['scope'] = 'Airport/Navigation warning'; |
|
2850 | + if ($ifrvfr == 'IV') { |
|
2851 | + $data['rules'] = 'IFR/VFR'; |
|
2852 | + } |
|
2853 | + if ($ifrvfr == 'I') { |
|
2854 | + $data['rules'] = 'IFR'; |
|
2855 | + } |
|
2856 | + if ($ifrvfr == 'V') { |
|
2857 | + $data['rules'] = 'VFR'; |
|
2858 | + } |
|
2859 | + if ($q[4] == 'A') { |
|
2860 | + $data['scope'] = 'Airport warning'; |
|
2861 | + } |
|
2862 | + if ($q[4] == 'E') { |
|
2863 | + $data['scope'] = 'Enroute warning'; |
|
2864 | + } |
|
2865 | + if ($q[4] == 'W') { |
|
2866 | + $data['scope'] = 'Navigation warning'; |
|
2867 | + } |
|
2868 | + if ($q[4] == 'AE') { |
|
2869 | + $data['scope'] = 'Airport/Enroute warning'; |
|
2870 | + } |
|
2871 | + if ($q[4] == 'AW') { |
|
2872 | + $data['scope'] = 'Airport/Navigation warning'; |
|
2873 | + } |
|
2302 | 2874 | //$data['scope'] = $q[4]; |
2303 | 2875 | $data['lower_limit'] = $q[5]; |
2304 | 2876 | $data['upper_limit'] = $q[6]; |
@@ -2306,8 +2878,12 @@ discard block |
||
2306 | 2878 | sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
2307 | 2879 | $latitude = $Common->convertDec($las,'latitude'); |
2308 | 2880 | $longitude = $Common->convertDec($lns,'longitude'); |
2309 | - if ($lac == 'S') $latitude = '-'.$latitude; |
|
2310 | - if ($lnc == 'W') $longitude = '-'.$longitude; |
|
2881 | + if ($lac == 'S') { |
|
2882 | + $latitude = '-'.$latitude; |
|
2883 | + } |
|
2884 | + if ($lnc == 'W') { |
|
2885 | + $longitude = '-'.$longitude; |
|
2886 | + } |
|
2311 | 2887 | $data['center_latitude'] = $latitude; |
2312 | 2888 | $data['center_longitude'] = $longitude; |
2313 | 2889 | $data['radius'] = intval($radius); |
@@ -2337,10 +2913,14 @@ discard block |
||
2337 | 2913 | $NOTAM->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['center_latitude'],$data['center_longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
2338 | 2914 | unset($data); |
2339 | 2915 | } |
2340 | - } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
2916 | + } else { |
|
2917 | + $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
2918 | + } |
|
2341 | 2919 | if ($error != '') { |
2342 | 2920 | return $error; |
2343 | - } elseif ($globalDebug) echo "Done\n"; |
|
2921 | + } elseif ($globalDebug) { |
|
2922 | + echo "Done\n"; |
|
2923 | + } |
|
2344 | 2924 | return ''; |
2345 | 2925 | } |
2346 | 2926 | |
@@ -2365,7 +2945,9 @@ discard block |
||
2365 | 2945 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
2366 | 2946 | $airspace_json = json_decode($airspace_lst,true); |
2367 | 2947 | foreach ($airspace_json['records'] as $airspace) { |
2368 | - if ($globalDebug) echo $airspace['name']."...\n"; |
|
2948 | + if ($globalDebug) { |
|
2949 | + echo $airspace['name']."...\n"; |
|
2950 | + } |
|
2369 | 2951 | update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
2370 | 2952 | if (file_exists($tmp_dir.$airspace['name'])) { |
2371 | 2953 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
@@ -2409,8 +2991,11 @@ discard block |
||
2409 | 2991 | return "error : ".$e->getMessage(); |
2410 | 2992 | } |
2411 | 2993 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2412 | - if ($row['nb'] > 0) return false; |
|
2413 | - else return true; |
|
2994 | + if ($row['nb'] > 0) { |
|
2995 | + return false; |
|
2996 | + } else { |
|
2997 | + return true; |
|
2998 | + } |
|
2414 | 2999 | } |
2415 | 3000 | |
2416 | 3001 | public static function insert_last_update() { |
@@ -2435,8 +3020,11 @@ discard block |
||
2435 | 3020 | return "error : ".$e->getMessage(); |
2436 | 3021 | } |
2437 | 3022 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2438 | - if ($row['nb'] > 0) return true; |
|
2439 | - else return false; |
|
3023 | + if ($row['nb'] > 0) { |
|
3024 | + return true; |
|
3025 | + } else { |
|
3026 | + return false; |
|
3027 | + } |
|
2440 | 3028 | } |
2441 | 3029 | |
2442 | 3030 | public static function check_marine_identity_version($version) { |
@@ -2449,8 +3037,11 @@ discard block |
||
2449 | 3037 | return "error : ".$e->getMessage(); |
2450 | 3038 | } |
2451 | 3039 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2452 | - if ($row['nb'] > 0) return true; |
|
2453 | - else return false; |
|
3040 | + if ($row['nb'] > 0) { |
|
3041 | + return true; |
|
3042 | + } else { |
|
3043 | + return false; |
|
3044 | + } |
|
2454 | 3045 | } |
2455 | 3046 | |
2456 | 3047 | |
@@ -2493,8 +3084,11 @@ discard block |
||
2493 | 3084 | return "error : ".$e->getMessage(); |
2494 | 3085 | } |
2495 | 3086 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2496 | - if ($row['nb'] > 0) return false; |
|
2497 | - else return true; |
|
3087 | + if ($row['nb'] > 0) { |
|
3088 | + return false; |
|
3089 | + } else { |
|
3090 | + return true; |
|
3091 | + } |
|
2498 | 3092 | } |
2499 | 3093 | |
2500 | 3094 | public static function insert_last_notam_update() { |
@@ -2523,8 +3117,11 @@ discard block |
||
2523 | 3117 | return "error : ".$e->getMessage(); |
2524 | 3118 | } |
2525 | 3119 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2526 | - if ($row['nb'] > 0) return false; |
|
2527 | - else return true; |
|
3120 | + if ($row['nb'] > 0) { |
|
3121 | + return false; |
|
3122 | + } else { |
|
3123 | + return true; |
|
3124 | + } |
|
2528 | 3125 | } |
2529 | 3126 | |
2530 | 3127 | public static function insert_last_airspace_update() { |
@@ -2554,8 +3151,11 @@ discard block |
||
2554 | 3151 | return "error : ".$e->getMessage(); |
2555 | 3152 | } |
2556 | 3153 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2557 | - if ($row['nb'] > 0) return false; |
|
2558 | - else return true; |
|
3154 | + if ($row['nb'] > 0) { |
|
3155 | + return false; |
|
3156 | + } else { |
|
3157 | + return true; |
|
3158 | + } |
|
2559 | 3159 | } |
2560 | 3160 | |
2561 | 3161 | public static function insert_last_owner_update() { |
@@ -2584,8 +3184,11 @@ discard block |
||
2584 | 3184 | return "error : ".$e->getMessage(); |
2585 | 3185 | } |
2586 | 3186 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2587 | - if ($row['nb'] > 0) return false; |
|
2588 | - else return true; |
|
3187 | + if ($row['nb'] > 0) { |
|
3188 | + return false; |
|
3189 | + } else { |
|
3190 | + return true; |
|
3191 | + } |
|
2589 | 3192 | } |
2590 | 3193 | |
2591 | 3194 | public static function insert_last_schedules_update() { |
@@ -2614,8 +3217,11 @@ discard block |
||
2614 | 3217 | return "error : ".$e->getMessage(); |
2615 | 3218 | } |
2616 | 3219 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2617 | - if ($row['nb'] > 0) return false; |
|
2618 | - else return true; |
|
3220 | + if ($row['nb'] > 0) { |
|
3221 | + return false; |
|
3222 | + } else { |
|
3223 | + return true; |
|
3224 | + } |
|
2619 | 3225 | } |
2620 | 3226 | |
2621 | 3227 | public static function insert_last_tle_update() { |
@@ -2644,8 +3250,11 @@ discard block |
||
2644 | 3250 | return "error : ".$e->getMessage(); |
2645 | 3251 | } |
2646 | 3252 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2647 | - if ($row['nb'] > 0) return false; |
|
2648 | - else return true; |
|
3253 | + if ($row['nb'] > 0) { |
|
3254 | + return false; |
|
3255 | + } else { |
|
3256 | + return true; |
|
3257 | + } |
|
2649 | 3258 | } |
2650 | 3259 | |
2651 | 3260 | public static function insert_last_marine_identity_update() { |
@@ -44,7 +44,9 @@ discard block |
||
44 | 44 | |
45 | 45 | public function checkAll() { |
46 | 46 | global $globalDebug; |
47 | - if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
47 | + if ($globalDebug) { |
|
48 | + echo "Update last seen tracked data...\n"; |
|
49 | + } |
|
48 | 50 | foreach ($this->all_tracked as $key => $flight) { |
49 | 51 | if (isset($this->all_tracked[$key]['id'])) { |
50 | 52 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
@@ -57,12 +59,16 @@ discard block |
||
57 | 59 | public function del() { |
58 | 60 | global $globalDebug; |
59 | 61 | // Delete old infos |
60 | - if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
|
62 | + if ($globalDebug) { |
|
63 | + echo 'Delete old values and update latest data...'."\n"; |
|
64 | + } |
|
61 | 65 | foreach ($this->all_tracked as $key => $flight) { |
62 | 66 | if (isset($flight['lastupdate'])) { |
63 | 67 | if ($flight['lastupdate'] < (time()-3000)) { |
64 | 68 | if (isset($this->all_tracked[$key]['id'])) { |
65 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
69 | + if ($globalDebug) { |
|
70 | + echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
71 | + } |
|
66 | 72 | /* |
67 | 73 | $TrackerLive = new TrackerLive(); |
68 | 74 | $TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']); |
@@ -72,7 +78,9 @@ discard block |
||
72 | 78 | $Tracker = new Tracker($this->db); |
73 | 79 | if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
74 | 80 | $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']); |
75 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
81 | + if ($globalDebug && $result != 'success') { |
|
82 | + echo '!!! ERROR : '.$result."\n"; |
|
83 | + } |
|
76 | 84 | } |
77 | 85 | // Put in archive |
78 | 86 | // $Tracker->db = null; |
@@ -85,7 +93,9 @@ discard block |
||
85 | 93 | |
86 | 94 | public function add($line) { |
87 | 95 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked; |
88 | - if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
|
96 | + if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') { |
|
97 | + $globalCoordMinChange = '0.02'; |
|
98 | + } |
|
89 | 99 | date_default_timezone_set('UTC'); |
90 | 100 | $dataFound = false; |
91 | 101 | $send = false; |
@@ -109,8 +119,11 @@ discard block |
||
109 | 119 | */ |
110 | 120 | |
111 | 121 | $Common = new Common(); |
112 | - if (!isset($line['id'])) $id = trim($line['ident']); |
|
113 | - else $id = trim($line['id']); |
|
122 | + if (!isset($line['id'])) { |
|
123 | + $id = trim($line['ident']); |
|
124 | + } else { |
|
125 | + $id = trim($line['id']); |
|
126 | + } |
|
114 | 127 | |
115 | 128 | if (!isset($this->all_tracked[$id])) { |
116 | 129 | $this->all_tracked[$id] = array(); |
@@ -118,31 +131,46 @@ discard block |
||
118 | 131 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
119 | 132 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
120 | 133 | if (!isset($line['id'])) { |
121 | - if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
134 | + if (!isset($globalDaemon)) { |
|
135 | + $globalDaemon = TRUE; |
|
136 | + } |
|
122 | 137 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
123 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
124 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
138 | + } else { |
|
139 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
140 | + } |
|
141 | + if ($globalAllTracked !== FALSE) { |
|
142 | + $dataFound = true; |
|
143 | + } |
|
125 | 144 | } |
126 | 145 | |
127 | 146 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60) { |
128 | 147 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
129 | 148 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
130 | 149 | } else { |
131 | - if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
132 | - elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
150 | + if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) { |
|
151 | + echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
152 | + } elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) { |
|
153 | + echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
154 | + } |
|
133 | 155 | return ''; |
134 | 156 | } |
135 | 157 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
136 | - if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."!!!"; |
|
158 | + if ($globalDebug) { |
|
159 | + echo "!!! Date is too old ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."!!!"; |
|
160 | + } |
|
137 | 161 | return ''; |
138 | 162 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
139 | - if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."!!!"; |
|
163 | + if ($globalDebug) { |
|
164 | + echo "!!! Date is in the future ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."!!!"; |
|
165 | + } |
|
140 | 166 | return ''; |
141 | 167 | } elseif (!isset($line['datetime'])) { |
142 | 168 | date_default_timezone_set('UTC'); |
143 | 169 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); |
144 | 170 | } else { |
145 | - if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."!!!"; |
|
171 | + if ($globalDebug) { |
|
172 | + echo "!!! Unknow date error ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."!!!"; |
|
173 | + } |
|
146 | 174 | return ''; |
147 | 175 | } |
148 | 176 | |
@@ -154,11 +182,17 @@ discard block |
||
154 | 182 | $Tracker = new Tracker($this->db); |
155 | 183 | $fromsource = NULL; |
156 | 184 | $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
157 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
185 | + if ($globalDebug && $result != 'success') { |
|
186 | + echo '!!! ERROR : '.$result."\n"; |
|
187 | + } |
|
158 | 188 | $Tracker->db = null; |
159 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
189 | + if ($globalDebugTimeElapsed) { |
|
190 | + echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
191 | + } |
|
192 | + } |
|
193 | + if (!isset($this->all_tracked[$id]['id'])) { |
|
194 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
160 | 195 | } |
161 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
162 | 196 | } |
163 | 197 | |
164 | 198 | if (isset($line['speed']) && $line['speed'] != '') { |
@@ -169,14 +203,21 @@ discard block |
||
169 | 203 | if ($distance > 1000 && $distance < 10000) { |
170 | 204 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
171 | 205 | $speed = $speed*3.6; |
172 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
173 | - if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
|
206 | + if ($speed < 1000) { |
|
207 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
208 | + } |
|
209 | + if ($globalDebug) { |
|
210 | + echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
|
211 | + } |
|
174 | 212 | } |
175 | 213 | } |
176 | 214 | |
177 | 215 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
178 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
179 | - else unset($timediff); |
|
216 | + if (isset($this->all_tracked[$id]['time_last_coord'])) { |
|
217 | + $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
218 | + } else { |
|
219 | + unset($timediff); |
|
220 | + } |
|
180 | 221 | if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
181 | 222 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
182 | 223 | if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
@@ -184,20 +225,30 @@ discard block |
||
184 | 225 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
185 | 226 | $this->all_tracked[$id]['putinarchive'] = true; |
186 | 227 | |
187 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
228 | + if ($globalDebug) { |
|
229 | + echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
230 | + } |
|
188 | 231 | $timeelapsed = microtime(true); |
189 | 232 | $Tracker = new Tracker($this->db); |
190 | 233 | $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
191 | - if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
234 | + if (!empty($all_country)) { |
|
235 | + $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
236 | + } |
|
192 | 237 | $Tracker->db = null; |
193 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
238 | + if ($globalDebugTimeElapsed) { |
|
239 | + echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
240 | + } |
|
194 | 241 | $this->tmd = 0; |
195 | - if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
|
242 | + if ($globalDebug) { |
|
243 | + echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
|
244 | + } |
|
196 | 245 | } |
197 | 246 | } |
198 | 247 | |
199 | 248 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
200 | - if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
|
249 | + if (!isset($this->all_tracked[$id]['archive_latitude'])) { |
|
250 | + $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
|
251 | + } |
|
201 | 252 | if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
202 | 253 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
203 | 254 | $dataFound = true; |
@@ -206,8 +257,12 @@ discard block |
||
206 | 257 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
207 | 258 | } |
208 | 259 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
209 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
210 | - if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
|
260 | + if ($line['longitude'] > 180) { |
|
261 | + $line['longitude'] = $line['longitude'] - 360; |
|
262 | + } |
|
263 | + if (!isset($this->all_tracked[$id]['archive_longitude'])) { |
|
264 | + $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
|
265 | + } |
|
211 | 266 | if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
212 | 267 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
213 | 268 | $dataFound = true; |
@@ -225,7 +280,9 @@ discard block |
||
225 | 280 | } |
226 | 281 | } |
227 | 282 | if (isset($line['last_update']) && $line['last_update'] != '') { |
228 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
283 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) { |
|
284 | + $dataFound = true; |
|
285 | + } |
|
229 | 286 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
230 | 287 | } |
231 | 288 | if (isset($line['format_source']) && $line['format_source'] != '') { |
@@ -245,7 +302,9 @@ discard block |
||
245 | 302 | |
246 | 303 | if (isset($line['altitude']) && $line['altitude'] != '') { |
247 | 304 | //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
248 | - if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
|
305 | + if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) { |
|
306 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
307 | + } |
|
249 | 308 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => round($line['altitude']/100))); |
250 | 309 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude'])); |
251 | 310 | //$dataFound = true; |
@@ -257,15 +316,21 @@ discard block |
||
257 | 316 | } |
258 | 317 | |
259 | 318 | if (isset($line['heading']) && $line['heading'] != '') { |
260 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
319 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) { |
|
320 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
321 | + } |
|
261 | 322 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
262 | 323 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
263 | 324 | //$dataFound = true; |
264 | 325 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
265 | 326 | $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
266 | 327 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
267 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
268 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
328 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) { |
|
329 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
330 | + } |
|
331 | + if ($globalDebug) { |
|
332 | + echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
333 | + } |
|
269 | 334 | } |
270 | 335 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
271 | 336 | |
@@ -274,20 +339,31 @@ discard block |
||
274 | 339 | if ($this->all_tracked[$id]['addedTracker'] == 0) { |
275 | 340 | if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
276 | 341 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
277 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
342 | + if ($globalDebug) { |
|
343 | + echo "Check if aircraft is already in DB..."; |
|
344 | + } |
|
278 | 345 | $timeelapsed = microtime(true); |
279 | 346 | $TrackerLive = new TrackerLive($this->db); |
280 | 347 | if (isset($line['id'])) { |
281 | 348 | $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
282 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
349 | + if ($globalDebugTimeElapsed) { |
|
350 | + echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
351 | + } |
|
283 | 352 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
284 | 353 | $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
285 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
286 | - } else $recent_ident = ''; |
|
354 | + if ($globalDebugTimeElapsed) { |
|
355 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
356 | + } |
|
357 | + } else { |
|
358 | + $recent_ident = ''; |
|
359 | + } |
|
287 | 360 | $TrackerLive->db=null; |
288 | 361 | |
289 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
290 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
362 | + if ($globalDebug && $recent_ident == '') { |
|
363 | + echo " Not in DB.\n"; |
|
364 | + } elseif ($globalDebug && $recent_ident != '') { |
|
365 | + echo " Already in DB.\n"; |
|
366 | + } |
|
291 | 367 | } else { |
292 | 368 | $recent_ident = ''; |
293 | 369 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
@@ -295,16 +371,24 @@ discard block |
||
295 | 371 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
296 | 372 | if($recent_ident == "") |
297 | 373 | { |
298 | - if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
|
374 | + if ($globalDebug) { |
|
375 | + echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
|
376 | + } |
|
299 | 377 | //adds the spotter data for the archive |
300 | 378 | $highlight = ''; |
301 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
379 | + if (!isset($this->all_tracked[$id]['id'])) { |
|
380 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
381 | + } |
|
302 | 382 | $timeelapsed = microtime(true); |
303 | 383 | $Tracker = new Tracker($this->db); |
304 | 384 | $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
305 | 385 | $Tracker->db = null; |
306 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
307 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
386 | + if ($globalDebug && isset($result)) { |
|
387 | + echo $result."\n"; |
|
388 | + } |
|
389 | + if ($globalDebugTimeElapsed) { |
|
390 | + echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
391 | + } |
|
308 | 392 | |
309 | 393 | /* |
310 | 394 | // Add source stat in DB |
@@ -338,12 +422,16 @@ discard block |
||
338 | 422 | $this->all_tracked[$id]['addedTracker'] = 1; |
339 | 423 | //print_r($this->all_tracked[$id]); |
340 | 424 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
341 | - if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
425 | + if ($globalDebug) { |
|
426 | + echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
427 | + } |
|
342 | 428 | //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
343 | 429 | $TrackerLive = new TrackerLive($this->db); |
344 | 430 | $TrackerLive->deleteLiveTrackerData(); |
345 | 431 | $TrackerLive->db=null; |
346 | - if ($globalDebug) echo " Done\n"; |
|
432 | + if ($globalDebug) { |
|
433 | + echo " Done\n"; |
|
434 | + } |
|
347 | 435 | $this->last_delete = time(); |
348 | 436 | } |
349 | 437 | } else { |
@@ -366,13 +454,17 @@ discard block |
||
366 | 454 | |
367 | 455 | if (!$ignoreImport) { |
368 | 456 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
369 | - if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
|
457 | + if ($globalDebug) { |
|
458 | + echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
|
459 | + } |
|
370 | 460 | $timeelapsed = microtime(true); |
371 | 461 | $TrackerLive = new TrackerLive($this->db); |
372 | 462 | $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
373 | 463 | $TrackerLive->db = null; |
374 | 464 | $this->all_tracked[$id]['putinarchive'] = false; |
375 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
465 | + if ($globalDebugTimeElapsed) { |
|
466 | + echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
467 | + } |
|
376 | 468 | |
377 | 469 | // Put statistics in $this->stats variable |
378 | 470 | /* |
@@ -429,19 +521,29 @@ discard block |
||
429 | 521 | */ |
430 | 522 | |
431 | 523 | $this->all_tracked[$id]['lastupdate'] = time(); |
432 | - if ($this->all_tracked[$id]['putinarchive']) $send = true; |
|
433 | - if ($globalDebug) echo $result."\n"; |
|
434 | - } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
524 | + if ($this->all_tracked[$id]['putinarchive']) { |
|
525 | + $send = true; |
|
526 | + } |
|
527 | + if ($globalDebug) { |
|
528 | + echo $result."\n"; |
|
529 | + } |
|
530 | + } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) { |
|
531 | + echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
532 | + } |
|
435 | 533 | //$this->del(); |
436 | 534 | |
437 | 535 | |
438 | 536 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
439 | - if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
537 | + if ($globalDebug) { |
|
538 | + echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
539 | + } |
|
440 | 540 | $TrackerLive = new TrackerLive($this->db); |
441 | 541 | $TrackerLive->deleteLiveTrackerDataNotUpdated(); |
442 | 542 | $TrackerLive->db = null; |
443 | 543 | //TrackerLive->deleteLiveTrackerData(); |
444 | - if ($globalDebug) echo " Done\n"; |
|
544 | + if ($globalDebug) { |
|
545 | + echo " Done\n"; |
|
546 | + } |
|
445 | 547 | $this->last_delete_hourly = time(); |
446 | 548 | } |
447 | 549 | |
@@ -449,7 +551,9 @@ discard block |
||
449 | 551 | //$ignoreImport = false; |
450 | 552 | } |
451 | 553 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
452 | - if ($send) return $this->all_tracked[$id]; |
|
554 | + if ($send) { |
|
555 | + return $this->all_tracked[$id]; |
|
556 | + } |
|
453 | 557 | } |
454 | 558 | } |
455 | 559 | } |
@@ -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 = 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,15 +310,21 @@ 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 | - 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 | + } else { |
|
326 | + $spotter_item['aircraft_shadow'] = ''; |
|
327 | + } |
|
266 | 328 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
267 | 329 | } |
268 | 330 | } |
@@ -270,73 +332,139 @@ discard block |
||
270 | 332 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
271 | 333 | if ($tracker) { |
272 | 334 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
273 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
274 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
335 | + if ($compress) { |
|
336 | + $output .= '"as": "ambulance.png",'; |
|
337 | + } else { |
|
338 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
339 | + } |
|
275 | 340 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
276 | - if ($compress) $output .= '"as": "police.png",'; |
|
277 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
341 | + if ($compress) { |
|
342 | + $output .= '"as": "police.png",'; |
|
343 | + } else { |
|
344 | + $output .= '"aircraft_shadow": "police.png",'; |
|
345 | + } |
|
278 | 346 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
279 | - if ($compress) $output .= '"as": "ship.png",'; |
|
280 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
347 | + if ($compress) { |
|
348 | + $output .= '"as": "ship.png",'; |
|
349 | + } else { |
|
350 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
351 | + } |
|
281 | 352 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
282 | - if ($compress) $output .= '"as": "ship.png",'; |
|
283 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
353 | + if ($compress) { |
|
354 | + $output .= '"as": "ship.png",'; |
|
355 | + } else { |
|
356 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
357 | + } |
|
284 | 358 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
285 | - if ($compress) $output .= '"as": "ship.png",'; |
|
286 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
359 | + if ($compress) { |
|
360 | + $output .= '"as": "ship.png",'; |
|
361 | + } else { |
|
362 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
363 | + } |
|
287 | 364 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
288 | - if ($compress) $output .= '"as": "truck.png",'; |
|
289 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
365 | + if ($compress) { |
|
366 | + $output .= '"as": "truck.png",'; |
|
367 | + } else { |
|
368 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
369 | + } |
|
290 | 370 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
291 | - if ($compress) $output .= '"as": "truck.png",'; |
|
292 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
371 | + if ($compress) { |
|
372 | + $output .= '"as": "truck.png",'; |
|
373 | + } else { |
|
374 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
375 | + } |
|
293 | 376 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
294 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
295 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
377 | + if ($compress) { |
|
378 | + $output .= '"as": "aircraft.png",'; |
|
379 | + } else { |
|
380 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
381 | + } |
|
296 | 382 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
297 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
298 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
383 | + if ($compress) { |
|
384 | + $output .= '"as": "aircraft.png",'; |
|
385 | + } else { |
|
386 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
387 | + } |
|
299 | 388 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
300 | - if ($compress) $output .= '"as": "helico.png",'; |
|
301 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
389 | + if ($compress) { |
|
390 | + $output .= '"as": "helico.png",'; |
|
391 | + } else { |
|
392 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
393 | + } |
|
302 | 394 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
303 | - if ($compress) $output .= '"as": "rail.png",'; |
|
304 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
395 | + if ($compress) { |
|
396 | + $output .= '"as": "rail.png",'; |
|
397 | + } else { |
|
398 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
399 | + } |
|
305 | 400 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
306 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
307 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
401 | + if ($compress) { |
|
402 | + $output .= '"as": "firetruck.png",'; |
|
403 | + } else { |
|
404 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
405 | + } |
|
308 | 406 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
309 | - if ($compress) $output .= '"as": "bus.png",'; |
|
310 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
407 | + if ($compress) { |
|
408 | + $output .= '"as": "bus.png",'; |
|
409 | + } else { |
|
410 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
411 | + } |
|
311 | 412 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
312 | - if ($compress) $output .= '"as": "phone.png",'; |
|
313 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
413 | + if ($compress) { |
|
414 | + $output .= '"as": "phone.png",'; |
|
415 | + } else { |
|
416 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
417 | + } |
|
314 | 418 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
315 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
316 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
419 | + if ($compress) { |
|
420 | + $output .= '"as": "jogger.png",'; |
|
421 | + } else { |
|
422 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
423 | + } |
|
317 | 424 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
318 | - if ($compress) $output .= '"as": "bike.png",'; |
|
319 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
425 | + if ($compress) { |
|
426 | + $output .= '"as": "bike.png",'; |
|
427 | + } else { |
|
428 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
429 | + } |
|
320 | 430 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
321 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
322 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
431 | + if ($compress) { |
|
432 | + $output .= '"as": "motorcycle.png",'; |
|
433 | + } else { |
|
434 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
435 | + } |
|
323 | 436 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
324 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
325 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
437 | + if ($compress) { |
|
438 | + $output .= '"as": "balloon.png",'; |
|
439 | + } else { |
|
440 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
441 | + } |
|
326 | 442 | } else { |
327 | - if ($compress) $output .= '"as": "car.png",'; |
|
328 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
443 | + if ($compress) { |
|
444 | + $output .= '"as": "car.png",'; |
|
445 | + } else { |
|
446 | + $output .= '"aircraft_shadow": "car.png",'; |
|
447 | + } |
|
329 | 448 | } |
330 | 449 | } elseif ($marine) { |
331 | - if ($compress) $output .= '"as": "ship.png",'; |
|
332 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
450 | + if ($compress) { |
|
451 | + $output .= '"as": "ship.png",'; |
|
452 | + } else { |
|
453 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
454 | + } |
|
333 | 455 | } else { |
334 | - if ($compress) $output .= '"as": "default.png",'; |
|
335 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
456 | + if ($compress) { |
|
457 | + $output .= '"as": "default.png",'; |
|
458 | + } else { |
|
459 | + $output .= '"aircraft_shadow": "default.png",'; |
|
460 | + } |
|
336 | 461 | } |
337 | 462 | } else { |
338 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
339 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
463 | + if ($compress) { |
|
464 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
465 | + } else { |
|
466 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
467 | + } |
|
340 | 468 | } |
341 | 469 | if (isset($spotter_item['airline_name'])) { |
342 | 470 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -344,8 +472,11 @@ discard block |
||
344 | 472 | $output .= '"airline_name": "NA",'; |
345 | 473 | } |
346 | 474 | if (isset($spotter_item['departure_airport'])) { |
347 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
348 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
475 | + if ($compress) { |
|
476 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
477 | + } else { |
|
478 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
479 | + } |
|
349 | 480 | } |
350 | 481 | if (isset($spotter_item['departure_airport_city'])) { |
351 | 482 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -357,8 +488,11 @@ discard block |
||
357 | 488 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
358 | 489 | } |
359 | 490 | if (isset($spotter_item['arrival_airport'])) { |
360 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
361 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
491 | + if ($compress) { |
|
492 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
493 | + } else { |
|
494 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
495 | + } |
|
362 | 496 | } |
363 | 497 | if (isset($spotter_item['arrival_airport_city'])) { |
364 | 498 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -377,11 +511,17 @@ discard block |
||
377 | 511 | } |
378 | 512 | |
379 | 513 | if (isset($spotter_item['altitude'])) { |
380 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
381 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
514 | + if ($compress) { |
|
515 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
516 | + } else { |
|
517 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
518 | + } |
|
519 | + } |
|
520 | + if ($compress) { |
|
521 | + $output .= '"h": "'.$spotter_item['heading'].'",'; |
|
522 | + } else { |
|
523 | + $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
382 | 524 | } |
383 | - if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",'; |
|
384 | - else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
385 | 525 | |
386 | 526 | if (isset($archivespeed)) { |
387 | 527 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
@@ -391,7 +531,9 @@ discard block |
||
391 | 531 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
392 | 532 | } |
393 | 533 | |
394 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
534 | + if (!$min) { |
|
535 | + $output .= '"image": "'.$image.'",'; |
|
536 | + } |
|
395 | 537 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
396 | 538 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
397 | 539 | } |
@@ -399,8 +541,11 @@ discard block |
||
399 | 541 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
400 | 542 | } |
401 | 543 | if (isset($spotter_item['squawk'])) { |
402 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
403 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
544 | + if ($compress) { |
|
545 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
546 | + } else { |
|
547 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
548 | + } |
|
404 | 549 | } |
405 | 550 | if (isset($spotter_item['squawk_usage'])) { |
406 | 551 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -419,14 +564,23 @@ discard block |
||
419 | 564 | } |
420 | 565 | // type when not aircraft ? |
421 | 566 | if (isset($spotter_item['type'])) { |
422 | - if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
|
423 | - else $output .= '"type": "'.$spotter_item['type'].'"'; |
|
567 | + if ($compress) { |
|
568 | + $output .= '"t": "'.$spotter_item['type'].'"'; |
|
569 | + } else { |
|
570 | + $output .= '"type": "'.$spotter_item['type'].'"'; |
|
571 | + } |
|
424 | 572 | } elseif ($marine) { |
425 | - if ($compress) $output .= '"t": "ship"'; |
|
426 | - else $output .= '"type": "ship"'; |
|
573 | + if ($compress) { |
|
574 | + $output .= '"t": "ship"'; |
|
575 | + } else { |
|
576 | + $output .= '"type": "ship"'; |
|
577 | + } |
|
427 | 578 | } else { |
428 | - if ($compress) $output .= '"t": "aircraft"'; |
|
429 | - else $output .= '"type": "aircraft"'; |
|
579 | + if ($compress) { |
|
580 | + $output .= '"t": "aircraft"'; |
|
581 | + } else { |
|
582 | + $output .= '"type": "aircraft"'; |
|
583 | + } |
|
430 | 584 | } |
431 | 585 | $output .= '},'; |
432 | 586 | $output .= '"geometry": {'; |
@@ -494,7 +648,9 @@ discard block |
||
494 | 648 | } |
495 | 649 | */ |
496 | 650 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
497 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
651 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
652 | + $history = $_COOKIE['history']; |
|
653 | + } |
|
498 | 654 | |
499 | 655 | if ( |
500 | 656 | (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -534,8 +690,11 @@ discard block |
||
534 | 690 | $output_history .= ']}},'; |
535 | 691 | $output .= $output_history; |
536 | 692 | } |
537 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
538 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
693 | + if ($compress) { |
|
694 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
695 | + } else { |
|
696 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
697 | + } |
|
539 | 698 | } |
540 | 699 | $output_history .= '['; |
541 | 700 | $output_history .= $spotter_history['longitude'].', '; |
@@ -554,9 +713,14 @@ discard block |
||
554 | 713 | $prev_alt = $alt; |
555 | 714 | } else { |
556 | 715 | if ($d == false) { |
557 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
558 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
559 | - } else $d = true; |
|
716 | + if ($compress) { |
|
717 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
718 | + } else { |
|
719 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
720 | + } |
|
721 | + } else { |
|
722 | + $d = true; |
|
723 | + } |
|
560 | 724 | $output_history .= '['; |
561 | 725 | $output_history .= $spotter_history['longitude'].', '; |
562 | 726 | $output_history .= $spotter_history['latitude']; |
@@ -577,7 +741,9 @@ discard block |
||
577 | 741 | $output_historyd = '['; |
578 | 742 | $output_historyd .= $spotter_item['longitude'].', '; |
579 | 743 | $output_historyd .= $spotter_item['latitude']; |
580 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
744 | + if (isset($spotter_history['altitude'])) { |
|
745 | + $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
746 | + } |
|
581 | 747 | $output_historyd .= '],'; |
582 | 748 | //$output_history = $output_historyd.$output_history; |
583 | 749 | $output_history = $output_history.$output_historyd; |
@@ -618,7 +784,9 @@ discard block |
||
618 | 784 | $output .= ']'; |
619 | 785 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
620 | 786 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
621 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
787 | + if (isset($begindate)) { |
|
788 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
789 | + } |
|
622 | 790 | $output .= '"fc": "'.$j.'"'; |
623 | 791 | } else { |
624 | 792 | $output .= '"features": '; |
@@ -26,7 +26,9 @@ discard block |
||
26 | 26 | if (isset($filter[0]['source'])) { |
27 | 27 | $filters = array_merge($filters,$filter); |
28 | 28 | } |
29 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
29 | + if (is_array($globalFilter)) { |
|
30 | + $filter = array_merge($filter,$globalFilter); |
|
31 | + } |
|
30 | 32 | $filter_query_join = ''; |
31 | 33 | $filter_query_where = ''; |
32 | 34 | foreach($filters as $flt) { |
@@ -72,8 +74,11 @@ discard block |
||
72 | 74 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
73 | 75 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
74 | 76 | } |
75 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
76 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
77 | + if ($filter_query_where == '' && $where) { |
|
78 | + $filter_query_where = ' WHERE'; |
|
79 | + } elseif ($filter_query_where != '' && $and) { |
|
80 | + $filter_query_where .= ' AND'; |
|
81 | + } |
|
77 | 82 | if ($filter_query_where != '') { |
78 | 83 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
79 | 84 | } |
@@ -593,7 +598,9 @@ discard block |
||
593 | 598 | $additional_query .= "(marine_archive_output.pilot_name like '%".$q_item."%') OR "; |
594 | 599 | $additional_query .= "(marine_archive_output.ident like '%".$q_item."%') OR "; |
595 | 600 | $translate = $Translation->ident2icao($q_item); |
596 | - if ($translate != $q_item) $additional_query .= "(marine_archive_output.ident like '%".$translate."%') OR "; |
|
601 | + if ($translate != $q_item) { |
|
602 | + $additional_query .= "(marine_archive_output.ident like '%".$translate."%') OR "; |
|
603 | + } |
|
597 | 604 | $additional_query .= "(marine_archive_output.highlight like '%".$q_item."%')"; |
598 | 605 | $additional_query .= ")"; |
599 | 606 | } |
@@ -811,7 +818,9 @@ discard block |
||
811 | 818 | date_default_timezone_set($globalTimezone); |
812 | 819 | $datetime = new DateTime(); |
813 | 820 | $offset = $datetime->format('P'); |
814 | - } else $offset = '+00:00'; |
|
821 | + } else { |
|
822 | + $offset = '+00:00'; |
|
823 | + } |
|
815 | 824 | |
816 | 825 | |
817 | 826 | if ($date_array[1] != "") |
@@ -1087,9 +1096,13 @@ discard block |
||
1087 | 1096 | $query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1088 | 1097 | } |
1089 | 1098 | } |
1090 | - if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
1099 | + if ($sincedate != '') { |
|
1100 | + $query .= "AND date > '".$sincedate."' "; |
|
1101 | + } |
|
1091 | 1102 | $query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1092 | - if ($limit) $query .= " LIMIT 0,10"; |
|
1103 | + if ($limit) { |
|
1104 | + $query .= " LIMIT 0,10"; |
|
1105 | + } |
|
1093 | 1106 | |
1094 | 1107 | |
1095 | 1108 | $sth = $this->db->prepare($query); |
@@ -1133,9 +1146,13 @@ discard block |
||
1133 | 1146 | $query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1134 | 1147 | } |
1135 | 1148 | } |
1136 | - if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' "; |
|
1149 | + if ($sincedate != '') { |
|
1150 | + $query .= "AND s.date > '".$sincedate."' "; |
|
1151 | + } |
|
1137 | 1152 | $query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1138 | - if ($limit) $query .= " LIMIT 0,10"; |
|
1153 | + if ($limit) { |
|
1154 | + $query .= " LIMIT 0,10"; |
|
1155 | + } |
|
1139 | 1156 | |
1140 | 1157 | |
1141 | 1158 | $sth = $this->db->prepare($query); |
@@ -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); |
@@ -337,9 +378,13 @@ discard block |
||
337 | 378 | $Connection->db->beginTransaction(); |
338 | 379 | } |
339 | 380 | } |
340 | - if ($globalTransaction) $Connection->db->commit(); |
|
381 | + if ($globalTransaction) { |
|
382 | + $Connection->db->commit(); |
|
383 | + } |
|
341 | 384 | } catch(PDOException $e) { |
342 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
385 | + if ($globalTransaction) { |
|
386 | + $Connection->db->rollBack(); |
|
387 | + } |
|
343 | 388 | echo $e->getMessage(); |
344 | 389 | } |
345 | 390 | $sth_check->closeCursor(); |
@@ -378,8 +423,11 @@ discard block |
||
378 | 423 | return "error : ".$e->getMessage(); |
379 | 424 | } |
380 | 425 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
381 | - if ($row['nb'] > 0) return false; |
|
382 | - else return true; |
|
426 | + if ($row['nb'] > 0) { |
|
427 | + return false; |
|
428 | + } else { |
|
429 | + return true; |
|
430 | + } |
|
383 | 431 | } |
384 | 432 | |
385 | 433 | public static function insert_last_accidents_update() { |
@@ -150,11 +150,26 @@ discard block |
||
150 | 150 | <li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li> |
151 | 151 | <li><?php echo _("NOTAM scope:"); ?> |
152 | 152 | <select class="selectpicker" onchange="notamscope(this);"> |
153 | - <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option> |
|
154 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option> |
|
155 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option> |
|
156 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option> |
|
157 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option> |
|
153 | + <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') { |
|
154 | + print ' selected'; |
|
155 | +} |
|
156 | +?>>All</option> |
|
157 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') { |
|
158 | + print ' selected'; |
|
159 | +} |
|
160 | +?>>Airport/Enroute warning</option> |
|
161 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') { |
|
162 | + print ' selected'; |
|
163 | +} |
|
164 | +?>>Airport warning</option> |
|
165 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') { |
|
166 | + print ' selected'; |
|
167 | +} |
|
168 | +?>>Navigation warning</option> |
|
169 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') { |
|
170 | + print ' selected'; |
|
171 | +} |
|
172 | +?>>Enroute warning</option> |
|
158 | 173 | </select |
159 | 174 | </li> |
160 | 175 | </ul> |
@@ -182,7 +197,12 @@ discard block |
||
182 | 197 | <div class="form-group"> |
183 | 198 | <label>From (UTC):</label> |
184 | 199 | <div class='input-group date' id='datetimepicker1'> |
185 | - <input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required /> |
|
200 | + <input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) { |
|
201 | + print $_POST['start_date']; |
|
202 | +} elseif (isset($_COOKIE['archive_begin'])) { |
|
203 | + print date("m/d/Y h:i a",$_COOKIE['archive_begin']); |
|
204 | +} |
|
205 | +?>" required /> |
|
186 | 206 | <span class="input-group-addon"> |
187 | 207 | <span class="glyphicon glyphicon-calendar"></span> |
188 | 208 | </span> |
@@ -191,7 +211,12 @@ discard block |
||
191 | 211 | <div class="form-group"> |
192 | 212 | <label>To (UTC):</label> |
193 | 213 | <div class='input-group date' id='datetimepicker2'> |
194 | - <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" /> |
|
214 | + <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) { |
|
215 | + print $_POST['end_date']; |
|
216 | +} elseif (isset($_COOKIE['archive_end'])) { |
|
217 | + print date("m/d/Y h:i a",$_COOKIE['archive_end']); |
|
218 | +} |
|
219 | +?>" /> |
|
195 | 220 | <span class="input-group-addon"> |
196 | 221 | <span class="glyphicon glyphicon-calendar"></span> |
197 | 222 | </span> |
@@ -217,8 +242,20 @@ discard block |
||
217 | 242 | |
218 | 243 | <li><?php echo _("Playback speed:"); ?> |
219 | 244 | <div class="range"> |
220 | - <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>"> |
|
221 | - <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output> |
|
245 | + <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) { |
|
246 | + print $_POST['archivespeed']; |
|
247 | +} elseif (isset($_COOKIE['archive_speed'])) { |
|
248 | + print $_COOKIE['archive_speed']; |
|
249 | +} else { |
|
250 | + print '1'; |
|
251 | +} |
|
252 | +?>"> |
|
253 | + <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) { |
|
254 | + print $_COOKIE['archive_speed']; |
|
255 | +} else { |
|
256 | + print '1'; |
|
257 | +} |
|
258 | +?></output> |
|
222 | 259 | </div> |
223 | 260 | </li> |
224 | 261 | <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li> |
@@ -240,15 +277,27 @@ discard block |
||
240 | 277 | <li><?php echo _("Type of Map:"); ?> |
241 | 278 | <select class="selectpicker" onchange="mapType(this);"> |
242 | 279 | <?php |
243 | - if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
|
244 | - else $MapType = $_COOKIE['MapType']; |
|
280 | + if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') { |
|
281 | + $MapType = $globalMapProvider; |
|
282 | + } else { |
|
283 | + $MapType = $_COOKIE['MapType']; |
|
284 | + } |
|
245 | 285 | ?> |
246 | 286 | <?php |
247 | 287 | if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
248 | 288 | ?> |
249 | - <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
|
250 | - <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
|
251 | - <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
|
289 | + <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') { |
|
290 | + print ' selected'; |
|
291 | +} |
|
292 | +?>>Bing-Aerial</option> |
|
293 | + <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') { |
|
294 | + print ' selected'; |
|
295 | +} |
|
296 | +?>>Bing-Hybrid</option> |
|
297 | + <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') { |
|
298 | + print ' selected'; |
|
299 | +} |
|
300 | +?>>Bing-Road</option> |
|
252 | 301 | <?php |
253 | 302 | } |
254 | 303 | ?> |
@@ -258,56 +307,131 @@ discard block |
||
258 | 307 | <?php |
259 | 308 | if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
260 | 309 | ?> |
261 | - <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> |
|
262 | - <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> |
|
263 | - <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> |
|
310 | + <option value="Here-Aerial"<?php if ($MapType == 'Here') { |
|
311 | + print ' selected'; |
|
312 | +} |
|
313 | +?>>Here-Aerial</option> |
|
314 | + <option value="Here-Hybrid"<?php if ($MapType == 'Here') { |
|
315 | + print ' selected'; |
|
316 | +} |
|
317 | +?>>Here-Hybrid</option> |
|
318 | + <option value="Here-Road"<?php if ($MapType == 'Here') { |
|
319 | + print ' selected'; |
|
320 | +} |
|
321 | +?>>Here-Road</option> |
|
264 | 322 | <?php |
265 | 323 | } |
266 | 324 | ?> |
267 | 325 | <?php |
268 | 326 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
269 | 327 | ?> |
270 | - <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
|
271 | - <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
|
272 | - <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
|
273 | - <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
|
328 | + <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') { |
|
329 | + print ' selected'; |
|
330 | +} |
|
331 | +?>>Google Roadmap</option> |
|
332 | + <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') { |
|
333 | + print ' selected'; |
|
334 | +} |
|
335 | +?>>Google Satellite</option> |
|
336 | + <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') { |
|
337 | + print ' selected'; |
|
338 | +} |
|
339 | +?>>Google Hybrid</option> |
|
340 | + <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') { |
|
341 | + print ' selected'; |
|
342 | +} |
|
343 | +?>>Google Terrain</option> |
|
274 | 344 | <?php |
275 | 345 | } |
276 | 346 | ?> |
277 | 347 | <?php |
278 | 348 | if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
279 | 349 | ?> |
280 | - <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
|
281 | - <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
|
282 | - <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
|
350 | + <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') { |
|
351 | + print ' selected'; |
|
352 | +} |
|
353 | +?>>MapQuest-OSM</option> |
|
354 | + <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') { |
|
355 | + print ' selected'; |
|
356 | +} |
|
357 | +?>>MapQuest-Aerial</option> |
|
358 | + <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') { |
|
359 | + print ' selected'; |
|
360 | +} |
|
361 | +?>>MapQuest-Hybrid</option> |
|
283 | 362 | <?php |
284 | 363 | } |
285 | 364 | ?> |
286 | - <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
|
365 | + <option value="Yandex"<?php if ($MapType == 'Yandex') { |
|
366 | + print ' selected'; |
|
367 | +} |
|
368 | +?>>Yandex</option> |
|
287 | 369 | <?php |
288 | 370 | } |
289 | 371 | ?> |
290 | 372 | <?php |
291 | 373 | if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
292 | - if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
|
293 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
374 | + if (!isset($_COOKIE['MapTypeId'])) { |
|
375 | + $MapBoxId = 'default'; |
|
376 | + } else { |
|
377 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
378 | + } |
|
294 | 379 | ?> |
295 | - <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
|
296 | - <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
|
297 | - <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option> |
|
298 | - <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option> |
|
299 | - <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option> |
|
300 | - <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option> |
|
301 | - <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option> |
|
302 | - <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option> |
|
303 | - <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option> |
|
304 | - <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option> |
|
305 | - <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
|
306 | - <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
|
380 | + <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') { |
|
381 | + print ' selected'; |
|
382 | +} |
|
383 | +?>>Mapbox default</option> |
|
384 | + <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') { |
|
385 | + print ' selected'; |
|
386 | +} |
|
387 | +?>>Mapbox streets</option> |
|
388 | + <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') { |
|
389 | + print ' selected'; |
|
390 | +} |
|
391 | +?>>Mapbox light</option> |
|
392 | + <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') { |
|
393 | + print ' selected'; |
|
394 | +} |
|
395 | +?>>Mapbox dark</option> |
|
396 | + <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') { |
|
397 | + print ' selected'; |
|
398 | +} |
|
399 | +?>>Mapbox satellite</option> |
|
400 | + <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') { |
|
401 | + print ' selected'; |
|
402 | +} |
|
403 | +?>>Mapbox streets-satellite</option> |
|
404 | + <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') { |
|
405 | + print ' selected'; |
|
406 | +} |
|
407 | +?>>Mapbox streets-basic</option> |
|
408 | + <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') { |
|
409 | + print ' selected'; |
|
410 | +} |
|
411 | +?>>Mapbox comic</option> |
|
412 | + <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') { |
|
413 | + print ' selected'; |
|
414 | +} |
|
415 | +?>>Mapbox outdoors</option> |
|
416 | + <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') { |
|
417 | + print ' selected'; |
|
418 | +} |
|
419 | +?>>Mapbox pencil</option> |
|
420 | + <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') { |
|
421 | + print ' selected'; |
|
422 | +} |
|
423 | +?>>Mapbox pirates</option> |
|
424 | + <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') { |
|
425 | + print ' selected'; |
|
426 | +} |
|
427 | +?>>Mapbox emerald</option> |
|
307 | 428 | <?php |
308 | 429 | } |
309 | 430 | ?> |
310 | - <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
|
431 | + <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') { |
|
432 | + print ' selected'; |
|
433 | +} |
|
434 | +?>>OpenStreetMap</option> |
|
311 | 435 | </select> |
312 | 436 | </li> |
313 | 437 | <?php |
@@ -315,9 +439,18 @@ discard block |
||
315 | 439 | ?> |
316 | 440 | <li><?php echo _("Type of Terrain:"); ?> |
317 | 441 | <select class="selectpicker" onchange="terrainType(this);"> |
318 | - <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
|
319 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
320 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
442 | + <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') { |
|
443 | + print ' selected'; |
|
444 | +} |
|
445 | +?>>stk terrain</option> |
|
446 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') { |
|
447 | + print ' selected'; |
|
448 | +} |
|
449 | +?>>ellipsoid</option> |
|
450 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') { |
|
451 | + print ' selected'; |
|
452 | +} |
|
453 | +?>>vr terrain</option> |
|
321 | 454 | </select> |
322 | 455 | </li> |
323 | 456 | <?php |
@@ -327,18 +460,36 @@ discard block |
||
327 | 460 | if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
328 | 461 | ?> |
329 | 462 | |
330 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li> |
|
331 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
332 | - <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
333 | - <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
463 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') { |
|
464 | + print 'checked'; |
|
465 | +} |
|
466 | +?> ><?php echo _("Display flight info as popup"); ?></label></div></li> |
|
467 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) { |
|
468 | + print 'checked'; |
|
469 | +} |
|
470 | +?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
471 | + <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) { |
|
472 | + print 'checked'; |
|
473 | +} |
|
474 | +?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
475 | + <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) { |
|
476 | + print 'checked'; |
|
477 | +} |
|
478 | +?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
334 | 479 | <?php |
335 | 480 | } |
336 | 481 | ?> |
337 | - <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
482 | + <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') { |
|
483 | + print 'checked'; |
|
484 | +} |
|
485 | +?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
338 | 486 | <?php |
339 | 487 | if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
340 | 488 | ?> |
341 | - <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
489 | + <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) { |
|
490 | + print 'checked'; |
|
491 | +} |
|
492 | +?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
342 | 493 | <?php |
343 | 494 | } |
344 | 495 | if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
@@ -352,17 +503,25 @@ discard block |
||
352 | 503 | if (function_exists('array_column')) { |
353 | 504 | if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
354 | 505 | ?> |
355 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
506 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
507 | + print 'checked'; |
|
508 | +} |
|
509 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
356 | 510 | <?php |
357 | 511 | } |
358 | 512 | } elseif (isset($globalSources)) { |
359 | 513 | $dispolar = false; |
360 | 514 | foreach ($globalSources as $testsource) { |
361 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
515 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) { |
|
516 | + $dispolar = true; |
|
517 | + } |
|
362 | 518 | } |
363 | 519 | if ($dispolar) { |
364 | 520 | ?> |
365 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
521 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
522 | + print 'checked'; |
|
523 | +} |
|
524 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
366 | 525 | <?php |
367 | 526 | } |
368 | 527 | } |
@@ -374,12 +533,22 @@ discard block |
||
374 | 533 | <?php |
375 | 534 | if (extension_loaded('gd') && function_exists('gd_info')) { |
376 | 535 | ?> |
377 | - <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
536 | + <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') { |
|
537 | + print 'checked'; |
|
538 | +} |
|
539 | +?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
378 | 540 | <?php |
379 | 541 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
380 | 542 | ?> |
381 | 543 | <li><?php echo _("Aircraft icon color:"); ?> |
382 | - <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"> |
|
544 | + <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
545 | + print $_COOKIE['IconColor']; |
|
546 | +} elseif (isset($globalAircraftIconColor)) { |
|
547 | + print $globalAircraftIconColor; |
|
548 | +} else { |
|
549 | + print '1a3151'; |
|
550 | +} |
|
551 | +?>"> |
|
383 | 552 | </li> |
384 | 553 | <?php |
385 | 554 | } |
@@ -390,7 +559,14 @@ discard block |
||
390 | 559 | if (extension_loaded('gd') && function_exists('gd_info')) { |
391 | 560 | ?> |
392 | 561 | <li><?php echo _("Marine icon color:"); ?> |
393 | - <input type="color" name="marinecolor" id="html5colorpicker" onchange="iconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>"> |
|
562 | + <input type="color" name="marinecolor" id="html5colorpicker" onchange="iconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { |
|
563 | + print $_COOKIE['MarineIconColor']; |
|
564 | +} elseif (isset($globalMarineIconColor)) { |
|
565 | + print $globalMarineIconColor; |
|
566 | +} else { |
|
567 | + print '1a3151'; |
|
568 | +} |
|
569 | +?>"> |
|
394 | 570 | </li> |
395 | 571 | <?php |
396 | 572 | } |
@@ -398,23 +574,57 @@ discard block |
||
398 | 574 | ?> |
399 | 575 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
400 | 576 | <div class="range"> |
401 | - <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>"> |
|
402 | - <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output> |
|
577 | + <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) { |
|
578 | + print $_COOKIE['AirportZoom']; |
|
579 | +} elseif (isset($globalAirportZoom)) { |
|
580 | + print $globalAirportZoom; |
|
581 | +} else { |
|
582 | + print '7'; |
|
583 | +} |
|
584 | +?>"> |
|
585 | + <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) { |
|
586 | + print $_COOKIE['AirportZoom']; |
|
587 | +} elseif (isset($globalAirportZoom)) { |
|
588 | + print $globalAirportZoom; |
|
589 | +} else { |
|
590 | + print '7'; |
|
591 | +} |
|
592 | +?></output> |
|
403 | 593 | </div> |
404 | 594 | </li> |
405 | 595 | <?php |
406 | 596 | } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') { |
407 | 597 | ?> |
408 | - <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Aircraft color"); ?></li> |
|
598 | + <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') { |
|
599 | + print 'checked'; |
|
600 | +} |
|
601 | +?> ><?php echo _("Force Aircraft color"); ?></li> |
|
409 | 602 | <li><?php echo _("Aircraft icon color:"); ?> |
410 | - <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print 'ff0000'; ?>"> |
|
603 | + <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
604 | + print $_COOKIE['IconColor']; |
|
605 | +} elseif (isset($globalAircraftIconColor)) { |
|
606 | + print $globalAircraftIconColor; |
|
607 | +} else { |
|
608 | + print 'ff0000'; |
|
609 | +} |
|
610 | +?>"> |
|
411 | 611 | </li> |
412 | 612 | <?php |
413 | 613 | if (isset($globalMarine) && $globalMarine === TRUE) { |
414 | 614 | ?> |
415 | - <li><input type="checkbox" name="marinecolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?></li> |
|
615 | + <li><input type="checkbox" name="marinecolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') { |
|
616 | + print 'checked'; |
|
617 | +} |
|
618 | +?> ><?php echo _("Force Marine color"); ?></li> |
|
416 | 619 | <li><?php echo _("Marine icon color:"); ?> |
417 | - <input type="color" name="marinecolor" id="html5colorpicker" onchange="iconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>"> |
|
620 | + <input type="color" name="marinecolor" id="html5colorpicker" onchange="iconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { |
|
621 | + print $_COOKIE['MarineIconColor']; |
|
622 | +} elseif (isset($globalMarineIconColor)) { |
|
623 | + print $globalMarineIconColor; |
|
624 | +} else { |
|
625 | + print 'ff0000'; |
|
626 | +} |
|
627 | +?>"> |
|
418 | 628 | </li> |
419 | 629 | <?php |
420 | 630 | } |
@@ -422,22 +632,46 @@ discard block |
||
422 | 632 | ?> |
423 | 633 | <li><?php echo _("Distance unit:"); ?> |
424 | 634 | <select class="selectpicker" onchange="unitdistance(this);"> |
425 | - <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option> |
|
426 | - <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option> |
|
427 | - <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option> |
|
635 | + <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
|
636 | + echo ' selected'; |
|
637 | +} |
|
638 | +?>>km</option> |
|
639 | + <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
|
640 | + echo ' selected'; |
|
641 | +} |
|
642 | +?>>nm</option> |
|
643 | + <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
|
644 | + echo ' selected'; |
|
645 | +} |
|
646 | +?>>mi</option> |
|
428 | 647 | </select> |
429 | 648 | </li> |
430 | 649 | <li><?php echo _("Altitude unit:"); ?> |
431 | 650 | <select class="selectpicker" onchange="unitaltitude(this);"> |
432 | - <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option> |
|
433 | - <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option> |
|
651 | + <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) { |
|
652 | + echo ' selected'; |
|
653 | +} |
|
654 | +?>>m</option> |
|
655 | + <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
|
656 | + echo ' selected'; |
|
657 | +} |
|
658 | +?>>feet</option> |
|
434 | 659 | </select> |
435 | 660 | </li> |
436 | 661 | <li><?php echo _("Speed unit:"); ?> |
437 | 662 | <select class="selectpicker" onchange="unitspeed(this);"> |
438 | - <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option> |
|
439 | - <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option> |
|
440 | - <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option> |
|
663 | + <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) { |
|
664 | + echo ' selected'; |
|
665 | +} |
|
666 | +?>>km/h</option> |
|
667 | + <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
|
668 | + echo ' selected'; |
|
669 | +} |
|
670 | +?>>mph</option> |
|
671 | + <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) { |
|
672 | + echo ' selected'; |
|
673 | +} |
|
674 | +?>>knots</option> |
|
441 | 675 | </select> |
442 | 676 | </li> |
443 | 677 | |
@@ -452,9 +686,18 @@ discard block |
||
452 | 686 | <?php |
453 | 687 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
454 | 688 | ?> |
455 | - <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
456 | - <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
457 | - <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
689 | + <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) { |
|
690 | + print 'checked'; |
|
691 | +} |
|
692 | +?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
693 | + <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) { |
|
694 | + print 'checked'; |
|
695 | +} |
|
696 | +?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
697 | + <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) { |
|
698 | + print 'checked'; |
|
699 | +} |
|
700 | +?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
458 | 701 | <?php |
459 | 702 | } |
460 | 703 | ?> |
@@ -462,10 +705,16 @@ discard block |
||
462 | 705 | if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
463 | 706 | ?> |
464 | 707 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
465 | - <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
708 | + <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) { |
|
709 | + print 'checked'; |
|
710 | +} |
|
711 | +?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
466 | 712 | <?php } ?> |
467 | 713 | <?php if (isset($globalAPRS) && $globalAPRS) { ?> |
468 | - <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
714 | + <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) { |
|
715 | + print 'checked'; |
|
716 | +} |
|
717 | +?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
469 | 718 | <?php } ?> |
470 | 719 | <?php |
471 | 720 | } |
@@ -482,7 +731,9 @@ discard block |
||
482 | 731 | } |
483 | 732 | foreach($allairlinenames as $airline) { |
484 | 733 | $airline_name = $airline['airline_name']; |
485 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
734 | + if (strlen($airline_name) > 30) { |
|
735 | + $airline_name = substr($airline_name,0,30).'...'; |
|
736 | + } |
|
486 | 737 | if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { |
487 | 738 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
488 | 739 | } else { |
@@ -500,7 +751,10 @@ discard block |
||
500 | 751 | <li><?php echo _("Display alliance:"); ?> |
501 | 752 | <br/> |
502 | 753 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
503 | - <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
754 | + <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') { |
|
755 | + echo ' selected'; |
|
756 | +} |
|
757 | +?>><?php echo _("All"); ?></option> |
|
504 | 758 | <?php |
505 | 759 | foreach($allalliancenames as $alliance) { |
506 | 760 | $alliance_name = $alliance['alliance']; |
@@ -541,10 +795,22 @@ discard block |
||
541 | 795 | ?> |
542 | 796 | <li><?php echo _("Display airlines of type:"); ?><br/> |
543 | 797 | <select class="selectpicker" onchange="airlinestype(this);"> |
544 | - <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
545 | - <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option> |
|
546 | - <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option> |
|
547 | - <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option> |
|
798 | + <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') { |
|
799 | + echo ' selected'; |
|
800 | +} |
|
801 | +?>><?php echo _("All"); ?></option> |
|
802 | + <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') { |
|
803 | + echo ' selected'; |
|
804 | +} |
|
805 | +?>><?php echo _("Passenger"); ?></option> |
|
806 | + <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') { |
|
807 | + echo ' selected'; |
|
808 | +} |
|
809 | +?>><?php echo _("Cargo"); ?></option> |
|
810 | + <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') { |
|
811 | + echo ' selected'; |
|
812 | +} |
|
813 | +?>><?php echo _("Military"); ?></option> |
|
548 | 814 | </select> |
549 | 815 | </li> |
550 | 816 | <?php |
@@ -552,7 +818,10 @@ discard block |
||
552 | 818 | ?> |
553 | 819 | <li> |
554 | 820 | <?php echo _("Display flight with ident:"); ?> |
555 | - <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> |
|
821 | + <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) { |
|
822 | + print $_COOKIE['filter_ident']; |
|
823 | +} |
|
824 | +?>" /> |
|
556 | 825 | </li> |
557 | 826 | </ul> |
558 | 827 | </form> |
@@ -568,7 +837,10 @@ discard block |
||
568 | 837 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
569 | 838 | <form> |
570 | 839 | <ul> |
571 | - <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
840 | + <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') { |
|
841 | + print 'checked'; |
|
842 | +} |
|
843 | +?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
572 | 844 | <li><?php echo _("Type:"); ?> |
573 | 845 | <select class="selectpicker" multiple onchange="sattypes(this);"> |
574 | 846 | <?php |
@@ -576,25 +848,45 @@ discard block |
||
576 | 848 | $types = $Satellite->get_tle_types(); |
577 | 849 | foreach ($types as $type) { |
578 | 850 | $type_name = $type['tle_type']; |
579 | - if ($type_name == 'musson') $type_name = 'Russian LEO Navigation'; |
|
580 | - else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System'; |
|
581 | - else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System'; |
|
582 | - else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational'; |
|
583 | - else if ($type_name == 'gps-ops') $type_name = 'GPS Operational'; |
|
584 | - else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System'; |
|
585 | - else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System'; |
|
586 | - else if ($type_name == 'sarsat') $type_name = 'Search & Rescue'; |
|
587 | - else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring'; |
|
588 | - else if ($type_name == 'resource') $type_name = 'Earth Resources'; |
|
589 | - else if ($type_name == 'stations') $type_name = 'Space Stations'; |
|
590 | - else if ($type_name == 'geo') $type_name = 'Geostationary'; |
|
591 | - else if ($type_name == 'amateur') $type_name = 'Amateur Radio'; |
|
592 | - else if ($type_name == 'x-comm') $type_name = 'Experimental'; |
|
593 | - else if ($type_name == 'other-comm') $type_name = 'Other Comm'; |
|
594 | - else if ($type_name == 'science') $type_name = 'Space & Earth Science'; |
|
595 | - else if ($type_name == 'military') $type_name = 'Miscellaneous Military'; |
|
596 | - else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
|
597 | - else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
|
851 | + if ($type_name == 'musson') { |
|
852 | + $type_name = 'Russian LEO Navigation'; |
|
853 | + } else if ($type_name == 'nnss') { |
|
854 | + $type_name = 'Navi Navigation Satellite System'; |
|
855 | + } else if ($type_name == 'sbas') { |
|
856 | + $type_name = 'Satellite-Based Augmentation System'; |
|
857 | + } else if ($type_name == 'glo-ops') { |
|
858 | + $type_name = 'Glonass Operational'; |
|
859 | + } else if ($type_name == 'gps-ops') { |
|
860 | + $type_name = 'GPS Operational'; |
|
861 | + } else if ($type_name == 'argos') { |
|
862 | + $type_name = 'ARGOS Data Collection System'; |
|
863 | + } else if ($type_name == 'tdrss') { |
|
864 | + $type_name = 'Tracking and Data Relay Satellite System'; |
|
865 | + } else if ($type_name == 'sarsat') { |
|
866 | + $type_name = 'Search & Rescue'; |
|
867 | + } else if ($type_name == 'dmc') { |
|
868 | + $type_name = 'Disaster Monitoring'; |
|
869 | + } else if ($type_name == 'resource') { |
|
870 | + $type_name = 'Earth Resources'; |
|
871 | + } else if ($type_name == 'stations') { |
|
872 | + $type_name = 'Space Stations'; |
|
873 | + } else if ($type_name == 'geo') { |
|
874 | + $type_name = 'Geostationary'; |
|
875 | + } else if ($type_name == 'amateur') { |
|
876 | + $type_name = 'Amateur Radio'; |
|
877 | + } else if ($type_name == 'x-comm') { |
|
878 | + $type_name = 'Experimental'; |
|
879 | + } else if ($type_name == 'other-comm') { |
|
880 | + $type_name = 'Other Comm'; |
|
881 | + } else if ($type_name == 'science') { |
|
882 | + $type_name = 'Space & Earth Science'; |
|
883 | + } else if ($type_name == 'military') { |
|
884 | + $type_name = 'Miscellaneous Military'; |
|
885 | + } else if ($type_name == 'radar') { |
|
886 | + $type_name = 'Radar Calibration'; |
|
887 | + } else if ($type_name == 'tle-new') { |
|
888 | + $type_name = 'Last 30 days launches'; |
|
889 | + } |
|
598 | 890 | |
599 | 891 | if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
600 | 892 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |
@@ -55,7 +55,9 @@ discard block |
||
55 | 55 | { |
56 | 56 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
57 | 57 | $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
58 | - } else $image = $spotter_item['image_thumbnail']; |
|
58 | + } else { |
|
59 | + $image = $spotter_item['image_thumbnail']; |
|
60 | + } |
|
59 | 61 | |
60 | 62 | } |
61 | 63 | /* else { |
@@ -67,7 +69,9 @@ discard block |
||
67 | 69 | print '<div class="left"><img src="'.$image.'" alt="'.$spotter_item['registration'].' '.$spotter_item['aircraft_name'].'" title="'.$spotter_item['registration'].' '.$spotter_item['aircraft_name'].' Image © '.$spotter_item['image_copyright'].'"/><br />Image © '.$spotter_item['image_copyright'].'</div>'; |
68 | 70 | } |
69 | 71 | print '<div class="right"><div class="callsign-details"><div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>'; |
70 | -if (isset($spotter_item['airline_name'])) print '<div class="airline">'.$spotter_item['airline_name'].'</div>'; |
|
72 | +if (isset($spotter_item['airline_name'])) { |
|
73 | + print '<div class="airline">'.$spotter_item['airline_name'].'</div>'; |
|
74 | +} |
|
71 | 75 | print '</div>'; |
72 | 76 | 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']; |
73 | 77 | if (isset($spotter_item['departure_airport_time'])) { |
@@ -95,9 +99,14 @@ discard block |
||
95 | 99 | print '<span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'" target="_blank">'.$spotter_item['arrival_airport'].'</a></span>'.$spotter_item['arrival_airport_city'].' '.$spotter_item['arrival_airport_country']; |
96 | 100 | print '</div></div><div id="aircraft">'; |
97 | 101 | print '<span>'._("Aircraft").'</span>'; |
98 | -if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
|
99 | -if (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
100 | -else print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name']; |
|
102 | +if (isset($spotter_item['aircraft_wiki'])) { |
|
103 | + print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
|
104 | +} |
|
105 | +if (isset($spotter_item['aircraft_type'])) { |
|
106 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
107 | +} else { |
|
108 | + print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name']; |
|
109 | +} |
|
101 | 110 | print '</div>'; |
102 | 111 | print '<div id ="altitude"><span>'._("Altitude").'</span>'; |
103 | 112 | if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
@@ -106,7 +115,9 @@ discard block |
||
106 | 115 | print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')'; |
107 | 116 | } |
108 | 117 | print '</div>'; |
109 | -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>'; |
|
118 | +if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') { |
|
119 | + print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>'; |
|
120 | +} |
|
110 | 121 | print '<div id="speed"><span>'._("Speed").'</span>'; |
111 | 122 | if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
112 | 123 | print round($spotter_item['ground_speed']*1.15078).' mph'; |
@@ -120,8 +131,11 @@ discard block |
||
120 | 131 | print '<div id="heading"><span>'._("Heading").'</span>'.$spotter_item['heading'].'°</div>'; |
121 | 132 | if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != '') { |
122 | 133 | print '<div id="pilot"><span>'._("Pilot").'</span>'; |
123 | - if (isset($spotter_item['pilot_id'])) print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
124 | - else print $spotter_item['pilot_name']; |
|
134 | + if (isset($spotter_item['pilot_id'])) { |
|
135 | + print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
136 | + } else { |
|
137 | + print $spotter_item['pilot_name']; |
|
138 | + } |
|
125 | 139 | print '</div>'; |
126 | 140 | } |
127 | 141 | |
@@ -149,10 +163,18 @@ discard block |
||
149 | 163 | print '</div>'; |
150 | 164 | print '</div>'; |
151 | 165 | |
152 | -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>'; |
|
153 | -if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
|
154 | -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>'; |
|
155 | -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>'; |
|
166 | +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') { |
|
167 | + print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
|
168 | +} |
|
169 | +if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') { |
|
170 | + print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
|
171 | +} |
|
172 | +if (isset($spotter_item['acars']['message'])) { |
|
173 | + 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>'; |
|
174 | +} |
|
175 | +if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) { |
|
176 | + print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
|
177 | +} |
|
156 | 178 | print '</div>'; |
157 | 179 | ?> |
158 | 180 | </div> |
159 | 181 | \ No newline at end of file |