@@ -23,7 +23,9 @@ |
||
23 | 23 | print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">'; |
24 | 24 | $Stats = new Stats(); |
25 | 25 | $all_manufacturers = $Stats->getAllManufacturers(); |
26 | - if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
|
26 | + if (empty($all_manufacturers)) { |
|
27 | + $all_manufacturers = $Spotter->getAllManufacturers(); |
|
28 | + } |
|
27 | 29 | foreach($all_manufacturers as $all_manufacturer) |
28 | 30 | { |
29 | 31 | if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
@@ -23,7 +23,9 @@ |
||
23 | 23 | print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">'; |
24 | 24 | $Stats = new Stats(); |
25 | 25 | $all_manufacturers = $Stats->getAllManufacturers(); |
26 | - if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
|
26 | + if (empty($all_manufacturers)) { |
|
27 | + $all_manufacturers = $Spotter->getAllManufacturers(); |
|
28 | + } |
|
27 | 29 | foreach($all_manufacturers as $all_manufacturer) |
28 | 30 | { |
29 | 31 | if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
@@ -23,7 +23,9 @@ |
||
23 | 23 | print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">'; |
24 | 24 | $Stats = new Stats(); |
25 | 25 | $all_manufacturers = $Stats->getAllManufacturers(); |
26 | - if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
|
26 | + if (empty($all_manufacturers)) { |
|
27 | + $all_manufacturers = $Spotter->getAllManufacturers(); |
|
28 | + } |
|
27 | 29 | foreach($all_manufacturers as $all_manufacturer) |
28 | 30 | { |
29 | 31 | if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
@@ -23,7 +23,9 @@ |
||
23 | 23 | print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">'; |
24 | 24 | $Stats = new Stats(); |
25 | 25 | $all_manufacturers = $Stats->getAllManufacturers(); |
26 | - if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
|
26 | + if (empty($all_manufacturers)) { |
|
27 | + $all_manufacturers = $Spotter->getAllManufacturers(); |
|
28 | + } |
|
27 | 29 | foreach($all_manufacturers as $all_manufacturer) |
28 | 30 | { |
29 | 31 | if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
@@ -23,7 +23,9 @@ |
||
23 | 23 | print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">'; |
24 | 24 | $Stats = new Stats(); |
25 | 25 | $all_manufacturers = $Stats->getAllManufacturers(); |
26 | - if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
|
26 | + if (empty($all_manufacturers)) { |
|
27 | + $all_manufacturers = $Spotter->getAllManufacturers(); |
|
28 | + } |
|
27 | 29 | foreach($all_manufacturers as $all_manufacturer) |
28 | 30 | { |
29 | 31 | if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
@@ -23,7 +23,9 @@ |
||
23 | 23 | print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">'; |
24 | 24 | $Stats = new Stats(); |
25 | 25 | $all_manufacturers = $Stats->getAllManufacturers(); |
26 | - if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
|
26 | + if (empty($all_manufacturers)) { |
|
27 | + $all_manufacturers = $Spotter->getAllManufacturers(); |
|
28 | + } |
|
27 | 29 | foreach($all_manufacturers as $all_manufacturer) |
28 | 30 | { |
29 | 31 | if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
@@ -23,7 +23,9 @@ discard block |
||
23 | 23 | $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
24 | 24 | } |
25 | 25 | } |
26 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
26 | + if (is_array($globalFilter)) { |
|
27 | + $filter = array_merge($filter,$globalFilter); |
|
28 | + } |
|
27 | 29 | $filter_query_join = ''; |
28 | 30 | $filter_query_where = ''; |
29 | 31 | foreach($filters as $flt) { |
@@ -69,8 +71,11 @@ discard block |
||
69 | 71 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
70 | 72 | } |
71 | 73 | } |
72 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
73 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
74 | + if ($filter_query_where == '' && $where) { |
|
75 | + $filter_query_where = ' WHERE'; |
|
76 | + } elseif ($filter_query_where != '' && $and) { |
|
77 | + $filter_query_where .= ' AND'; |
|
78 | + } |
|
74 | 79 | $filter_query = $filter_query_join.$filter_query_where; |
75 | 80 | return $filter_query; |
76 | 81 | } |
@@ -81,10 +86,17 @@ discard block |
||
81 | 86 | if ($over_country == '') { |
82 | 87 | $Spotter = new Spotter($this->db); |
83 | 88 | $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude); |
84 | - if (!empty($data_country)) $country = $data_country['iso2']; |
|
85 | - else $country = ''; |
|
86 | - } else $country = $over_country; |
|
87 | - if ($airline_type === NULL) $airline_type =''; |
|
89 | + if (!empty($data_country)) { |
|
90 | + $country = $data_country['iso2']; |
|
91 | + } else { |
|
92 | + $country = ''; |
|
93 | + } |
|
94 | + } else { |
|
95 | + $country = $over_country; |
|
96 | + } |
|
97 | + if ($airline_type === NULL) { |
|
98 | + $airline_type =''; |
|
99 | + } |
|
88 | 100 | |
89 | 101 | //if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n"; |
90 | 102 | //else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n"; |
@@ -587,7 +599,9 @@ discard block |
||
587 | 599 | $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR "; |
588 | 600 | $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR "; |
589 | 601 | $translate = $Translation->ident2icao($q_item); |
590 | - if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
602 | + if ($translate != $q_item) { |
|
603 | + $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
604 | + } |
|
591 | 605 | $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')"; |
592 | 606 | $additional_query .= ")"; |
593 | 607 | } |
@@ -805,7 +819,9 @@ discard block |
||
805 | 819 | date_default_timezone_set($globalTimezone); |
806 | 820 | $datetime = new DateTime(); |
807 | 821 | $offset = $datetime->format('P'); |
808 | - } else $offset = '+00:00'; |
|
822 | + } else { |
|
823 | + $offset = '+00:00'; |
|
824 | + } |
|
809 | 825 | |
810 | 826 | |
811 | 827 | if ($date_array[1] != "") |
@@ -969,9 +985,13 @@ discard block |
||
969 | 985 | $query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
970 | 986 | } |
971 | 987 | } |
972 | - if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
988 | + if ($sincedate != '') { |
|
989 | + $query .= "AND date > '".$sincedate."' "; |
|
990 | + } |
|
973 | 991 | $query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
974 | - if ($limit) $query .= " LIMIT 0,10"; |
|
992 | + if ($limit) { |
|
993 | + $query .= " LIMIT 0,10"; |
|
994 | + } |
|
975 | 995 | |
976 | 996 | |
977 | 997 | $sth = $this->db->prepare($query); |
@@ -26,7 +26,9 @@ discard block |
||
26 | 26 | $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
27 | 27 | } |
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) { |
@@ -71,8 +73,11 @@ discard block |
||
71 | 73 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
72 | 74 | } |
73 | 75 | } |
74 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
75 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
76 | + if ($filter_query_where == '' && $where) { |
|
77 | + $filter_query_where = ' WHERE'; |
|
78 | + } elseif ($filter_query_where != '' && $and) { |
|
79 | + $filter_query_where .= ' AND'; |
|
80 | + } |
|
76 | 81 | $filter_query = $filter_query_join.$filter_query_where; |
77 | 82 | return $filter_query; |
78 | 83 | } |
@@ -108,7 +113,9 @@ discard block |
||
108 | 113 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
109 | 114 | } |
110 | 115 | |
111 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
116 | + if (!isset($globalLiveInterval)) { |
|
117 | + $globalLiveInterval = '200'; |
|
118 | + } |
|
112 | 119 | if ($globalDBdriver == 'mysql') { |
113 | 120 | //$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
114 | 121 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -133,7 +140,9 @@ discard block |
||
133 | 140 | |
134 | 141 | $filter_query = $this->getFilter($filter,true,true); |
135 | 142 | |
136 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
143 | + if (!isset($globalLiveInterval)) { |
|
144 | + $globalLiveInterval = '200'; |
|
145 | + } |
|
137 | 146 | if ($globalDBdriver == 'mysql') { |
138 | 147 | // $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate$orderby_query"; |
139 | 148 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao'; |
@@ -180,7 +189,9 @@ discard block |
||
180 | 189 | |
181 | 190 | $filter_query = $this->getFilter($filter,true,true); |
182 | 191 | |
183 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
192 | + if (!isset($globalLiveInterval)) { |
|
193 | + $globalLiveInterval = '200'; |
|
194 | + } |
|
184 | 195 | if ($globalDBdriver == 'mysql') { |
185 | 196 | |
186 | 197 | $query = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
@@ -220,7 +231,9 @@ discard block |
||
220 | 231 | global $globalDBdriver, $globalLiveInterval; |
221 | 232 | $filter_query = $this->getFilter($filter,true,true); |
222 | 233 | |
223 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
234 | + if (!isset($globalLiveInterval)) { |
|
235 | + $globalLiveInterval = '200'; |
|
236 | + } |
|
224 | 237 | if ($globalDBdriver == 'mysql') { |
225 | 238 | //$query = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query; |
226 | 239 | $query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
@@ -250,7 +263,9 @@ discard block |
||
250 | 263 | { |
251 | 264 | global $globalDBdriver, $globalLiveInterval; |
252 | 265 | $Spotter = new Spotter($this->db); |
253 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
266 | + if (!isset($globalLiveInterval)) { |
|
267 | + $globalLiveInterval = '200'; |
|
268 | + } |
|
254 | 269 | $filter_query = $this->getFilter($filter); |
255 | 270 | |
256 | 271 | if (is_array($coord)) { |
@@ -258,7 +273,9 @@ discard block |
||
258 | 273 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
259 | 274 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
260 | 275 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
261 | - } else return array(); |
|
276 | + } else { |
|
277 | + return array(); |
|
278 | + } |
|
262 | 279 | if ($globalDBdriver == 'mysql') { |
263 | 280 | //$query = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
264 | 281 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
@@ -449,11 +466,15 @@ discard block |
||
449 | 466 | //$query = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date'; |
450 | 467 | if ($globalDBdriver == 'mysql') { |
451 | 468 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
452 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
469 | + if ($liveinterval) { |
|
470 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
471 | + } |
|
453 | 472 | $query .= ' ORDER BY date'; |
454 | 473 | } else { |
455 | 474 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
456 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
475 | + if ($liveinterval) { |
|
476 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
477 | + } |
|
457 | 478 | $query .= ' ORDER BY date'; |
458 | 479 | } |
459 | 480 | |
@@ -548,7 +569,9 @@ discard block |
||
548 | 569 | $i++; |
549 | 570 | $j++; |
550 | 571 | if ($j == 30) { |
551 | - if ($globalDebug) echo "."; |
|
572 | + if ($globalDebug) { |
|
573 | + echo "."; |
|
574 | + } |
|
552 | 575 | try { |
553 | 576 | |
554 | 577 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -856,7 +879,9 @@ discard block |
||
856 | 879 | { |
857 | 880 | return false; |
858 | 881 | } |
859 | - } else return ''; |
|
882 | + } else { |
|
883 | + return ''; |
|
884 | + } |
|
860 | 885 | |
861 | 886 | if ($longitude != '') |
862 | 887 | { |
@@ -864,7 +889,9 @@ discard block |
||
864 | 889 | { |
865 | 890 | return false; |
866 | 891 | } |
867 | - } else return ''; |
|
892 | + } else { |
|
893 | + return ''; |
|
894 | + } |
|
868 | 895 | |
869 | 896 | if ($waypoints != '') |
870 | 897 | { |
@@ -880,7 +907,9 @@ discard block |
||
880 | 907 | { |
881 | 908 | return false; |
882 | 909 | } |
883 | - } else $altitude = 0; |
|
910 | + } else { |
|
911 | + $altitude = 0; |
|
912 | + } |
|
884 | 913 | |
885 | 914 | if ($heading != '') |
886 | 915 | { |
@@ -888,7 +917,9 @@ discard block |
||
888 | 917 | { |
889 | 918 | return false; |
890 | 919 | } |
891 | - } else $heading = 0; |
|
920 | + } else { |
|
921 | + $heading = 0; |
|
922 | + } |
|
892 | 923 | |
893 | 924 | if ($groundspeed != '') |
894 | 925 | { |
@@ -896,9 +927,13 @@ discard block |
||
896 | 927 | { |
897 | 928 | return false; |
898 | 929 | } |
899 | - } else $groundspeed = 0; |
|
930 | + } else { |
|
931 | + $groundspeed = 0; |
|
932 | + } |
|
900 | 933 | date_default_timezone_set('UTC'); |
901 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
934 | + if ($date == '') { |
|
935 | + $date = date("Y-m-d H:i:s", time()); |
|
936 | + } |
|
902 | 937 | |
903 | 938 | |
904 | 939 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -942,10 +977,18 @@ discard block |
||
942 | 977 | $arrival_airport_country = ''; |
943 | 978 | |
944 | 979 | |
945 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
946 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
947 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
948 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
980 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) { |
|
981 | + $squawk = NULL; |
|
982 | + } |
|
983 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) { |
|
984 | + $verticalrate = NULL; |
|
985 | + } |
|
986 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
987 | + $groundspeed = 0; |
|
988 | + } |
|
989 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
990 | + $heading = 0; |
|
991 | + } |
|
949 | 992 | |
950 | 993 | $query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
951 | 994 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)'; |
@@ -960,9 +1003,13 @@ discard block |
||
960 | 1003 | return "error : ".$e->getMessage(); |
961 | 1004 | } |
962 | 1005 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
963 | - if ($globalDebug) echo '(Add to SBS archive : '; |
|
1006 | + if ($globalDebug) { |
|
1007 | + echo '(Add to SBS archive : '; |
|
1008 | + } |
|
964 | 1009 | $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
965 | - if ($globalDebug) echo $result.')'; |
|
1010 | + if ($globalDebug) { |
|
1011 | + echo $result.')'; |
|
1012 | + } |
|
966 | 1013 | } |
967 | 1014 | return "success"; |
968 | 1015 |
@@ -20,20 +20,27 @@ discard block |
||
20 | 20 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
21 | 21 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
22 | 22 | foreach($globalStatsFilters[$globalFilterName] as $source) { |
23 | - if (isset($source['source'])) $filter['source'][] = $source['source']; |
|
23 | + if (isset($source['source'])) { |
|
24 | + $filter['source'][] = $source['source']; |
|
25 | + } |
|
24 | 26 | } |
25 | 27 | } else { |
26 | 28 | $filter = $globalStatsFilters[$globalFilterName]; |
27 | 29 | } |
28 | 30 | } |
29 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
31 | + if (is_array($globalFilter)) { |
|
32 | + $filter = array_merge($filter,$globalFilter); |
|
33 | + } |
|
30 | 34 | $filter_query_join = ''; |
31 | 35 | $filter_query_where = ''; |
32 | 36 | if (isset($filter['source']) && !empty($filter['source'])) { |
33 | 37 | $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
34 | 38 | } |
35 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
36 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
39 | + if ($filter_query_where == '' && $where) { |
|
40 | + $filter_query_where = ' WHERE'; |
|
41 | + } elseif ($filter_query_where != '' && $and) { |
|
42 | + $filter_query_where .= ' AND'; |
|
43 | + } |
|
37 | 44 | $filter_query = $filter_query_join.$filter_query_where; |
38 | 45 | return $filter_query; |
39 | 46 | } |
@@ -57,7 +64,9 @@ discard block |
||
57 | 64 | $info = str_replace('^','<br />',$info); |
58 | 65 | $info = str_replace('&sect;','',$info); |
59 | 66 | $info = str_replace('"','',$info); |
60 | - if ($type == '') $type = NULL; |
|
67 | + if ($type == '') { |
|
68 | + $type = NULL; |
|
69 | + } |
|
61 | 70 | $query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name,format_source,source_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name,:format_source,:source_name)"; |
62 | 71 | $query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name); |
63 | 72 | try { |