@@ -27,7 +27,9 @@ discard block |
||
| 27 | 27 | $filter = array_merge($globalStatsFilters[$globalFilterName],$filter); |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | - if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter); |
|
| 30 | + if (is_array($globalFilter)) { |
|
| 31 | + $filter = array_merge($globalFilter,$filter); |
|
| 32 | + } |
|
| 31 | 33 | $filter_query_join = ''; |
| 32 | 34 | $filter_query_where = ''; |
| 33 | 35 | foreach($filters as $flt) { |
@@ -72,8 +74,11 @@ discard block |
||
| 72 | 74 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 73 | 75 | } |
| 74 | 76 | } |
| 75 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 76 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 77 | + if ($filter_query_where == '' && $where) { |
|
| 78 | + $filter_query_where = ' WHERE'; |
|
| 79 | + } elseif ($filter_query_where != '' && $and) { |
|
| 80 | + $filter_query_where .= ' AND'; |
|
| 81 | + } |
|
| 77 | 82 | $filter_query = $filter_query_join.$filter_query_where; |
| 78 | 83 | return $filter_query; |
| 79 | 84 | } |
@@ -93,10 +98,18 @@ discard block |
||
| 93 | 98 | $Image = new Image($this->db); |
| 94 | 99 | $Schedule = new Schedule($this->db); |
| 95 | 100 | $ACARS = new ACARS($this->db); |
| 96 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 97 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 98 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 99 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 101 | + if (!isset($globalIVAO)) { |
|
| 102 | + $globalIVAO = FALSE; |
|
| 103 | + } |
|
| 104 | + if (!isset($globalVATSIM)) { |
|
| 105 | + $globalVATSIM = FALSE; |
|
| 106 | + } |
|
| 107 | + if (!isset($globalphpVMS)) { |
|
| 108 | + $globalphpVMS = FALSE; |
|
| 109 | + } |
|
| 110 | + if (!isset($globalVAM)) { |
|
| 111 | + $globalVAM = FALSE; |
|
| 112 | + } |
|
| 100 | 113 | date_default_timezone_set('UTC'); |
| 101 | 114 | |
| 102 | 115 | if (!is_string($query)) |
@@ -143,21 +156,35 @@ discard block |
||
| 143 | 156 | } else { |
| 144 | 157 | $temp_array['spotter_id'] = ''; |
| 145 | 158 | } |
| 146 | - if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 147 | - if (isset($row['modes'])) $temp_array['modes'] = $row['modes']; |
|
| 159 | + if (isset($row['flightaware_id'])) { |
|
| 160 | + $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 161 | + } |
|
| 162 | + if (isset($row['modes'])) { |
|
| 163 | + $temp_array['modes'] = $row['modes']; |
|
| 164 | + } |
|
| 148 | 165 | $temp_array['ident'] = $row['ident']; |
| 149 | 166 | if (isset($row['registration']) && $row['registration'] != '') { |
| 150 | 167 | $temp_array['registration'] = $row['registration']; |
| 151 | 168 | } elseif (isset($temp_array['modes'])) { |
| 152 | 169 | $temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']); |
| 153 | - } else $temp_array['registration'] = ''; |
|
| 154 | - if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 170 | + } else { |
|
| 171 | + $temp_array['registration'] = ''; |
|
| 172 | + } |
|
| 173 | + if (isset($row['aircraft_icao'])) { |
|
| 174 | + $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 175 | + } |
|
| 155 | 176 | |
| 156 | 177 | $temp_array['departure_airport'] = $row['departure_airport_icao']; |
| 157 | 178 | $temp_array['arrival_airport'] = $row['arrival_airport_icao']; |
| 158 | - if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 159 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
| 160 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
| 179 | + if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) { |
|
| 180 | + $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 181 | + } |
|
| 182 | + if (isset($row['latitude'])) { |
|
| 183 | + $temp_array['latitude'] = $row['latitude']; |
|
| 184 | + } |
|
| 185 | + if (isset($row['longitude'])) { |
|
| 186 | + $temp_array['longitude'] = $row['longitude']; |
|
| 187 | + } |
|
| 161 | 188 | /* |
| 162 | 189 | if (Connection->tableExists('countries')) { |
| 163 | 190 | $country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']); |
@@ -167,8 +194,12 @@ discard block |
||
| 167 | 194 | } |
| 168 | 195 | } |
| 169 | 196 | */ |
| 170 | - if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints']; |
|
| 171 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
| 197 | + if (isset($row['waypoints'])) { |
|
| 198 | + $temp_array['waypoints'] = $row['waypoints']; |
|
| 199 | + } |
|
| 200 | + if (isset($row['format_source'])) { |
|
| 201 | + $temp_array['format_source'] = $row['format_source']; |
|
| 202 | + } |
|
| 172 | 203 | if (isset($row['route_stop'])) { |
| 173 | 204 | $temp_array['route_stop'] = $row['route_stop']; |
| 174 | 205 | if ($row['route_stop'] != '') { |
@@ -187,13 +218,19 @@ discard block |
||
| 187 | 218 | } |
| 188 | 219 | } |
| 189 | 220 | } |
| 190 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
| 221 | + if (isset($row['altitude'])) { |
|
| 222 | + $temp_array['altitude'] = $row['altitude']; |
|
| 223 | + } |
|
| 191 | 224 | if (isset($row['heading'])) { |
| 192 | 225 | $temp_array['heading'] = $row['heading']; |
| 193 | 226 | $heading_direction = $this->parseDirection($row['heading']); |
| 194 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 227 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
| 228 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 229 | + } |
|
| 230 | + } |
|
| 231 | + if (isset($row['ground_speed'])) { |
|
| 232 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 195 | 233 | } |
| 196 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 197 | 234 | $temp_array['image'] = ""; |
| 198 | 235 | $temp_array['image_thumbnail'] = ""; |
| 199 | 236 | $temp_array['image_source'] = ""; |
@@ -201,7 +238,9 @@ discard block |
||
| 201 | 238 | |
| 202 | 239 | if (isset($row['highlight'])) { |
| 203 | 240 | $temp_array['highlight'] = $row['highlight']; |
| 204 | - } else $temp_array['highlight'] = ''; |
|
| 241 | + } else { |
|
| 242 | + $temp_array['highlight'] = ''; |
|
| 243 | + } |
|
| 205 | 244 | |
| 206 | 245 | if (isset($row['date'])) { |
| 207 | 246 | $dateArray = $this->parseDateString($row['date']); |
@@ -249,7 +288,9 @@ discard block |
||
| 249 | 288 | |
| 250 | 289 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
| 251 | 290 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
| 252 | - } else $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 291 | + } else { |
|
| 292 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 293 | + } |
|
| 253 | 294 | } else { |
| 254 | 295 | $temp_array['aircraft_shadow'] = 'default.png'; |
| 255 | 296 | $temp_array['aircraft_name'] = 'N/A'; |
@@ -257,11 +298,17 @@ discard block |
||
| 257 | 298 | } |
| 258 | 299 | } |
| 259 | 300 | $fromsource = NULL; |
| 260 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 261 | - elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 262 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 263 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 264 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 301 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 302 | + $fromsource = $globalAirlinesSource; |
|
| 303 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 304 | + $fromsource = 'vatsim'; |
|
| 305 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 306 | + $fromsource = 'ivao'; |
|
| 307 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 308 | + $fromsource = 'vatsim'; |
|
| 309 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 310 | + $fromsource = 'ivao'; |
|
| 311 | + } |
|
| 265 | 312 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
| 266 | 313 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
| 267 | 314 | if (is_numeric(substr($row['ident'], 2, 1))) { |
@@ -284,12 +331,18 @@ discard block |
||
| 284 | 331 | } |
| 285 | 332 | } else { |
| 286 | 333 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 287 | - if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 288 | - else $temp_array['airline_iata'] = ''; |
|
| 334 | + if (isset($row['airline_iata'])) { |
|
| 335 | + $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 336 | + } else { |
|
| 337 | + $temp_array['airline_iata'] = ''; |
|
| 338 | + } |
|
| 289 | 339 | $temp_array['airline_name'] = $row['airline_name']; |
| 290 | 340 | $temp_array['airline_country'] = $row['airline_country']; |
| 291 | - if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 292 | - else $temp_array['airline_callsign'] = 'N/A'; |
|
| 341 | + if (isset($row['airline_callsign'])) { |
|
| 342 | + $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 343 | + } else { |
|
| 344 | + $temp_array['airline_callsign'] = 'N/A'; |
|
| 345 | + } |
|
| 293 | 346 | $temp_array['airline_type'] = $row['airline_type']; |
| 294 | 347 | } |
| 295 | 348 | if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') { |
@@ -305,7 +358,9 @@ discard block |
||
| 305 | 358 | } |
| 306 | 359 | if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) { |
| 307 | 360 | $owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']); |
| 308 | - if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 361 | + if ($owner_info['owner'] != '') { |
|
| 362 | + $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 363 | + } |
|
| 309 | 364 | $temp_array['aircraft_base'] = $owner_info['base']; |
| 310 | 365 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
| 311 | 366 | } |
@@ -313,9 +368,14 @@ discard block |
||
| 313 | 368 | if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
| 314 | 369 | { |
| 315 | 370 | if ($globalIVAO) { |
| 316 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 317 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 318 | - } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 371 | + if (isset($temp_array['airline_icao'])) { |
|
| 372 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 373 | + } else { |
|
| 374 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 375 | + } |
|
| 376 | + } else { |
|
| 377 | + $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 378 | + } |
|
| 319 | 379 | if (count($image_array) > 0) { |
| 320 | 380 | $temp_array['image'] = $image_array[0]['image']; |
| 321 | 381 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -365,7 +425,9 @@ discard block |
||
| 365 | 425 | //if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') { |
| 366 | 426 | if ($row['departure_airport_icao'] != '') { |
| 367 | 427 | $departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']); |
| 368 | - if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 428 | + if (!isset($departure_airport_array[0]['name'])) { |
|
| 429 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 430 | + } |
|
| 369 | 431 | /* |
| 370 | 432 | } elseif ($row['departure_airport_name'] != '') { |
| 371 | 433 | $temp_array['departure_airport_name'] = $row['departure_airport_name']; |
@@ -373,7 +435,9 @@ discard block |
||
| 373 | 435 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 374 | 436 | $temp_array['departure_airport_icao'] = $row['departure_airport_icao']; |
| 375 | 437 | */ |
| 376 | - } else $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 438 | + } else { |
|
| 439 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 440 | + } |
|
| 377 | 441 | if (isset($departure_airport_array[0]['name'])) { |
| 378 | 442 | $temp_array['departure_airport_name'] = $departure_airport_array[0]['name']; |
| 379 | 443 | $temp_array['departure_airport_city'] = $departure_airport_array[0]['city']; |
@@ -393,8 +457,12 @@ discard block |
||
| 393 | 457 | |
| 394 | 458 | if ($row['arrival_airport_icao'] != '') { |
| 395 | 459 | $arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']); |
| 396 | - if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 397 | - } else $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 460 | + if (count($arrival_airport_array) == 0) { |
|
| 461 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 462 | + } |
|
| 463 | + } else { |
|
| 464 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 465 | + } |
|
| 398 | 466 | if (isset($arrival_airport_array[0]['name'])) { |
| 399 | 467 | $temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name']; |
| 400 | 468 | $temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city']; |
@@ -410,27 +478,45 @@ discard block |
||
| 410 | 478 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
| 411 | 479 | } |
| 412 | 480 | */ |
| 413 | - if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 414 | - if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 415 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
| 416 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
| 417 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
| 481 | + if (isset($row['pilot_id']) && $row['pilot_id'] != '') { |
|
| 482 | + $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 483 | + } |
|
| 484 | + if (isset($row['pilot_name']) && $row['pilot_name'] != '') { |
|
| 485 | + $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 486 | + } |
|
| 487 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
| 488 | + $temp_array['source_name'] = $row['source_name']; |
|
| 489 | + } |
|
| 490 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
| 491 | + $temp_array['over_country'] = $row['over_country']; |
|
| 492 | + } |
|
| 493 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
| 494 | + $temp_array['distance'] = $row['distance']; |
|
| 495 | + } |
|
| 418 | 496 | if (isset($row['squawk'])) { |
| 419 | 497 | $temp_array['squawk'] = $row['squawk']; |
| 420 | 498 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
| 421 | 499 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
| 422 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 500 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 501 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 502 | + } |
|
| 423 | 503 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
| 424 | 504 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
| 425 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 426 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 505 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 506 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 507 | + } |
|
| 508 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) { |
|
| 509 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 510 | + } |
|
| 427 | 511 | } |
| 428 | 512 | |
| 429 | 513 | $temp_array['query_number_rows'] = $num_rows; |
| 430 | 514 | |
| 431 | 515 | $spotter_array[] = $temp_array; |
| 432 | 516 | } |
| 433 | - if ($num_rows == 0) return array(); |
|
| 517 | + if ($num_rows == 0) { |
|
| 518 | + return array(); |
|
| 519 | + } |
|
| 434 | 520 | $spotter_array[0]['query_number_rows'] = $num_rows; |
| 435 | 521 | return $spotter_array; |
| 436 | 522 | } |
@@ -463,7 +549,9 @@ discard block |
||
| 463 | 549 | foreach ($q_array as $q_item){ |
| 464 | 550 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
| 465 | 551 | $additional_query .= " AND ("; |
| 466 | - if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 552 | + if (is_int($q_item)) { |
|
| 553 | + $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 554 | + } |
|
| 467 | 555 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
| 468 | 556 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
| 469 | 557 | $additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
@@ -484,7 +572,9 @@ discard block |
||
| 484 | 572 | $additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR "; |
| 485 | 573 | $additional_query .= "(spotter_output.ident like '%".$q_item."%') OR "; |
| 486 | 574 | $translate = $Translation->ident2icao($q_item); |
| 487 | - if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 575 | + if ($translate != $q_item) { |
|
| 576 | + $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 577 | + } |
|
| 488 | 578 | $additional_query .= "(spotter_output.highlight like '%".$q_item."%')"; |
| 489 | 579 | $additional_query .= ")"; |
| 490 | 580 | } |
@@ -711,7 +801,9 @@ discard block |
||
| 711 | 801 | date_default_timezone_set($globalTimezone); |
| 712 | 802 | $datetime = new DateTime(); |
| 713 | 803 | $offset = $datetime->format('P'); |
| 714 | - } else $offset = '+00:00'; |
|
| 804 | + } else { |
|
| 805 | + $offset = '+00:00'; |
|
| 806 | + } |
|
| 715 | 807 | |
| 716 | 808 | if ($date_array[1] != "") |
| 717 | 809 | { |
@@ -743,8 +835,12 @@ discard block |
||
| 743 | 835 | { |
| 744 | 836 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 745 | 837 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 746 | - } else $limit_query = ""; |
|
| 747 | - } else $limit_query = ""; |
|
| 838 | + } else { |
|
| 839 | + $limit_query = ""; |
|
| 840 | + } |
|
| 841 | + } else { |
|
| 842 | + $limit_query = ""; |
|
| 843 | + } |
|
| 748 | 844 | |
| 749 | 845 | |
| 750 | 846 | if ($sort != "") |
@@ -812,8 +908,12 @@ discard block |
||
| 812 | 908 | { |
| 813 | 909 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 814 | 910 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 815 | - } else $limit_query = ""; |
|
| 816 | - } else $limit_query = ""; |
|
| 911 | + } else { |
|
| 912 | + $limit_query = ""; |
|
| 913 | + } |
|
| 914 | + } else { |
|
| 915 | + $limit_query = ""; |
|
| 916 | + } |
|
| 817 | 917 | |
| 818 | 918 | if ($sort != "") |
| 819 | 919 | { |
@@ -1137,7 +1237,9 @@ discard block |
||
| 1137 | 1237 | global $global_query; |
| 1138 | 1238 | |
| 1139 | 1239 | date_default_timezone_set('UTC'); |
| 1140 | - if ($id == '') return array(); |
|
| 1240 | + if ($id == '') { |
|
| 1241 | + return array(); |
|
| 1242 | + } |
|
| 1141 | 1243 | $additional_query = "spotter_output.spotter_id = :id"; |
| 1142 | 1244 | $query_values = array(':id' => $id); |
| 1143 | 1245 | |
@@ -1764,7 +1866,9 @@ discard block |
||
| 1764 | 1866 | { |
| 1765 | 1867 | $highlight = $row['highlight']; |
| 1766 | 1868 | } |
| 1767 | - if (isset($highlight)) return $highlight; |
|
| 1869 | + if (isset($highlight)) { |
|
| 1870 | + return $highlight; |
|
| 1871 | + } |
|
| 1768 | 1872 | } |
| 1769 | 1873 | |
| 1770 | 1874 | |
@@ -1792,7 +1896,9 @@ discard block |
||
| 1792 | 1896 | $sth->closeCursor(); |
| 1793 | 1897 | if (count($row) > 0) { |
| 1794 | 1898 | return $row['usage']; |
| 1795 | - } else return ''; |
|
| 1899 | + } else { |
|
| 1900 | + return ''; |
|
| 1901 | + } |
|
| 1796 | 1902 | } |
| 1797 | 1903 | |
| 1798 | 1904 | /** |
@@ -1817,7 +1923,9 @@ discard block |
||
| 1817 | 1923 | $sth->closeCursor(); |
| 1818 | 1924 | if (count($row) > 0) { |
| 1819 | 1925 | return $row['icao']; |
| 1820 | - } else return ''; |
|
| 1926 | + } else { |
|
| 1927 | + return ''; |
|
| 1928 | + } |
|
| 1821 | 1929 | } |
| 1822 | 1930 | |
| 1823 | 1931 | /** |
@@ -1845,7 +1953,9 @@ discard block |
||
| 1845 | 1953 | $airport_longitude = $row['longitude']; |
| 1846 | 1954 | $Common = new Common(); |
| 1847 | 1955 | return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
| 1848 | - } else return ''; |
|
| 1956 | + } else { |
|
| 1957 | + return ''; |
|
| 1958 | + } |
|
| 1849 | 1959 | } |
| 1850 | 1960 | |
| 1851 | 1961 | /** |
@@ -1957,7 +2067,9 @@ discard block |
||
| 1957 | 2067 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1958 | 2068 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1959 | 2069 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1960 | - } else return array(); |
|
| 2070 | + } else { |
|
| 2071 | + return array(); |
|
| 2072 | + } |
|
| 1961 | 2073 | if ($globalDBdriver == 'mysql') { |
| 1962 | 2074 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
| 1963 | 2075 | } else { |
@@ -1992,7 +2104,9 @@ discard block |
||
| 1992 | 2104 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1993 | 2105 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1994 | 2106 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1995 | - } else return array(); |
|
| 2107 | + } else { |
|
| 2108 | + return array(); |
|
| 2109 | + } |
|
| 1996 | 2110 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
| 1997 | 2111 | $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.")"; |
| 1998 | 2112 | //$query = "SELECT waypoints.* FROM waypoints"; |
@@ -2027,7 +2141,9 @@ discard block |
||
| 2027 | 2141 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
| 2028 | 2142 | { |
| 2029 | 2143 | global $globalUseRealAirlines; |
| 2030 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2144 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2145 | + $fromsource = NULL; |
|
| 2146 | + } |
|
| 2031 | 2147 | $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
| 2032 | 2148 | if ($airline_icao == 'NA') { |
| 2033 | 2149 | $airline_array = array(); |
@@ -2077,7 +2193,9 @@ discard block |
||
| 2077 | 2193 | $sth->execute(array(':fromsource' => $fromsource)); |
| 2078 | 2194 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2079 | 2195 | $sth->closeCursor(); |
| 2080 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao); |
|
| 2196 | + if ($row['nb'] == 0) { |
|
| 2197 | + $result = $this->getAllAirlineInfo($airline_icao); |
|
| 2198 | + } |
|
| 2081 | 2199 | } |
| 2082 | 2200 | return $result; |
| 2083 | 2201 | } |
@@ -2141,15 +2259,20 @@ discard block |
||
| 2141 | 2259 | 'A320-211' => 'A320', |
| 2142 | 2260 | '747-8i' => 'B748', |
| 2143 | 2261 | 'A380' => 'A388'); |
| 2144 | - if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
|
| 2262 | + if (isset($all_aircraft[$aircraft_type])) { |
|
| 2263 | + return $all_aircraft[$aircraft_type]; |
|
| 2264 | + } |
|
| 2145 | 2265 | |
| 2146 | 2266 | $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
| 2147 | 2267 | $aircraft_type = strtoupper($aircraft_type); |
| 2148 | 2268 | $sth = $this->db->prepare($query); |
| 2149 | 2269 | $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
| 2150 | 2270 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2151 | - if (isset($result[0]['icao'])) return $result[0]['icao']; |
|
| 2152 | - else return ''; |
|
| 2271 | + if (isset($result[0]['icao'])) { |
|
| 2272 | + return $result[0]['icao']; |
|
| 2273 | + } else { |
|
| 2274 | + return ''; |
|
| 2275 | + } |
|
| 2153 | 2276 | } |
| 2154 | 2277 | |
| 2155 | 2278 | /** |
@@ -2172,7 +2295,9 @@ discard block |
||
| 2172 | 2295 | $sth->closeCursor(); |
| 2173 | 2296 | if (isset($row['icaotypecode'])) { |
| 2174 | 2297 | return $row['icaotypecode']; |
| 2175 | - } else return ''; |
|
| 2298 | + } else { |
|
| 2299 | + return ''; |
|
| 2300 | + } |
|
| 2176 | 2301 | } |
| 2177 | 2302 | |
| 2178 | 2303 | /** |
@@ -2194,7 +2319,9 @@ discard block |
||
| 2194 | 2319 | $sth->closeCursor(); |
| 2195 | 2320 | if (isset($row['operator_correct'])) { |
| 2196 | 2321 | return $row['operator_correct']; |
| 2197 | - } else return $operator; |
|
| 2322 | + } else { |
|
| 2323 | + return $operator; |
|
| 2324 | + } |
|
| 2198 | 2325 | } |
| 2199 | 2326 | |
| 2200 | 2327 | /** |
@@ -2207,7 +2334,9 @@ discard block |
||
| 2207 | 2334 | public function getRouteInfo($callsign) |
| 2208 | 2335 | { |
| 2209 | 2336 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
| 2210 | - if ($callsign == '') return array(); |
|
| 2337 | + if ($callsign == '') { |
|
| 2338 | + return array(); |
|
| 2339 | + } |
|
| 2211 | 2340 | $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"; |
| 2212 | 2341 | |
| 2213 | 2342 | $sth = $this->db->prepare($query); |
@@ -2217,7 +2346,9 @@ discard block |
||
| 2217 | 2346 | $sth->closeCursor(); |
| 2218 | 2347 | if (count($row) > 0) { |
| 2219 | 2348 | return $row; |
| 2220 | - } else return array(); |
|
| 2349 | + } else { |
|
| 2350 | + return array(); |
|
| 2351 | + } |
|
| 2221 | 2352 | } |
| 2222 | 2353 | |
| 2223 | 2354 | /** |
@@ -2270,7 +2401,9 @@ discard block |
||
| 2270 | 2401 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 2271 | 2402 | $sth->closeCursor(); |
| 2272 | 2403 | return $result; |
| 2273 | - } else return array(); |
|
| 2404 | + } else { |
|
| 2405 | + return array(); |
|
| 2406 | + } |
|
| 2274 | 2407 | } |
| 2275 | 2408 | |
| 2276 | 2409 | |
@@ -2427,8 +2560,11 @@ discard block |
||
| 2427 | 2560 | $query .= " ORDER BY spotter_output.source_name ASC"; |
| 2428 | 2561 | |
| 2429 | 2562 | $sth = $this->db->prepare($query); |
| 2430 | - if (!empty($query_values)) $sth->execute($query_values); |
|
| 2431 | - else $sth->execute(); |
|
| 2563 | + if (!empty($query_values)) { |
|
| 2564 | + $sth->execute($query_values); |
|
| 2565 | + } else { |
|
| 2566 | + $sth->execute(); |
|
| 2567 | + } |
|
| 2432 | 2568 | |
| 2433 | 2569 | $source_array = array(); |
| 2434 | 2570 | $temp_array = array(); |
@@ -2461,9 +2597,13 @@ discard block |
||
| 2461 | 2597 | WHERE spotter_output.airline_icao <> '' |
| 2462 | 2598 | ORDER BY spotter_output.airline_name ASC"; |
| 2463 | 2599 | */ |
| 2464 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2465 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2466 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2600 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2601 | + $forsource = $globalAirlinesSource; |
|
| 2602 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2603 | + $forsource = 'vatsim'; |
|
| 2604 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2605 | + $forsource = 'ivao'; |
|
| 2606 | + } |
|
| 2467 | 2607 | if ($forsource === NULL) { |
| 2468 | 2608 | $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"; |
| 2469 | 2609 | $query_data = array(); |
@@ -2755,7 +2895,9 @@ discard block |
||
| 2755 | 2895 | date_default_timezone_set($globalTimezone); |
| 2756 | 2896 | $datetime = new DateTime(); |
| 2757 | 2897 | $offset = $datetime->format('P'); |
| 2758 | - } else $offset = '+00:00'; |
|
| 2898 | + } else { |
|
| 2899 | + $offset = '+00:00'; |
|
| 2900 | + } |
|
| 2759 | 2901 | if ($airport_icao == '') { |
| 2760 | 2902 | if ($globalDBdriver == 'mysql') { |
| 2761 | 2903 | $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' 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"; |
@@ -2787,7 +2929,9 @@ discard block |
||
| 2787 | 2929 | date_default_timezone_set($globalTimezone); |
| 2788 | 2930 | $datetime = new DateTime(); |
| 2789 | 2931 | $offset = $datetime->format('P'); |
| 2790 | - } else $offset = '+00:00'; |
|
| 2932 | + } else { |
|
| 2933 | + $offset = '+00:00'; |
|
| 2934 | + } |
|
| 2791 | 2935 | if ($airport_icao == '') { |
| 2792 | 2936 | if ($globalDBdriver == 'mysql') { |
| 2793 | 2937 | $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 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"; |
@@ -2820,7 +2964,9 @@ discard block |
||
| 2820 | 2964 | date_default_timezone_set($globalTimezone); |
| 2821 | 2965 | $datetime = new DateTime(); |
| 2822 | 2966 | $offset = $datetime->format('P'); |
| 2823 | - } else $offset = '+00:00'; |
|
| 2967 | + } else { |
|
| 2968 | + $offset = '+00:00'; |
|
| 2969 | + } |
|
| 2824 | 2970 | if ($airport_icao == '') { |
| 2825 | 2971 | if ($globalDBdriver == 'mysql') { |
| 2826 | 2972 | $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 |
@@ -2859,7 +3005,9 @@ discard block |
||
| 2859 | 3005 | date_default_timezone_set($globalTimezone); |
| 2860 | 3006 | $datetime = new DateTime(); |
| 2861 | 3007 | $offset = $datetime->format('P'); |
| 2862 | - } else $offset = '+00:00'; |
|
| 3008 | + } else { |
|
| 3009 | + $offset = '+00:00'; |
|
| 3010 | + } |
|
| 2863 | 3011 | if ($airport_icao == '') { |
| 2864 | 3012 | if ($globalDBdriver == 'mysql') { |
| 2865 | 3013 | $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 |
@@ -2904,7 +3052,9 @@ discard block |
||
| 2904 | 3052 | date_default_timezone_set($globalTimezone); |
| 2905 | 3053 | $datetime = new DateTime(); |
| 2906 | 3054 | $offset = $datetime->format('P'); |
| 2907 | - } else $offset = '+00:00'; |
|
| 3055 | + } else { |
|
| 3056 | + $offset = '+00:00'; |
|
| 3057 | + } |
|
| 2908 | 3058 | if ($airport_icao == '') { |
| 2909 | 3059 | if ($globalDBdriver == 'mysql') { |
| 2910 | 3060 | $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' 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"; |
@@ -2939,7 +3089,9 @@ discard block |
||
| 2939 | 3089 | date_default_timezone_set($globalTimezone); |
| 2940 | 3090 | $datetime = new DateTime(); |
| 2941 | 3091 | $offset = $datetime->format('P'); |
| 2942 | - } else $offset = '+00:00'; |
|
| 3092 | + } else { |
|
| 3093 | + $offset = '+00:00'; |
|
| 3094 | + } |
|
| 2943 | 3095 | if ($airport_icao == '') { |
| 2944 | 3096 | if ($globalDBdriver == 'mysql') { |
| 2945 | 3097 | $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 |
@@ -2981,7 +3133,9 @@ discard block |
||
| 2981 | 3133 | date_default_timezone_set($globalTimezone); |
| 2982 | 3134 | $datetime = new DateTime(); |
| 2983 | 3135 | $offset = $datetime->format('P'); |
| 2984 | - } else $offset = '+00:00'; |
|
| 3136 | + } else { |
|
| 3137 | + $offset = '+00:00'; |
|
| 3138 | + } |
|
| 2985 | 3139 | if ($airport_icao == '') { |
| 2986 | 3140 | if ($globalDBdriver == 'mysql') { |
| 2987 | 3141 | $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 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"; |
@@ -3015,7 +3169,9 @@ discard block |
||
| 3015 | 3169 | date_default_timezone_set($globalTimezone); |
| 3016 | 3170 | $datetime = new DateTime(); |
| 3017 | 3171 | $offset = $datetime->format('P'); |
| 3018 | - } else $offset = '+00:00'; |
|
| 3172 | + } else { |
|
| 3173 | + $offset = '+00:00'; |
|
| 3174 | + } |
|
| 3019 | 3175 | if ($airport_icao == '') { |
| 3020 | 3176 | if ($globalDBdriver == 'mysql') { |
| 3021 | 3177 | $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 |
@@ -3063,7 +3219,9 @@ discard block |
||
| 3063 | 3219 | date_default_timezone_set($globalTimezone); |
| 3064 | 3220 | $datetime = new DateTime(); |
| 3065 | 3221 | $offset = $datetime->format('P'); |
| 3066 | - } else $offset = '+00:00'; |
|
| 3222 | + } else { |
|
| 3223 | + $offset = '+00:00'; |
|
| 3224 | + } |
|
| 3067 | 3225 | |
| 3068 | 3226 | if ($globalDBdriver == 'mysql') { |
| 3069 | 3227 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
@@ -3183,7 +3341,9 @@ discard block |
||
| 3183 | 3341 | */ |
| 3184 | 3342 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
| 3185 | 3343 | { |
| 3186 | - if ($groundspeed == '') $groundspeed = NULL; |
|
| 3344 | + if ($groundspeed == '') { |
|
| 3345 | + $groundspeed = NULL; |
|
| 3346 | + } |
|
| 3187 | 3347 | $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'; |
| 3188 | 3348 | $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); |
| 3189 | 3349 | |
@@ -3233,10 +3393,18 @@ discard block |
||
| 3233 | 3393 | $Image = new Image($this->db); |
| 3234 | 3394 | $Common = new Common(); |
| 3235 | 3395 | |
| 3236 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 3237 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 3238 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 3239 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 3396 | + if (!isset($globalIVAO)) { |
|
| 3397 | + $globalIVAO = FALSE; |
|
| 3398 | + } |
|
| 3399 | + if (!isset($globalVATSIM)) { |
|
| 3400 | + $globalVATSIM = FALSE; |
|
| 3401 | + } |
|
| 3402 | + if (!isset($globalphpVMS)) { |
|
| 3403 | + $globalphpVMS = FALSE; |
|
| 3404 | + } |
|
| 3405 | + if (!isset($globalVAM)) { |
|
| 3406 | + $globalVAM = FALSE; |
|
| 3407 | + } |
|
| 3240 | 3408 | date_default_timezone_set('UTC'); |
| 3241 | 3409 | |
| 3242 | 3410 | //getting the registration |
@@ -3249,23 +3417,33 @@ discard block |
||
| 3249 | 3417 | if ($ModeS != '') { |
| 3250 | 3418 | $timeelapsed = microtime(true); |
| 3251 | 3419 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
| 3252 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3420 | + if ($globalDebugTimeElapsed) { |
|
| 3421 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3422 | + } |
|
| 3253 | 3423 | } else { |
| 3254 | 3424 | $myhex = explode('-',$flightaware_id); |
| 3255 | 3425 | if (count($myhex) > 0) { |
| 3256 | 3426 | $timeelapsed = microtime(true); |
| 3257 | 3427 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
| 3258 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3428 | + if ($globalDebugTimeElapsed) { |
|
| 3429 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3430 | + } |
|
| 3259 | 3431 | } |
| 3260 | 3432 | } |
| 3261 | 3433 | } |
| 3262 | 3434 | } |
| 3263 | 3435 | $fromsource = NULL; |
| 3264 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 3265 | - elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 3266 | - elseif ($format_source == 'whazzup') $fromsource = 'ivao'; |
|
| 3267 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 3268 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 3436 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 3437 | + $fromsource = $globalAirlinesSource; |
|
| 3438 | + } elseif ($format_source == 'vatsimtxt') { |
|
| 3439 | + $fromsource = 'vatsim'; |
|
| 3440 | + } elseif ($format_source == 'whazzup') { |
|
| 3441 | + $fromsource = 'ivao'; |
|
| 3442 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 3443 | + $fromsource = 'vatsim'; |
|
| 3444 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 3445 | + $fromsource = 'ivao'; |
|
| 3446 | + } |
|
| 3269 | 3447 | //getting the airline information |
| 3270 | 3448 | if ($ident != "") |
| 3271 | 3449 | { |
@@ -3289,15 +3467,21 @@ discard block |
||
| 3289 | 3467 | if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
| 3290 | 3468 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3291 | 3469 | } |
| 3292 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3470 | + if ($globalDebugTimeElapsed) { |
|
| 3471 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3472 | + } |
|
| 3293 | 3473 | |
| 3294 | 3474 | } else { |
| 3295 | 3475 | $timeelapsed = microtime(true); |
| 3296 | 3476 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3297 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3477 | + if ($globalDebugTimeElapsed) { |
|
| 3478 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3479 | + } |
|
| 3298 | 3480 | } |
| 3299 | 3481 | } |
| 3300 | - } else $airline_array = array(); |
|
| 3482 | + } else { |
|
| 3483 | + $airline_array = array(); |
|
| 3484 | + } |
|
| 3301 | 3485 | |
| 3302 | 3486 | //getting the aircraft information |
| 3303 | 3487 | $aircraft_array = array(); |
@@ -3311,27 +3495,37 @@ discard block |
||
| 3311 | 3495 | { |
| 3312 | 3496 | $timeelapsed = microtime(true); |
| 3313 | 3497 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3314 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3498 | + if ($globalDebugTimeElapsed) { |
|
| 3499 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3500 | + } |
|
| 3315 | 3501 | } else { |
| 3316 | 3502 | $timeelapsed = microtime(true); |
| 3317 | 3503 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3318 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3504 | + if ($globalDebugTimeElapsed) { |
|
| 3505 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3506 | + } |
|
| 3319 | 3507 | } |
| 3320 | 3508 | } |
| 3321 | 3509 | } else { |
| 3322 | 3510 | if ($ModeS != '') { |
| 3323 | 3511 | $timeelapsed = microtime(true); |
| 3324 | 3512 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
| 3325 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3513 | + if ($globalDebugTimeElapsed) { |
|
| 3514 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3515 | + } |
|
| 3326 | 3516 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
| 3327 | 3517 | { |
| 3328 | 3518 | $timeelapsed = microtime(true); |
| 3329 | 3519 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3330 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3520 | + if ($globalDebugTimeElapsed) { |
|
| 3521 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3522 | + } |
|
| 3331 | 3523 | } else { |
| 3332 | 3524 | $timeelapsed = microtime(true); |
| 3333 | 3525 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3334 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3526 | + if ($globalDebugTimeElapsed) { |
|
| 3527 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3528 | + } |
|
| 3335 | 3529 | } |
| 3336 | 3530 | } |
| 3337 | 3531 | } |
@@ -3346,7 +3540,9 @@ discard block |
||
| 3346 | 3540 | } else { |
| 3347 | 3541 | $timeelapsed = microtime(true); |
| 3348 | 3542 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
| 3349 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3543 | + if ($globalDebugTimeElapsed) { |
|
| 3544 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3545 | + } |
|
| 3350 | 3546 | } |
| 3351 | 3547 | } |
| 3352 | 3548 | |
@@ -3360,7 +3556,9 @@ discard block |
||
| 3360 | 3556 | } else { |
| 3361 | 3557 | $timeelapsed = microtime(true); |
| 3362 | 3558 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
| 3363 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3559 | + if ($globalDebugTimeElapsed) { |
|
| 3560 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3561 | + } |
|
| 3364 | 3562 | } |
| 3365 | 3563 | } |
| 3366 | 3564 | |
@@ -3395,7 +3593,9 @@ discard block |
||
| 3395 | 3593 | { |
| 3396 | 3594 | return false; |
| 3397 | 3595 | } |
| 3398 | - } else $altitude = 0; |
|
| 3596 | + } else { |
|
| 3597 | + $altitude = 0; |
|
| 3598 | + } |
|
| 3399 | 3599 | |
| 3400 | 3600 | if ($heading != "") |
| 3401 | 3601 | { |
@@ -3424,7 +3624,9 @@ discard block |
||
| 3424 | 3624 | { |
| 3425 | 3625 | $timeelapsed = microtime(true); |
| 3426 | 3626 | $image_array = $Image->getSpotterImage($registration); |
| 3427 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3627 | + if ($globalDebugTimeElapsed) { |
|
| 3628 | + echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3629 | + } |
|
| 3428 | 3630 | if (!isset($image_array[0]['registration'])) |
| 3429 | 3631 | { |
| 3430 | 3632 | //echo "Add image !!!! \n"; |
@@ -3432,14 +3634,21 @@ discard block |
||
| 3432 | 3634 | } |
| 3433 | 3635 | $timeelapsed = microtime(true); |
| 3434 | 3636 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
| 3435 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3436 | - if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 3637 | + if ($globalDebugTimeElapsed) { |
|
| 3638 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3639 | + } |
|
| 3640 | + if ($owner_info['owner'] != '') { |
|
| 3641 | + $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 3642 | + } |
|
| 3437 | 3643 | } |
| 3438 | 3644 | |
| 3439 | 3645 | if ($globalIVAO && $aircraft_icao != '') |
| 3440 | 3646 | { |
| 3441 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3442 | - else $airline_icao = ''; |
|
| 3647 | + if (isset($airline_array[0]['icao'])) { |
|
| 3648 | + $airline_icao = $airline_array[0]['icao']; |
|
| 3649 | + } else { |
|
| 3650 | + $airline_icao = ''; |
|
| 3651 | + } |
|
| 3443 | 3652 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
| 3444 | 3653 | if (!isset($image_array[0]['registration'])) |
| 3445 | 3654 | { |
@@ -3484,16 +3693,28 @@ discard block |
||
| 3484 | 3693 | { |
| 3485 | 3694 | $arrival_airport_array = $this->getAllAirportInfo('NA'); |
| 3486 | 3695 | } |
| 3487 | - if ($registration == '') $registration = 'NA'; |
|
| 3696 | + if ($registration == '') { |
|
| 3697 | + $registration = 'NA'; |
|
| 3698 | + } |
|
| 3488 | 3699 | if ($latitude == '' && $longitude == '') { |
| 3489 | 3700 | $latitude = 0; |
| 3490 | 3701 | $longitude = 0; |
| 3491 | 3702 | } |
| 3492 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3493 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3494 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3495 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3496 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 3703 | + if ($squawk == '' || $Common->isInteger($squawk) === false) { |
|
| 3704 | + $squawk = NULL; |
|
| 3705 | + } |
|
| 3706 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) { |
|
| 3707 | + $verticalrate = NULL; |
|
| 3708 | + } |
|
| 3709 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
| 3710 | + $heading = 0; |
|
| 3711 | + } |
|
| 3712 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
| 3713 | + $groundspeed = 0; |
|
| 3714 | + } |
|
| 3715 | + if (!isset($aircraft_owner)) { |
|
| 3716 | + $aircraft_owner = NULL; |
|
| 3717 | + } |
|
| 3497 | 3718 | $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) |
| 3498 | 3719 | 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)"; |
| 3499 | 3720 | |
@@ -3504,9 +3725,13 @@ discard block |
||
| 3504 | 3725 | if ($airline_type == '') { |
| 3505 | 3726 | $timeelapsed = microtime(true); |
| 3506 | 3727 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3507 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3728 | + if ($globalDebugTimeElapsed) { |
|
| 3729 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3730 | + } |
|
| 3731 | + } |
|
| 3732 | + if ($airline_type == null) { |
|
| 3733 | + $airline_type = ''; |
|
| 3508 | 3734 | } |
| 3509 | - if ($airline_type == null) $airline_type = ''; |
|
| 3510 | 3735 | $aircraft_type = $aircraft_array[0]['type']; |
| 3511 | 3736 | $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
| 3512 | 3737 | $departure_airport_name = $departure_airport_array[0]['name']; |
@@ -3641,7 +3866,9 @@ discard block |
||
| 3641 | 3866 | } |
| 3642 | 3867 | } |
| 3643 | 3868 | $query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC"; |
| 3644 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 3869 | + if ($limit) { |
|
| 3870 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 3871 | + } |
|
| 3645 | 3872 | |
| 3646 | 3873 | $sth = $this->db->prepare($query); |
| 3647 | 3874 | $sth->execute(); |
@@ -3686,7 +3913,9 @@ discard block |
||
| 3686 | 3913 | } |
| 3687 | 3914 | } |
| 3688 | 3915 | $query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC"; |
| 3689 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 3916 | + if ($limit) { |
|
| 3917 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 3918 | + } |
|
| 3690 | 3919 | |
| 3691 | 3920 | |
| 3692 | 3921 | $sth = $this->db->prepare($query); |
@@ -3731,7 +3960,9 @@ discard block |
||
| 3731 | 3960 | } |
| 3732 | 3961 | } |
| 3733 | 3962 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC"; |
| 3734 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 3963 | + if ($limit) { |
|
| 3964 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 3965 | + } |
|
| 3735 | 3966 | |
| 3736 | 3967 | |
| 3737 | 3968 | $sth = $this->db->prepare($query); |
@@ -3778,7 +4009,9 @@ discard block |
||
| 3778 | 4009 | } |
| 3779 | 4010 | } |
| 3780 | 4011 | $query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC"; |
| 3781 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4012 | + if ($limit) { |
|
| 4013 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4014 | + } |
|
| 3782 | 4015 | |
| 3783 | 4016 | |
| 3784 | 4017 | $sth = $this->db->prepare($query); |
@@ -3823,7 +4056,9 @@ discard block |
||
| 3823 | 4056 | } |
| 3824 | 4057 | } |
| 3825 | 4058 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC"; |
| 3826 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4059 | + if ($limit) { |
|
| 4060 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4061 | + } |
|
| 3827 | 4062 | |
| 3828 | 4063 | |
| 3829 | 4064 | $sth = $this->db->prepare($query); |
@@ -4066,7 +4301,9 @@ discard block |
||
| 4066 | 4301 | date_default_timezone_set($globalTimezone); |
| 4067 | 4302 | $datetime = new DateTime($date); |
| 4068 | 4303 | $offset = $datetime->format('P'); |
| 4069 | - } else $offset = '+00:00'; |
|
| 4304 | + } else { |
|
| 4305 | + $offset = '+00:00'; |
|
| 4306 | + } |
|
| 4070 | 4307 | |
| 4071 | 4308 | if ($globalDBdriver == 'mysql') { |
| 4072 | 4309 | $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
@@ -4114,7 +4351,9 @@ discard block |
||
| 4114 | 4351 | date_default_timezone_set($globalTimezone); |
| 4115 | 4352 | $datetime = new DateTime($date); |
| 4116 | 4353 | $offset = $datetime->format('P'); |
| 4117 | - } else $offset = '+00:00'; |
|
| 4354 | + } else { |
|
| 4355 | + $offset = '+00:00'; |
|
| 4356 | + } |
|
| 4118 | 4357 | |
| 4119 | 4358 | if ($globalDBdriver == 'mysql') { |
| 4120 | 4359 | $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
@@ -4332,7 +4571,9 @@ discard block |
||
| 4332 | 4571 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' |
| 4333 | 4572 | GROUP BY spotter_output.airline_country |
| 4334 | 4573 | ORDER BY airline_country_count DESC"; |
| 4335 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4574 | + if ($limit) { |
|
| 4575 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4576 | + } |
|
| 4336 | 4577 | |
| 4337 | 4578 | $sth = $this->db->prepare($query); |
| 4338 | 4579 | $sth->execute(); |
@@ -4360,7 +4601,9 @@ discard block |
||
| 4360 | 4601 | global $globalDBdriver; |
| 4361 | 4602 | //$filter_query = $this->getFilter($filters,true,true); |
| 4362 | 4603 | $Connection= new Connection($this->db); |
| 4363 | - if (!$Connection->tableExists('countries')) return array(); |
|
| 4604 | + if (!$Connection->tableExists('countries')) { |
|
| 4605 | + return array(); |
|
| 4606 | + } |
|
| 4364 | 4607 | /* |
| 4365 | 4608 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
| 4366 | 4609 | FROM countries c, spotter_output s |
@@ -4385,7 +4628,9 @@ discard block |
||
| 4385 | 4628 | } |
| 4386 | 4629 | |
| 4387 | 4630 | $query .= "GROUP BY c.name ORDER BY nb DESC"; |
| 4388 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4631 | + if ($limit) { |
|
| 4632 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4633 | + } |
|
| 4389 | 4634 | |
| 4390 | 4635 | |
| 4391 | 4636 | $sth = $this->db->prepare($query); |
@@ -4435,7 +4680,9 @@ discard block |
||
| 4435 | 4680 | } |
| 4436 | 4681 | |
| 4437 | 4682 | $query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 4438 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4683 | + if ($limit) { |
|
| 4684 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4685 | + } |
|
| 4439 | 4686 | |
| 4440 | 4687 | $sth = $this->db->prepare($query); |
| 4441 | 4688 | $sth->execute(); |
@@ -4481,7 +4728,9 @@ discard block |
||
| 4481 | 4728 | } |
| 4482 | 4729 | |
| 4483 | 4730 | $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"; |
| 4484 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4731 | + if ($limit) { |
|
| 4732 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4733 | + } |
|
| 4485 | 4734 | |
| 4486 | 4735 | $sth = $this->db->prepare($query); |
| 4487 | 4736 | $sth->execute(); |
@@ -4534,7 +4783,9 @@ discard block |
||
| 4534 | 4783 | if($row['registration'] != "") |
| 4535 | 4784 | { |
| 4536 | 4785 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4537 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 4786 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 4787 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 4788 | + } |
|
| 4538 | 4789 | } |
| 4539 | 4790 | $temp_array['registration_count'] = $row['registration_count']; |
| 4540 | 4791 | |
@@ -4609,7 +4860,9 @@ discard block |
||
| 4609 | 4860 | if($row['registration'] != "") |
| 4610 | 4861 | { |
| 4611 | 4862 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4612 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 4863 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 4864 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 4865 | + } |
|
| 4613 | 4866 | } |
| 4614 | 4867 | $temp_array['registration_count'] = $row['registration_count']; |
| 4615 | 4868 | |
@@ -4716,7 +4969,9 @@ discard block |
||
| 4716 | 4969 | if($row['registration'] != "") |
| 4717 | 4970 | { |
| 4718 | 4971 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4719 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 4972 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 4973 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 4974 | + } |
|
| 4720 | 4975 | } |
| 4721 | 4976 | $temp_array['registration_count'] = $row['registration_count']; |
| 4722 | 4977 | $aircraft_array[] = $temp_array; |
@@ -4841,7 +5096,9 @@ discard block |
||
| 4841 | 5096 | date_default_timezone_set($globalTimezone); |
| 4842 | 5097 | $datetime = new DateTime($date); |
| 4843 | 5098 | $offset = $datetime->format('P'); |
| 4844 | - } else $offset = '+00:00'; |
|
| 5099 | + } else { |
|
| 5100 | + $offset = '+00:00'; |
|
| 5101 | + } |
|
| 4845 | 5102 | |
| 4846 | 5103 | if ($globalDBdriver == 'mysql') { |
| 4847 | 5104 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
@@ -4888,7 +5145,9 @@ discard block |
||
| 4888 | 5145 | date_default_timezone_set($globalTimezone); |
| 4889 | 5146 | $datetime = new DateTime($date); |
| 4890 | 5147 | $offset = $datetime->format('P'); |
| 4891 | - } else $offset = '+00:00'; |
|
| 5148 | + } else { |
|
| 5149 | + $offset = '+00:00'; |
|
| 5150 | + } |
|
| 4892 | 5151 | |
| 4893 | 5152 | if ($globalDBdriver == 'mysql') { |
| 4894 | 5153 | $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 |
@@ -4917,7 +5176,9 @@ discard block |
||
| 4917 | 5176 | if($row['registration'] != "") |
| 4918 | 5177 | { |
| 4919 | 5178 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4920 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5179 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5180 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5181 | + } |
|
| 4921 | 5182 | } |
| 4922 | 5183 | $temp_array['registration_count'] = $row['registration_count']; |
| 4923 | 5184 | |
@@ -4942,7 +5203,9 @@ discard block |
||
| 4942 | 5203 | date_default_timezone_set($globalTimezone); |
| 4943 | 5204 | $datetime = new DateTime($date); |
| 4944 | 5205 | $offset = $datetime->format('P'); |
| 4945 | - } else $offset = '+00:00'; |
|
| 5206 | + } else { |
|
| 5207 | + $offset = '+00:00'; |
|
| 5208 | + } |
|
| 4946 | 5209 | |
| 4947 | 5210 | if ($globalDBdriver == 'mysql') { |
| 4948 | 5211 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
@@ -5040,8 +5303,11 @@ discard block |
||
| 5040 | 5303 | if($row['registration'] != "") |
| 5041 | 5304 | { |
| 5042 | 5305 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5043 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5044 | - else $temp_array['image_thumbnail'] = ''; |
|
| 5306 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5307 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5308 | + } else { |
|
| 5309 | + $temp_array['image_thumbnail'] = ''; |
|
| 5310 | + } |
|
| 5045 | 5311 | } |
| 5046 | 5312 | $temp_array['registration_count'] = $row['registration_count']; |
| 5047 | 5313 | $aircraft_array[] = $temp_array; |
@@ -5148,7 +5414,9 @@ discard block |
||
| 5148 | 5414 | if($row['registration'] != "") |
| 5149 | 5415 | { |
| 5150 | 5416 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5151 | - 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 | + } |
|
| 5152 | 5420 | } |
| 5153 | 5421 | $temp_array['registration_count'] = $row['registration_count']; |
| 5154 | 5422 | |
@@ -5265,7 +5533,9 @@ discard block |
||
| 5265 | 5533 | if($row['registration'] != "") |
| 5266 | 5534 | { |
| 5267 | 5535 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5268 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5536 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5537 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5538 | + } |
|
| 5269 | 5539 | } |
| 5270 | 5540 | $temp_array['registration_count'] = $row['registration_count']; |
| 5271 | 5541 | |
@@ -5377,7 +5647,9 @@ discard block |
||
| 5377 | 5647 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5378 | 5648 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5379 | 5649 | $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
| 5380 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5650 | + if ($limit) { |
|
| 5651 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5652 | + } |
|
| 5381 | 5653 | |
| 5382 | 5654 | $sth = $this->db->prepare($query); |
| 5383 | 5655 | $sth->execute(); |
@@ -5396,7 +5668,9 @@ discard block |
||
| 5396 | 5668 | if($row['registration'] != "") |
| 5397 | 5669 | { |
| 5398 | 5670 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5399 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5671 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5672 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5673 | + } |
|
| 5400 | 5674 | } |
| 5401 | 5675 | |
| 5402 | 5676 | $aircraft_array[] = $temp_array; |
@@ -5437,7 +5711,9 @@ discard block |
||
| 5437 | 5711 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5438 | 5712 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5439 | 5713 | $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"; |
| 5440 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5714 | + if ($limit) { |
|
| 5715 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5716 | + } |
|
| 5441 | 5717 | |
| 5442 | 5718 | $sth = $this->db->prepare($query); |
| 5443 | 5719 | $sth->execute(); |
@@ -5457,7 +5733,9 @@ discard block |
||
| 5457 | 5733 | if($row['registration'] != "") |
| 5458 | 5734 | { |
| 5459 | 5735 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5460 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5736 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5737 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5738 | + } |
|
| 5461 | 5739 | } |
| 5462 | 5740 | |
| 5463 | 5741 | $aircraft_array[] = $temp_array; |
@@ -5498,7 +5776,9 @@ discard block |
||
| 5498 | 5776 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5499 | 5777 | $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 5500 | 5778 | ORDER BY airport_departure_icao_count DESC"; |
| 5501 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5779 | + if ($limit) { |
|
| 5780 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5781 | + } |
|
| 5502 | 5782 | |
| 5503 | 5783 | $sth = $this->db->prepare($query); |
| 5504 | 5784 | $sth->execute(); |
@@ -5550,7 +5830,9 @@ discard block |
||
| 5550 | 5830 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5551 | 5831 | $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 |
| 5552 | 5832 | ORDER BY airport_departure_icao_count DESC"; |
| 5553 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5833 | + if ($limit) { |
|
| 5834 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5835 | + } |
|
| 5554 | 5836 | |
| 5555 | 5837 | $sth = $this->db->prepare($query); |
| 5556 | 5838 | $sth->execute(); |
@@ -5602,7 +5884,9 @@ discard block |
||
| 5602 | 5884 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5603 | 5885 | $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
| 5604 | 5886 | ORDER BY airport_departure_icao_count DESC"; |
| 5605 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5887 | + if ($limit) { |
|
| 5888 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5889 | + } |
|
| 5606 | 5890 | //echo $query; |
| 5607 | 5891 | $sth = $this->db->prepare($query); |
| 5608 | 5892 | $sth->execute(); |
@@ -5654,7 +5938,9 @@ discard block |
||
| 5654 | 5938 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5655 | 5939 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
| 5656 | 5940 | ORDER BY airport_departure_icao_count DESC"; |
| 5657 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5941 | + if ($limit) { |
|
| 5942 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5943 | + } |
|
| 5658 | 5944 | |
| 5659 | 5945 | $sth = $this->db->prepare($query); |
| 5660 | 5946 | $sth->execute(); |
@@ -6049,7 +6335,9 @@ discard block |
||
| 6049 | 6335 | date_default_timezone_set($globalTimezone); |
| 6050 | 6336 | $datetime = new DateTime($date); |
| 6051 | 6337 | $offset = $datetime->format('P'); |
| 6052 | - } else $offset = '+00:00'; |
|
| 6338 | + } else { |
|
| 6339 | + $offset = '+00:00'; |
|
| 6340 | + } |
|
| 6053 | 6341 | |
| 6054 | 6342 | if ($globalDBdriver == 'mysql') { |
| 6055 | 6343 | $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 |
@@ -6099,7 +6387,9 @@ discard block |
||
| 6099 | 6387 | date_default_timezone_set($globalTimezone); |
| 6100 | 6388 | $datetime = new DateTime($date); |
| 6101 | 6389 | $offset = $datetime->format('P'); |
| 6102 | - } else $offset = '+00:00'; |
|
| 6390 | + } else { |
|
| 6391 | + $offset = '+00:00'; |
|
| 6392 | + } |
|
| 6103 | 6393 | |
| 6104 | 6394 | if ($globalDBdriver == 'mysql') { |
| 6105 | 6395 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
@@ -6312,7 +6602,9 @@ discard block |
||
| 6312 | 6602 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6313 | 6603 | $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6314 | 6604 | ORDER BY airport_arrival_icao_count DESC"; |
| 6315 | - if ($limit) $query .= " LIMIT 10"; |
|
| 6605 | + if ($limit) { |
|
| 6606 | + $query .= " LIMIT 10"; |
|
| 6607 | + } |
|
| 6316 | 6608 | |
| 6317 | 6609 | |
| 6318 | 6610 | $sth = $this->db->prepare($query); |
@@ -6332,7 +6624,9 @@ discard block |
||
| 6332 | 6624 | if ($icaoaskey) { |
| 6333 | 6625 | $icao = $row['arrival_airport_icao']; |
| 6334 | 6626 | $airport_array[$icao] = $temp_array; |
| 6335 | - } else $airport_array[] = $temp_array; |
|
| 6627 | + } else { |
|
| 6628 | + $airport_array[] = $temp_array; |
|
| 6629 | + } |
|
| 6336 | 6630 | } |
| 6337 | 6631 | |
| 6338 | 6632 | return $airport_array; |
@@ -6374,7 +6668,9 @@ discard block |
||
| 6374 | 6668 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6375 | 6669 | $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 |
| 6376 | 6670 | ORDER BY airport_arrival_icao_count DESC"; |
| 6377 | - if ($limit) $query .= " LIMIT 10"; |
|
| 6671 | + if ($limit) { |
|
| 6672 | + $query .= " LIMIT 10"; |
|
| 6673 | + } |
|
| 6378 | 6674 | |
| 6379 | 6675 | |
| 6380 | 6676 | $sth = $this->db->prepare($query); |
@@ -6395,7 +6691,9 @@ discard block |
||
| 6395 | 6691 | if ($icaoaskey) { |
| 6396 | 6692 | $icao = $row['arrival_airport_icao']; |
| 6397 | 6693 | $airport_array[$icao] = $temp_array; |
| 6398 | - } else $airport_array[] = $temp_array; |
|
| 6694 | + } else { |
|
| 6695 | + $airport_array[] = $temp_array; |
|
| 6696 | + } |
|
| 6399 | 6697 | } |
| 6400 | 6698 | |
| 6401 | 6699 | return $airport_array; |
@@ -6437,7 +6735,9 @@ discard block |
||
| 6437 | 6735 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6438 | 6736 | $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
| 6439 | 6737 | ORDER BY airport_arrival_icao_count DESC"; |
| 6440 | - if ($limit) $query .= " LIMIT 10"; |
|
| 6738 | + if ($limit) { |
|
| 6739 | + $query .= " LIMIT 10"; |
|
| 6740 | + } |
|
| 6441 | 6741 | |
| 6442 | 6742 | |
| 6443 | 6743 | $sth = $this->db->prepare($query); |
@@ -6457,7 +6757,9 @@ discard block |
||
| 6457 | 6757 | if ($icaoaskey) { |
| 6458 | 6758 | $icao = $row['arrival_airport_icao']; |
| 6459 | 6759 | $airport_array[$icao] = $temp_array; |
| 6460 | - } else $airport_array[] = $temp_array; |
|
| 6760 | + } else { |
|
| 6761 | + $airport_array[] = $temp_array; |
|
| 6762 | + } |
|
| 6461 | 6763 | } |
| 6462 | 6764 | |
| 6463 | 6765 | return $airport_array; |
@@ -6499,7 +6801,9 @@ discard block |
||
| 6499 | 6801 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6500 | 6802 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
| 6501 | 6803 | ORDER BY airport_arrival_icao_count DESC"; |
| 6502 | - if ($limit) $query .= " LIMIT 10"; |
|
| 6804 | + if ($limit) { |
|
| 6805 | + $query .= " LIMIT 10"; |
|
| 6806 | + } |
|
| 6503 | 6807 | |
| 6504 | 6808 | |
| 6505 | 6809 | $sth = $this->db->prepare($query); |
@@ -6520,7 +6824,9 @@ discard block |
||
| 6520 | 6824 | if ($icaoaskey) { |
| 6521 | 6825 | $icao = $row['arrival_airport_icao']; |
| 6522 | 6826 | $airport_array[$icao] = $temp_array; |
| 6523 | - } else $airport_array[] = $temp_array; |
|
| 6827 | + } else { |
|
| 6828 | + $airport_array[] = $temp_array; |
|
| 6829 | + } |
|
| 6524 | 6830 | } |
| 6525 | 6831 | |
| 6526 | 6832 | return $airport_array; |
@@ -6901,7 +7207,9 @@ discard block |
||
| 6901 | 7207 | date_default_timezone_set($globalTimezone); |
| 6902 | 7208 | $datetime = new DateTime($date); |
| 6903 | 7209 | $offset = $datetime->format('P'); |
| 6904 | - } else $offset = '+00:00'; |
|
| 7210 | + } else { |
|
| 7211 | + $offset = '+00:00'; |
|
| 7212 | + } |
|
| 6905 | 7213 | |
| 6906 | 7214 | if ($globalDBdriver == 'mysql') { |
| 6907 | 7215 | $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 |
@@ -6951,7 +7259,9 @@ discard block |
||
| 6951 | 7259 | date_default_timezone_set($globalTimezone); |
| 6952 | 7260 | $datetime = new DateTime($date); |
| 6953 | 7261 | $offset = $datetime->format('P'); |
| 6954 | - } else $offset = '+00:00'; |
|
| 7262 | + } else { |
|
| 7263 | + $offset = '+00:00'; |
|
| 7264 | + } |
|
| 6955 | 7265 | |
| 6956 | 7266 | if ($globalDBdriver == 'mysql') { |
| 6957 | 7267 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
@@ -7174,7 +7484,9 @@ discard block |
||
| 7174 | 7484 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'"; |
| 7175 | 7485 | $query .= " GROUP BY spotter_output.arrival_airport_country |
| 7176 | 7486 | ORDER BY airport_arrival_country_count DESC"; |
| 7177 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7487 | + if ($limit) { |
|
| 7488 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7489 | + } |
|
| 7178 | 7490 | |
| 7179 | 7491 | |
| 7180 | 7492 | $sth = $this->db->prepare($query); |
@@ -7461,7 +7773,9 @@ discard block |
||
| 7461 | 7773 | date_default_timezone_set($globalTimezone); |
| 7462 | 7774 | $datetime = new DateTime($date); |
| 7463 | 7775 | $offset = $datetime->format('P'); |
| 7464 | - } else $offset = '+00:00'; |
|
| 7776 | + } else { |
|
| 7777 | + $offset = '+00:00'; |
|
| 7778 | + } |
|
| 7465 | 7779 | |
| 7466 | 7780 | if ($globalDBdriver == 'mysql') { |
| 7467 | 7781 | $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 |
@@ -7637,15 +7951,23 @@ discard block |
||
| 7637 | 7951 | $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
| 7638 | 7952 | FROM spotter_output".$filter_query." spotter_output.ident <> '' "; |
| 7639 | 7953 | if ($olderthanmonths > 0) { |
| 7640 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 7641 | - else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 7954 | + if ($globalDBdriver == 'mysql') { |
|
| 7955 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 7956 | + } else { |
|
| 7957 | + $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 7958 | + } |
|
| 7642 | 7959 | } |
| 7643 | 7960 | if ($sincedate != '') { |
| 7644 | - if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 7645 | - else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 7961 | + if ($globalDBdriver == 'mysql') { |
|
| 7962 | + $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 7963 | + } else { |
|
| 7964 | + $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 7965 | + } |
|
| 7646 | 7966 | } |
| 7647 | 7967 | $query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 7648 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7968 | + if ($limit) { |
|
| 7969 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7970 | + } |
|
| 7649 | 7971 | |
| 7650 | 7972 | $sth = $this->db->prepare($query); |
| 7651 | 7973 | $sth->execute(); |
@@ -7679,15 +8001,23 @@ discard block |
||
| 7679 | 8001 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
| 7680 | 8002 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
| 7681 | 8003 | if ($olderthanmonths > 0) { |
| 7682 | - if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 7683 | - else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 8004 | + if ($globalDBdriver == 'mysql') { |
|
| 8005 | + $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 8006 | + } else { |
|
| 8007 | + $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 8008 | + } |
|
| 7684 | 8009 | } |
| 7685 | 8010 | if ($sincedate != '') { |
| 7686 | - if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 7687 | - else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 8011 | + if ($globalDBdriver == 'mysql') { |
|
| 8012 | + $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 8013 | + } else { |
|
| 8014 | + $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 8015 | + } |
|
| 7688 | 8016 | } |
| 7689 | 8017 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 7690 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 8018 | + if ($limit) { |
|
| 8019 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 8020 | + } |
|
| 7691 | 8021 | |
| 7692 | 8022 | $sth = $this->db->prepare($query); |
| 7693 | 8023 | $sth->execute(); |
@@ -7724,7 +8054,9 @@ discard block |
||
| 7724 | 8054 | date_default_timezone_set($globalTimezone); |
| 7725 | 8055 | $datetime = new DateTime(); |
| 7726 | 8056 | $offset = $datetime->format('P'); |
| 7727 | - } else $offset = '+00:00'; |
|
| 8057 | + } else { |
|
| 8058 | + $offset = '+00:00'; |
|
| 8059 | + } |
|
| 7728 | 8060 | |
| 7729 | 8061 | if ($globalDBdriver == 'mysql') { |
| 7730 | 8062 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -7773,7 +8105,9 @@ discard block |
||
| 7773 | 8105 | date_default_timezone_set($globalTimezone); |
| 7774 | 8106 | $datetime = new DateTime(); |
| 7775 | 8107 | $offset = $datetime->format('P'); |
| 7776 | - } else $offset = '+00:00'; |
|
| 8108 | + } else { |
|
| 8109 | + $offset = '+00:00'; |
|
| 8110 | + } |
|
| 7777 | 8111 | $filter_query = $this->getFilter($filters,true,true); |
| 7778 | 8112 | if ($globalDBdriver == 'mysql') { |
| 7779 | 8113 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -7822,7 +8156,9 @@ discard block |
||
| 7822 | 8156 | date_default_timezone_set($globalTimezone); |
| 7823 | 8157 | $datetime = new DateTime(); |
| 7824 | 8158 | $offset = $datetime->format('P'); |
| 7825 | - } else $offset = '+00:00'; |
|
| 8159 | + } else { |
|
| 8160 | + $offset = '+00:00'; |
|
| 8161 | + } |
|
| 7826 | 8162 | $filter_query = $this->getFilter($filters,true,true); |
| 7827 | 8163 | if ($globalDBdriver == 'mysql') { |
| 7828 | 8164 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -7868,7 +8204,9 @@ discard block |
||
| 7868 | 8204 | date_default_timezone_set($globalTimezone); |
| 7869 | 8205 | $datetime = new DateTime(); |
| 7870 | 8206 | $offset = $datetime->format('P'); |
| 7871 | - } else $offset = '+00:00'; |
|
| 8207 | + } else { |
|
| 8208 | + $offset = '+00:00'; |
|
| 8209 | + } |
|
| 7872 | 8210 | $filter_query = $this->getFilter($filters,true,true); |
| 7873 | 8211 | if ($globalDBdriver == 'mysql') { |
| 7874 | 8212 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -7916,7 +8254,9 @@ discard block |
||
| 7916 | 8254 | date_default_timezone_set($globalTimezone); |
| 7917 | 8255 | $datetime = new DateTime(); |
| 7918 | 8256 | $offset = $datetime->format('P'); |
| 7919 | - } else $offset = '+00:00'; |
|
| 8257 | + } else { |
|
| 8258 | + $offset = '+00:00'; |
|
| 8259 | + } |
|
| 7920 | 8260 | |
| 7921 | 8261 | if ($globalDBdriver == 'mysql') { |
| 7922 | 8262 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -7964,7 +8304,9 @@ discard block |
||
| 7964 | 8304 | date_default_timezone_set($globalTimezone); |
| 7965 | 8305 | $datetime = new DateTime(); |
| 7966 | 8306 | $offset = $datetime->format('P'); |
| 7967 | - } else $offset = '+00:00'; |
|
| 8307 | + } else { |
|
| 8308 | + $offset = '+00:00'; |
|
| 8309 | + } |
|
| 7968 | 8310 | |
| 7969 | 8311 | if ($globalDBdriver == 'mysql') { |
| 7970 | 8312 | $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 |
@@ -8011,7 +8353,9 @@ discard block |
||
| 8011 | 8353 | date_default_timezone_set($globalTimezone); |
| 8012 | 8354 | $datetime = new DateTime(); |
| 8013 | 8355 | $offset = $datetime->format('P'); |
| 8014 | - } else $offset = '+00:00'; |
|
| 8356 | + } else { |
|
| 8357 | + $offset = '+00:00'; |
|
| 8358 | + } |
|
| 8015 | 8359 | |
| 8016 | 8360 | if ($globalDBdriver == 'mysql') { |
| 8017 | 8361 | $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 |
@@ -8059,7 +8403,9 @@ discard block |
||
| 8059 | 8403 | date_default_timezone_set($globalTimezone); |
| 8060 | 8404 | $datetime = new DateTime(); |
| 8061 | 8405 | $offset = $datetime->format('P'); |
| 8062 | - } else $offset = '+00:00'; |
|
| 8406 | + } else { |
|
| 8407 | + $offset = '+00:00'; |
|
| 8408 | + } |
|
| 8063 | 8409 | $filter_query = $this->getFilter($filters,true,true); |
| 8064 | 8410 | if ($globalDBdriver == 'mysql') { |
| 8065 | 8411 | $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 |
@@ -8104,7 +8450,9 @@ discard block |
||
| 8104 | 8450 | date_default_timezone_set($globalTimezone); |
| 8105 | 8451 | $datetime = new DateTime(); |
| 8106 | 8452 | $offset = $datetime->format('P'); |
| 8107 | - } else $offset = '+00:00'; |
|
| 8453 | + } else { |
|
| 8454 | + $offset = '+00:00'; |
|
| 8455 | + } |
|
| 8108 | 8456 | $filter_query = $this->getFilter($filters,true,true); |
| 8109 | 8457 | |
| 8110 | 8458 | if ($globalDBdriver == 'mysql') { |
@@ -8151,7 +8499,9 @@ discard block |
||
| 8151 | 8499 | date_default_timezone_set($globalTimezone); |
| 8152 | 8500 | $datetime = new DateTime(); |
| 8153 | 8501 | $offset = $datetime->format('P'); |
| 8154 | - } else $offset = '+00:00'; |
|
| 8502 | + } else { |
|
| 8503 | + $offset = '+00:00'; |
|
| 8504 | + } |
|
| 8155 | 8505 | |
| 8156 | 8506 | if ($globalDBdriver == 'mysql') { |
| 8157 | 8507 | $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 |
@@ -8197,7 +8547,9 @@ discard block |
||
| 8197 | 8547 | date_default_timezone_set($globalTimezone); |
| 8198 | 8548 | $datetime = new DateTime(); |
| 8199 | 8549 | $offset = $datetime->format('P'); |
| 8200 | - } else $offset = '+00:00'; |
|
| 8550 | + } else { |
|
| 8551 | + $offset = '+00:00'; |
|
| 8552 | + } |
|
| 8201 | 8553 | $filter_query = $this->getFilter($filters,true,true); |
| 8202 | 8554 | |
| 8203 | 8555 | if ($globalDBdriver == 'mysql') { |
@@ -8244,7 +8596,9 @@ discard block |
||
| 8244 | 8596 | date_default_timezone_set($globalTimezone); |
| 8245 | 8597 | $datetime = new DateTime(); |
| 8246 | 8598 | $offset = $datetime->format('P'); |
| 8247 | - } else $offset = '+00:00'; |
|
| 8599 | + } else { |
|
| 8600 | + $offset = '+00:00'; |
|
| 8601 | + } |
|
| 8248 | 8602 | |
| 8249 | 8603 | if ($globalDBdriver == 'mysql') { |
| 8250 | 8604 | $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 |
@@ -8291,7 +8645,9 @@ discard block |
||
| 8291 | 8645 | date_default_timezone_set($globalTimezone); |
| 8292 | 8646 | $datetime = new DateTime(); |
| 8293 | 8647 | $offset = $datetime->format('P'); |
| 8294 | - } else $offset = '+00:00'; |
|
| 8648 | + } else { |
|
| 8649 | + $offset = '+00:00'; |
|
| 8650 | + } |
|
| 8295 | 8651 | |
| 8296 | 8652 | if ($globalDBdriver == 'mysql') { |
| 8297 | 8653 | $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 |
@@ -8336,7 +8692,9 @@ discard block |
||
| 8336 | 8692 | date_default_timezone_set($globalTimezone); |
| 8337 | 8693 | $datetime = new DateTime(); |
| 8338 | 8694 | $offset = $datetime->format('P'); |
| 8339 | - } else $offset = '+00:00'; |
|
| 8695 | + } else { |
|
| 8696 | + $offset = '+00:00'; |
|
| 8697 | + } |
|
| 8340 | 8698 | $filter_query = $this->getFilter($filters,true,true); |
| 8341 | 8699 | |
| 8342 | 8700 | if ($globalDBdriver == 'mysql') { |
@@ -8384,7 +8742,9 @@ discard block |
||
| 8384 | 8742 | date_default_timezone_set($globalTimezone); |
| 8385 | 8743 | $datetime = new DateTime(); |
| 8386 | 8744 | $offset = $datetime->format('P'); |
| 8387 | - } else $offset = '+00:00'; |
|
| 8745 | + } else { |
|
| 8746 | + $offset = '+00:00'; |
|
| 8747 | + } |
|
| 8388 | 8748 | |
| 8389 | 8749 | if ($globalDBdriver == 'mysql') { |
| 8390 | 8750 | $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 |
@@ -8430,7 +8790,9 @@ discard block |
||
| 8430 | 8790 | date_default_timezone_set($globalTimezone); |
| 8431 | 8791 | $datetime = new DateTime(); |
| 8432 | 8792 | $offset = $datetime->format('P'); |
| 8433 | - } else $offset = '+00:00'; |
|
| 8793 | + } else { |
|
| 8794 | + $offset = '+00:00'; |
|
| 8795 | + } |
|
| 8434 | 8796 | $filter_query = $this->getFilter($filters,true,true); |
| 8435 | 8797 | |
| 8436 | 8798 | if ($globalDBdriver == 'mysql') { |
@@ -8478,7 +8840,9 @@ discard block |
||
| 8478 | 8840 | date_default_timezone_set($globalTimezone); |
| 8479 | 8841 | $datetime = new DateTime(); |
| 8480 | 8842 | $offset = $datetime->format('P'); |
| 8481 | - } else $offset = '+00:00'; |
|
| 8843 | + } else { |
|
| 8844 | + $offset = '+00:00'; |
|
| 8845 | + } |
|
| 8482 | 8846 | |
| 8483 | 8847 | if ($globalDBdriver == 'mysql') { |
| 8484 | 8848 | $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 |
@@ -8525,7 +8889,9 @@ discard block |
||
| 8525 | 8889 | date_default_timezone_set($globalTimezone); |
| 8526 | 8890 | $datetime = new DateTime(); |
| 8527 | 8891 | $offset = $datetime->format('P'); |
| 8528 | - } else $offset = '+00:00'; |
|
| 8892 | + } else { |
|
| 8893 | + $offset = '+00:00'; |
|
| 8894 | + } |
|
| 8529 | 8895 | $filter_query = $this->getFilter($filters,true,true); |
| 8530 | 8896 | if ($globalDBdriver == 'mysql') { |
| 8531 | 8897 | $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 |
@@ -8574,7 +8940,9 @@ discard block |
||
| 8574 | 8940 | date_default_timezone_set($globalTimezone); |
| 8575 | 8941 | $datetime = new DateTime(); |
| 8576 | 8942 | $offset = $datetime->format('P'); |
| 8577 | - } else $offset = '+00:00'; |
|
| 8943 | + } else { |
|
| 8944 | + $offset = '+00:00'; |
|
| 8945 | + } |
|
| 8578 | 8946 | |
| 8579 | 8947 | $orderby_sql = ''; |
| 8580 | 8948 | if ($orderby == "hour") |
@@ -8640,7 +9008,9 @@ discard block |
||
| 8640 | 9008 | date_default_timezone_set($globalTimezone); |
| 8641 | 9009 | $datetime = new DateTime(); |
| 8642 | 9010 | $offset = $datetime->format('P'); |
| 8643 | - } else $offset = '+00:00'; |
|
| 9011 | + } else { |
|
| 9012 | + $offset = '+00:00'; |
|
| 9013 | + } |
|
| 8644 | 9014 | |
| 8645 | 9015 | $orderby_sql = ''; |
| 8646 | 9016 | if ($orderby == "hour") |
@@ -8707,7 +9077,9 @@ discard block |
||
| 8707 | 9077 | date_default_timezone_set($globalTimezone); |
| 8708 | 9078 | $datetime = new DateTime(); |
| 8709 | 9079 | $offset = $datetime->format('P'); |
| 8710 | - } else $offset = '+00:00'; |
|
| 9080 | + } else { |
|
| 9081 | + $offset = '+00:00'; |
|
| 9082 | + } |
|
| 8711 | 9083 | |
| 8712 | 9084 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
| 8713 | 9085 | |
@@ -8758,7 +9130,9 @@ discard block |
||
| 8758 | 9130 | date_default_timezone_set($globalTimezone); |
| 8759 | 9131 | $datetime = new DateTime(); |
| 8760 | 9132 | $offset = $datetime->format('P'); |
| 8761 | - } else $offset = '+00:00'; |
|
| 9133 | + } else { |
|
| 9134 | + $offset = '+00:00'; |
|
| 9135 | + } |
|
| 8762 | 9136 | |
| 8763 | 9137 | if ($globalDBdriver == 'mysql') { |
| 8764 | 9138 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -8805,7 +9179,9 @@ discard block |
||
| 8805 | 9179 | date_default_timezone_set($globalTimezone); |
| 8806 | 9180 | $datetime = new DateTime(); |
| 8807 | 9181 | $offset = $datetime->format('P'); |
| 8808 | - } else $offset = '+00:00'; |
|
| 9182 | + } else { |
|
| 9183 | + $offset = '+00:00'; |
|
| 9184 | + } |
|
| 8809 | 9185 | |
| 8810 | 9186 | if ($globalDBdriver == 'mysql') { |
| 8811 | 9187 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -8852,7 +9228,9 @@ discard block |
||
| 8852 | 9228 | date_default_timezone_set($globalTimezone); |
| 8853 | 9229 | $datetime = new DateTime(); |
| 8854 | 9230 | $offset = $datetime->format('P'); |
| 8855 | - } else $offset = '+00:00'; |
|
| 9231 | + } else { |
|
| 9232 | + $offset = '+00:00'; |
|
| 9233 | + } |
|
| 8856 | 9234 | |
| 8857 | 9235 | if ($globalDBdriver == 'mysql') { |
| 8858 | 9236 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -8900,7 +9278,9 @@ discard block |
||
| 8900 | 9278 | date_default_timezone_set($globalTimezone); |
| 8901 | 9279 | $datetime = new DateTime(); |
| 8902 | 9280 | $offset = $datetime->format('P'); |
| 8903 | - } else $offset = '+00:00'; |
|
| 9281 | + } else { |
|
| 9282 | + $offset = '+00:00'; |
|
| 9283 | + } |
|
| 8904 | 9284 | |
| 8905 | 9285 | if ($globalDBdriver == 'mysql') { |
| 8906 | 9286 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -8948,7 +9328,9 @@ discard block |
||
| 8948 | 9328 | date_default_timezone_set($globalTimezone); |
| 8949 | 9329 | $datetime = new DateTime($date); |
| 8950 | 9330 | $offset = $datetime->format('P'); |
| 8951 | - } else $offset = '+00:00'; |
|
| 9331 | + } else { |
|
| 9332 | + $offset = '+00:00'; |
|
| 9333 | + } |
|
| 8952 | 9334 | |
| 8953 | 9335 | if ($globalDBdriver == 'mysql') { |
| 8954 | 9336 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -8996,7 +9378,9 @@ discard block |
||
| 8996 | 9378 | date_default_timezone_set($globalTimezone); |
| 8997 | 9379 | $datetime = new DateTime(); |
| 8998 | 9380 | $offset = $datetime->format('P'); |
| 8999 | - } else $offset = '+00:00'; |
|
| 9381 | + } else { |
|
| 9382 | + $offset = '+00:00'; |
|
| 9383 | + } |
|
| 9000 | 9384 | |
| 9001 | 9385 | if ($globalDBdriver == 'mysql') { |
| 9002 | 9386 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9046,7 +9430,9 @@ discard block |
||
| 9046 | 9430 | date_default_timezone_set($globalTimezone); |
| 9047 | 9431 | $datetime = new DateTime(); |
| 9048 | 9432 | $offset = $datetime->format('P'); |
| 9049 | - } else $offset = '+00:00'; |
|
| 9433 | + } else { |
|
| 9434 | + $offset = '+00:00'; |
|
| 9435 | + } |
|
| 9050 | 9436 | |
| 9051 | 9437 | if ($globalDBdriver == 'mysql') { |
| 9052 | 9438 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9093,7 +9479,9 @@ discard block |
||
| 9093 | 9479 | date_default_timezone_set($globalTimezone); |
| 9094 | 9480 | $datetime = new DateTime(); |
| 9095 | 9481 | $offset = $datetime->format('P'); |
| 9096 | - } else $offset = '+00:00'; |
|
| 9482 | + } else { |
|
| 9483 | + $offset = '+00:00'; |
|
| 9484 | + } |
|
| 9097 | 9485 | |
| 9098 | 9486 | if ($globalDBdriver == 'mysql') { |
| 9099 | 9487 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9261,7 +9649,9 @@ discard block |
||
| 9261 | 9649 | date_default_timezone_set($globalTimezone); |
| 9262 | 9650 | $datetime = new DateTime(); |
| 9263 | 9651 | $offset = $datetime->format('P'); |
| 9264 | - } else $offset = '+00:00'; |
|
| 9652 | + } else { |
|
| 9653 | + $offset = '+00:00'; |
|
| 9654 | + } |
|
| 9265 | 9655 | |
| 9266 | 9656 | if ($globalDBdriver == 'mysql') { |
| 9267 | 9657 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9447,7 +9837,9 @@ discard block |
||
| 9447 | 9837 | */ |
| 9448 | 9838 | public function parseDirection($direction = 0) |
| 9449 | 9839 | { |
| 9450 | - if ($direction == '') $direction = 0; |
|
| 9840 | + if ($direction == '') { |
|
| 9841 | + $direction = 0; |
|
| 9842 | + } |
|
| 9451 | 9843 | $direction_array = array(); |
| 9452 | 9844 | $temp_array = array(); |
| 9453 | 9845 | |
@@ -9548,7 +9940,9 @@ discard block |
||
| 9548 | 9940 | if (isset($result->AirlineFlightInfoResult)) |
| 9549 | 9941 | { |
| 9550 | 9942 | $registration = $result->AirlineFlightInfoResult->tailnumber; |
| 9551 | - } else return ''; |
|
| 9943 | + } else { |
|
| 9944 | + return ''; |
|
| 9945 | + } |
|
| 9552 | 9946 | |
| 9553 | 9947 | $registration = $this->convertAircraftRegistration($registration); |
| 9554 | 9948 | |
@@ -9577,7 +9971,9 @@ discard block |
||
| 9577 | 9971 | if (count($row) > 0) { |
| 9578 | 9972 | //return $row['Registration']; |
| 9579 | 9973 | return $row['registration']; |
| 9580 | - } else return ''; |
|
| 9974 | + } else { |
|
| 9975 | + return ''; |
|
| 9976 | + } |
|
| 9581 | 9977 | |
| 9582 | 9978 | } |
| 9583 | 9979 | |
@@ -9600,9 +9996,14 @@ discard block |
||
| 9600 | 9996 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 9601 | 9997 | $sth->closeCursor(); |
| 9602 | 9998 | if (count($row) > 0) { |
| 9603 | - if ($row['type_flight'] == null) return ''; |
|
| 9604 | - else return $row['type_flight']; |
|
| 9605 | - } else return ''; |
|
| 9999 | + if ($row['type_flight'] == null) { |
|
| 10000 | + return ''; |
|
| 10001 | + } else { |
|
| 10002 | + return $row['type_flight']; |
|
| 10003 | + } |
|
| 10004 | + } else { |
|
| 10005 | + return ''; |
|
| 10006 | + } |
|
| 9606 | 10007 | |
| 9607 | 10008 | } |
| 9608 | 10009 | |
@@ -9620,7 +10021,9 @@ discard block |
||
| 9620 | 10021 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 9621 | 10022 | |
| 9622 | 10023 | $Connection = new Connection($this->db); |
| 9623 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 10024 | + if (!$Connection->tableExists('countries')) { |
|
| 10025 | + return ''; |
|
| 10026 | + } |
|
| 9624 | 10027 | |
| 9625 | 10028 | try { |
| 9626 | 10029 | /* |
@@ -9640,9 +10043,13 @@ discard block |
||
| 9640 | 10043 | $sth->closeCursor(); |
| 9641 | 10044 | if (count($row) > 0) { |
| 9642 | 10045 | return $row; |
| 9643 | - } else return ''; |
|
| 10046 | + } else { |
|
| 10047 | + return ''; |
|
| 10048 | + } |
|
| 9644 | 10049 | } catch (PDOException $e) { |
| 9645 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 10050 | + if (isset($globalDebug) && $globalDebug) { |
|
| 10051 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 10052 | + } |
|
| 9646 | 10053 | return ''; |
| 9647 | 10054 | } |
| 9648 | 10055 | |
@@ -9790,7 +10197,9 @@ discard block |
||
| 9790 | 10197 | { |
| 9791 | 10198 | global $globalBitlyAccessToken; |
| 9792 | 10199 | |
| 9793 | - if ($globalBitlyAccessToken == '') return $url; |
|
| 10200 | + if ($globalBitlyAccessToken == '') { |
|
| 10201 | + return $url; |
|
| 10202 | + } |
|
| 9794 | 10203 | |
| 9795 | 10204 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
| 9796 | 10205 | |
@@ -9939,7 +10348,9 @@ discard block |
||
| 9939 | 10348 | |
| 9940 | 10349 | |
| 9941 | 10350 | // routes |
| 9942 | - if ($globalDebug) print "Routes...\n"; |
|
| 10351 | + if ($globalDebug) { |
|
| 10352 | + print "Routes...\n"; |
|
| 10353 | + } |
|
| 9943 | 10354 | if ($globalDBdriver == 'mysql') { |
| 9944 | 10355 | $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)"; |
| 9945 | 10356 | } else { |
@@ -9958,7 +10369,9 @@ discard block |
||
| 9958 | 10369 | } |
| 9959 | 10370 | } |
| 9960 | 10371 | |
| 9961 | - if ($globalDebug) print "Airlines...\n"; |
|
| 10372 | + if ($globalDebug) { |
|
| 10373 | + print "Airlines...\n"; |
|
| 10374 | + } |
|
| 9962 | 10375 | //airlines |
| 9963 | 10376 | if ($globalDBdriver == 'mysql') { |
| 9964 | 10377 | $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)"; |
@@ -9972,10 +10385,15 @@ discard block |
||
| 9972 | 10385 | if (is_numeric(substr($row['ident'], -1, 1))) |
| 9973 | 10386 | { |
| 9974 | 10387 | $fromsource = NULL; |
| 9975 | - if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 9976 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 9977 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 9978 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 10388 | + if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 10389 | + $fromsource = 'vatsim'; |
|
| 10390 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 10391 | + $fromsource = 'ivao'; |
|
| 10392 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 10393 | + $fromsource = 'vatsim'; |
|
| 10394 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 10395 | + $fromsource = 'ivao'; |
|
| 10396 | + } |
|
| 9979 | 10397 | $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
| 9980 | 10398 | if (isset($airline_array[0]['name'])) { |
| 9981 | 10399 | $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"; |
@@ -9985,13 +10403,17 @@ discard block |
||
| 9985 | 10403 | } |
| 9986 | 10404 | } |
| 9987 | 10405 | |
| 9988 | - if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n"; |
|
| 10406 | + if ($globalDebug) { |
|
| 10407 | + print "Remove Duplicate in aircraft_modes...\n"; |
|
| 10408 | + } |
|
| 9989 | 10409 | //duplicate modes |
| 9990 | 10410 | $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"; |
| 9991 | 10411 | $sth = $this->db->prepare($query); |
| 9992 | 10412 | $sth->execute(); |
| 9993 | 10413 | |
| 9994 | - if ($globalDebug) print "Aircraft...\n"; |
|
| 10414 | + if ($globalDebug) { |
|
| 10415 | + print "Aircraft...\n"; |
|
| 10416 | + } |
|
| 9995 | 10417 | //aircraft |
| 9996 | 10418 | if ($globalDBdriver == 'mysql') { |
| 9997 | 10419 | $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)"; |
@@ -10034,26 +10456,38 @@ discard block |
||
| 10034 | 10456 | if (isset($closestAirports[0])) { |
| 10035 | 10457 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
| 10036 | 10458 | $airport_icao = $closestAirports[0]['icao']; |
| 10037 | - if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 10459 | + if ($globalDebug) { |
|
| 10460 | + echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 10461 | + } |
|
| 10038 | 10462 | } elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') { |
| 10039 | 10463 | foreach ($closestAirports as $airport) { |
| 10040 | 10464 | if ($row['arrival_airport_icao'] == $airport['icao']) { |
| 10041 | 10465 | $airport_icao = $airport['icao']; |
| 10042 | - if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 10466 | + if ($globalDebug) { |
|
| 10467 | + echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 10468 | + } |
|
| 10043 | 10469 | break; |
| 10044 | 10470 | } |
| 10045 | 10471 | } |
| 10046 | 10472 | } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
| 10047 | 10473 | $airport_icao = $closestAirports[0]['icao']; |
| 10048 | - 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"; |
|
| 10474 | + if ($globalDebug) { |
|
| 10475 | + 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"; |
|
| 10476 | + } |
|
| 10049 | 10477 | } else { |
| 10050 | - 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"; |
|
| 10478 | + if ($globalDebug) { |
|
| 10479 | + 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"; |
|
| 10480 | + } |
|
| 10051 | 10481 | } |
| 10052 | 10482 | } else { |
| 10053 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 10483 | + if ($globalDebug) { |
|
| 10484 | + echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 10485 | + } |
|
| 10054 | 10486 | } |
| 10055 | 10487 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
| 10056 | - if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
|
| 10488 | + if ($globalDebug) { |
|
| 10489 | + echo "Updating airport to ".$airport_icao."...\n"; |
|
| 10490 | + } |
|
| 10057 | 10491 | $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
| 10058 | 10492 | $sthu = $this->db->prepare($update_query); |
| 10059 | 10493 | $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
@@ -26,7 +26,9 @@ discard block |
||
| 26 | 26 | $filter = array_merge($globalStatsFilters[$globalFilterName],$filter); |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | - if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter); |
|
| 29 | + if (is_array($globalFilter)) { |
|
| 30 | + $filter = array_merge($globalFilter,$filter); |
|
| 31 | + } |
|
| 30 | 32 | $filter_query_join = ''; |
| 31 | 33 | $filter_query_where = ''; |
| 32 | 34 | foreach($filters as $flt) { |
@@ -71,8 +73,11 @@ discard block |
||
| 71 | 73 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 72 | 74 | } |
| 73 | 75 | } |
| 74 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 75 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 76 | + if ($filter_query_where == '' && $where) { |
|
| 77 | + $filter_query_where = ' WHERE'; |
|
| 78 | + } elseif ($filter_query_where != '' && $and) { |
|
| 79 | + $filter_query_where .= ' AND'; |
|
| 80 | + } |
|
| 76 | 81 | $filter_query = $filter_query_join.$filter_query_where; |
| 77 | 82 | return $filter_query; |
| 78 | 83 | } |
@@ -108,7 +113,9 @@ discard block |
||
| 108 | 113 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
| 109 | 114 | } |
| 110 | 115 | |
| 111 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 116 | + if (!isset($globalLiveInterval)) { |
|
| 117 | + $globalLiveInterval = '200'; |
|
| 118 | + } |
|
| 112 | 119 | if ($globalDBdriver == 'mysql') { |
| 113 | 120 | //$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
| 114 | 121 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -133,7 +140,9 @@ discard block |
||
| 133 | 140 | |
| 134 | 141 | $filter_query = $this->getFilter($filter,true,true); |
| 135 | 142 | |
| 136 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 143 | + if (!isset($globalLiveInterval)) { |
|
| 144 | + $globalLiveInterval = '200'; |
|
| 145 | + } |
|
| 137 | 146 | if ($globalDBdriver == 'mysql') { |
| 138 | 147 | // $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate$orderby_query"; |
| 139 | 148 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao'; |
@@ -180,7 +189,9 @@ discard block |
||
| 180 | 189 | |
| 181 | 190 | $filter_query = $this->getFilter($filter,true,true); |
| 182 | 191 | |
| 183 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 192 | + if (!isset($globalLiveInterval)) { |
|
| 193 | + $globalLiveInterval = '200'; |
|
| 194 | + } |
|
| 184 | 195 | if ($globalDBdriver == 'mysql') { |
| 185 | 196 | |
| 186 | 197 | $query = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
@@ -220,7 +231,9 @@ discard block |
||
| 220 | 231 | global $globalDBdriver, $globalLiveInterval; |
| 221 | 232 | $filter_query = $this->getFilter($filter,true,true); |
| 222 | 233 | |
| 223 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 234 | + if (!isset($globalLiveInterval)) { |
|
| 235 | + $globalLiveInterval = '200'; |
|
| 236 | + } |
|
| 224 | 237 | if ($globalDBdriver == 'mysql') { |
| 225 | 238 | //$query = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query; |
| 226 | 239 | $query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
@@ -250,7 +263,9 @@ discard block |
||
| 250 | 263 | { |
| 251 | 264 | global $globalDBdriver, $globalLiveInterval; |
| 252 | 265 | $Spotter = new Spotter($this->db); |
| 253 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 266 | + if (!isset($globalLiveInterval)) { |
|
| 267 | + $globalLiveInterval = '200'; |
|
| 268 | + } |
|
| 254 | 269 | $filter_query = $this->getFilter($filter); |
| 255 | 270 | |
| 256 | 271 | if (is_array($coord)) { |
@@ -258,7 +273,9 @@ discard block |
||
| 258 | 273 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 259 | 274 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 260 | 275 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 261 | - } else return array(); |
|
| 276 | + } else { |
|
| 277 | + return array(); |
|
| 278 | + } |
|
| 262 | 279 | if ($globalDBdriver == 'mysql') { |
| 263 | 280 | //$query = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
| 264 | 281 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
@@ -449,11 +466,15 @@ discard block |
||
| 449 | 466 | //$query = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date'; |
| 450 | 467 | if ($globalDBdriver == 'mysql') { |
| 451 | 468 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
| 452 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 469 | + if ($liveinterval) { |
|
| 470 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 471 | + } |
|
| 453 | 472 | $query .= ' ORDER BY date'; |
| 454 | 473 | } else { |
| 455 | 474 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
| 456 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 475 | + if ($liveinterval) { |
|
| 476 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 477 | + } |
|
| 457 | 478 | $query .= ' ORDER BY date'; |
| 458 | 479 | } |
| 459 | 480 | |
@@ -548,7 +569,9 @@ discard block |
||
| 548 | 569 | $i++; |
| 549 | 570 | $j++; |
| 550 | 571 | if ($j == 30) { |
| 551 | - if ($globalDebug) echo "."; |
|
| 572 | + if ($globalDebug) { |
|
| 573 | + echo "."; |
|
| 574 | + } |
|
| 552 | 575 | try { |
| 553 | 576 | |
| 554 | 577 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -856,7 +879,9 @@ discard block |
||
| 856 | 879 | { |
| 857 | 880 | return false; |
| 858 | 881 | } |
| 859 | - } else return ''; |
|
| 882 | + } else { |
|
| 883 | + return ''; |
|
| 884 | + } |
|
| 860 | 885 | |
| 861 | 886 | if ($longitude != '') |
| 862 | 887 | { |
@@ -864,7 +889,9 @@ discard block |
||
| 864 | 889 | { |
| 865 | 890 | return false; |
| 866 | 891 | } |
| 867 | - } else return ''; |
|
| 892 | + } else { |
|
| 893 | + return ''; |
|
| 894 | + } |
|
| 868 | 895 | |
| 869 | 896 | if ($waypoints != '') |
| 870 | 897 | { |
@@ -880,7 +907,9 @@ discard block |
||
| 880 | 907 | { |
| 881 | 908 | return false; |
| 882 | 909 | } |
| 883 | - } else $altitude = 0; |
|
| 910 | + } else { |
|
| 911 | + $altitude = 0; |
|
| 912 | + } |
|
| 884 | 913 | |
| 885 | 914 | if ($heading != '') |
| 886 | 915 | { |
@@ -888,7 +917,9 @@ discard block |
||
| 888 | 917 | { |
| 889 | 918 | return false; |
| 890 | 919 | } |
| 891 | - } else $heading = 0; |
|
| 920 | + } else { |
|
| 921 | + $heading = 0; |
|
| 922 | + } |
|
| 892 | 923 | |
| 893 | 924 | if ($groundspeed != '') |
| 894 | 925 | { |
@@ -896,9 +927,13 @@ discard block |
||
| 896 | 927 | { |
| 897 | 928 | return false; |
| 898 | 929 | } |
| 899 | - } else $groundspeed = 0; |
|
| 930 | + } else { |
|
| 931 | + $groundspeed = 0; |
|
| 932 | + } |
|
| 900 | 933 | date_default_timezone_set('UTC'); |
| 901 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
| 934 | + if ($date == '') { |
|
| 935 | + $date = date("Y-m-d H:i:s", time()); |
|
| 936 | + } |
|
| 902 | 937 | |
| 903 | 938 | |
| 904 | 939 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -942,10 +977,18 @@ discard block |
||
| 942 | 977 | $arrival_airport_country = ''; |
| 943 | 978 | |
| 944 | 979 | |
| 945 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 946 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 947 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 948 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 980 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) { |
|
| 981 | + $squawk = NULL; |
|
| 982 | + } |
|
| 983 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) { |
|
| 984 | + $verticalrate = NULL; |
|
| 985 | + } |
|
| 986 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
| 987 | + $groundspeed = 0; |
|
| 988 | + } |
|
| 989 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
| 990 | + $heading = 0; |
|
| 991 | + } |
|
| 949 | 992 | |
| 950 | 993 | $query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
| 951 | 994 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)'; |
@@ -960,9 +1003,13 @@ discard block |
||
| 960 | 1003 | return "error : ".$e->getMessage(); |
| 961 | 1004 | } |
| 962 | 1005 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 963 | - if ($globalDebug) echo '(Add to SBS archive : '; |
|
| 1006 | + if ($globalDebug) { |
|
| 1007 | + echo '(Add to SBS archive : '; |
|
| 1008 | + } |
|
| 964 | 1009 | $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
| 965 | - if ($globalDebug) echo $result.')'; |
|
| 1010 | + if ($globalDebug) { |
|
| 1011 | + echo $result.')'; |
|
| 1012 | + } |
|
| 966 | 1013 | } |
| 967 | 1014 | return "success"; |
| 968 | 1015 | |
@@ -23,7 +23,9 @@ discard block |
||
| 23 | 23 | $filter = array_merge($globalStatsFilters[$globalFilterName],$filter); |
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | - if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter); |
|
| 26 | + if (is_array($globalFilter)) { |
|
| 27 | + $filter = array_merge($globalFilter,$filter); |
|
| 28 | + } |
|
| 27 | 29 | $filter_query_join = ''; |
| 28 | 30 | $filter_query_where = ''; |
| 29 | 31 | foreach($filters as $flt) { |
@@ -69,8 +71,11 @@ discard block |
||
| 69 | 71 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 70 | 72 | } |
| 71 | 73 | } |
| 72 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 73 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 74 | + if ($filter_query_where == '' && $where) { |
|
| 75 | + $filter_query_where = ' WHERE'; |
|
| 76 | + } elseif ($filter_query_where != '' && $and) { |
|
| 77 | + $filter_query_where .= ' AND'; |
|
| 78 | + } |
|
| 74 | 79 | $filter_query = $filter_query_join.$filter_query_where; |
| 75 | 80 | return $filter_query; |
| 76 | 81 | } |
@@ -81,10 +86,17 @@ discard block |
||
| 81 | 86 | if ($over_country == '') { |
| 82 | 87 | $Spotter = new Spotter($this->db); |
| 83 | 88 | $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude); |
| 84 | - if (!empty($data_country)) $country = $data_country['iso2']; |
|
| 85 | - else $country = ''; |
|
| 86 | - } else $country = $over_country; |
|
| 87 | - if ($airline_type === NULL) $airline_type =''; |
|
| 89 | + if (!empty($data_country)) { |
|
| 90 | + $country = $data_country['iso2']; |
|
| 91 | + } else { |
|
| 92 | + $country = ''; |
|
| 93 | + } |
|
| 94 | + } else { |
|
| 95 | + $country = $over_country; |
|
| 96 | + } |
|
| 97 | + if ($airline_type === NULL) { |
|
| 98 | + $airline_type =''; |
|
| 99 | + } |
|
| 88 | 100 | |
| 89 | 101 | //if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n"; |
| 90 | 102 | //else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n"; |
@@ -587,7 +599,9 @@ discard block |
||
| 587 | 599 | $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR "; |
| 588 | 600 | $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR "; |
| 589 | 601 | $translate = $Translation->ident2icao($q_item); |
| 590 | - if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
| 602 | + if ($translate != $q_item) { |
|
| 603 | + $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
| 604 | + } |
|
| 591 | 605 | $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')"; |
| 592 | 606 | $additional_query .= ")"; |
| 593 | 607 | } |
@@ -805,7 +819,9 @@ discard block |
||
| 805 | 819 | date_default_timezone_set($globalTimezone); |
| 806 | 820 | $datetime = new DateTime(); |
| 807 | 821 | $offset = $datetime->format('P'); |
| 808 | - } else $offset = '+00:00'; |
|
| 822 | + } else { |
|
| 823 | + $offset = '+00:00'; |
|
| 824 | + } |
|
| 809 | 825 | |
| 810 | 826 | |
| 811 | 827 | if ($date_array[1] != "") |
@@ -969,9 +985,13 @@ discard block |
||
| 969 | 985 | $query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 970 | 986 | } |
| 971 | 987 | } |
| 972 | - if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 988 | + if ($sincedate != '') { |
|
| 989 | + $query .= "AND date > '".$sincedate."' "; |
|
| 990 | + } |
|
| 973 | 991 | $query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
| 974 | - if ($limit) $query .= " LIMIT 0,10"; |
|
| 992 | + if ($limit) { |
|
| 993 | + $query .= " LIMIT 0,10"; |
|
| 994 | + } |
|
| 975 | 995 | |
| 976 | 996 | |
| 977 | 997 | $sth = $this->db->prepare($query); |