@@ -17,6 +17,10 @@ discard block |
||
| 17 | 17 | $this->db = $Connection->db(); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | + /** |
|
| 21 | + * @param string $type |
|
| 22 | + * @param string $stats_date |
|
| 23 | + */ |
|
| 20 | 24 | public function addLastStatsUpdate($type,$stats_date) { |
| 21 | 25 | $query = "DELETE FROM config WHERE name = :type; |
| 22 | 26 | INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
@@ -878,6 +882,11 @@ discard block |
||
| 878 | 882 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 879 | 883 | return $all; |
| 880 | 884 | } |
| 885 | + |
|
| 886 | + /** |
|
| 887 | + * @param string $type |
|
| 888 | + * @param string $year |
|
| 889 | + */ |
|
| 881 | 890 | public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
| 882 | 891 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 883 | 892 | global $globalArchiveMonths, $globalDBdriver; |
@@ -1022,6 +1031,10 @@ discard block |
||
| 1022 | 1031 | else return 0; |
| 1023 | 1032 | } |
| 1024 | 1033 | |
| 1034 | + /** |
|
| 1035 | + * @param string $type |
|
| 1036 | + * @param string $stats_date |
|
| 1037 | + */ |
|
| 1025 | 1038 | public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 1026 | 1039 | global $globalDBdriver; |
| 1027 | 1040 | if ($filter_name == '') $filter_name = $this->filter_name; |
@@ -1075,6 +1088,9 @@ discard block |
||
| 1075 | 1088 | } |
| 1076 | 1089 | */ |
| 1077 | 1090 | |
| 1091 | + /** |
|
| 1092 | + * @param string $stats_type |
|
| 1093 | + */ |
|
| 1078 | 1094 | public function getStatsSource($stats_type,$year = '',$month = '',$day = '') { |
| 1079 | 1095 | global $globalDBdriver; |
| 1080 | 1096 | $query = "SELECT * FROM stats_source WHERE stats_type = :stats_type"; |
@@ -1118,6 +1134,9 @@ discard block |
||
| 1118 | 1134 | return $all; |
| 1119 | 1135 | } |
| 1120 | 1136 | |
| 1137 | + /** |
|
| 1138 | + * @param string $stats_type |
|
| 1139 | + */ |
|
| 1121 | 1140 | public function addStatSource($data,$source_name,$stats_type,$date) { |
| 1122 | 1141 | global $globalDBdriver; |
| 1123 | 1142 | if ($globalDBdriver == 'mysql') { |
@@ -1133,6 +1152,10 @@ discard block |
||
| 1133 | 1152 | return "error : ".$e->getMessage(); |
| 1134 | 1153 | } |
| 1135 | 1154 | } |
| 1155 | + |
|
| 1156 | + /** |
|
| 1157 | + * @param string $type |
|
| 1158 | + */ |
|
| 1136 | 1159 | public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
| 1137 | 1160 | $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
| 1138 | 1161 | $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
@@ -1399,6 +1422,10 @@ discard block |
||
| 1399 | 1422 | return "error : ".$e->getMessage(); |
| 1400 | 1423 | } |
| 1401 | 1424 | } |
| 1425 | + |
|
| 1426 | + /** |
|
| 1427 | + * @param string $type |
|
| 1428 | + */ |
|
| 1402 | 1429 | public function deleteStatFlight($type) { |
| 1403 | 1430 | $query = "DELETE FROM stats_flight WHERE stats_type = :type"; |
| 1404 | 1431 | $query_values = array(':type' => $type); |
@@ -1409,6 +1436,10 @@ discard block |
||
| 1409 | 1436 | return "error : ".$e->getMessage(); |
| 1410 | 1437 | } |
| 1411 | 1438 | } |
| 1439 | + |
|
| 1440 | + /** |
|
| 1441 | + * @param string $type |
|
| 1442 | + */ |
|
| 1412 | 1443 | public function deleteStatAirport($type) { |
| 1413 | 1444 | $query = "DELETE FROM stats_airport WHERE stats_type = :type"; |
| 1414 | 1445 | $query_values = array(':type' => $type); |
@@ -12,7 +12,9 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | public function __construct($dbc = null) { |
| 14 | 14 | global $globalFilterName; |
| 15 | - if (isset($globalFilterName)) $this->filter_name = $globalFilterName; |
|
| 15 | + if (isset($globalFilterName)) { |
|
| 16 | + $this->filter_name = $globalFilterName; |
|
| 17 | + } |
|
| 16 | 18 | $Connection = new Connection($dbc); |
| 17 | 19 | $this->db = $Connection->db(); |
| 18 | 20 | } |
@@ -77,7 +79,9 @@ discard block |
||
| 77 | 79 | } |
| 78 | 80 | } |
| 79 | 81 | public function getAllAirlineNames($filter_name = '') { |
| 80 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 82 | + if ($filter_name == '') { |
|
| 83 | + $filter_name = $this->filter_name; |
|
| 84 | + } |
|
| 81 | 85 | $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
| 82 | 86 | try { |
| 83 | 87 | $sth = $this->db->prepare($query); |
@@ -89,7 +93,9 @@ discard block |
||
| 89 | 93 | return $all; |
| 90 | 94 | } |
| 91 | 95 | public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
| 92 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 96 | + if ($filter_name == '') { |
|
| 97 | + $filter_name = $this->filter_name; |
|
| 98 | + } |
|
| 93 | 99 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
| 94 | 100 | try { |
| 95 | 101 | $sth = $this->db->prepare($query); |
@@ -101,7 +107,9 @@ discard block |
||
| 101 | 107 | return $all; |
| 102 | 108 | } |
| 103 | 109 | public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
| 104 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 110 | + if ($filter_name == '') { |
|
| 111 | + $filter_name = $this->filter_name; |
|
| 112 | + } |
|
| 105 | 113 | $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC"; |
| 106 | 114 | try { |
| 107 | 115 | $sth = $this->db->prepare($query); |
@@ -113,7 +121,9 @@ discard block |
||
| 113 | 121 | return $all; |
| 114 | 122 | } |
| 115 | 123 | public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
| 116 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 124 | + if ($filter_name == '') { |
|
| 125 | + $filter_name = $this->filter_name; |
|
| 126 | + } |
|
| 117 | 127 | $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
| 118 | 128 | try { |
| 119 | 129 | $sth = $this->db->prepare($query); |
@@ -126,7 +136,9 @@ discard block |
||
| 126 | 136 | } |
| 127 | 137 | |
| 128 | 138 | public function getAllOwnerNames($stats_airline = '',$filter_name = '') { |
| 129 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 139 | + if ($filter_name == '') { |
|
| 140 | + $filter_name = $this->filter_name; |
|
| 141 | + } |
|
| 130 | 142 | $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC"; |
| 131 | 143 | try { |
| 132 | 144 | $sth = $this->db->prepare($query); |
@@ -139,7 +151,9 @@ discard block |
||
| 139 | 151 | } |
| 140 | 152 | |
| 141 | 153 | public function getAllPilotNames($stats_airline = '',$filter_name = '') { |
| 142 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 154 | + if ($filter_name == '') { |
|
| 155 | + $filter_name = $this->filter_name; |
|
| 156 | + } |
|
| 143 | 157 | $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC"; |
| 144 | 158 | try { |
| 145 | 159 | $sth = $this->db->prepare($query); |
@@ -154,10 +168,15 @@ discard block |
||
| 154 | 168 | |
| 155 | 169 | public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 156 | 170 | global $globalStatsFilters; |
| 157 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 171 | + if ($filter_name == '') { |
|
| 172 | + $filter_name = $this->filter_name; |
|
| 173 | + } |
|
| 158 | 174 | if ($year == '' && $month == '') { |
| 159 | - if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 160 | - else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 175 | + if ($limit) { |
|
| 176 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 177 | + } else { |
|
| 178 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 179 | + } |
|
| 161 | 180 | try { |
| 162 | 181 | $sth = $this->db->prepare($query); |
| 163 | 182 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -165,7 +184,9 @@ discard block |
||
| 165 | 184 | echo "error : ".$e->getMessage(); |
| 166 | 185 | } |
| 167 | 186 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 168 | - } else $all = array(); |
|
| 187 | + } else { |
|
| 188 | + $all = array(); |
|
| 189 | + } |
|
| 169 | 190 | if (empty($all)) { |
| 170 | 191 | $filters = array('airlines' => array($stats_airline)); |
| 171 | 192 | if ($filter_name != '') { |
@@ -178,10 +199,15 @@ discard block |
||
| 178 | 199 | } |
| 179 | 200 | public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
| 180 | 201 | global $globalStatsFilters; |
| 181 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 202 | + if ($filter_name == '') { |
|
| 203 | + $filter_name = $this->filter_name; |
|
| 204 | + } |
|
| 182 | 205 | if ($year == '' && $month == '') { |
| 183 | - if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 184 | - else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC"; |
|
| 206 | + if ($limit) { |
|
| 207 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 208 | + } else { |
|
| 209 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC"; |
|
| 210 | + } |
|
| 185 | 211 | try { |
| 186 | 212 | $sth = $this->db->prepare($query); |
| 187 | 213 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -189,7 +215,9 @@ discard block |
||
| 189 | 215 | echo "error : ".$e->getMessage(); |
| 190 | 216 | } |
| 191 | 217 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 192 | - } else $all = array(); |
|
| 218 | + } else { |
|
| 219 | + $all = array(); |
|
| 220 | + } |
|
| 193 | 221 | if (empty($all)) { |
| 194 | 222 | $Spotter = new Spotter($this->db); |
| 195 | 223 | $filters = array(); |
@@ -202,10 +230,15 @@ discard block |
||
| 202 | 230 | } |
| 203 | 231 | public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 204 | 232 | global $globalStatsFilters; |
| 205 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 233 | + if ($filter_name == '') { |
|
| 234 | + $filter_name = $this->filter_name; |
|
| 235 | + } |
|
| 206 | 236 | if ($year == '' && $month == '') { |
| 207 | - if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
| 208 | - else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
| 237 | + if ($limit) { |
|
| 238 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
| 239 | + } else { |
|
| 240 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
| 241 | + } |
|
| 209 | 242 | try { |
| 210 | 243 | $sth = $this->db->prepare($query); |
| 211 | 244 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -213,7 +246,9 @@ discard block |
||
| 213 | 246 | echo "error : ".$e->getMessage(); |
| 214 | 247 | } |
| 215 | 248 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 216 | - } else $all = array(); |
|
| 249 | + } else { |
|
| 250 | + $all = array(); |
|
| 251 | + } |
|
| 217 | 252 | if (empty($all)) { |
| 218 | 253 | $filters = array('airlines' => array($stats_airline)); |
| 219 | 254 | if ($filter_name != '') { |
@@ -227,10 +262,15 @@ discard block |
||
| 227 | 262 | |
| 228 | 263 | public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 229 | 264 | global $globalStatsFilters; |
| 230 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 265 | + if ($filter_name == '') { |
|
| 266 | + $filter_name = $this->filter_name; |
|
| 267 | + } |
|
| 231 | 268 | if ($year == '' && $month == '') { |
| 232 | - if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 233 | - else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
|
| 269 | + if ($limit) { |
|
| 270 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 271 | + } else { |
|
| 272 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
|
| 273 | + } |
|
| 234 | 274 | try { |
| 235 | 275 | $sth = $this->db->prepare($query); |
| 236 | 276 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -238,7 +278,9 @@ discard block |
||
| 238 | 278 | echo "error : ".$e->getMessage(); |
| 239 | 279 | } |
| 240 | 280 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 241 | - } else $all = array(); |
|
| 281 | + } else { |
|
| 282 | + $all = array(); |
|
| 283 | + } |
|
| 242 | 284 | if (empty($all)) { |
| 243 | 285 | $filters = array('airlines' => array($stats_airline)); |
| 244 | 286 | if ($filter_name != '') { |
@@ -251,9 +293,14 @@ discard block |
||
| 251 | 293 | } |
| 252 | 294 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
| 253 | 295 | global $globalStatsFilters; |
| 254 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 255 | - if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 256 | - else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
|
| 296 | + if ($filter_name == '') { |
|
| 297 | + $filter_name = $this->filter_name; |
|
| 298 | + } |
|
| 299 | + if ($limit) { |
|
| 300 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 301 | + } else { |
|
| 302 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
|
| 303 | + } |
|
| 257 | 304 | try { |
| 258 | 305 | $sth = $this->db->prepare($query); |
| 259 | 306 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -274,10 +321,15 @@ discard block |
||
| 274 | 321 | |
| 275 | 322 | public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
| 276 | 323 | global $globalStatsFilters; |
| 277 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 324 | + if ($filter_name == '') { |
|
| 325 | + $filter_name = $this->filter_name; |
|
| 326 | + } |
|
| 278 | 327 | if ($year == '' && $month == '') { |
| 279 | - if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 280 | - else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC"; |
|
| 328 | + if ($limit) { |
|
| 329 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 330 | + } else { |
|
| 331 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC"; |
|
| 332 | + } |
|
| 281 | 333 | try { |
| 282 | 334 | $sth = $this->db->prepare($query); |
| 283 | 335 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -285,7 +337,9 @@ discard block |
||
| 285 | 337 | echo "error : ".$e->getMessage(); |
| 286 | 338 | } |
| 287 | 339 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 288 | - } else $all = array(); |
|
| 340 | + } else { |
|
| 341 | + $all = array(); |
|
| 342 | + } |
|
| 289 | 343 | if (empty($all)) { |
| 290 | 344 | $Spotter = new Spotter($this->db); |
| 291 | 345 | $filters = array(); |
@@ -299,10 +353,15 @@ discard block |
||
| 299 | 353 | } |
| 300 | 354 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 301 | 355 | global $globalStatsFilters; |
| 302 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 356 | + if ($filter_name == '') { |
|
| 357 | + $filter_name = $this->filter_name; |
|
| 358 | + } |
|
| 303 | 359 | if ($year == '' && $month == '') { |
| 304 | - if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
| 305 | - else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
| 360 | + if ($limit) { |
|
| 361 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
| 362 | + } else { |
|
| 363 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
| 364 | + } |
|
| 306 | 365 | try { |
| 307 | 366 | $sth = $this->db->prepare($query); |
| 308 | 367 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -310,7 +369,9 @@ discard block |
||
| 310 | 369 | echo "error : ".$e->getMessage(); |
| 311 | 370 | } |
| 312 | 371 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 313 | - } else $all = array(); |
|
| 372 | + } else { |
|
| 373 | + $all = array(); |
|
| 374 | + } |
|
| 314 | 375 | if (empty($all)) { |
| 315 | 376 | $filters = array('airlines' => array($stats_airline)); |
| 316 | 377 | if ($filter_name != '') { |
@@ -323,10 +384,15 @@ discard block |
||
| 323 | 384 | } |
| 324 | 385 | public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 325 | 386 | global $globalStatsFilters; |
| 326 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 387 | + if ($filter_name == '') { |
|
| 388 | + $filter_name = $this->filter_name; |
|
| 389 | + } |
|
| 327 | 390 | if ($year == '' && $month == '') { |
| 328 | - if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 329 | - else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
| 391 | + if ($limit) { |
|
| 392 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 393 | + } else { |
|
| 394 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
| 395 | + } |
|
| 330 | 396 | try { |
| 331 | 397 | $sth = $this->db->prepare($query); |
| 332 | 398 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -334,7 +400,9 @@ discard block |
||
| 334 | 400 | echo "error : ".$e->getMessage(); |
| 335 | 401 | } |
| 336 | 402 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 337 | - } else $all = array(); |
|
| 403 | + } else { |
|
| 404 | + $all = array(); |
|
| 405 | + } |
|
| 338 | 406 | if (empty($all)) { |
| 339 | 407 | $filters = array('airlines' => array($stats_airline)); |
| 340 | 408 | if ($filter_name != '') { |
@@ -347,11 +415,16 @@ discard block |
||
| 347 | 415 | } |
| 348 | 416 | public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 349 | 417 | $Connection = new Connection(); |
| 350 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 418 | + if ($filter_name == '') { |
|
| 419 | + $filter_name = $this->filter_name; |
|
| 420 | + } |
|
| 351 | 421 | if ($Connection->tableExists('countries')) { |
| 352 | 422 | if ($year == '' && $month == '') { |
| 353 | - if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
| 354 | - else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
| 423 | + if ($limit) { |
|
| 424 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
| 425 | + } else { |
|
| 426 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
| 427 | + } |
|
| 355 | 428 | try { |
| 356 | 429 | $sth = $this->db->prepare($query); |
| 357 | 430 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -366,17 +439,24 @@ discard block |
||
| 366 | 439 | } |
| 367 | 440 | */ |
| 368 | 441 | return $all; |
| 369 | - } else return array(); |
|
| 442 | + } else { |
|
| 443 | + return array(); |
|
| 444 | + } |
|
| 370 | 445 | } else { |
| 371 | 446 | return array(); |
| 372 | 447 | } |
| 373 | 448 | } |
| 374 | 449 | public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
| 375 | 450 | global $globalStatsFilters; |
| 376 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 451 | + if ($filter_name == '') { |
|
| 452 | + $filter_name = $this->filter_name; |
|
| 453 | + } |
|
| 377 | 454 | if ($year == '' && $month == '') { |
| 378 | - if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
|
| 379 | - else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
|
| 455 | + if ($limit) { |
|
| 456 | + $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
|
| 457 | + } else { |
|
| 458 | + $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
|
| 459 | + } |
|
| 380 | 460 | try { |
| 381 | 461 | $sth = $this->db->prepare($query); |
| 382 | 462 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -384,7 +464,9 @@ discard block |
||
| 384 | 464 | echo "error : ".$e->getMessage(); |
| 385 | 465 | } |
| 386 | 466 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 387 | - } else $all = array(); |
|
| 467 | + } else { |
|
| 468 | + $all = array(); |
|
| 469 | + } |
|
| 388 | 470 | if (empty($all)) { |
| 389 | 471 | $filters = array('airlines' => array($stats_airline)); |
| 390 | 472 | if ($filter_name != '') { |
@@ -398,10 +480,15 @@ discard block |
||
| 398 | 480 | |
| 399 | 481 | public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
| 400 | 482 | global $globalStatsFilters; |
| 401 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 483 | + if ($filter_name == '') { |
|
| 484 | + $filter_name = $this->filter_name; |
|
| 485 | + } |
|
| 402 | 486 | if ($year == '' && $month == '') { |
| 403 | - if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
| 404 | - else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
| 487 | + if ($limit) { |
|
| 488 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
| 489 | + } else { |
|
| 490 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
| 491 | + } |
|
| 405 | 492 | try { |
| 406 | 493 | $sth = $this->db->prepare($query); |
| 407 | 494 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -409,7 +496,9 @@ discard block |
||
| 409 | 496 | echo "error : ".$e->getMessage(); |
| 410 | 497 | } |
| 411 | 498 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 412 | - } else $all = array(); |
|
| 499 | + } else { |
|
| 500 | + $all = array(); |
|
| 501 | + } |
|
| 413 | 502 | if (empty($all)) { |
| 414 | 503 | $filters = array('airlines' => array($stats_airline)); |
| 415 | 504 | if ($filter_name != '') { |
@@ -422,10 +511,15 @@ discard block |
||
| 422 | 511 | } |
| 423 | 512 | public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 424 | 513 | global $globalStatsFilters; |
| 425 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 514 | + if ($filter_name == '') { |
|
| 515 | + $filter_name = $this->filter_name; |
|
| 516 | + } |
|
| 426 | 517 | if ($year == '' && $month == '') { |
| 427 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 428 | - else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
| 518 | + if ($limit) { |
|
| 519 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 520 | + } else { |
|
| 521 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
| 522 | + } |
|
| 429 | 523 | try { |
| 430 | 524 | $sth = $this->db->prepare($query); |
| 431 | 525 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -433,7 +527,9 @@ discard block |
||
| 433 | 527 | echo "error : ".$e->getMessage(); |
| 434 | 528 | } |
| 435 | 529 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 436 | - } else $all = array(); |
|
| 530 | + } else { |
|
| 531 | + $all = array(); |
|
| 532 | + } |
|
| 437 | 533 | if (empty($all)) { |
| 438 | 534 | $filters = array('airlines' => array($stats_airline)); |
| 439 | 535 | if ($filter_name != '') { |
@@ -452,7 +548,9 @@ discard block |
||
| 452 | 548 | $icao = $value['airport_departure_icao']; |
| 453 | 549 | if (isset($all[$icao])) { |
| 454 | 550 | $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 455 | - } else $all[$icao] = $value; |
|
| 551 | + } else { |
|
| 552 | + $all[$icao] = $value; |
|
| 553 | + } |
|
| 456 | 554 | } |
| 457 | 555 | $count = array(); |
| 458 | 556 | foreach ($all as $key => $row) { |
@@ -464,10 +562,15 @@ discard block |
||
| 464 | 562 | } |
| 465 | 563 | public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 466 | 564 | global $globalStatsFilters; |
| 467 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 565 | + if ($filter_name == '') { |
|
| 566 | + $filter_name = $this->filter_name; |
|
| 567 | + } |
|
| 468 | 568 | if ($year == '' && $month == '') { |
| 469 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 470 | - else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
| 569 | + if ($limit) { |
|
| 570 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 571 | + } else { |
|
| 572 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
| 573 | + } |
|
| 471 | 574 | try { |
| 472 | 575 | $sth = $this->db->prepare($query); |
| 473 | 576 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -475,7 +578,9 @@ discard block |
||
| 475 | 578 | echo "error : ".$e->getMessage(); |
| 476 | 579 | } |
| 477 | 580 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 478 | - } else $all = array(); |
|
| 581 | + } else { |
|
| 582 | + $all = array(); |
|
| 583 | + } |
|
| 479 | 584 | if (empty($all)) { |
| 480 | 585 | $filters = array('airlines' => array($stats_airline)); |
| 481 | 586 | if ($filter_name != '') { |
@@ -494,7 +599,9 @@ discard block |
||
| 494 | 599 | $icao = $value['airport_arrival_icao']; |
| 495 | 600 | if (isset($all[$icao])) { |
| 496 | 601 | $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 497 | - } else $all[$icao] = $value; |
|
| 602 | + } else { |
|
| 603 | + $all[$icao] = $value; |
|
| 604 | + } |
|
| 498 | 605 | } |
| 499 | 606 | $count = array(); |
| 500 | 607 | foreach ($all as $key => $row) { |
@@ -507,13 +614,21 @@ discard block |
||
| 507 | 614 | } |
| 508 | 615 | public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
| 509 | 616 | global $globalDBdriver, $globalStatsFilters; |
| 510 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 617 | + if ($filter_name == '') { |
|
| 618 | + $filter_name = $this->filter_name; |
|
| 619 | + } |
|
| 511 | 620 | if ($globalDBdriver == 'mysql') { |
| 512 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 513 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 621 | + if ($limit) { |
|
| 622 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 623 | + } else { |
|
| 624 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 625 | + } |
|
| 514 | 626 | } else { |
| 515 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 516 | - else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 627 | + if ($limit) { |
|
| 628 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 629 | + } else { |
|
| 630 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 631 | + } |
|
| 517 | 632 | } |
| 518 | 633 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 519 | 634 | try { |
@@ -537,7 +652,9 @@ discard block |
||
| 537 | 652 | |
| 538 | 653 | public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
| 539 | 654 | global $globalStatsFilters; |
| 540 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 655 | + if ($filter_name == '') { |
|
| 656 | + $filter_name = $this->filter_name; |
|
| 657 | + } |
|
| 541 | 658 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 542 | 659 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 543 | 660 | try { |
@@ -559,7 +676,9 @@ discard block |
||
| 559 | 676 | } |
| 560 | 677 | public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
| 561 | 678 | global $globalDBdriver, $globalStatsFilters; |
| 562 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 679 | + if ($filter_name == '') { |
|
| 680 | + $filter_name = $this->filter_name; |
|
| 681 | + } |
|
| 563 | 682 | if ($globalDBdriver == 'mysql') { |
| 564 | 683 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 565 | 684 | } else { |
@@ -585,7 +704,9 @@ discard block |
||
| 585 | 704 | } |
| 586 | 705 | public function countAllDates($stats_airline = '',$filter_name = '') { |
| 587 | 706 | global $globalStatsFilters; |
| 588 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 707 | + if ($filter_name == '') { |
|
| 708 | + $filter_name = $this->filter_name; |
|
| 709 | + } |
|
| 589 | 710 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 590 | 711 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 591 | 712 | try { |
@@ -607,7 +728,9 @@ discard block |
||
| 607 | 728 | } |
| 608 | 729 | public function countAllDatesByAirlines($filter_name = '') { |
| 609 | 730 | global $globalStatsFilters; |
| 610 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 731 | + if ($filter_name == '') { |
|
| 732 | + $filter_name = $this->filter_name; |
|
| 733 | + } |
|
| 611 | 734 | $query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name"; |
| 612 | 735 | $query_data = array('filter_name' => $filter_name); |
| 613 | 736 | try { |
@@ -629,7 +752,9 @@ discard block |
||
| 629 | 752 | } |
| 630 | 753 | public function countAllMonths($stats_airline = '',$filter_name = '') { |
| 631 | 754 | global $globalStatsFilters; |
| 632 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 755 | + if ($filter_name == '') { |
|
| 756 | + $filter_name = $this->filter_name; |
|
| 757 | + } |
|
| 633 | 758 | $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 634 | 759 | try { |
| 635 | 760 | $sth = $this->db->prepare($query); |
@@ -652,7 +777,9 @@ discard block |
||
| 652 | 777 | } |
| 653 | 778 | public function countAllMilitaryMonths($filter_name = '') { |
| 654 | 779 | global $globalStatsFilters; |
| 655 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 780 | + if ($filter_name == '') { |
|
| 781 | + $filter_name = $this->filter_name; |
|
| 782 | + } |
|
| 656 | 783 | $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name"; |
| 657 | 784 | try { |
| 658 | 785 | $sth = $this->db->prepare($query); |
@@ -673,9 +800,14 @@ discard block |
||
| 673 | 800 | } |
| 674 | 801 | public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
| 675 | 802 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
| 676 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 677 | - if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 678 | - else $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 803 | + if ($filter_name == '') { |
|
| 804 | + $filter_name = $this->filter_name; |
|
| 805 | + } |
|
| 806 | + if ($limit) { |
|
| 807 | + $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 808 | + } else { |
|
| 809 | + $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 810 | + } |
|
| 679 | 811 | if ($orderby == 'hour') { |
| 680 | 812 | /* |
| 681 | 813 | if ($globalDBdriver == 'mysql') { |
@@ -684,7 +816,9 @@ discard block |
||
| 684 | 816 | */ |
| 685 | 817 | $query .= " ORDER BY CAST(flight_date AS integer) ASC"; |
| 686 | 818 | } |
| 687 | - if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
|
| 819 | + if ($orderby == 'count') { |
|
| 820 | + $query .= " ORDER BY hour_count DESC"; |
|
| 821 | + } |
|
| 688 | 822 | try { |
| 689 | 823 | $sth = $this->db->prepare($query); |
| 690 | 824 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
@@ -705,8 +839,12 @@ discard block |
||
| 705 | 839 | |
| 706 | 840 | public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
| 707 | 841 | global $globalStatsFilters; |
| 708 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 709 | - if ($year == '') $year = date('Y'); |
|
| 842 | + if ($filter_name == '') { |
|
| 843 | + $filter_name = $this->filter_name; |
|
| 844 | + } |
|
| 845 | + if ($year == '') { |
|
| 846 | + $year = date('Y'); |
|
| 847 | + } |
|
| 710 | 848 | $all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
| 711 | 849 | if (empty($all)) { |
| 712 | 850 | $filters = array('airlines' => array($stats_airline)); |
@@ -720,8 +858,12 @@ discard block |
||
| 720 | 858 | } |
| 721 | 859 | public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
| 722 | 860 | global $globalStatsFilters; |
| 723 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 724 | - if ($year == '') $year = date('Y'); |
|
| 861 | + if ($filter_name == '') { |
|
| 862 | + $filter_name = $this->filter_name; |
|
| 863 | + } |
|
| 864 | + if ($year == '') { |
|
| 865 | + $year = date('Y'); |
|
| 866 | + } |
|
| 725 | 867 | $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
| 726 | 868 | if (empty($all)) { |
| 727 | 869 | $filters = array(); |
@@ -735,8 +877,12 @@ discard block |
||
| 735 | 877 | } |
| 736 | 878 | public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
| 737 | 879 | global $globalStatsFilters; |
| 738 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 739 | - if ($year == '') $year = date('Y'); |
|
| 880 | + if ($filter_name == '') { |
|
| 881 | + $filter_name = $this->filter_name; |
|
| 882 | + } |
|
| 883 | + if ($year == '') { |
|
| 884 | + $year = date('Y'); |
|
| 885 | + } |
|
| 740 | 886 | $all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
| 741 | 887 | if (empty($all)) { |
| 742 | 888 | $filters = array('airlines' => array($stats_airline)); |
@@ -750,7 +896,9 @@ discard block |
||
| 750 | 896 | } |
| 751 | 897 | public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
| 752 | 898 | global $globalStatsFilters; |
| 753 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 899 | + if ($filter_name == '') { |
|
| 900 | + $filter_name = $this->filter_name; |
|
| 901 | + } |
|
| 754 | 902 | if ($year == '' && $month == '') { |
| 755 | 903 | $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 756 | 904 | try { |
@@ -761,7 +909,9 @@ discard block |
||
| 761 | 909 | } |
| 762 | 910 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 763 | 911 | $all = $result[0]['nb']; |
| 764 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 912 | + } else { |
|
| 913 | + $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 914 | + } |
|
| 765 | 915 | if (empty($all)) { |
| 766 | 916 | $filters = array('airlines' => array($stats_airline)); |
| 767 | 917 | if ($filter_name != '') { |
@@ -774,7 +924,9 @@ discard block |
||
| 774 | 924 | } |
| 775 | 925 | public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
| 776 | 926 | global $globalStatsFilters; |
| 777 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 927 | + if ($filter_name == '') { |
|
| 928 | + $filter_name = $this->filter_name; |
|
| 929 | + } |
|
| 778 | 930 | if ($year == '' && $month == '') { |
| 779 | 931 | $query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name"; |
| 780 | 932 | try { |
@@ -785,7 +937,9 @@ discard block |
||
| 785 | 937 | } |
| 786 | 938 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 787 | 939 | $all = $result[0]['nb_airline']; |
| 788 | - } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
| 940 | + } else { |
|
| 941 | + $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
| 942 | + } |
|
| 789 | 943 | if (empty($all)) { |
| 790 | 944 | $filters = array(); |
| 791 | 945 | if ($filter_name != '') { |
@@ -798,7 +952,9 @@ discard block |
||
| 798 | 952 | } |
| 799 | 953 | public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
| 800 | 954 | global $globalStatsFilters; |
| 801 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 955 | + if ($filter_name == '') { |
|
| 956 | + $filter_name = $this->filter_name; |
|
| 957 | + } |
|
| 802 | 958 | if ($year == '' && $month == '') { |
| 803 | 959 | $query = "SELECT count(*) as nb FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 804 | 960 | $query_values = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
@@ -825,7 +981,9 @@ discard block |
||
| 825 | 981 | } |
| 826 | 982 | public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 827 | 983 | global $globalStatsFilters; |
| 828 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 984 | + if ($filter_name == '') { |
|
| 985 | + $filter_name = $this->filter_name; |
|
| 986 | + } |
|
| 829 | 987 | //if ($year == '') $year = date('Y'); |
| 830 | 988 | if ($year == '' && $month == '') { |
| 831 | 989 | $query = "SELECT count(*) as nb FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -853,7 +1011,9 @@ discard block |
||
| 853 | 1011 | } |
| 854 | 1012 | |
| 855 | 1013 | public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
| 856 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1014 | + if ($filter_name == '') { |
|
| 1015 | + $filter_name = $this->filter_name; |
|
| 1016 | + } |
|
| 857 | 1017 | $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date"; |
| 858 | 1018 | $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
| 859 | 1019 | try { |
@@ -866,7 +1026,9 @@ discard block |
||
| 866 | 1026 | return $all; |
| 867 | 1027 | } |
| 868 | 1028 | public function getStats($type,$stats_airline = '', $filter_name = '') { |
| 869 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1029 | + if ($filter_name == '') { |
|
| 1030 | + $filter_name = $this->filter_name; |
|
| 1031 | + } |
|
| 870 | 1032 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
| 871 | 1033 | $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 872 | 1034 | try { |
@@ -879,7 +1041,9 @@ discard block |
||
| 879 | 1041 | return $all; |
| 880 | 1042 | } |
| 881 | 1043 | public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
| 882 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1044 | + if ($filter_name == '') { |
|
| 1045 | + $filter_name = $this->filter_name; |
|
| 1046 | + } |
|
| 883 | 1047 | global $globalArchiveMonths, $globalDBdriver; |
| 884 | 1048 | if ($globalDBdriver == 'mysql') { |
| 885 | 1049 | if ($month == '') { |
@@ -909,7 +1073,9 @@ discard block |
||
| 909 | 1073 | } |
| 910 | 1074 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
| 911 | 1075 | global $globalArchiveMonths, $globalDBdriver; |
| 912 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1076 | + if ($filter_name == '') { |
|
| 1077 | + $filter_name = $this->filter_name; |
|
| 1078 | + } |
|
| 913 | 1079 | if ($globalDBdriver == 'mysql') { |
| 914 | 1080 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 915 | 1081 | } else { |
@@ -927,7 +1093,9 @@ discard block |
||
| 927 | 1093 | } |
| 928 | 1094 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
| 929 | 1095 | global $globalArchiveMonths, $globalDBdriver; |
| 930 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1096 | + if ($filter_name == '') { |
|
| 1097 | + $filter_name = $this->filter_name; |
|
| 1098 | + } |
|
| 931 | 1099 | if ($globalDBdriver == 'mysql') { |
| 932 | 1100 | $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 933 | 1101 | } else { |
@@ -944,7 +1112,9 @@ discard block |
||
| 944 | 1112 | } |
| 945 | 1113 | public function getStatsAirlineTotal($filter_name = '') { |
| 946 | 1114 | global $globalArchiveMonths, $globalDBdriver; |
| 947 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1115 | + if ($filter_name == '') { |
|
| 1116 | + $filter_name = $this->filter_name; |
|
| 1117 | + } |
|
| 948 | 1118 | if ($globalDBdriver == 'mysql') { |
| 949 | 1119 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
| 950 | 1120 | } else { |
@@ -961,7 +1131,9 @@ discard block |
||
| 961 | 1131 | } |
| 962 | 1132 | public function getStatsOwnerTotal($filter_name = '') { |
| 963 | 1133 | global $globalArchiveMonths, $globalDBdriver; |
| 964 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1134 | + if ($filter_name == '') { |
|
| 1135 | + $filter_name = $this->filter_name; |
|
| 1136 | + } |
|
| 965 | 1137 | if ($globalDBdriver == 'mysql') { |
| 966 | 1138 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
| 967 | 1139 | } else { |
@@ -978,7 +1150,9 @@ discard block |
||
| 978 | 1150 | } |
| 979 | 1151 | public function getStatsOwner($owner_name,$filter_name = '') { |
| 980 | 1152 | global $globalArchiveMonths, $globalDBdriver; |
| 981 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1153 | + if ($filter_name == '') { |
|
| 1154 | + $filter_name = $this->filter_name; |
|
| 1155 | + } |
|
| 982 | 1156 | $query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name"; |
| 983 | 1157 | try { |
| 984 | 1158 | $sth = $this->db->prepare($query); |
@@ -987,12 +1161,17 @@ discard block |
||
| 987 | 1161 | echo "error : ".$e->getMessage(); |
| 988 | 1162 | } |
| 989 | 1163 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 990 | - if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
| 991 | - else return 0; |
|
| 1164 | + if (isset($all[0]['cnt'])) { |
|
| 1165 | + return $all[0]['cnt']; |
|
| 1166 | + } else { |
|
| 1167 | + return 0; |
|
| 1168 | + } |
|
| 992 | 1169 | } |
| 993 | 1170 | public function getStatsPilotTotal($filter_name = '') { |
| 994 | 1171 | global $globalArchiveMonths, $globalDBdriver; |
| 995 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1172 | + if ($filter_name == '') { |
|
| 1173 | + $filter_name = $this->filter_name; |
|
| 1174 | + } |
|
| 996 | 1175 | if ($globalDBdriver == 'mysql') { |
| 997 | 1176 | $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
| 998 | 1177 | } else { |
@@ -1009,7 +1188,9 @@ discard block |
||
| 1009 | 1188 | } |
| 1010 | 1189 | public function getStatsPilot($pilot,$filter_name = '') { |
| 1011 | 1190 | global $globalArchiveMonths, $globalDBdriver; |
| 1012 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1191 | + if ($filter_name == '') { |
|
| 1192 | + $filter_name = $this->filter_name; |
|
| 1193 | + } |
|
| 1013 | 1194 | $query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)"; |
| 1014 | 1195 | try { |
| 1015 | 1196 | $sth = $this->db->prepare($query); |
@@ -1018,13 +1199,18 @@ discard block |
||
| 1018 | 1199 | echo "error : ".$e->getMessage(); |
| 1019 | 1200 | } |
| 1020 | 1201 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1021 | - if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
| 1022 | - else return 0; |
|
| 1202 | + if (isset($all[0]['cnt'])) { |
|
| 1203 | + return $all[0]['cnt']; |
|
| 1204 | + } else { |
|
| 1205 | + return 0; |
|
| 1206 | + } |
|
| 1023 | 1207 | } |
| 1024 | 1208 | |
| 1025 | 1209 | public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 1026 | 1210 | global $globalDBdriver; |
| 1027 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1211 | + if ($filter_name == '') { |
|
| 1212 | + $filter_name = $this->filter_name; |
|
| 1213 | + } |
|
| 1028 | 1214 | if ($globalDBdriver == 'mysql') { |
| 1029 | 1215 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt"; |
| 1030 | 1216 | } else { |
@@ -1040,7 +1226,9 @@ discard block |
||
| 1040 | 1226 | } |
| 1041 | 1227 | public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 1042 | 1228 | global $globalDBdriver; |
| 1043 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1229 | + if ($filter_name == '') { |
|
| 1230 | + $filter_name = $this->filter_name; |
|
| 1231 | + } |
|
| 1044 | 1232 | if ($globalDBdriver == 'mysql') { |
| 1045 | 1233 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
| 1046 | 1234 | } else { |
@@ -1426,10 +1614,14 @@ discard block |
||
| 1426 | 1614 | $Connection = new Connection(); |
| 1427 | 1615 | date_default_timezone_set('UTC'); |
| 1428 | 1616 | $last_update = $this->getLastStatsUpdate('last_update_stats'); |
| 1429 | - if ($globalDebug) echo 'Update stats !'."\n"; |
|
| 1617 | + if ($globalDebug) { |
|
| 1618 | + echo 'Update stats !'."\n"; |
|
| 1619 | + } |
|
| 1430 | 1620 | if (isset($last_update[0]['value'])) { |
| 1431 | 1621 | $last_update_day = $last_update[0]['value']; |
| 1432 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
| 1622 | + } else { |
|
| 1623 | + $last_update_day = '2012-12-12 12:12:12'; |
|
| 1624 | + } |
|
| 1433 | 1625 | $reset = false; |
| 1434 | 1626 | if ($globalStatsResetYear) { |
| 1435 | 1627 | $reset = true; |
@@ -1437,42 +1629,60 @@ discard block |
||
| 1437 | 1629 | } |
| 1438 | 1630 | $Spotter = new Spotter($this->db); |
| 1439 | 1631 | |
| 1440 | - if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
|
| 1632 | + if ($globalDebug) { |
|
| 1633 | + echo 'Count all aircraft types...'."\n"; |
|
| 1634 | + } |
|
| 1441 | 1635 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
| 1442 | 1636 | foreach ($alldata as $number) { |
| 1443 | 1637 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
| 1444 | 1638 | } |
| 1445 | - if ($globalDebug) echo 'Count all airlines...'."\n"; |
|
| 1639 | + if ($globalDebug) { |
|
| 1640 | + echo 'Count all airlines...'."\n"; |
|
| 1641 | + } |
|
| 1446 | 1642 | $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
| 1447 | 1643 | foreach ($alldata as $number) { |
| 1448 | 1644 | $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
| 1449 | 1645 | } |
| 1450 | - if ($globalDebug) echo 'Count all registrations...'."\n"; |
|
| 1646 | + if ($globalDebug) { |
|
| 1647 | + echo 'Count all registrations...'."\n"; |
|
| 1648 | + } |
|
| 1451 | 1649 | $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
| 1452 | 1650 | foreach ($alldata as $number) { |
| 1453 | 1651 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
| 1454 | 1652 | } |
| 1455 | - if ($globalDebug) echo 'Count all callsigns...'."\n"; |
|
| 1653 | + if ($globalDebug) { |
|
| 1654 | + echo 'Count all callsigns...'."\n"; |
|
| 1655 | + } |
|
| 1456 | 1656 | $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
| 1457 | 1657 | foreach ($alldata as $number) { |
| 1458 | 1658 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
| 1459 | 1659 | } |
| 1460 | - if ($globalDebug) echo 'Count all owners...'."\n"; |
|
| 1660 | + if ($globalDebug) { |
|
| 1661 | + echo 'Count all owners...'."\n"; |
|
| 1662 | + } |
|
| 1461 | 1663 | $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
| 1462 | 1664 | foreach ($alldata as $number) { |
| 1463 | 1665 | $this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
| 1464 | 1666 | } |
| 1465 | - if ($globalDebug) echo 'Count all pilots...'."\n"; |
|
| 1667 | + if ($globalDebug) { |
|
| 1668 | + echo 'Count all pilots...'."\n"; |
|
| 1669 | + } |
|
| 1466 | 1670 | $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
| 1467 | 1671 | foreach ($alldata as $number) { |
| 1468 | 1672 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
| 1469 | 1673 | } |
| 1470 | 1674 | |
| 1471 | - if ($globalDebug) echo 'Count all departure airports...'."\n"; |
|
| 1675 | + if ($globalDebug) { |
|
| 1676 | + echo 'Count all departure airports...'."\n"; |
|
| 1677 | + } |
|
| 1472 | 1678 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
| 1473 | - if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
|
| 1679 | + if ($globalDebug) { |
|
| 1680 | + echo 'Count all detected departure airports...'."\n"; |
|
| 1681 | + } |
|
| 1474 | 1682 | $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
| 1475 | - if ($globalDebug) echo 'Order departure airports...'."\n"; |
|
| 1683 | + if ($globalDebug) { |
|
| 1684 | + echo 'Order departure airports...'."\n"; |
|
| 1685 | + } |
|
| 1476 | 1686 | $alldata = array(); |
| 1477 | 1687 | |
| 1478 | 1688 | foreach ($pall as $value) { |
@@ -1483,7 +1693,9 @@ discard block |
||
| 1483 | 1693 | $icao = $value['airport_departure_icao']; |
| 1484 | 1694 | if (isset($alldata[$icao])) { |
| 1485 | 1695 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 1486 | - } else $alldata[$icao] = $value; |
|
| 1696 | + } else { |
|
| 1697 | + $alldata[$icao] = $value; |
|
| 1698 | + } |
|
| 1487 | 1699 | } |
| 1488 | 1700 | $count = array(); |
| 1489 | 1701 | foreach ($alldata as $key => $row) { |
@@ -1493,11 +1705,17 @@ discard block |
||
| 1493 | 1705 | foreach ($alldata as $number) { |
| 1494 | 1706 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset); |
| 1495 | 1707 | } |
| 1496 | - if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
|
| 1708 | + if ($globalDebug) { |
|
| 1709 | + echo 'Count all arrival airports...'."\n"; |
|
| 1710 | + } |
|
| 1497 | 1711 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
| 1498 | - if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
|
| 1712 | + if ($globalDebug) { |
|
| 1713 | + echo 'Count all detected arrival airports...'."\n"; |
|
| 1714 | + } |
|
| 1499 | 1715 | $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
| 1500 | - if ($globalDebug) echo 'Order arrival airports...'."\n"; |
|
| 1716 | + if ($globalDebug) { |
|
| 1717 | + echo 'Order arrival airports...'."\n"; |
|
| 1718 | + } |
|
| 1501 | 1719 | $alldata = array(); |
| 1502 | 1720 | foreach ($pall as $value) { |
| 1503 | 1721 | $icao = $value['airport_arrival_icao']; |
@@ -1507,7 +1725,9 @@ discard block |
||
| 1507 | 1725 | $icao = $value['airport_arrival_icao']; |
| 1508 | 1726 | if (isset($alldata[$icao])) { |
| 1509 | 1727 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 1510 | - } else $alldata[$icao] = $value; |
|
| 1728 | + } else { |
|
| 1729 | + $alldata[$icao] = $value; |
|
| 1730 | + } |
|
| 1511 | 1731 | } |
| 1512 | 1732 | $count = array(); |
| 1513 | 1733 | foreach ($alldata as $key => $row) { |
@@ -1518,7 +1738,9 @@ discard block |
||
| 1518 | 1738 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset); |
| 1519 | 1739 | } |
| 1520 | 1740 | if ($Connection->tableExists('countries')) { |
| 1521 | - if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
|
| 1741 | + if ($globalDebug) { |
|
| 1742 | + echo 'Count all flights by countries...'."\n"; |
|
| 1743 | + } |
|
| 1522 | 1744 | $SpotterArchive = new SpotterArchive(); |
| 1523 | 1745 | $alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
| 1524 | 1746 | foreach ($alldata as $number) { |
@@ -1530,46 +1752,66 @@ discard block |
||
| 1530 | 1752 | // Add by month using getstat if month finish... |
| 1531 | 1753 | |
| 1532 | 1754 | //if (date('m',strtotime($last_update_day)) != date('m')) { |
| 1533 | - if ($globalDebug) echo 'Count all flights by months...'."\n"; |
|
| 1755 | + if ($globalDebug) { |
|
| 1756 | + echo 'Count all flights by months...'."\n"; |
|
| 1757 | + } |
|
| 1534 | 1758 | $Spotter = new Spotter($this->db); |
| 1535 | 1759 | $alldata = $Spotter->countAllMonths(); |
| 1536 | 1760 | $lastyear = false; |
| 1537 | 1761 | foreach ($alldata as $number) { |
| 1538 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 1762 | + if ($number['year_name'] != date('Y')) { |
|
| 1763 | + $lastyear = true; |
|
| 1764 | + } |
|
| 1539 | 1765 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 1540 | 1766 | } |
| 1541 | - if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
|
| 1767 | + if ($globalDebug) { |
|
| 1768 | + echo 'Count all military flights by months...'."\n"; |
|
| 1769 | + } |
|
| 1542 | 1770 | $alldata = $Spotter->countAllMilitaryMonths(); |
| 1543 | 1771 | foreach ($alldata as $number) { |
| 1544 | 1772 | $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 1545 | 1773 | } |
| 1546 | - if ($globalDebug) echo 'Count all owners by months...'."\n"; |
|
| 1774 | + if ($globalDebug) { |
|
| 1775 | + echo 'Count all owners by months...'."\n"; |
|
| 1776 | + } |
|
| 1547 | 1777 | $alldata = $Spotter->countAllMonthsOwners(); |
| 1548 | 1778 | foreach ($alldata as $number) { |
| 1549 | 1779 | $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 1550 | 1780 | } |
| 1551 | - if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
|
| 1781 | + if ($globalDebug) { |
|
| 1782 | + echo 'Count all pilots by months...'."\n"; |
|
| 1783 | + } |
|
| 1552 | 1784 | $alldata = $Spotter->countAllMonthsPilots(); |
| 1553 | 1785 | foreach ($alldata as $number) { |
| 1554 | 1786 | $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 1555 | 1787 | } |
| 1556 | - if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
|
| 1788 | + if ($globalDebug) { |
|
| 1789 | + echo 'Count all airlines by months...'."\n"; |
|
| 1790 | + } |
|
| 1557 | 1791 | $alldata = $Spotter->countAllMonthsAirlines(); |
| 1558 | 1792 | foreach ($alldata as $number) { |
| 1559 | 1793 | $this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 1560 | 1794 | } |
| 1561 | - if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
|
| 1795 | + if ($globalDebug) { |
|
| 1796 | + echo 'Count all aircrafts by months...'."\n"; |
|
| 1797 | + } |
|
| 1562 | 1798 | $alldata = $Spotter->countAllMonthsAircrafts(); |
| 1563 | 1799 | foreach ($alldata as $number) { |
| 1564 | 1800 | $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 1565 | 1801 | } |
| 1566 | - if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
|
| 1802 | + if ($globalDebug) { |
|
| 1803 | + echo 'Count all real arrivals by months...'."\n"; |
|
| 1804 | + } |
|
| 1567 | 1805 | $alldata = $Spotter->countAllMonthsRealArrivals(); |
| 1568 | 1806 | foreach ($alldata as $number) { |
| 1569 | 1807 | $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 1570 | 1808 | } |
| 1571 | - if ($globalDebug) echo 'Airports data...'."\n"; |
|
| 1572 | - if ($globalDebug) echo '...Departure'."\n"; |
|
| 1809 | + if ($globalDebug) { |
|
| 1810 | + echo 'Airports data...'."\n"; |
|
| 1811 | + } |
|
| 1812 | + if ($globalDebug) { |
|
| 1813 | + echo '...Departure'."\n"; |
|
| 1814 | + } |
|
| 1573 | 1815 | $this->deleteStatAirport('daily'); |
| 1574 | 1816 | // $pall = $Spotter->getLast7DaysAirportsDeparture(); |
| 1575 | 1817 | // $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
@@ -1690,44 +1932,62 @@ discard block |
||
| 1690 | 1932 | // Count by airlines |
| 1691 | 1933 | echo '--- Stats by airlines ---'."\n"; |
| 1692 | 1934 | if ($Connection->tableExists('countries')) { |
| 1693 | - if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n"; |
|
| 1935 | + if ($globalDebug) { |
|
| 1936 | + echo 'Count all flights by countries by airlines...'."\n"; |
|
| 1937 | + } |
|
| 1694 | 1938 | $SpotterArchive = new SpotterArchive(); |
| 1695 | 1939 | $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
| 1696 | 1940 | foreach ($alldata as $number) { |
| 1697 | 1941 | $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset); |
| 1698 | 1942 | } |
| 1699 | 1943 | } |
| 1700 | - if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
|
| 1944 | + if ($globalDebug) { |
|
| 1945 | + echo 'Count all aircraft types by airlines...'."\n"; |
|
| 1946 | + } |
|
| 1701 | 1947 | $Spotter = new Spotter($this->db); |
| 1702 | 1948 | $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
| 1703 | 1949 | foreach ($alldata as $number) { |
| 1704 | 1950 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
| 1705 | 1951 | } |
| 1706 | - if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
|
| 1952 | + if ($globalDebug) { |
|
| 1953 | + echo 'Count all aircraft registrations by airlines...'."\n"; |
|
| 1954 | + } |
|
| 1707 | 1955 | $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
| 1708 | 1956 | foreach ($alldata as $number) { |
| 1709 | 1957 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
| 1710 | 1958 | } |
| 1711 | - if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
|
| 1959 | + if ($globalDebug) { |
|
| 1960 | + echo 'Count all callsigns by airlines...'."\n"; |
|
| 1961 | + } |
|
| 1712 | 1962 | $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
| 1713 | 1963 | foreach ($alldata as $number) { |
| 1714 | 1964 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
| 1715 | 1965 | } |
| 1716 | - if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
|
| 1966 | + if ($globalDebug) { |
|
| 1967 | + echo 'Count all owners by airlines...'."\n"; |
|
| 1968 | + } |
|
| 1717 | 1969 | $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
| 1718 | 1970 | foreach ($alldata as $number) { |
| 1719 | 1971 | $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
| 1720 | 1972 | } |
| 1721 | - if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
|
| 1973 | + if ($globalDebug) { |
|
| 1974 | + echo 'Count all pilots by airlines...'."\n"; |
|
| 1975 | + } |
|
| 1722 | 1976 | $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
| 1723 | 1977 | foreach ($alldata as $number) { |
| 1724 | 1978 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
| 1725 | 1979 | } |
| 1726 | - if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
|
| 1980 | + if ($globalDebug) { |
|
| 1981 | + echo 'Count all departure airports by airlines...'."\n"; |
|
| 1982 | + } |
|
| 1727 | 1983 | $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
| 1728 | - if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
|
| 1984 | + if ($globalDebug) { |
|
| 1985 | + echo 'Count all detected departure airports by airlines...'."\n"; |
|
| 1986 | + } |
|
| 1729 | 1987 | $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
| 1730 | - if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
|
| 1988 | + if ($globalDebug) { |
|
| 1989 | + echo 'Order detected departure airports by airlines...'."\n"; |
|
| 1990 | + } |
|
| 1731 | 1991 | //$alldata = array(); |
| 1732 | 1992 | foreach ($dall as $value) { |
| 1733 | 1993 | $icao = $value['airport_departure_icao']; |
@@ -1748,11 +2008,17 @@ discard block |
||
| 1748 | 2008 | foreach ($alldata as $number) { |
| 1749 | 2009 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset); |
| 1750 | 2010 | } |
| 1751 | - if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
|
| 2011 | + if ($globalDebug) { |
|
| 2012 | + echo 'Count all arrival airports by airlines...'."\n"; |
|
| 2013 | + } |
|
| 1752 | 2014 | $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
| 1753 | - if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
|
| 2015 | + if ($globalDebug) { |
|
| 2016 | + echo 'Count all detected arrival airports by airlines...'."\n"; |
|
| 2017 | + } |
|
| 1754 | 2018 | $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
| 1755 | - if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
|
| 2019 | + if ($globalDebug) { |
|
| 2020 | + echo 'Order arrival airports by airlines...'."\n"; |
|
| 2021 | + } |
|
| 1756 | 2022 | //$alldata = array(); |
| 1757 | 2023 | foreach ($dall as $value) { |
| 1758 | 2024 | $icao = $value['airport_arrival_icao']; |
@@ -1771,37 +2037,53 @@ discard block |
||
| 1771 | 2037 | } |
| 1772 | 2038 | $alldata = $pall; |
| 1773 | 2039 | foreach ($alldata as $number) { |
| 1774 | - if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
| 2040 | + if ($number['airline_icao'] != '') { |
|
| 2041 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
| 2042 | + } |
|
| 2043 | + } |
|
| 2044 | + if ($globalDebug) { |
|
| 2045 | + echo 'Count all flights by months by airlines...'."\n"; |
|
| 1775 | 2046 | } |
| 1776 | - if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
|
| 1777 | 2047 | $Spotter = new Spotter($this->db); |
| 1778 | 2048 | $alldata = $Spotter->countAllMonthsByAirlines(); |
| 1779 | 2049 | $lastyear = false; |
| 1780 | 2050 | foreach ($alldata as $number) { |
| 1781 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 2051 | + if ($number['year_name'] != date('Y')) { |
|
| 2052 | + $lastyear = true; |
|
| 2053 | + } |
|
| 1782 | 2054 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
| 1783 | 2055 | } |
| 1784 | - if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
|
| 2056 | + if ($globalDebug) { |
|
| 2057 | + echo 'Count all owners by months by airlines...'."\n"; |
|
| 2058 | + } |
|
| 1785 | 2059 | $alldata = $Spotter->countAllMonthsOwnersByAirlines(); |
| 1786 | 2060 | foreach ($alldata as $number) { |
| 1787 | 2061 | $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
| 1788 | 2062 | } |
| 1789 | - if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
|
| 2063 | + if ($globalDebug) { |
|
| 2064 | + echo 'Count all pilots by months by airlines...'."\n"; |
|
| 2065 | + } |
|
| 1790 | 2066 | $alldata = $Spotter->countAllMonthsPilotsByAirlines(); |
| 1791 | 2067 | foreach ($alldata as $number) { |
| 1792 | 2068 | $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
| 1793 | 2069 | } |
| 1794 | - if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
|
| 2070 | + if ($globalDebug) { |
|
| 2071 | + echo 'Count all aircrafts by months by airlines...'."\n"; |
|
| 2072 | + } |
|
| 1795 | 2073 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines(); |
| 1796 | 2074 | foreach ($alldata as $number) { |
| 1797 | 2075 | $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
| 1798 | 2076 | } |
| 1799 | - if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
|
| 2077 | + if ($globalDebug) { |
|
| 2078 | + echo 'Count all real arrivals by months by airlines...'."\n"; |
|
| 2079 | + } |
|
| 1800 | 2080 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines(); |
| 1801 | 2081 | foreach ($alldata as $number) { |
| 1802 | 2082 | $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
| 1803 | 2083 | } |
| 1804 | - if ($globalDebug) echo '...Departure'."\n"; |
|
| 2084 | + if ($globalDebug) { |
|
| 2085 | + echo '...Departure'."\n"; |
|
| 2086 | + } |
|
| 1805 | 2087 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
| 1806 | 2088 | $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
| 1807 | 2089 | foreach ($dall as $value) { |
@@ -1824,7 +2106,9 @@ discard block |
||
| 1824 | 2106 | foreach ($alldata as $number) { |
| 1825 | 2107 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']); |
| 1826 | 2108 | } |
| 1827 | - if ($globalDebug) echo '...Arrival'."\n"; |
|
| 2109 | + if ($globalDebug) { |
|
| 2110 | + echo '...Arrival'."\n"; |
|
| 2111 | + } |
|
| 1828 | 2112 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
| 1829 | 2113 | $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
| 1830 | 2114 | foreach ($dall as $value) { |
@@ -1848,13 +2132,19 @@ discard block |
||
| 1848 | 2132 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']); |
| 1849 | 2133 | } |
| 1850 | 2134 | |
| 1851 | - if ($globalDebug) echo 'Flights data...'."\n"; |
|
| 1852 | - if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
|
| 2135 | + if ($globalDebug) { |
|
| 2136 | + echo 'Flights data...'."\n"; |
|
| 2137 | + } |
|
| 2138 | + if ($globalDebug) { |
|
| 2139 | + echo '-> countAllDatesLastMonth...'."\n"; |
|
| 2140 | + } |
|
| 1853 | 2141 | $alldata = $Spotter->countAllDatesLastMonthByAirlines(); |
| 1854 | 2142 | foreach ($alldata as $number) { |
| 1855 | 2143 | $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
| 1856 | 2144 | } |
| 1857 | - if ($globalDebug) echo '-> countAllDates...'."\n"; |
|
| 2145 | + if ($globalDebug) { |
|
| 2146 | + echo '-> countAllDates...'."\n"; |
|
| 2147 | + } |
|
| 1858 | 2148 | //$previousdata = $this->countAllDatesByAirlines(); |
| 1859 | 2149 | $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines()); |
| 1860 | 2150 | $values = array(); |
@@ -1867,7 +2157,9 @@ discard block |
||
| 1867 | 2157 | $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
| 1868 | 2158 | } |
| 1869 | 2159 | |
| 1870 | - if ($globalDebug) echo '-> countAllHours...'."\n"; |
|
| 2160 | + if ($globalDebug) { |
|
| 2161 | + echo '-> countAllHours...'."\n"; |
|
| 2162 | + } |
|
| 1871 | 2163 | $alldata = $Spotter->countAllHoursByAirlines('hour'); |
| 1872 | 2164 | foreach ($alldata as $number) { |
| 1873 | 2165 | $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
@@ -1875,7 +2167,9 @@ discard block |
||
| 1875 | 2167 | |
| 1876 | 2168 | |
| 1877 | 2169 | // Stats by filters |
| 1878 | - if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array(); |
|
| 2170 | + if (!isset($globalStatsFilters) || $globalStatsFilters == '') { |
|
| 2171 | + $globalStatsFilters = array(); |
|
| 2172 | + } |
|
| 1879 | 2173 | foreach ($globalStatsFilters as $name => $filter) { |
| 1880 | 2174 | //$filter_name = $filter['name']; |
| 1881 | 2175 | $filter_name = $name; |
@@ -1883,11 +2177,15 @@ discard block |
||
| 1883 | 2177 | $last_update = $this->getLastStatsUpdate('last_update_stats_'.$filter_name); |
| 1884 | 2178 | if (isset($last_update[0]['value'])) { |
| 1885 | 2179 | $last_update_day = $last_update[0]['value']; |
| 1886 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
| 2180 | + } else { |
|
| 2181 | + $last_update_day = '2012-12-12 12:12:12'; |
|
| 2182 | + } |
|
| 1887 | 2183 | $reset = false; |
| 1888 | 2184 | |
| 1889 | 2185 | // Count by filter |
| 1890 | - if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
| 2186 | + if ($globalDebug) { |
|
| 2187 | + echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
| 2188 | + } |
|
| 1891 | 2189 | $Spotter = new Spotter($this->db); |
| 1892 | 2190 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
| 1893 | 2191 | foreach ($alldata as $number) { |
@@ -1924,7 +2222,9 @@ discard block |
||
| 1924 | 2222 | $icao = $value['airport_departure_icao']; |
| 1925 | 2223 | if (isset($alldata[$icao])) { |
| 1926 | 2224 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 1927 | - } else $alldata[$icao] = $value; |
|
| 2225 | + } else { |
|
| 2226 | + $alldata[$icao] = $value; |
|
| 2227 | + } |
|
| 1928 | 2228 | } |
| 1929 | 2229 | $count = array(); |
| 1930 | 2230 | foreach ($alldata as $key => $row) { |
@@ -1945,7 +2245,9 @@ discard block |
||
| 1945 | 2245 | $icao = $value['airport_arrival_icao']; |
| 1946 | 2246 | if (isset($alldata[$icao])) { |
| 1947 | 2247 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 1948 | - } else $alldata[$icao] = $value; |
|
| 2248 | + } else { |
|
| 2249 | + $alldata[$icao] = $value; |
|
| 2250 | + } |
|
| 1949 | 2251 | } |
| 1950 | 2252 | $count = array(); |
| 1951 | 2253 | foreach ($alldata as $key => $row) { |
@@ -1959,7 +2261,9 @@ discard block |
||
| 1959 | 2261 | $alldata = $Spotter->countAllMonths($filter); |
| 1960 | 2262 | $lastyear = false; |
| 1961 | 2263 | foreach ($alldata as $number) { |
| 1962 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 2264 | + if ($number['year_name'] != date('Y')) { |
|
| 2265 | + $lastyear = true; |
|
| 2266 | + } |
|
| 1963 | 2267 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
| 1964 | 2268 | } |
| 1965 | 2269 | $alldata = $Spotter->countAllMonthsOwners($filter); |
@@ -69,7 +69,9 @@ discard block |
||
| 69 | 69 | $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 72 | + if (is_array($globalFilter)) { |
|
| 73 | + $filter = array_merge($filter,$globalFilter); |
|
| 74 | + } |
|
| 73 | 75 | $filter_query_join = ''; |
| 74 | 76 | $filter_query_where = ''; |
| 75 | 77 | foreach($filters as $flt) { |
@@ -122,8 +124,11 @@ discard block |
||
| 122 | 124 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 123 | 125 | } |
| 124 | 126 | } |
| 125 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 126 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 127 | + if ($filter_query_where == '' && $where) { |
|
| 128 | + $filter_query_where = ' WHERE'; |
|
| 129 | + } elseif ($filter_query_where != '' && $and) { |
|
| 130 | + $filter_query_where .= ' AND'; |
|
| 131 | + } |
|
| 127 | 132 | $filter_query = $filter_query_join.$filter_query_where; |
| 128 | 133 | return $filter_query; |
| 129 | 134 | } |
@@ -143,10 +148,18 @@ discard block |
||
| 143 | 148 | $Image = new Image($this->db); |
| 144 | 149 | $Schedule = new Schedule($this->db); |
| 145 | 150 | $ACARS = new ACARS($this->db); |
| 146 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 147 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 148 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 149 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 151 | + if (!isset($globalIVAO)) { |
|
| 152 | + $globalIVAO = FALSE; |
|
| 153 | + } |
|
| 154 | + if (!isset($globalVATSIM)) { |
|
| 155 | + $globalVATSIM = FALSE; |
|
| 156 | + } |
|
| 157 | + if (!isset($globalphpVMS)) { |
|
| 158 | + $globalphpVMS = FALSE; |
|
| 159 | + } |
|
| 160 | + if (!isset($globalVAM)) { |
|
| 161 | + $globalVAM = FALSE; |
|
| 162 | + } |
|
| 150 | 163 | date_default_timezone_set('UTC'); |
| 151 | 164 | |
| 152 | 165 | if (!is_string($query)) |
@@ -193,21 +206,35 @@ discard block |
||
| 193 | 206 | } else { |
| 194 | 207 | $temp_array['spotter_id'] = ''; |
| 195 | 208 | } |
| 196 | - if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 197 | - if (isset($row['modes'])) $temp_array['modes'] = $row['modes']; |
|
| 209 | + if (isset($row['flightaware_id'])) { |
|
| 210 | + $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 211 | + } |
|
| 212 | + if (isset($row['modes'])) { |
|
| 213 | + $temp_array['modes'] = $row['modes']; |
|
| 214 | + } |
|
| 198 | 215 | $temp_array['ident'] = $row['ident']; |
| 199 | 216 | if (isset($row['registration']) && $row['registration'] != '') { |
| 200 | 217 | $temp_array['registration'] = $row['registration']; |
| 201 | 218 | } elseif (isset($temp_array['modes'])) { |
| 202 | 219 | $temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']); |
| 203 | - } else $temp_array['registration'] = ''; |
|
| 204 | - if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 220 | + } else { |
|
| 221 | + $temp_array['registration'] = ''; |
|
| 222 | + } |
|
| 223 | + if (isset($row['aircraft_icao'])) { |
|
| 224 | + $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 225 | + } |
|
| 205 | 226 | |
| 206 | 227 | $temp_array['departure_airport'] = $row['departure_airport_icao']; |
| 207 | 228 | $temp_array['arrival_airport'] = $row['arrival_airport_icao']; |
| 208 | - if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 209 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
| 210 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
| 229 | + if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) { |
|
| 230 | + $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 231 | + } |
|
| 232 | + if (isset($row['latitude'])) { |
|
| 233 | + $temp_array['latitude'] = $row['latitude']; |
|
| 234 | + } |
|
| 235 | + if (isset($row['longitude'])) { |
|
| 236 | + $temp_array['longitude'] = $row['longitude']; |
|
| 237 | + } |
|
| 211 | 238 | /* |
| 212 | 239 | if (Connection->tableExists('countries')) { |
| 213 | 240 | $country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']); |
@@ -217,8 +244,12 @@ discard block |
||
| 217 | 244 | } |
| 218 | 245 | } |
| 219 | 246 | */ |
| 220 | - if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints']; |
|
| 221 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
| 247 | + if (isset($row['waypoints'])) { |
|
| 248 | + $temp_array['waypoints'] = $row['waypoints']; |
|
| 249 | + } |
|
| 250 | + if (isset($row['format_source'])) { |
|
| 251 | + $temp_array['format_source'] = $row['format_source']; |
|
| 252 | + } |
|
| 222 | 253 | if (isset($row['route_stop']) && $row['route_stop'] != '') { |
| 223 | 254 | $temp_array['route_stop'] = $row['route_stop']; |
| 224 | 255 | $allroute = explode(' ',$row['route_stop']); |
@@ -234,13 +265,19 @@ discard block |
||
| 234 | 265 | } |
| 235 | 266 | } |
| 236 | 267 | } |
| 237 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
| 268 | + if (isset($row['altitude'])) { |
|
| 269 | + $temp_array['altitude'] = $row['altitude']; |
|
| 270 | + } |
|
| 238 | 271 | if (isset($row['heading'])) { |
| 239 | 272 | $temp_array['heading'] = $row['heading']; |
| 240 | 273 | $heading_direction = $this->parseDirection($row['heading']); |
| 241 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 274 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
| 275 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 276 | + } |
|
| 277 | + } |
|
| 278 | + if (isset($row['ground_speed'])) { |
|
| 279 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 242 | 280 | } |
| 243 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 244 | 281 | $temp_array['image'] = ""; |
| 245 | 282 | $temp_array['image_thumbnail'] = ""; |
| 246 | 283 | $temp_array['image_source'] = ""; |
@@ -248,7 +285,9 @@ discard block |
||
| 248 | 285 | |
| 249 | 286 | if (isset($row['highlight'])) { |
| 250 | 287 | $temp_array['highlight'] = $row['highlight']; |
| 251 | - } else $temp_array['highlight'] = ''; |
|
| 288 | + } else { |
|
| 289 | + $temp_array['highlight'] = ''; |
|
| 290 | + } |
|
| 252 | 291 | |
| 253 | 292 | if (isset($row['date'])) { |
| 254 | 293 | $dateArray = $this->parseDateString($row['date']); |
@@ -302,7 +341,9 @@ discard block |
||
| 302 | 341 | |
| 303 | 342 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
| 304 | 343 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
| 305 | - } else $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 344 | + } else { |
|
| 345 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 346 | + } |
|
| 306 | 347 | } else { |
| 307 | 348 | $temp_array['aircraft_shadow'] = 'default.png'; |
| 308 | 349 | $temp_array['aircraft_name'] = 'N/A'; |
@@ -310,11 +351,17 @@ discard block |
||
| 310 | 351 | } |
| 311 | 352 | } |
| 312 | 353 | $fromsource = NULL; |
| 313 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 314 | - elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 315 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 316 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 317 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 354 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 355 | + $fromsource = $globalAirlinesSource; |
|
| 356 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 357 | + $fromsource = 'vatsim'; |
|
| 358 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 359 | + $fromsource = 'ivao'; |
|
| 360 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 361 | + $fromsource = 'vatsim'; |
|
| 362 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 363 | + $fromsource = 'ivao'; |
|
| 364 | + } |
|
| 318 | 365 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
| 319 | 366 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
| 320 | 367 | if (is_numeric(substr($row['ident'], 2, 1))) { |
@@ -337,12 +384,18 @@ discard block |
||
| 337 | 384 | } |
| 338 | 385 | } else { |
| 339 | 386 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 340 | - if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 341 | - else $temp_array['airline_iata'] = 'N/A'; |
|
| 387 | + if (isset($row['airline_iata'])) { |
|
| 388 | + $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 389 | + } else { |
|
| 390 | + $temp_array['airline_iata'] = 'N/A'; |
|
| 391 | + } |
|
| 342 | 392 | $temp_array['airline_name'] = $row['airline_name']; |
| 343 | 393 | $temp_array['airline_country'] = $row['airline_country']; |
| 344 | - if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 345 | - else $temp_array['airline_callsign'] = 'N/A'; |
|
| 394 | + if (isset($row['airline_callsign'])) { |
|
| 395 | + $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 396 | + } else { |
|
| 397 | + $temp_array['airline_callsign'] = 'N/A'; |
|
| 398 | + } |
|
| 346 | 399 | $temp_array['airline_type'] = $row['airline_type']; |
| 347 | 400 | if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') { |
| 348 | 401 | $airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']); |
@@ -369,7 +422,9 @@ discard block |
||
| 369 | 422 | } |
| 370 | 423 | if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) { |
| 371 | 424 | $owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']); |
| 372 | - if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 425 | + if ($owner_info['owner'] != '') { |
|
| 426 | + $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 427 | + } |
|
| 373 | 428 | $temp_array['aircraft_base'] = $owner_info['base']; |
| 374 | 429 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
| 375 | 430 | } |
@@ -377,9 +432,14 @@ discard block |
||
| 377 | 432 | if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
| 378 | 433 | { |
| 379 | 434 | if ($globalIVAO) { |
| 380 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 381 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 382 | - } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 435 | + if (isset($temp_array['airline_icao'])) { |
|
| 436 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 437 | + } else { |
|
| 438 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 439 | + } |
|
| 440 | + } else { |
|
| 441 | + $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 442 | + } |
|
| 383 | 443 | if (count($image_array) > 0) { |
| 384 | 444 | $temp_array['image'] = $image_array[0]['image']; |
| 385 | 445 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -431,7 +491,9 @@ discard block |
||
| 431 | 491 | //if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') { |
| 432 | 492 | if ($row['departure_airport_icao'] != '') { |
| 433 | 493 | $departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']); |
| 434 | - if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 494 | + if (!isset($departure_airport_array[0]['name'])) { |
|
| 495 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 496 | + } |
|
| 435 | 497 | /* |
| 436 | 498 | } elseif ($row['departure_airport_name'] != '') { |
| 437 | 499 | $temp_array['departure_airport_name'] = $row['departure_airport_name']; |
@@ -439,7 +501,9 @@ discard block |
||
| 439 | 501 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 440 | 502 | $temp_array['departure_airport_icao'] = $row['departure_airport_icao']; |
| 441 | 503 | */ |
| 442 | - } else $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 504 | + } else { |
|
| 505 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 506 | + } |
|
| 443 | 507 | if (isset($departure_airport_array[0]['name'])) { |
| 444 | 508 | $temp_array['departure_airport_name'] = $departure_airport_array[0]['name']; |
| 445 | 509 | $temp_array['departure_airport_city'] = $departure_airport_array[0]['city']; |
@@ -459,8 +523,12 @@ discard block |
||
| 459 | 523 | |
| 460 | 524 | if ($row['arrival_airport_icao'] != '') { |
| 461 | 525 | $arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']); |
| 462 | - if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 463 | - } else $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 526 | + if (count($arrival_airport_array) == 0) { |
|
| 527 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 528 | + } |
|
| 529 | + } else { |
|
| 530 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 531 | + } |
|
| 464 | 532 | if (isset($arrival_airport_array[0]['name'])) { |
| 465 | 533 | $temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name']; |
| 466 | 534 | $temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city']; |
@@ -476,27 +544,45 @@ discard block |
||
| 476 | 544 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
| 477 | 545 | } |
| 478 | 546 | */ |
| 479 | - if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 480 | - if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 481 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
| 482 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
| 483 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
| 547 | + if (isset($row['pilot_id']) && $row['pilot_id'] != '') { |
|
| 548 | + $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 549 | + } |
|
| 550 | + if (isset($row['pilot_name']) && $row['pilot_name'] != '') { |
|
| 551 | + $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 552 | + } |
|
| 553 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
| 554 | + $temp_array['source_name'] = $row['source_name']; |
|
| 555 | + } |
|
| 556 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
| 557 | + $temp_array['over_country'] = $row['over_country']; |
|
| 558 | + } |
|
| 559 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
| 560 | + $temp_array['distance'] = $row['distance']; |
|
| 561 | + } |
|
| 484 | 562 | if (isset($row['squawk'])) { |
| 485 | 563 | $temp_array['squawk'] = $row['squawk']; |
| 486 | 564 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
| 487 | 565 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
| 488 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 566 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 567 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 568 | + } |
|
| 489 | 569 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
| 490 | 570 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
| 491 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 492 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 571 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 572 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 573 | + } |
|
| 574 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) { |
|
| 575 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 576 | + } |
|
| 493 | 577 | } |
| 494 | 578 | |
| 495 | 579 | $temp_array['query_number_rows'] = $num_rows; |
| 496 | 580 | |
| 497 | 581 | $spotter_array[] = $temp_array; |
| 498 | 582 | } |
| 499 | - if ($num_rows == 0) return array(); |
|
| 583 | + if ($num_rows == 0) { |
|
| 584 | + return array(); |
|
| 585 | + } |
|
| 500 | 586 | $spotter_array[0]['query_number_rows'] = $num_rows; |
| 501 | 587 | return $spotter_array; |
| 502 | 588 | } |
@@ -529,7 +615,9 @@ discard block |
||
| 529 | 615 | foreach ($q_array as $q_item){ |
| 530 | 616 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
| 531 | 617 | $additional_query .= " AND ("; |
| 532 | - if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 618 | + if (is_int($q_item)) { |
|
| 619 | + $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 620 | + } |
|
| 533 | 621 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
| 534 | 622 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
| 535 | 623 | $additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
@@ -550,7 +638,9 @@ discard block |
||
| 550 | 638 | $additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR "; |
| 551 | 639 | $additional_query .= "(spotter_output.ident like '%".$q_item."%') OR "; |
| 552 | 640 | $translate = $Translation->ident2icao($q_item); |
| 553 | - if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 641 | + if ($translate != $q_item) { |
|
| 642 | + $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 643 | + } |
|
| 554 | 644 | $additional_query .= "(spotter_output.highlight like '%".$q_item."%')"; |
| 555 | 645 | $additional_query .= ")"; |
| 556 | 646 | } |
@@ -777,7 +867,9 @@ discard block |
||
| 777 | 867 | date_default_timezone_set($globalTimezone); |
| 778 | 868 | $datetime = new DateTime(); |
| 779 | 869 | $offset = $datetime->format('P'); |
| 780 | - } else $offset = '+00:00'; |
|
| 870 | + } else { |
|
| 871 | + $offset = '+00:00'; |
|
| 872 | + } |
|
| 781 | 873 | |
| 782 | 874 | if ($date_array[1] != "") |
| 783 | 875 | { |
@@ -809,8 +901,12 @@ discard block |
||
| 809 | 901 | { |
| 810 | 902 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 811 | 903 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 812 | - } else $limit_query = ""; |
|
| 813 | - } else $limit_query = ""; |
|
| 904 | + } else { |
|
| 905 | + $limit_query = ""; |
|
| 906 | + } |
|
| 907 | + } else { |
|
| 908 | + $limit_query = ""; |
|
| 909 | + } |
|
| 814 | 910 | |
| 815 | 911 | |
| 816 | 912 | if ($sort != "") |
@@ -878,8 +974,12 @@ discard block |
||
| 878 | 974 | { |
| 879 | 975 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 880 | 976 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 881 | - } else $limit_query = ""; |
|
| 882 | - } else $limit_query = ""; |
|
| 977 | + } else { |
|
| 978 | + $limit_query = ""; |
|
| 979 | + } |
|
| 980 | + } else { |
|
| 981 | + $limit_query = ""; |
|
| 982 | + } |
|
| 883 | 983 | |
| 884 | 984 | if ($sort != "") |
| 885 | 985 | { |
@@ -1203,7 +1303,9 @@ discard block |
||
| 1203 | 1303 | global $global_query; |
| 1204 | 1304 | |
| 1205 | 1305 | date_default_timezone_set('UTC'); |
| 1206 | - if ($id == '') return array(); |
|
| 1306 | + if ($id == '') { |
|
| 1307 | + return array(); |
|
| 1308 | + } |
|
| 1207 | 1309 | $additional_query = "spotter_output.spotter_id = :id"; |
| 1208 | 1310 | $query_values = array(':id' => $id); |
| 1209 | 1311 | |
@@ -1940,7 +2042,9 @@ discard block |
||
| 1940 | 2042 | { |
| 1941 | 2043 | $highlight = $row['highlight']; |
| 1942 | 2044 | } |
| 1943 | - if (isset($highlight)) return $highlight; |
|
| 2045 | + if (isset($highlight)) { |
|
| 2046 | + return $highlight; |
|
| 2047 | + } |
|
| 1944 | 2048 | } |
| 1945 | 2049 | |
| 1946 | 2050 | |
@@ -1968,7 +2072,9 @@ discard block |
||
| 1968 | 2072 | $sth->closeCursor(); |
| 1969 | 2073 | if (count($row) > 0) { |
| 1970 | 2074 | return $row['usage']; |
| 1971 | - } else return ''; |
|
| 2075 | + } else { |
|
| 2076 | + return ''; |
|
| 2077 | + } |
|
| 1972 | 2078 | } |
| 1973 | 2079 | |
| 1974 | 2080 | /** |
@@ -1993,7 +2099,9 @@ discard block |
||
| 1993 | 2099 | $sth->closeCursor(); |
| 1994 | 2100 | if (count($row) > 0) { |
| 1995 | 2101 | return $row['icao']; |
| 1996 | - } else return ''; |
|
| 2102 | + } else { |
|
| 2103 | + return ''; |
|
| 2104 | + } |
|
| 1997 | 2105 | } |
| 1998 | 2106 | |
| 1999 | 2107 | /** |
@@ -2021,7 +2129,9 @@ discard block |
||
| 2021 | 2129 | $airport_longitude = $row['longitude']; |
| 2022 | 2130 | $Common = new Common(); |
| 2023 | 2131 | return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
| 2024 | - } else return ''; |
|
| 2132 | + } else { |
|
| 2133 | + return ''; |
|
| 2134 | + } |
|
| 2025 | 2135 | } |
| 2026 | 2136 | |
| 2027 | 2137 | /** |
@@ -2133,7 +2243,9 @@ discard block |
||
| 2133 | 2243 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2134 | 2244 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2135 | 2245 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2136 | - } else return array(); |
|
| 2246 | + } else { |
|
| 2247 | + return array(); |
|
| 2248 | + } |
|
| 2137 | 2249 | if ($globalDBdriver == 'mysql') { |
| 2138 | 2250 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
| 2139 | 2251 | } else { |
@@ -2168,7 +2280,9 @@ discard block |
||
| 2168 | 2280 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2169 | 2281 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2170 | 2282 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2171 | - } else return array(); |
|
| 2283 | + } else { |
|
| 2284 | + return array(); |
|
| 2285 | + } |
|
| 2172 | 2286 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
| 2173 | 2287 | $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
| 2174 | 2288 | //$query = "SELECT waypoints.* FROM waypoints"; |
@@ -2203,7 +2317,9 @@ discard block |
||
| 2203 | 2317 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
| 2204 | 2318 | { |
| 2205 | 2319 | global $globalUseRealAirlines; |
| 2206 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2320 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2321 | + $fromsource = NULL; |
|
| 2322 | + } |
|
| 2207 | 2323 | $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
| 2208 | 2324 | if ($airline_icao == 'NA') { |
| 2209 | 2325 | $airline_array = array(); |
@@ -2272,7 +2388,9 @@ discard block |
||
| 2272 | 2388 | public function getAllAirlineInfoByName($airline_name, $fromsource = NULL) |
| 2273 | 2389 | { |
| 2274 | 2390 | global $globalUseRealAirlines; |
| 2275 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2391 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2392 | + $fromsource = NULL; |
|
| 2393 | + } |
|
| 2276 | 2394 | $airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING)); |
| 2277 | 2395 | $query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1"; |
| 2278 | 2396 | $sth = $this->db->prepare($query); |
@@ -2288,7 +2406,9 @@ discard block |
||
| 2288 | 2406 | $sth->execute(array(':fromsource' => $fromsource)); |
| 2289 | 2407 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2290 | 2408 | $sth->closeCursor(); |
| 2291 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name); |
|
| 2409 | + if ($row['nb'] == 0) { |
|
| 2410 | + $result = $this->getAllAirlineInfoByName($airline_name); |
|
| 2411 | + } |
|
| 2292 | 2412 | } |
| 2293 | 2413 | return $result; |
| 2294 | 2414 | } |
@@ -2351,15 +2471,20 @@ discard block |
||
| 2351 | 2471 | 'A320-211' => 'A320', |
| 2352 | 2472 | '747-8i' => 'B748', |
| 2353 | 2473 | 'A380' => 'A388'); |
| 2354 | - if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
|
| 2474 | + if (isset($all_aircraft[$aircraft_type])) { |
|
| 2475 | + return $all_aircraft[$aircraft_type]; |
|
| 2476 | + } |
|
| 2355 | 2477 | |
| 2356 | 2478 | $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
| 2357 | 2479 | $aircraft_type = strtoupper($aircraft_type); |
| 2358 | 2480 | $sth = $this->db->prepare($query); |
| 2359 | 2481 | $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
| 2360 | 2482 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2361 | - if (isset($result[0]['icao'])) return $result[0]['icao']; |
|
| 2362 | - else return ''; |
|
| 2483 | + if (isset($result[0]['icao'])) { |
|
| 2484 | + return $result[0]['icao']; |
|
| 2485 | + } else { |
|
| 2486 | + return ''; |
|
| 2487 | + } |
|
| 2363 | 2488 | } |
| 2364 | 2489 | |
| 2365 | 2490 | /** |
@@ -2382,9 +2507,13 @@ discard block |
||
| 2382 | 2507 | $sth->closeCursor(); |
| 2383 | 2508 | if (isset($row['icaotypecode'])) { |
| 2384 | 2509 | $icao = $row['icaotypecode']; |
| 2385 | - if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao]; |
|
| 2510 | + if (isset($this->aircraft_correct_icaotype[$icao])) { |
|
| 2511 | + $icao = $this->aircraft_correct_icaotype[$icao]; |
|
| 2512 | + } |
|
| 2386 | 2513 | return $icao; |
| 2387 | - } else return ''; |
|
| 2514 | + } else { |
|
| 2515 | + return ''; |
|
| 2516 | + } |
|
| 2388 | 2517 | } |
| 2389 | 2518 | |
| 2390 | 2519 | /** |
@@ -2407,7 +2536,9 @@ discard block |
||
| 2407 | 2536 | $sth->closeCursor(); |
| 2408 | 2537 | if (isset($row['icaotypecode'])) { |
| 2409 | 2538 | return $row['icaotypecode']; |
| 2410 | - } else return ''; |
|
| 2539 | + } else { |
|
| 2540 | + return ''; |
|
| 2541 | + } |
|
| 2411 | 2542 | } |
| 2412 | 2543 | |
| 2413 | 2544 | /** |
@@ -2453,7 +2584,9 @@ discard block |
||
| 2453 | 2584 | $sth->closeCursor(); |
| 2454 | 2585 | if (isset($row['operator_correct'])) { |
| 2455 | 2586 | return $row['operator_correct']; |
| 2456 | - } else return $operator; |
|
| 2587 | + } else { |
|
| 2588 | + return $operator; |
|
| 2589 | + } |
|
| 2457 | 2590 | } |
| 2458 | 2591 | |
| 2459 | 2592 | /** |
@@ -2466,7 +2599,9 @@ discard block |
||
| 2466 | 2599 | public function getRouteInfo($callsign) |
| 2467 | 2600 | { |
| 2468 | 2601 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
| 2469 | - if ($callsign == '') return array(); |
|
| 2602 | + if ($callsign == '') { |
|
| 2603 | + return array(); |
|
| 2604 | + } |
|
| 2470 | 2605 | $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
| 2471 | 2606 | |
| 2472 | 2607 | $sth = $this->db->prepare($query); |
@@ -2476,7 +2611,9 @@ discard block |
||
| 2476 | 2611 | $sth->closeCursor(); |
| 2477 | 2612 | if (count($row) > 0) { |
| 2478 | 2613 | return $row; |
| 2479 | - } else return array(); |
|
| 2614 | + } else { |
|
| 2615 | + return array(); |
|
| 2616 | + } |
|
| 2480 | 2617 | } |
| 2481 | 2618 | |
| 2482 | 2619 | /** |
@@ -2529,7 +2666,9 @@ discard block |
||
| 2529 | 2666 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 2530 | 2667 | $sth->closeCursor(); |
| 2531 | 2668 | return $result; |
| 2532 | - } else return array(); |
|
| 2669 | + } else { |
|
| 2670 | + return array(); |
|
| 2671 | + } |
|
| 2533 | 2672 | } |
| 2534 | 2673 | |
| 2535 | 2674 | |
@@ -2688,8 +2827,11 @@ discard block |
||
| 2688 | 2827 | $query .= " ORDER BY spotter_output.source_name ASC"; |
| 2689 | 2828 | |
| 2690 | 2829 | $sth = $this->db->prepare($query); |
| 2691 | - if (!empty($query_values)) $sth->execute($query_values); |
|
| 2692 | - else $sth->execute(); |
|
| 2830 | + if (!empty($query_values)) { |
|
| 2831 | + $sth->execute($query_values); |
|
| 2832 | + } else { |
|
| 2833 | + $sth->execute(); |
|
| 2834 | + } |
|
| 2693 | 2835 | |
| 2694 | 2836 | $source_array = array(); |
| 2695 | 2837 | $temp_array = array(); |
@@ -2722,9 +2864,13 @@ discard block |
||
| 2722 | 2864 | WHERE spotter_output.airline_icao <> '' |
| 2723 | 2865 | ORDER BY spotter_output.airline_name ASC"; |
| 2724 | 2866 | */ |
| 2725 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2726 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2727 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2867 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2868 | + $forsource = $globalAirlinesSource; |
|
| 2869 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2870 | + $forsource = 'vatsim'; |
|
| 2871 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2872 | + $forsource = 'ivao'; |
|
| 2873 | + } |
|
| 2728 | 2874 | if ($forsource === NULL) { |
| 2729 | 2875 | $query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC"; |
| 2730 | 2876 | $query_data = array(); |
@@ -2767,9 +2913,13 @@ discard block |
||
| 2767 | 2913 | { |
| 2768 | 2914 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
| 2769 | 2915 | $filter_query = $this->getFilter($filters,true,true); |
| 2770 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2771 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2772 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2916 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2917 | + $forsource = $globalAirlinesSource; |
|
| 2918 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2919 | + $forsource = 'vatsim'; |
|
| 2920 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2921 | + $forsource = 'ivao'; |
|
| 2922 | + } |
|
| 2773 | 2923 | if ($forsource === NULL) { |
| 2774 | 2924 | $query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC"; |
| 2775 | 2925 | $query_data = array(); |
@@ -3080,7 +3230,9 @@ discard block |
||
| 3080 | 3230 | date_default_timezone_set($globalTimezone); |
| 3081 | 3231 | $datetime = new DateTime(); |
| 3082 | 3232 | $offset = $datetime->format('P'); |
| 3083 | - } else $offset = '+00:00'; |
|
| 3233 | + } else { |
|
| 3234 | + $offset = '+00:00'; |
|
| 3235 | + } |
|
| 3084 | 3236 | if ($airport_icao == '') { |
| 3085 | 3237 | if ($globalDBdriver == 'mysql') { |
| 3086 | 3238 | $query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -3112,7 +3264,9 @@ discard block |
||
| 3112 | 3264 | date_default_timezone_set($globalTimezone); |
| 3113 | 3265 | $datetime = new DateTime(); |
| 3114 | 3266 | $offset = $datetime->format('P'); |
| 3115 | - } else $offset = '+00:00'; |
|
| 3267 | + } else { |
|
| 3268 | + $offset = '+00:00'; |
|
| 3269 | + } |
|
| 3116 | 3270 | if ($airport_icao == '') { |
| 3117 | 3271 | if ($globalDBdriver == 'mysql') { |
| 3118 | 3272 | $query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -3145,7 +3299,9 @@ discard block |
||
| 3145 | 3299 | date_default_timezone_set($globalTimezone); |
| 3146 | 3300 | $datetime = new DateTime(); |
| 3147 | 3301 | $offset = $datetime->format('P'); |
| 3148 | - } else $offset = '+00:00'; |
|
| 3302 | + } else { |
|
| 3303 | + $offset = '+00:00'; |
|
| 3304 | + } |
|
| 3149 | 3305 | if ($airport_icao == '') { |
| 3150 | 3306 | if ($globalDBdriver == 'mysql') { |
| 3151 | 3307 | $query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3184,7 +3340,9 @@ discard block |
||
| 3184 | 3340 | date_default_timezone_set($globalTimezone); |
| 3185 | 3341 | $datetime = new DateTime(); |
| 3186 | 3342 | $offset = $datetime->format('P'); |
| 3187 | - } else $offset = '+00:00'; |
|
| 3343 | + } else { |
|
| 3344 | + $offset = '+00:00'; |
|
| 3345 | + } |
|
| 3188 | 3346 | if ($airport_icao == '') { |
| 3189 | 3347 | if ($globalDBdriver == 'mysql') { |
| 3190 | 3348 | $query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3229,7 +3387,9 @@ discard block |
||
| 3229 | 3387 | date_default_timezone_set($globalTimezone); |
| 3230 | 3388 | $datetime = new DateTime(); |
| 3231 | 3389 | $offset = $datetime->format('P'); |
| 3232 | - } else $offset = '+00:00'; |
|
| 3390 | + } else { |
|
| 3391 | + $offset = '+00:00'; |
|
| 3392 | + } |
|
| 3233 | 3393 | if ($airport_icao == '') { |
| 3234 | 3394 | if ($globalDBdriver == 'mysql') { |
| 3235 | 3395 | $query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -3264,7 +3424,9 @@ discard block |
||
| 3264 | 3424 | date_default_timezone_set($globalTimezone); |
| 3265 | 3425 | $datetime = new DateTime(); |
| 3266 | 3426 | $offset = $datetime->format('P'); |
| 3267 | - } else $offset = '+00:00'; |
|
| 3427 | + } else { |
|
| 3428 | + $offset = '+00:00'; |
|
| 3429 | + } |
|
| 3268 | 3430 | if ($airport_icao == '') { |
| 3269 | 3431 | if ($globalDBdriver == 'mysql') { |
| 3270 | 3432 | $query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3306,7 +3468,9 @@ discard block |
||
| 3306 | 3468 | date_default_timezone_set($globalTimezone); |
| 3307 | 3469 | $datetime = new DateTime(); |
| 3308 | 3470 | $offset = $datetime->format('P'); |
| 3309 | - } else $offset = '+00:00'; |
|
| 3471 | + } else { |
|
| 3472 | + $offset = '+00:00'; |
|
| 3473 | + } |
|
| 3310 | 3474 | if ($airport_icao == '') { |
| 3311 | 3475 | if ($globalDBdriver == 'mysql') { |
| 3312 | 3476 | $query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -3340,7 +3504,9 @@ discard block |
||
| 3340 | 3504 | date_default_timezone_set($globalTimezone); |
| 3341 | 3505 | $datetime = new DateTime(); |
| 3342 | 3506 | $offset = $datetime->format('P'); |
| 3343 | - } else $offset = '+00:00'; |
|
| 3507 | + } else { |
|
| 3508 | + $offset = '+00:00'; |
|
| 3509 | + } |
|
| 3344 | 3510 | if ($airport_icao == '') { |
| 3345 | 3511 | if ($globalDBdriver == 'mysql') { |
| 3346 | 3512 | $query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3388,7 +3554,9 @@ discard block |
||
| 3388 | 3554 | date_default_timezone_set($globalTimezone); |
| 3389 | 3555 | $datetime = new DateTime(); |
| 3390 | 3556 | $offset = $datetime->format('P'); |
| 3391 | - } else $offset = '+00:00'; |
|
| 3557 | + } else { |
|
| 3558 | + $offset = '+00:00'; |
|
| 3559 | + } |
|
| 3392 | 3560 | |
| 3393 | 3561 | if ($globalDBdriver == 'mysql') { |
| 3394 | 3562 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
@@ -3508,7 +3676,9 @@ discard block |
||
| 3508 | 3676 | */ |
| 3509 | 3677 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
| 3510 | 3678 | { |
| 3511 | - if ($groundspeed == '') $groundspeed = NULL; |
|
| 3679 | + if ($groundspeed == '') { |
|
| 3680 | + $groundspeed = NULL; |
|
| 3681 | + } |
|
| 3512 | 3682 | $query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id'; |
| 3513 | 3683 | $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
| 3514 | 3684 | |
@@ -3558,10 +3728,18 @@ discard block |
||
| 3558 | 3728 | $Image = new Image($this->db); |
| 3559 | 3729 | $Common = new Common(); |
| 3560 | 3730 | |
| 3561 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 3562 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 3563 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 3564 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 3731 | + if (!isset($globalIVAO)) { |
|
| 3732 | + $globalIVAO = FALSE; |
|
| 3733 | + } |
|
| 3734 | + if (!isset($globalVATSIM)) { |
|
| 3735 | + $globalVATSIM = FALSE; |
|
| 3736 | + } |
|
| 3737 | + if (!isset($globalphpVMS)) { |
|
| 3738 | + $globalphpVMS = FALSE; |
|
| 3739 | + } |
|
| 3740 | + if (!isset($globalVAM)) { |
|
| 3741 | + $globalVAM = FALSE; |
|
| 3742 | + } |
|
| 3565 | 3743 | date_default_timezone_set('UTC'); |
| 3566 | 3744 | |
| 3567 | 3745 | //getting the registration |
@@ -3574,23 +3752,33 @@ discard block |
||
| 3574 | 3752 | if ($ModeS != '') { |
| 3575 | 3753 | $timeelapsed = microtime(true); |
| 3576 | 3754 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
| 3577 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3755 | + if ($globalDebugTimeElapsed) { |
|
| 3756 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3757 | + } |
|
| 3578 | 3758 | } else { |
| 3579 | 3759 | $myhex = explode('-',$flightaware_id); |
| 3580 | 3760 | if (count($myhex) > 0) { |
| 3581 | 3761 | $timeelapsed = microtime(true); |
| 3582 | 3762 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
| 3583 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3763 | + if ($globalDebugTimeElapsed) { |
|
| 3764 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3765 | + } |
|
| 3584 | 3766 | } |
| 3585 | 3767 | } |
| 3586 | 3768 | } |
| 3587 | 3769 | } |
| 3588 | 3770 | $fromsource = NULL; |
| 3589 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 3590 | - elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 3591 | - elseif ($format_source == 'whazzup') $fromsource = 'ivao'; |
|
| 3592 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 3593 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 3771 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 3772 | + $fromsource = $globalAirlinesSource; |
|
| 3773 | + } elseif ($format_source == 'vatsimtxt') { |
|
| 3774 | + $fromsource = 'vatsim'; |
|
| 3775 | + } elseif ($format_source == 'whazzup') { |
|
| 3776 | + $fromsource = 'ivao'; |
|
| 3777 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 3778 | + $fromsource = 'vatsim'; |
|
| 3779 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 3780 | + $fromsource = 'ivao'; |
|
| 3781 | + } |
|
| 3594 | 3782 | //getting the airline information |
| 3595 | 3783 | if ($ident != "") |
| 3596 | 3784 | { |
@@ -3614,15 +3802,21 @@ discard block |
||
| 3614 | 3802 | if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
| 3615 | 3803 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3616 | 3804 | } |
| 3617 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3805 | + if ($globalDebugTimeElapsed) { |
|
| 3806 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3807 | + } |
|
| 3618 | 3808 | |
| 3619 | 3809 | } else { |
| 3620 | 3810 | $timeelapsed = microtime(true); |
| 3621 | 3811 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3622 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3812 | + if ($globalDebugTimeElapsed) { |
|
| 3813 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3814 | + } |
|
| 3623 | 3815 | } |
| 3624 | 3816 | } |
| 3625 | - } else $airline_array = array(); |
|
| 3817 | + } else { |
|
| 3818 | + $airline_array = array(); |
|
| 3819 | + } |
|
| 3626 | 3820 | |
| 3627 | 3821 | //getting the aircraft information |
| 3628 | 3822 | $aircraft_array = array(); |
@@ -3636,27 +3830,37 @@ discard block |
||
| 3636 | 3830 | { |
| 3637 | 3831 | $timeelapsed = microtime(true); |
| 3638 | 3832 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3639 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3833 | + if ($globalDebugTimeElapsed) { |
|
| 3834 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3835 | + } |
|
| 3640 | 3836 | } else { |
| 3641 | 3837 | $timeelapsed = microtime(true); |
| 3642 | 3838 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3643 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3839 | + if ($globalDebugTimeElapsed) { |
|
| 3840 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3841 | + } |
|
| 3644 | 3842 | } |
| 3645 | 3843 | } |
| 3646 | 3844 | } else { |
| 3647 | 3845 | if ($ModeS != '') { |
| 3648 | 3846 | $timeelapsed = microtime(true); |
| 3649 | 3847 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
| 3650 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3848 | + if ($globalDebugTimeElapsed) { |
|
| 3849 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3850 | + } |
|
| 3651 | 3851 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
| 3652 | 3852 | { |
| 3653 | 3853 | $timeelapsed = microtime(true); |
| 3654 | 3854 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3655 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3855 | + if ($globalDebugTimeElapsed) { |
|
| 3856 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3857 | + } |
|
| 3656 | 3858 | } else { |
| 3657 | 3859 | $timeelapsed = microtime(true); |
| 3658 | 3860 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3659 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3861 | + if ($globalDebugTimeElapsed) { |
|
| 3862 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3863 | + } |
|
| 3660 | 3864 | } |
| 3661 | 3865 | } |
| 3662 | 3866 | } |
@@ -3672,7 +3876,9 @@ discard block |
||
| 3672 | 3876 | } else { |
| 3673 | 3877 | $timeelapsed = microtime(true); |
| 3674 | 3878 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
| 3675 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3879 | + if ($globalDebugTimeElapsed) { |
|
| 3880 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3881 | + } |
|
| 3676 | 3882 | } |
| 3677 | 3883 | } |
| 3678 | 3884 | |
@@ -3687,7 +3893,9 @@ discard block |
||
| 3687 | 3893 | } else { |
| 3688 | 3894 | $timeelapsed = microtime(true); |
| 3689 | 3895 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
| 3690 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3896 | + if ($globalDebugTimeElapsed) { |
|
| 3897 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3898 | + } |
|
| 3691 | 3899 | } |
| 3692 | 3900 | } |
| 3693 | 3901 | |
@@ -3721,7 +3929,9 @@ discard block |
||
| 3721 | 3929 | { |
| 3722 | 3930 | return false; |
| 3723 | 3931 | } |
| 3724 | - } else $altitude = 0; |
|
| 3932 | + } else { |
|
| 3933 | + $altitude = 0; |
|
| 3934 | + } |
|
| 3725 | 3935 | |
| 3726 | 3936 | if ($heading != "") |
| 3727 | 3937 | { |
@@ -3750,7 +3960,9 @@ discard block |
||
| 3750 | 3960 | { |
| 3751 | 3961 | $timeelapsed = microtime(true); |
| 3752 | 3962 | $image_array = $Image->getSpotterImage($registration); |
| 3753 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3963 | + if ($globalDebugTimeElapsed) { |
|
| 3964 | + echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3965 | + } |
|
| 3754 | 3966 | if (!isset($image_array[0]['registration'])) |
| 3755 | 3967 | { |
| 3756 | 3968 | //echo "Add image !!!! \n"; |
@@ -3758,14 +3970,21 @@ discard block |
||
| 3758 | 3970 | } |
| 3759 | 3971 | $timeelapsed = microtime(true); |
| 3760 | 3972 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
| 3761 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3762 | - if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 3973 | + if ($globalDebugTimeElapsed) { |
|
| 3974 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3975 | + } |
|
| 3976 | + if ($owner_info['owner'] != '') { |
|
| 3977 | + $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 3978 | + } |
|
| 3763 | 3979 | } |
| 3764 | 3980 | |
| 3765 | 3981 | if ($globalIVAO && $aircraft_icao != '') |
| 3766 | 3982 | { |
| 3767 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3768 | - else $airline_icao = ''; |
|
| 3983 | + if (isset($airline_array[0]['icao'])) { |
|
| 3984 | + $airline_icao = $airline_array[0]['icao']; |
|
| 3985 | + } else { |
|
| 3986 | + $airline_icao = ''; |
|
| 3987 | + } |
|
| 3769 | 3988 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
| 3770 | 3989 | if (!isset($image_array[0]['registration'])) |
| 3771 | 3990 | { |
@@ -3810,16 +4029,28 @@ discard block |
||
| 3810 | 4029 | { |
| 3811 | 4030 | $arrival_airport_array = $this->getAllAirportInfo('NA'); |
| 3812 | 4031 | } |
| 3813 | - if ($registration == '') $registration = 'NA'; |
|
| 4032 | + if ($registration == '') { |
|
| 4033 | + $registration = 'NA'; |
|
| 4034 | + } |
|
| 3814 | 4035 | if ($latitude == '' && $longitude == '') { |
| 3815 | 4036 | $latitude = 0; |
| 3816 | 4037 | $longitude = 0; |
| 3817 | 4038 | } |
| 3818 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3819 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3820 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3821 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3822 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 4039 | + if ($squawk == '' || $Common->isInteger($squawk) === false) { |
|
| 4040 | + $squawk = NULL; |
|
| 4041 | + } |
|
| 4042 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) { |
|
| 4043 | + $verticalrate = NULL; |
|
| 4044 | + } |
|
| 4045 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
| 4046 | + $heading = 0; |
|
| 4047 | + } |
|
| 4048 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
| 4049 | + $groundspeed = 0; |
|
| 4050 | + } |
|
| 4051 | + if (!isset($aircraft_owner)) { |
|
| 4052 | + $aircraft_owner = NULL; |
|
| 4053 | + } |
|
| 3823 | 4054 | $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, 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,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
| 3824 | 4055 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,: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, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)"; |
| 3825 | 4056 | |
@@ -3830,9 +4061,13 @@ discard block |
||
| 3830 | 4061 | if ($airline_type == '') { |
| 3831 | 4062 | $timeelapsed = microtime(true); |
| 3832 | 4063 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3833 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4064 | + if ($globalDebugTimeElapsed) { |
|
| 4065 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4066 | + } |
|
| 4067 | + } |
|
| 4068 | + if ($airline_type == null) { |
|
| 4069 | + $airline_type = ''; |
|
| 3834 | 4070 | } |
| 3835 | - if ($airline_type == null) $airline_type = ''; |
|
| 3836 | 4071 | $aircraft_type = $aircraft_array[0]['type']; |
| 3837 | 4072 | $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
| 3838 | 4073 | $departure_airport_name = $departure_airport_array[0]['name']; |
@@ -3996,7 +4231,9 @@ discard block |
||
| 3996 | 4231 | } |
| 3997 | 4232 | } |
| 3998 | 4233 | $query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC"; |
| 3999 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4234 | + if ($limit) { |
|
| 4235 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4236 | + } |
|
| 4000 | 4237 | |
| 4001 | 4238 | $sth = $this->db->prepare($query); |
| 4002 | 4239 | $sth->execute($query_values); |
@@ -4069,7 +4306,9 @@ discard block |
||
| 4069 | 4306 | } |
| 4070 | 4307 | |
| 4071 | 4308 | $query .= " GROUP BY spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 4072 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4309 | + if ($limit) { |
|
| 4310 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4311 | + } |
|
| 4073 | 4312 | |
| 4074 | 4313 | |
| 4075 | 4314 | $sth = $this->db->prepare($query); |
@@ -4113,7 +4352,9 @@ discard block |
||
| 4113 | 4352 | } |
| 4114 | 4353 | } |
| 4115 | 4354 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 4116 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4355 | + if ($limit) { |
|
| 4356 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4357 | + } |
|
| 4117 | 4358 | |
| 4118 | 4359 | |
| 4119 | 4360 | $sth = $this->db->prepare($query); |
@@ -4189,7 +4430,9 @@ discard block |
||
| 4189 | 4430 | } |
| 4190 | 4431 | } |
| 4191 | 4432 | $query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC"; |
| 4192 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4433 | + if ($limit) { |
|
| 4434 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4435 | + } |
|
| 4193 | 4436 | |
| 4194 | 4437 | $sth = $this->db->prepare($query); |
| 4195 | 4438 | $sth->execute($query_values); |
@@ -4231,7 +4474,9 @@ discard block |
||
| 4231 | 4474 | } |
| 4232 | 4475 | } |
| 4233 | 4476 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC"; |
| 4234 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4477 | + if ($limit) { |
|
| 4478 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4479 | + } |
|
| 4235 | 4480 | |
| 4236 | 4481 | |
| 4237 | 4482 | $sth = $this->db->prepare($query); |
@@ -4474,7 +4719,9 @@ discard block |
||
| 4474 | 4719 | date_default_timezone_set($globalTimezone); |
| 4475 | 4720 | $datetime = new DateTime($date); |
| 4476 | 4721 | $offset = $datetime->format('P'); |
| 4477 | - } else $offset = '+00:00'; |
|
| 4722 | + } else { |
|
| 4723 | + $offset = '+00:00'; |
|
| 4724 | + } |
|
| 4478 | 4725 | |
| 4479 | 4726 | if ($globalDBdriver == 'mysql') { |
| 4480 | 4727 | $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
@@ -4522,7 +4769,9 @@ discard block |
||
| 4522 | 4769 | date_default_timezone_set($globalTimezone); |
| 4523 | 4770 | $datetime = new DateTime($date); |
| 4524 | 4771 | $offset = $datetime->format('P'); |
| 4525 | - } else $offset = '+00:00'; |
|
| 4772 | + } else { |
|
| 4773 | + $offset = '+00:00'; |
|
| 4774 | + } |
|
| 4526 | 4775 | |
| 4527 | 4776 | if ($globalDBdriver == 'mysql') { |
| 4528 | 4777 | $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
@@ -4611,8 +4860,11 @@ discard block |
||
| 4611 | 4860 | $sth = $this->db->prepare($query); |
| 4612 | 4861 | $sth->execute(array(':owner' => $owner)); |
| 4613 | 4862 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 4614 | - if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
| 4615 | - else return $result[0]['duration']; |
|
| 4863 | + if (is_int($result[0]['duration'])) { |
|
| 4864 | + return gmdate('H:i:s',$result[0]['duration']); |
|
| 4865 | + } else { |
|
| 4866 | + return $result[0]['duration']; |
|
| 4867 | + } |
|
| 4616 | 4868 | } |
| 4617 | 4869 | |
| 4618 | 4870 | /** |
@@ -4630,8 +4882,11 @@ discard block |
||
| 4630 | 4882 | $sth = $this->db->prepare($query); |
| 4631 | 4883 | $sth->execute(array(':pilot' => $pilot)); |
| 4632 | 4884 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 4633 | - if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
| 4634 | - else return $result[0]['duration']; |
|
| 4885 | + if (is_int($result[0]['duration'])) { |
|
| 4886 | + return gmdate('H:i:s',$result[0]['duration']); |
|
| 4887 | + } else { |
|
| 4888 | + return $result[0]['duration']; |
|
| 4889 | + } |
|
| 4635 | 4890 | } |
| 4636 | 4891 | |
| 4637 | 4892 | /** |
@@ -4836,7 +5091,9 @@ discard block |
||
| 4836 | 5091 | } |
| 4837 | 5092 | $query .= " GROUP BY spotter_output.airline_country |
| 4838 | 5093 | ORDER BY airline_country_count DESC"; |
| 4839 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5094 | + if ($limit) { |
|
| 5095 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5096 | + } |
|
| 4840 | 5097 | |
| 4841 | 5098 | $sth = $this->db->prepare($query); |
| 4842 | 5099 | $sth->execute($query_values); |
@@ -4864,7 +5121,9 @@ discard block |
||
| 4864 | 5121 | global $globalDBdriver; |
| 4865 | 5122 | //$filter_query = $this->getFilter($filters,true,true); |
| 4866 | 5123 | $Connection= new Connection($this->db); |
| 4867 | - if (!$Connection->tableExists('countries')) return array(); |
|
| 5124 | + if (!$Connection->tableExists('countries')) { |
|
| 5125 | + return array(); |
|
| 5126 | + } |
|
| 4868 | 5127 | /* |
| 4869 | 5128 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
| 4870 | 5129 | FROM countries c, spotter_output s |
@@ -4896,7 +5155,9 @@ discard block |
||
| 4896 | 5155 | } |
| 4897 | 5156 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT flightaware_id,over_country FROM spotter_live".$filter_query.") l ON c.iso2 = l.over_country "; |
| 4898 | 5157 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
| 4899 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5158 | + if ($limit) { |
|
| 5159 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5160 | + } |
|
| 4900 | 5161 | |
| 4901 | 5162 | |
| 4902 | 5163 | $sth = $this->db->prepare($query); |
@@ -4973,7 +5234,9 @@ discard block |
||
| 4973 | 5234 | } |
| 4974 | 5235 | |
| 4975 | 5236 | $query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 4976 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5237 | + if ($limit) { |
|
| 5238 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5239 | + } |
|
| 4977 | 5240 | |
| 4978 | 5241 | $sth = $this->db->prepare($query); |
| 4979 | 5242 | $sth->execute($query_values); |
@@ -5047,7 +5310,9 @@ discard block |
||
| 5047 | 5310 | } |
| 5048 | 5311 | |
| 5049 | 5312 | $query .= " GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 5050 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5313 | + if ($limit) { |
|
| 5314 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5315 | + } |
|
| 5051 | 5316 | |
| 5052 | 5317 | $sth = $this->db->prepare($query); |
| 5053 | 5318 | $sth->execute($query_values); |
@@ -5094,7 +5359,9 @@ discard block |
||
| 5094 | 5359 | } |
| 5095 | 5360 | |
| 5096 | 5361 | $query .= "GROUP BY EXTRACT(month from spotter_output.date), EXTRACT(year from spotter_output.date), spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 5097 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5362 | + if ($limit) { |
|
| 5363 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5364 | + } |
|
| 5098 | 5365 | |
| 5099 | 5366 | $sth = $this->db->prepare($query); |
| 5100 | 5367 | $sth->execute(); |
@@ -5147,7 +5414,9 @@ discard block |
||
| 5147 | 5414 | if($row['registration'] != "") |
| 5148 | 5415 | { |
| 5149 | 5416 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5150 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5417 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5418 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5419 | + } |
|
| 5151 | 5420 | } |
| 5152 | 5421 | $temp_array['registration_count'] = $row['registration_count']; |
| 5153 | 5422 | |
@@ -5222,7 +5491,9 @@ discard block |
||
| 5222 | 5491 | if($row['registration'] != "") |
| 5223 | 5492 | { |
| 5224 | 5493 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5225 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5494 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5495 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5496 | + } |
|
| 5226 | 5497 | } |
| 5227 | 5498 | $temp_array['registration_count'] = $row['registration_count']; |
| 5228 | 5499 | |
@@ -5329,7 +5600,9 @@ discard block |
||
| 5329 | 5600 | if($row['registration'] != "") |
| 5330 | 5601 | { |
| 5331 | 5602 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5332 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5603 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5604 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5605 | + } |
|
| 5333 | 5606 | } |
| 5334 | 5607 | $temp_array['registration_count'] = $row['registration_count']; |
| 5335 | 5608 | $aircraft_array[] = $temp_array; |
@@ -5454,7 +5727,9 @@ discard block |
||
| 5454 | 5727 | date_default_timezone_set($globalTimezone); |
| 5455 | 5728 | $datetime = new DateTime($date); |
| 5456 | 5729 | $offset = $datetime->format('P'); |
| 5457 | - } else $offset = '+00:00'; |
|
| 5730 | + } else { |
|
| 5731 | + $offset = '+00:00'; |
|
| 5732 | + } |
|
| 5458 | 5733 | |
| 5459 | 5734 | if ($globalDBdriver == 'mysql') { |
| 5460 | 5735 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
@@ -5501,7 +5776,9 @@ discard block |
||
| 5501 | 5776 | date_default_timezone_set($globalTimezone); |
| 5502 | 5777 | $datetime = new DateTime($date); |
| 5503 | 5778 | $offset = $datetime->format('P'); |
| 5504 | - } else $offset = '+00:00'; |
|
| 5779 | + } else { |
|
| 5780 | + $offset = '+00:00'; |
|
| 5781 | + } |
|
| 5505 | 5782 | |
| 5506 | 5783 | if ($globalDBdriver == 'mysql') { |
| 5507 | 5784 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
@@ -5530,7 +5807,9 @@ discard block |
||
| 5530 | 5807 | if($row['registration'] != "") |
| 5531 | 5808 | { |
| 5532 | 5809 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5533 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5810 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5811 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5812 | + } |
|
| 5534 | 5813 | } |
| 5535 | 5814 | $temp_array['registration_count'] = $row['registration_count']; |
| 5536 | 5815 | |
@@ -5555,7 +5834,9 @@ discard block |
||
| 5555 | 5834 | date_default_timezone_set($globalTimezone); |
| 5556 | 5835 | $datetime = new DateTime($date); |
| 5557 | 5836 | $offset = $datetime->format('P'); |
| 5558 | - } else $offset = '+00:00'; |
|
| 5837 | + } else { |
|
| 5838 | + $offset = '+00:00'; |
|
| 5839 | + } |
|
| 5559 | 5840 | |
| 5560 | 5841 | if ($globalDBdriver == 'mysql') { |
| 5561 | 5842 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
@@ -5692,8 +5973,11 @@ discard block |
||
| 5692 | 5973 | if($row['registration'] != "") |
| 5693 | 5974 | { |
| 5694 | 5975 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5695 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5696 | - else $temp_array['image_thumbnail'] = ''; |
|
| 5976 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5977 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5978 | + } else { |
|
| 5979 | + $temp_array['image_thumbnail'] = ''; |
|
| 5980 | + } |
|
| 5697 | 5981 | } |
| 5698 | 5982 | $temp_array['registration_count'] = $row['registration_count']; |
| 5699 | 5983 | $aircraft_array[] = $temp_array; |
@@ -5736,8 +6020,11 @@ discard block |
||
| 5736 | 6020 | if($row['registration'] != "") |
| 5737 | 6021 | { |
| 5738 | 6022 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5739 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5740 | - else $temp_array['image_thumbnail'] = ''; |
|
| 6023 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6024 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6025 | + } else { |
|
| 6026 | + $temp_array['image_thumbnail'] = ''; |
|
| 6027 | + } |
|
| 5741 | 6028 | } |
| 5742 | 6029 | $temp_array['registration_count'] = $row['registration_count']; |
| 5743 | 6030 | $aircraft_array[] = $temp_array; |
@@ -5780,8 +6067,11 @@ discard block |
||
| 5780 | 6067 | if($row['registration'] != "") |
| 5781 | 6068 | { |
| 5782 | 6069 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5783 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5784 | - else $temp_array['image_thumbnail'] = ''; |
|
| 6070 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6071 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6072 | + } else { |
|
| 6073 | + $temp_array['image_thumbnail'] = ''; |
|
| 6074 | + } |
|
| 5785 | 6075 | } |
| 5786 | 6076 | $temp_array['registration_count'] = $row['registration_count']; |
| 5787 | 6077 | $aircraft_array[] = $temp_array; |
@@ -5930,7 +6220,9 @@ discard block |
||
| 5930 | 6220 | if($row['registration'] != "") |
| 5931 | 6221 | { |
| 5932 | 6222 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5933 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6223 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6224 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6225 | + } |
|
| 5934 | 6226 | } |
| 5935 | 6227 | $temp_array['registration_count'] = $row['registration_count']; |
| 5936 | 6228 | |
@@ -6047,7 +6339,9 @@ discard block |
||
| 6047 | 6339 | if($row['registration'] != "") |
| 6048 | 6340 | { |
| 6049 | 6341 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6050 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6342 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6343 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6344 | + } |
|
| 6051 | 6345 | } |
| 6052 | 6346 | $temp_array['registration_count'] = $row['registration_count']; |
| 6053 | 6347 | |
@@ -6213,7 +6507,9 @@ discard block |
||
| 6213 | 6507 | } |
| 6214 | 6508 | } |
| 6215 | 6509 | $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
| 6216 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6510 | + if ($limit) { |
|
| 6511 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6512 | + } |
|
| 6217 | 6513 | |
| 6218 | 6514 | $sth = $this->db->prepare($query); |
| 6219 | 6515 | $sth->execute($query_values); |
@@ -6232,7 +6528,9 @@ discard block |
||
| 6232 | 6528 | if($row['registration'] != "") |
| 6233 | 6529 | { |
| 6234 | 6530 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6235 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6531 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6532 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6533 | + } |
|
| 6236 | 6534 | } |
| 6237 | 6535 | |
| 6238 | 6536 | $aircraft_array[] = $temp_array; |
@@ -6273,7 +6571,9 @@ discard block |
||
| 6273 | 6571 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6274 | 6572 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6275 | 6573 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
| 6276 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6574 | + if ($limit) { |
|
| 6575 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6576 | + } |
|
| 6277 | 6577 | |
| 6278 | 6578 | $sth = $this->db->prepare($query); |
| 6279 | 6579 | $sth->execute(); |
@@ -6293,7 +6593,9 @@ discard block |
||
| 6293 | 6593 | if($row['registration'] != "") |
| 6294 | 6594 | { |
| 6295 | 6595 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6296 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6596 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6597 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6598 | + } |
|
| 6297 | 6599 | } |
| 6298 | 6600 | |
| 6299 | 6601 | $aircraft_array[] = $temp_array; |
@@ -6359,7 +6661,9 @@ discard block |
||
| 6359 | 6661 | } |
| 6360 | 6662 | $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6361 | 6663 | ORDER BY airport_departure_icao_count DESC"; |
| 6362 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6664 | + if ($limit) { |
|
| 6665 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6666 | + } |
|
| 6363 | 6667 | |
| 6364 | 6668 | $sth = $this->db->prepare($query); |
| 6365 | 6669 | $sth->execute($query_values); |
@@ -6410,7 +6714,9 @@ discard block |
||
| 6410 | 6714 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6411 | 6715 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6412 | 6716 | ORDER BY airport_departure_icao_count DESC"; |
| 6413 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6717 | + if ($limit) { |
|
| 6718 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6719 | + } |
|
| 6414 | 6720 | |
| 6415 | 6721 | $sth = $this->db->prepare($query); |
| 6416 | 6722 | $sth->execute(); |
@@ -6488,7 +6794,9 @@ discard block |
||
| 6488 | 6794 | } |
| 6489 | 6795 | $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
| 6490 | 6796 | ORDER BY airport_departure_icao_count DESC"; |
| 6491 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6797 | + if ($limit) { |
|
| 6798 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6799 | + } |
|
| 6492 | 6800 | //echo $query; |
| 6493 | 6801 | $sth = $this->db->prepare($query); |
| 6494 | 6802 | $sth->execute($query_values); |
@@ -6540,7 +6848,9 @@ discard block |
||
| 6540 | 6848 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6541 | 6849 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
| 6542 | 6850 | ORDER BY airport_departure_icao_count DESC"; |
| 6543 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6851 | + if ($limit) { |
|
| 6852 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6853 | + } |
|
| 6544 | 6854 | |
| 6545 | 6855 | $sth = $this->db->prepare($query); |
| 6546 | 6856 | $sth->execute(); |
@@ -6935,7 +7245,9 @@ discard block |
||
| 6935 | 7245 | date_default_timezone_set($globalTimezone); |
| 6936 | 7246 | $datetime = new DateTime($date); |
| 6937 | 7247 | $offset = $datetime->format('P'); |
| 6938 | - } else $offset = '+00:00'; |
|
| 7248 | + } else { |
|
| 7249 | + $offset = '+00:00'; |
|
| 7250 | + } |
|
| 6939 | 7251 | |
| 6940 | 7252 | if ($globalDBdriver == 'mysql') { |
| 6941 | 7253 | $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
@@ -6985,7 +7297,9 @@ discard block |
||
| 6985 | 7297 | date_default_timezone_set($globalTimezone); |
| 6986 | 7298 | $datetime = new DateTime($date); |
| 6987 | 7299 | $offset = $datetime->format('P'); |
| 6988 | - } else $offset = '+00:00'; |
|
| 7300 | + } else { |
|
| 7301 | + $offset = '+00:00'; |
|
| 7302 | + } |
|
| 6989 | 7303 | |
| 6990 | 7304 | if ($globalDBdriver == 'mysql') { |
| 6991 | 7305 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
@@ -7334,7 +7648,9 @@ discard block |
||
| 7334 | 7648 | } |
| 7335 | 7649 | $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7336 | 7650 | ORDER BY airport_arrival_icao_count DESC"; |
| 7337 | - if ($limit) $query .= " LIMIT 10"; |
|
| 7651 | + if ($limit) { |
|
| 7652 | + $query .= " LIMIT 10"; |
|
| 7653 | + } |
|
| 7338 | 7654 | |
| 7339 | 7655 | |
| 7340 | 7656 | $sth = $this->db->prepare($query); |
@@ -7354,7 +7670,9 @@ discard block |
||
| 7354 | 7670 | if ($icaoaskey) { |
| 7355 | 7671 | $icao = $row['arrival_airport_icao']; |
| 7356 | 7672 | $airport_array[$icao] = $temp_array; |
| 7357 | - } else $airport_array[] = $temp_array; |
|
| 7673 | + } else { |
|
| 7674 | + $airport_array[] = $temp_array; |
|
| 7675 | + } |
|
| 7358 | 7676 | } |
| 7359 | 7677 | |
| 7360 | 7678 | return $airport_array; |
@@ -7391,7 +7709,9 @@ discard block |
||
| 7391 | 7709 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 7392 | 7710 | $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7393 | 7711 | ORDER BY airport_arrival_icao_count DESC"; |
| 7394 | - if ($limit) $query .= " LIMIT 10"; |
|
| 7712 | + if ($limit) { |
|
| 7713 | + $query .= " LIMIT 10"; |
|
| 7714 | + } |
|
| 7395 | 7715 | |
| 7396 | 7716 | |
| 7397 | 7717 | $sth = $this->db->prepare($query); |
@@ -7412,7 +7732,9 @@ discard block |
||
| 7412 | 7732 | if ($icaoaskey) { |
| 7413 | 7733 | $icao = $row['arrival_airport_icao']; |
| 7414 | 7734 | $airport_array[$icao] = $temp_array; |
| 7415 | - } else $airport_array[] = $temp_array; |
|
| 7735 | + } else { |
|
| 7736 | + $airport_array[] = $temp_array; |
|
| 7737 | + } |
|
| 7416 | 7738 | } |
| 7417 | 7739 | |
| 7418 | 7740 | return $airport_array; |
@@ -7475,7 +7797,9 @@ discard block |
||
| 7475 | 7797 | } |
| 7476 | 7798 | $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
| 7477 | 7799 | ORDER BY airport_arrival_icao_count DESC"; |
| 7478 | - if ($limit) $query .= " LIMIT 10"; |
|
| 7800 | + if ($limit) { |
|
| 7801 | + $query .= " LIMIT 10"; |
|
| 7802 | + } |
|
| 7479 | 7803 | |
| 7480 | 7804 | |
| 7481 | 7805 | $sth = $this->db->prepare($query); |
@@ -7494,7 +7818,9 @@ discard block |
||
| 7494 | 7818 | if ($icaoaskey) { |
| 7495 | 7819 | $icao = $row['arrival_airport_icao']; |
| 7496 | 7820 | $airport_array[$icao] = $temp_array; |
| 7497 | - } else $airport_array[] = $temp_array; |
|
| 7821 | + } else { |
|
| 7822 | + $airport_array[] = $temp_array; |
|
| 7823 | + } |
|
| 7498 | 7824 | } |
| 7499 | 7825 | |
| 7500 | 7826 | return $airport_array; |
@@ -7531,7 +7857,9 @@ discard block |
||
| 7531 | 7857 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 7532 | 7858 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
| 7533 | 7859 | ORDER BY airport_arrival_icao_count DESC"; |
| 7534 | - if ($limit) $query .= " LIMIT 10"; |
|
| 7860 | + if ($limit) { |
|
| 7861 | + $query .= " LIMIT 10"; |
|
| 7862 | + } |
|
| 7535 | 7863 | |
| 7536 | 7864 | |
| 7537 | 7865 | $sth = $this->db->prepare($query); |
@@ -7552,7 +7880,9 @@ discard block |
||
| 7552 | 7880 | if ($icaoaskey) { |
| 7553 | 7881 | $icao = $row['arrival_airport_icao']; |
| 7554 | 7882 | $airport_array[$icao] = $temp_array; |
| 7555 | - } else $airport_array[] = $temp_array; |
|
| 7883 | + } else { |
|
| 7884 | + $airport_array[] = $temp_array; |
|
| 7885 | + } |
|
| 7556 | 7886 | } |
| 7557 | 7887 | |
| 7558 | 7888 | return $airport_array; |
@@ -7933,7 +8263,9 @@ discard block |
||
| 7933 | 8263 | date_default_timezone_set($globalTimezone); |
| 7934 | 8264 | $datetime = new DateTime($date); |
| 7935 | 8265 | $offset = $datetime->format('P'); |
| 7936 | - } else $offset = '+00:00'; |
|
| 8266 | + } else { |
|
| 8267 | + $offset = '+00:00'; |
|
| 8268 | + } |
|
| 7937 | 8269 | |
| 7938 | 8270 | if ($globalDBdriver == 'mysql') { |
| 7939 | 8271 | $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
@@ -7983,7 +8315,9 @@ discard block |
||
| 7983 | 8315 | date_default_timezone_set($globalTimezone); |
| 7984 | 8316 | $datetime = new DateTime($date); |
| 7985 | 8317 | $offset = $datetime->format('P'); |
| 7986 | - } else $offset = '+00:00'; |
|
| 8318 | + } else { |
|
| 8319 | + $offset = '+00:00'; |
|
| 8320 | + } |
|
| 7987 | 8321 | |
| 7988 | 8322 | if ($globalDBdriver == 'mysql') { |
| 7989 | 8323 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
@@ -8374,7 +8708,9 @@ discard block |
||
| 8374 | 8708 | } |
| 8375 | 8709 | $query .= " GROUP BY spotter_output.arrival_airport_country |
| 8376 | 8710 | ORDER BY airport_arrival_country_count DESC"; |
| 8377 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 8711 | + if ($limit) { |
|
| 8712 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 8713 | + } |
|
| 8378 | 8714 | |
| 8379 | 8715 | |
| 8380 | 8716 | $sth = $this->db->prepare($query); |
@@ -8661,7 +8997,9 @@ discard block |
||
| 8661 | 8997 | date_default_timezone_set($globalTimezone); |
| 8662 | 8998 | $datetime = new DateTime($date); |
| 8663 | 8999 | $offset = $datetime->format('P'); |
| 8664 | - } else $offset = '+00:00'; |
|
| 9000 | + } else { |
|
| 9001 | + $offset = '+00:00'; |
|
| 9002 | + } |
|
| 8665 | 9003 | |
| 8666 | 9004 | if ($globalDBdriver == 'mysql') { |
| 8667 | 9005 | $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
@@ -8917,12 +9255,18 @@ discard block |
||
| 8917 | 9255 | $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
| 8918 | 9256 | FROM spotter_output".$filter_query." spotter_output.ident <> ''"; |
| 8919 | 9257 | if ($olderthanmonths > 0) { |
| 8920 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 8921 | - else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 9258 | + if ($globalDBdriver == 'mysql') { |
|
| 9259 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 9260 | + } else { |
|
| 9261 | + $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 9262 | + } |
|
| 8922 | 9263 | } |
| 8923 | 9264 | if ($sincedate != '') { |
| 8924 | - if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 8925 | - else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 9265 | + if ($globalDBdriver == 'mysql') { |
|
| 9266 | + $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 9267 | + } else { |
|
| 9268 | + $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 9269 | + } |
|
| 8926 | 9270 | } |
| 8927 | 9271 | $query_values = array(); |
| 8928 | 9272 | if ($year != '') { |
@@ -8953,7 +9297,9 @@ discard block |
||
| 8953 | 9297 | } |
| 8954 | 9298 | } |
| 8955 | 9299 | $query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 8956 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 9300 | + if ($limit) { |
|
| 9301 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 9302 | + } |
|
| 8957 | 9303 | |
| 8958 | 9304 | $sth = $this->db->prepare($query); |
| 8959 | 9305 | $sth->execute($query_values); |
@@ -8987,15 +9333,23 @@ discard block |
||
| 8987 | 9333 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
| 8988 | 9334 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
| 8989 | 9335 | if ($olderthanmonths > 0) { |
| 8990 | - if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 8991 | - else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 9336 | + if ($globalDBdriver == 'mysql') { |
|
| 9337 | + $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 9338 | + } else { |
|
| 9339 | + $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 9340 | + } |
|
| 8992 | 9341 | } |
| 8993 | 9342 | if ($sincedate != '') { |
| 8994 | - if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 8995 | - else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 9343 | + if ($globalDBdriver == 'mysql') { |
|
| 9344 | + $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 9345 | + } else { |
|
| 9346 | + $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 9347 | + } |
|
| 8996 | 9348 | } |
| 8997 | 9349 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 8998 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 9350 | + if ($limit) { |
|
| 9351 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 9352 | + } |
|
| 8999 | 9353 | |
| 9000 | 9354 | $sth = $this->db->prepare($query); |
| 9001 | 9355 | $sth->execute(); |
@@ -9032,7 +9386,9 @@ discard block |
||
| 9032 | 9386 | date_default_timezone_set($globalTimezone); |
| 9033 | 9387 | $datetime = new DateTime(); |
| 9034 | 9388 | $offset = $datetime->format('P'); |
| 9035 | - } else $offset = '+00:00'; |
|
| 9389 | + } else { |
|
| 9390 | + $offset = '+00:00'; |
|
| 9391 | + } |
|
| 9036 | 9392 | |
| 9037 | 9393 | if ($globalDBdriver == 'mysql') { |
| 9038 | 9394 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9081,7 +9437,9 @@ discard block |
||
| 9081 | 9437 | date_default_timezone_set($globalTimezone); |
| 9082 | 9438 | $datetime = new DateTime(); |
| 9083 | 9439 | $offset = $datetime->format('P'); |
| 9084 | - } else $offset = '+00:00'; |
|
| 9440 | + } else { |
|
| 9441 | + $offset = '+00:00'; |
|
| 9442 | + } |
|
| 9085 | 9443 | $filter_query = $this->getFilter($filters,true,true); |
| 9086 | 9444 | if ($globalDBdriver == 'mysql') { |
| 9087 | 9445 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9130,7 +9488,9 @@ discard block |
||
| 9130 | 9488 | date_default_timezone_set($globalTimezone); |
| 9131 | 9489 | $datetime = new DateTime(); |
| 9132 | 9490 | $offset = $datetime->format('P'); |
| 9133 | - } else $offset = '+00:00'; |
|
| 9491 | + } else { |
|
| 9492 | + $offset = '+00:00'; |
|
| 9493 | + } |
|
| 9134 | 9494 | $filter_query = $this->getFilter($filters,true,true); |
| 9135 | 9495 | if ($globalDBdriver == 'mysql') { |
| 9136 | 9496 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9176,7 +9536,9 @@ discard block |
||
| 9176 | 9536 | date_default_timezone_set($globalTimezone); |
| 9177 | 9537 | $datetime = new DateTime(); |
| 9178 | 9538 | $offset = $datetime->format('P'); |
| 9179 | - } else $offset = '+00:00'; |
|
| 9539 | + } else { |
|
| 9540 | + $offset = '+00:00'; |
|
| 9541 | + } |
|
| 9180 | 9542 | $filter_query = $this->getFilter($filters,true,true); |
| 9181 | 9543 | if ($globalDBdriver == 'mysql') { |
| 9182 | 9544 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9224,7 +9586,9 @@ discard block |
||
| 9224 | 9586 | date_default_timezone_set($globalTimezone); |
| 9225 | 9587 | $datetime = new DateTime(); |
| 9226 | 9588 | $offset = $datetime->format('P'); |
| 9227 | - } else $offset = '+00:00'; |
|
| 9589 | + } else { |
|
| 9590 | + $offset = '+00:00'; |
|
| 9591 | + } |
|
| 9228 | 9592 | |
| 9229 | 9593 | if ($globalDBdriver == 'mysql') { |
| 9230 | 9594 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9272,7 +9636,9 @@ discard block |
||
| 9272 | 9636 | date_default_timezone_set($globalTimezone); |
| 9273 | 9637 | $datetime = new DateTime(); |
| 9274 | 9638 | $offset = $datetime->format('P'); |
| 9275 | - } else $offset = '+00:00'; |
|
| 9639 | + } else { |
|
| 9640 | + $offset = '+00:00'; |
|
| 9641 | + } |
|
| 9276 | 9642 | |
| 9277 | 9643 | if ($globalDBdriver == 'mysql') { |
| 9278 | 9644 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -9319,7 +9685,9 @@ discard block |
||
| 9319 | 9685 | date_default_timezone_set($globalTimezone); |
| 9320 | 9686 | $datetime = new DateTime(); |
| 9321 | 9687 | $offset = $datetime->format('P'); |
| 9322 | - } else $offset = '+00:00'; |
|
| 9688 | + } else { |
|
| 9689 | + $offset = '+00:00'; |
|
| 9690 | + } |
|
| 9323 | 9691 | |
| 9324 | 9692 | if ($globalDBdriver == 'mysql') { |
| 9325 | 9693 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -9367,7 +9735,9 @@ discard block |
||
| 9367 | 9735 | date_default_timezone_set($globalTimezone); |
| 9368 | 9736 | $datetime = new DateTime(); |
| 9369 | 9737 | $offset = $datetime->format('P'); |
| 9370 | - } else $offset = '+00:00'; |
|
| 9738 | + } else { |
|
| 9739 | + $offset = '+00:00'; |
|
| 9740 | + } |
|
| 9371 | 9741 | $filter_query = $this->getFilter($filters,true,true); |
| 9372 | 9742 | if ($globalDBdriver == 'mysql') { |
| 9373 | 9743 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -9412,7 +9782,9 @@ discard block |
||
| 9412 | 9782 | date_default_timezone_set($globalTimezone); |
| 9413 | 9783 | $datetime = new DateTime(); |
| 9414 | 9784 | $offset = $datetime->format('P'); |
| 9415 | - } else $offset = '+00:00'; |
|
| 9785 | + } else { |
|
| 9786 | + $offset = '+00:00'; |
|
| 9787 | + } |
|
| 9416 | 9788 | $filter_query = $this->getFilter($filters,true,true); |
| 9417 | 9789 | |
| 9418 | 9790 | if ($globalDBdriver == 'mysql') { |
@@ -9459,7 +9831,9 @@ discard block |
||
| 9459 | 9831 | date_default_timezone_set($globalTimezone); |
| 9460 | 9832 | $datetime = new DateTime(); |
| 9461 | 9833 | $offset = $datetime->format('P'); |
| 9462 | - } else $offset = '+00:00'; |
|
| 9834 | + } else { |
|
| 9835 | + $offset = '+00:00'; |
|
| 9836 | + } |
|
| 9463 | 9837 | |
| 9464 | 9838 | if ($globalDBdriver == 'mysql') { |
| 9465 | 9839 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
@@ -9505,7 +9879,9 @@ discard block |
||
| 9505 | 9879 | date_default_timezone_set($globalTimezone); |
| 9506 | 9880 | $datetime = new DateTime(); |
| 9507 | 9881 | $offset = $datetime->format('P'); |
| 9508 | - } else $offset = '+00:00'; |
|
| 9882 | + } else { |
|
| 9883 | + $offset = '+00:00'; |
|
| 9884 | + } |
|
| 9509 | 9885 | $filter_query = $this->getFilter($filters,true,true); |
| 9510 | 9886 | |
| 9511 | 9887 | if ($globalDBdriver == 'mysql') { |
@@ -9552,7 +9928,9 @@ discard block |
||
| 9552 | 9928 | date_default_timezone_set($globalTimezone); |
| 9553 | 9929 | $datetime = new DateTime(); |
| 9554 | 9930 | $offset = $datetime->format('P'); |
| 9555 | - } else $offset = '+00:00'; |
|
| 9931 | + } else { |
|
| 9932 | + $offset = '+00:00'; |
|
| 9933 | + } |
|
| 9556 | 9934 | |
| 9557 | 9935 | if ($globalDBdriver == 'mysql') { |
| 9558 | 9936 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
@@ -9599,7 +9977,9 @@ discard block |
||
| 9599 | 9977 | date_default_timezone_set($globalTimezone); |
| 9600 | 9978 | $datetime = new DateTime(); |
| 9601 | 9979 | $offset = $datetime->format('P'); |
| 9602 | - } else $offset = '+00:00'; |
|
| 9980 | + } else { |
|
| 9981 | + $offset = '+00:00'; |
|
| 9982 | + } |
|
| 9603 | 9983 | |
| 9604 | 9984 | if ($globalDBdriver == 'mysql') { |
| 9605 | 9985 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
@@ -9644,7 +10024,9 @@ discard block |
||
| 9644 | 10024 | date_default_timezone_set($globalTimezone); |
| 9645 | 10025 | $datetime = new DateTime(); |
| 9646 | 10026 | $offset = $datetime->format('P'); |
| 9647 | - } else $offset = '+00:00'; |
|
| 10027 | + } else { |
|
| 10028 | + $offset = '+00:00'; |
|
| 10029 | + } |
|
| 9648 | 10030 | $filter_query = $this->getFilter($filters,true,true); |
| 9649 | 10031 | |
| 9650 | 10032 | if ($globalDBdriver == 'mysql') { |
@@ -9692,7 +10074,9 @@ discard block |
||
| 9692 | 10074 | date_default_timezone_set($globalTimezone); |
| 9693 | 10075 | $datetime = new DateTime(); |
| 9694 | 10076 | $offset = $datetime->format('P'); |
| 9695 | - } else $offset = '+00:00'; |
|
| 10077 | + } else { |
|
| 10078 | + $offset = '+00:00'; |
|
| 10079 | + } |
|
| 9696 | 10080 | |
| 9697 | 10081 | if ($globalDBdriver == 'mysql') { |
| 9698 | 10082 | $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
@@ -9738,7 +10122,9 @@ discard block |
||
| 9738 | 10122 | date_default_timezone_set($globalTimezone); |
| 9739 | 10123 | $datetime = new DateTime(); |
| 9740 | 10124 | $offset = $datetime->format('P'); |
| 9741 | - } else $offset = '+00:00'; |
|
| 10125 | + } else { |
|
| 10126 | + $offset = '+00:00'; |
|
| 10127 | + } |
|
| 9742 | 10128 | $filter_query = $this->getFilter($filters,true,true); |
| 9743 | 10129 | |
| 9744 | 10130 | if ($globalDBdriver == 'mysql') { |
@@ -9786,7 +10172,9 @@ discard block |
||
| 9786 | 10172 | date_default_timezone_set($globalTimezone); |
| 9787 | 10173 | $datetime = new DateTime(); |
| 9788 | 10174 | $offset = $datetime->format('P'); |
| 9789 | - } else $offset = '+00:00'; |
|
| 10175 | + } else { |
|
| 10176 | + $offset = '+00:00'; |
|
| 10177 | + } |
|
| 9790 | 10178 | |
| 9791 | 10179 | if ($globalDBdriver == 'mysql') { |
| 9792 | 10180 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
@@ -9833,7 +10221,9 @@ discard block |
||
| 9833 | 10221 | date_default_timezone_set($globalTimezone); |
| 9834 | 10222 | $datetime = new DateTime(); |
| 9835 | 10223 | $offset = $datetime->format('P'); |
| 9836 | - } else $offset = '+00:00'; |
|
| 10224 | + } else { |
|
| 10225 | + $offset = '+00:00'; |
|
| 10226 | + } |
|
| 9837 | 10227 | $filter_query = $this->getFilter($filters,true,true); |
| 9838 | 10228 | if ($globalDBdriver == 'mysql') { |
| 9839 | 10229 | $query = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
@@ -9882,7 +10272,9 @@ discard block |
||
| 9882 | 10272 | date_default_timezone_set($globalTimezone); |
| 9883 | 10273 | $datetime = new DateTime(); |
| 9884 | 10274 | $offset = $datetime->format('P'); |
| 9885 | - } else $offset = '+00:00'; |
|
| 10275 | + } else { |
|
| 10276 | + $offset = '+00:00'; |
|
| 10277 | + } |
|
| 9886 | 10278 | |
| 9887 | 10279 | $orderby_sql = ''; |
| 9888 | 10280 | if ($orderby == "hour") |
@@ -9948,7 +10340,9 @@ discard block |
||
| 9948 | 10340 | date_default_timezone_set($globalTimezone); |
| 9949 | 10341 | $datetime = new DateTime(); |
| 9950 | 10342 | $offset = $datetime->format('P'); |
| 9951 | - } else $offset = '+00:00'; |
|
| 10343 | + } else { |
|
| 10344 | + $offset = '+00:00'; |
|
| 10345 | + } |
|
| 9952 | 10346 | |
| 9953 | 10347 | $orderby_sql = ''; |
| 9954 | 10348 | if ($orderby == "hour") |
@@ -10015,7 +10409,9 @@ discard block |
||
| 10015 | 10409 | date_default_timezone_set($globalTimezone); |
| 10016 | 10410 | $datetime = new DateTime(); |
| 10017 | 10411 | $offset = $datetime->format('P'); |
| 10018 | - } else $offset = '+00:00'; |
|
| 10412 | + } else { |
|
| 10413 | + $offset = '+00:00'; |
|
| 10414 | + } |
|
| 10019 | 10415 | |
| 10020 | 10416 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
| 10021 | 10417 | |
@@ -10066,7 +10462,9 @@ discard block |
||
| 10066 | 10462 | date_default_timezone_set($globalTimezone); |
| 10067 | 10463 | $datetime = new DateTime(); |
| 10068 | 10464 | $offset = $datetime->format('P'); |
| 10069 | - } else $offset = '+00:00'; |
|
| 10465 | + } else { |
|
| 10466 | + $offset = '+00:00'; |
|
| 10467 | + } |
|
| 10070 | 10468 | |
| 10071 | 10469 | if ($globalDBdriver == 'mysql') { |
| 10072 | 10470 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10113,7 +10511,9 @@ discard block |
||
| 10113 | 10511 | date_default_timezone_set($globalTimezone); |
| 10114 | 10512 | $datetime = new DateTime(); |
| 10115 | 10513 | $offset = $datetime->format('P'); |
| 10116 | - } else $offset = '+00:00'; |
|
| 10514 | + } else { |
|
| 10515 | + $offset = '+00:00'; |
|
| 10516 | + } |
|
| 10117 | 10517 | |
| 10118 | 10518 | if ($globalDBdriver == 'mysql') { |
| 10119 | 10519 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10160,7 +10560,9 @@ discard block |
||
| 10160 | 10560 | date_default_timezone_set($globalTimezone); |
| 10161 | 10561 | $datetime = new DateTime(); |
| 10162 | 10562 | $offset = $datetime->format('P'); |
| 10163 | - } else $offset = '+00:00'; |
|
| 10563 | + } else { |
|
| 10564 | + $offset = '+00:00'; |
|
| 10565 | + } |
|
| 10164 | 10566 | |
| 10165 | 10567 | if ($globalDBdriver == 'mysql') { |
| 10166 | 10568 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10208,7 +10610,9 @@ discard block |
||
| 10208 | 10610 | date_default_timezone_set($globalTimezone); |
| 10209 | 10611 | $datetime = new DateTime(); |
| 10210 | 10612 | $offset = $datetime->format('P'); |
| 10211 | - } else $offset = '+00:00'; |
|
| 10613 | + } else { |
|
| 10614 | + $offset = '+00:00'; |
|
| 10615 | + } |
|
| 10212 | 10616 | |
| 10213 | 10617 | if ($globalDBdriver == 'mysql') { |
| 10214 | 10618 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10256,7 +10660,9 @@ discard block |
||
| 10256 | 10660 | date_default_timezone_set($globalTimezone); |
| 10257 | 10661 | $datetime = new DateTime($date); |
| 10258 | 10662 | $offset = $datetime->format('P'); |
| 10259 | - } else $offset = '+00:00'; |
|
| 10663 | + } else { |
|
| 10664 | + $offset = '+00:00'; |
|
| 10665 | + } |
|
| 10260 | 10666 | |
| 10261 | 10667 | if ($globalDBdriver == 'mysql') { |
| 10262 | 10668 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10304,7 +10710,9 @@ discard block |
||
| 10304 | 10710 | date_default_timezone_set($globalTimezone); |
| 10305 | 10711 | $datetime = new DateTime(); |
| 10306 | 10712 | $offset = $datetime->format('P'); |
| 10307 | - } else $offset = '+00:00'; |
|
| 10713 | + } else { |
|
| 10714 | + $offset = '+00:00'; |
|
| 10715 | + } |
|
| 10308 | 10716 | |
| 10309 | 10717 | if ($globalDBdriver == 'mysql') { |
| 10310 | 10718 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10351,7 +10759,9 @@ discard block |
||
| 10351 | 10759 | date_default_timezone_set($globalTimezone); |
| 10352 | 10760 | $datetime = new DateTime(); |
| 10353 | 10761 | $offset = $datetime->format('P'); |
| 10354 | - } else $offset = '+00:00'; |
|
| 10762 | + } else { |
|
| 10763 | + $offset = '+00:00'; |
|
| 10764 | + } |
|
| 10355 | 10765 | |
| 10356 | 10766 | if ($globalDBdriver == 'mysql') { |
| 10357 | 10767 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10398,7 +10808,9 @@ discard block |
||
| 10398 | 10808 | date_default_timezone_set($globalTimezone); |
| 10399 | 10809 | $datetime = new DateTime(); |
| 10400 | 10810 | $offset = $datetime->format('P'); |
| 10401 | - } else $offset = '+00:00'; |
|
| 10811 | + } else { |
|
| 10812 | + $offset = '+00:00'; |
|
| 10813 | + } |
|
| 10402 | 10814 | |
| 10403 | 10815 | if ($globalDBdriver == 'mysql') { |
| 10404 | 10816 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10448,7 +10860,9 @@ discard block |
||
| 10448 | 10860 | date_default_timezone_set($globalTimezone); |
| 10449 | 10861 | $datetime = new DateTime(); |
| 10450 | 10862 | $offset = $datetime->format('P'); |
| 10451 | - } else $offset = '+00:00'; |
|
| 10863 | + } else { |
|
| 10864 | + $offset = '+00:00'; |
|
| 10865 | + } |
|
| 10452 | 10866 | |
| 10453 | 10867 | if ($globalDBdriver == 'mysql') { |
| 10454 | 10868 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10495,7 +10909,9 @@ discard block |
||
| 10495 | 10909 | date_default_timezone_set($globalTimezone); |
| 10496 | 10910 | $datetime = new DateTime(); |
| 10497 | 10911 | $offset = $datetime->format('P'); |
| 10498 | - } else $offset = '+00:00'; |
|
| 10912 | + } else { |
|
| 10913 | + $offset = '+00:00'; |
|
| 10914 | + } |
|
| 10499 | 10915 | |
| 10500 | 10916 | if ($globalDBdriver == 'mysql') { |
| 10501 | 10917 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10706,8 +11122,11 @@ discard block |
||
| 10706 | 11122 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 10707 | 11123 | } |
| 10708 | 11124 | } |
| 10709 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
| 10710 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11125 | + if (empty($query_values)) { |
|
| 11126 | + $queryi .= $this->getFilter($filters); |
|
| 11127 | + } else { |
|
| 11128 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11129 | + } |
|
| 10711 | 11130 | |
| 10712 | 11131 | //echo $query; |
| 10713 | 11132 | $sth = $this->db->prepare($queryi); |
@@ -10786,8 +11205,11 @@ discard block |
||
| 10786 | 11205 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 10787 | 11206 | } |
| 10788 | 11207 | } |
| 10789 | - if ($query == '') $queryi .= $this->getFilter($filters); |
|
| 10790 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11208 | + if ($query == '') { |
|
| 11209 | + $queryi .= $this->getFilter($filters); |
|
| 11210 | + } else { |
|
| 11211 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11212 | + } |
|
| 10791 | 11213 | |
| 10792 | 11214 | |
| 10793 | 11215 | $sth = $this->db->prepare($queryi); |
@@ -10810,7 +11232,9 @@ discard block |
||
| 10810 | 11232 | date_default_timezone_set($globalTimezone); |
| 10811 | 11233 | $datetime = new DateTime(); |
| 10812 | 11234 | $offset = $datetime->format('P'); |
| 10813 | - } else $offset = '+00:00'; |
|
| 11235 | + } else { |
|
| 11236 | + $offset = '+00:00'; |
|
| 11237 | + } |
|
| 10814 | 11238 | |
| 10815 | 11239 | if ($globalDBdriver == 'mysql') { |
| 10816 | 11240 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10996,7 +11420,9 @@ discard block |
||
| 10996 | 11420 | */ |
| 10997 | 11421 | public function parseDirection($direction = 0) |
| 10998 | 11422 | { |
| 10999 | - if ($direction == '') $direction = 0; |
|
| 11423 | + if ($direction == '') { |
|
| 11424 | + $direction = 0; |
|
| 11425 | + } |
|
| 11000 | 11426 | $direction_array = array(); |
| 11001 | 11427 | $temp_array = array(); |
| 11002 | 11428 | |
@@ -11097,7 +11523,9 @@ discard block |
||
| 11097 | 11523 | if (isset($result->AirlineFlightInfoResult)) |
| 11098 | 11524 | { |
| 11099 | 11525 | $registration = $result->AirlineFlightInfoResult->tailnumber; |
| 11100 | - } else return ''; |
|
| 11526 | + } else { |
|
| 11527 | + return ''; |
|
| 11528 | + } |
|
| 11101 | 11529 | |
| 11102 | 11530 | $registration = $this->convertAircraftRegistration($registration); |
| 11103 | 11531 | |
@@ -11126,7 +11554,9 @@ discard block |
||
| 11126 | 11554 | if (count($row) > 0) { |
| 11127 | 11555 | //return $row['Registration']; |
| 11128 | 11556 | return $row['registration']; |
| 11129 | - } else return ''; |
|
| 11557 | + } else { |
|
| 11558 | + return ''; |
|
| 11559 | + } |
|
| 11130 | 11560 | |
| 11131 | 11561 | } |
| 11132 | 11562 | |
@@ -11149,9 +11579,14 @@ discard block |
||
| 11149 | 11579 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 11150 | 11580 | $sth->closeCursor(); |
| 11151 | 11581 | if (count($row) > 0) { |
| 11152 | - if ($row['type_flight'] == null) return ''; |
|
| 11153 | - else return $row['type_flight']; |
|
| 11154 | - } else return ''; |
|
| 11582 | + if ($row['type_flight'] == null) { |
|
| 11583 | + return ''; |
|
| 11584 | + } else { |
|
| 11585 | + return $row['type_flight']; |
|
| 11586 | + } |
|
| 11587 | + } else { |
|
| 11588 | + return ''; |
|
| 11589 | + } |
|
| 11155 | 11590 | |
| 11156 | 11591 | } |
| 11157 | 11592 | |
@@ -11169,7 +11604,9 @@ discard block |
||
| 11169 | 11604 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 11170 | 11605 | |
| 11171 | 11606 | $Connection = new Connection($this->db); |
| 11172 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 11607 | + if (!$Connection->tableExists('countries')) { |
|
| 11608 | + return ''; |
|
| 11609 | + } |
|
| 11173 | 11610 | |
| 11174 | 11611 | try { |
| 11175 | 11612 | /* |
@@ -11189,9 +11626,13 @@ discard block |
||
| 11189 | 11626 | $sth->closeCursor(); |
| 11190 | 11627 | if (count($row) > 0) { |
| 11191 | 11628 | return $row; |
| 11192 | - } else return ''; |
|
| 11629 | + } else { |
|
| 11630 | + return ''; |
|
| 11631 | + } |
|
| 11193 | 11632 | } catch (PDOException $e) { |
| 11194 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 11633 | + if (isset($globalDebug) && $globalDebug) { |
|
| 11634 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 11635 | + } |
|
| 11195 | 11636 | return ''; |
| 11196 | 11637 | } |
| 11197 | 11638 | |
@@ -11209,7 +11650,9 @@ discard block |
||
| 11209 | 11650 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
| 11210 | 11651 | |
| 11211 | 11652 | $Connection = new Connection($this->db); |
| 11212 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 11653 | + if (!$Connection->tableExists('countries')) { |
|
| 11654 | + return ''; |
|
| 11655 | + } |
|
| 11213 | 11656 | |
| 11214 | 11657 | try { |
| 11215 | 11658 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -11221,9 +11664,13 @@ discard block |
||
| 11221 | 11664 | $sth->closeCursor(); |
| 11222 | 11665 | if (count($row) > 0) { |
| 11223 | 11666 | return $row; |
| 11224 | - } else return ''; |
|
| 11667 | + } else { |
|
| 11668 | + return ''; |
|
| 11669 | + } |
|
| 11225 | 11670 | } catch (PDOException $e) { |
| 11226 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 11671 | + if (isset($globalDebug) && $globalDebug) { |
|
| 11672 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 11673 | + } |
|
| 11227 | 11674 | return ''; |
| 11228 | 11675 | } |
| 11229 | 11676 | |
@@ -11473,7 +11920,9 @@ discard block |
||
| 11473 | 11920 | { |
| 11474 | 11921 | global $globalBitlyAccessToken; |
| 11475 | 11922 | |
| 11476 | - if ($globalBitlyAccessToken == '') return $url; |
|
| 11923 | + if ($globalBitlyAccessToken == '') { |
|
| 11924 | + return $url; |
|
| 11925 | + } |
|
| 11477 | 11926 | |
| 11478 | 11927 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
| 11479 | 11928 | |
@@ -11622,7 +12071,9 @@ discard block |
||
| 11622 | 12071 | |
| 11623 | 12072 | |
| 11624 | 12073 | // routes |
| 11625 | - if ($globalDebug) print "Routes...\n"; |
|
| 12074 | + if ($globalDebug) { |
|
| 12075 | + print "Routes...\n"; |
|
| 12076 | + } |
|
| 11626 | 12077 | if ($globalDBdriver == 'mysql') { |
| 11627 | 12078 | $query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)"; |
| 11628 | 12079 | } else { |
@@ -11641,7 +12092,9 @@ discard block |
||
| 11641 | 12092 | } |
| 11642 | 12093 | } |
| 11643 | 12094 | |
| 11644 | - if ($globalDebug) print "Airlines...\n"; |
|
| 12095 | + if ($globalDebug) { |
|
| 12096 | + print "Airlines...\n"; |
|
| 12097 | + } |
|
| 11645 | 12098 | //airlines |
| 11646 | 12099 | if ($globalDBdriver == 'mysql') { |
| 11647 | 12100 | $query = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)"; |
@@ -11655,10 +12108,15 @@ discard block |
||
| 11655 | 12108 | if (is_numeric(substr($row['ident'], -1, 1))) |
| 11656 | 12109 | { |
| 11657 | 12110 | $fromsource = NULL; |
| 11658 | - if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 11659 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 11660 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 11661 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 12111 | + if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 12112 | + $fromsource = 'vatsim'; |
|
| 12113 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 12114 | + $fromsource = 'ivao'; |
|
| 12115 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 12116 | + $fromsource = 'vatsim'; |
|
| 12117 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 12118 | + $fromsource = 'ivao'; |
|
| 12119 | + } |
|
| 11662 | 12120 | $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
| 11663 | 12121 | if (isset($airline_array[0]['name'])) { |
| 11664 | 12122 | $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
@@ -11668,13 +12126,17 @@ discard block |
||
| 11668 | 12126 | } |
| 11669 | 12127 | } |
| 11670 | 12128 | |
| 11671 | - if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n"; |
|
| 12129 | + if ($globalDebug) { |
|
| 12130 | + print "Remove Duplicate in aircraft_modes...\n"; |
|
| 12131 | + } |
|
| 11672 | 12132 | //duplicate modes |
| 11673 | 12133 | $query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL"; |
| 11674 | 12134 | $sth = $this->db->prepare($query); |
| 11675 | 12135 | $sth->execute(); |
| 11676 | 12136 | |
| 11677 | - if ($globalDebug) print "Aircraft...\n"; |
|
| 12137 | + if ($globalDebug) { |
|
| 12138 | + print "Aircraft...\n"; |
|
| 12139 | + } |
|
| 11678 | 12140 | //aircraft |
| 11679 | 12141 | if ($globalDBdriver == 'mysql') { |
| 11680 | 12142 | $query = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -11717,26 +12179,38 @@ discard block |
||
| 11717 | 12179 | if (isset($closestAirports[0])) { |
| 11718 | 12180 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
| 11719 | 12181 | $airport_icao = $closestAirports[0]['icao']; |
| 11720 | - if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12182 | + if ($globalDebug) { |
|
| 12183 | + echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12184 | + } |
|
| 11721 | 12185 | } elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') { |
| 11722 | 12186 | foreach ($closestAirports as $airport) { |
| 11723 | 12187 | if ($row['arrival_airport_icao'] == $airport['icao']) { |
| 11724 | 12188 | $airport_icao = $airport['icao']; |
| 11725 | - if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12189 | + if ($globalDebug) { |
|
| 12190 | + echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12191 | + } |
|
| 11726 | 12192 | break; |
| 11727 | 12193 | } |
| 11728 | 12194 | } |
| 11729 | 12195 | } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
| 11730 | 12196 | $airport_icao = $closestAirports[0]['icao']; |
| 11731 | - if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 12197 | + if ($globalDebug) { |
|
| 12198 | + echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 12199 | + } |
|
| 11732 | 12200 | } else { |
| 11733 | - if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 12201 | + if ($globalDebug) { |
|
| 12202 | + echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 12203 | + } |
|
| 11734 | 12204 | } |
| 11735 | 12205 | } else { |
| 11736 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 12206 | + if ($globalDebug) { |
|
| 12207 | + echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 12208 | + } |
|
| 11737 | 12209 | } |
| 11738 | 12210 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
| 11739 | - if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
|
| 12211 | + if ($globalDebug) { |
|
| 12212 | + echo "Updating airport to ".$airport_icao."...\n"; |
|
| 12213 | + } |
|
| 11740 | 12214 | $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
| 11741 | 12215 | $sthu = $this->db->prepare($update_query); |
| 11742 | 12216 | $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
@@ -53,8 +53,12 @@ discard block |
||
| 53 | 53 | { |
| 54 | 54 | $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']); |
| 55 | 55 | $ident = $spotter_array[0]['ident']; |
| 56 | - if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
|
| 57 | - if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
|
| 56 | + if (isset($spotter_array[0]['latitude'])) { |
|
| 57 | + $latitude = $spotter_array[0]['latitude']; |
|
| 58 | + } |
|
| 59 | + if (isset($spotter_array[0]['longitude'])) { |
|
| 60 | + $longitude = $spotter_array[0]['longitude']; |
|
| 61 | + } |
|
| 58 | 62 | require_once('header.php'); |
| 59 | 63 | /* |
| 60 | 64 | if (isset($globalArchive) && $globalArchive) { |
@@ -107,7 +111,9 @@ discard block |
||
| 107 | 111 | */ |
| 108 | 112 | print '<div class="info column">'; |
| 109 | 113 | print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>'; |
| 110 | - if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>'; |
|
| 114 | + if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') { |
|
| 115 | + print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>'; |
|
| 116 | + } |
|
| 111 | 117 | $Stats = new Stats(); |
| 112 | 118 | $flights = $Stats->getStatsPilot($pilot); |
| 113 | 119 | print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>'; |