@@ -69,7 +69,9 @@ discard block |
||
| 69 | 69 | $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 72 | + if (is_array($globalFilter)) { |
|
| 73 | + $filter = array_merge($filter,$globalFilter); |
|
| 74 | + } |
|
| 73 | 75 | $filter_query_join = ''; |
| 74 | 76 | $filter_query_where = ''; |
| 75 | 77 | foreach($filters as $flt) { |
@@ -139,8 +141,11 @@ discard block |
||
| 139 | 141 | $filter_query_where .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'"; |
| 140 | 142 | } |
| 141 | 143 | } |
| 142 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 143 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 144 | + if ($filter_query_where == '' && $where) { |
|
| 145 | + $filter_query_where = ' WHERE'; |
|
| 146 | + } elseif ($filter_query_where != '' && $and) { |
|
| 147 | + $filter_query_where .= ' AND'; |
|
| 148 | + } |
|
| 144 | 149 | if ($filter_query_where != '') { |
| 145 | 150 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 146 | 151 | } |
@@ -163,10 +168,18 @@ discard block |
||
| 163 | 168 | $Image = new Image($this->db); |
| 164 | 169 | $Schedule = new Schedule($this->db); |
| 165 | 170 | $ACARS = new ACARS($this->db); |
| 166 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 167 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 168 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 169 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 171 | + if (!isset($globalIVAO)) { |
|
| 172 | + $globalIVAO = FALSE; |
|
| 173 | + } |
|
| 174 | + if (!isset($globalVATSIM)) { |
|
| 175 | + $globalVATSIM = FALSE; |
|
| 176 | + } |
|
| 177 | + if (!isset($globalphpVMS)) { |
|
| 178 | + $globalphpVMS = FALSE; |
|
| 179 | + } |
|
| 180 | + if (!isset($globalVAM)) { |
|
| 181 | + $globalVAM = FALSE; |
|
| 182 | + } |
|
| 170 | 183 | date_default_timezone_set('UTC'); |
| 171 | 184 | |
| 172 | 185 | if (!is_string($query)) |
@@ -213,21 +226,35 @@ discard block |
||
| 213 | 226 | } else { |
| 214 | 227 | $temp_array['spotter_id'] = ''; |
| 215 | 228 | } |
| 216 | - if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 217 | - if (isset($row['modes'])) $temp_array['modes'] = $row['modes']; |
|
| 229 | + if (isset($row['flightaware_id'])) { |
|
| 230 | + $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 231 | + } |
|
| 232 | + if (isset($row['modes'])) { |
|
| 233 | + $temp_array['modes'] = $row['modes']; |
|
| 234 | + } |
|
| 218 | 235 | $temp_array['ident'] = $row['ident']; |
| 219 | 236 | if (isset($row['registration']) && $row['registration'] != '') { |
| 220 | 237 | $temp_array['registration'] = $row['registration']; |
| 221 | 238 | } elseif (isset($temp_array['modes'])) { |
| 222 | 239 | $temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']); |
| 223 | - } else $temp_array['registration'] = ''; |
|
| 224 | - if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 240 | + } else { |
|
| 241 | + $temp_array['registration'] = ''; |
|
| 242 | + } |
|
| 243 | + if (isset($row['aircraft_icao'])) { |
|
| 244 | + $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 245 | + } |
|
| 225 | 246 | |
| 226 | 247 | $temp_array['departure_airport'] = $row['departure_airport_icao']; |
| 227 | 248 | $temp_array['arrival_airport'] = $row['arrival_airport_icao']; |
| 228 | - if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 229 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
| 230 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
| 249 | + if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) { |
|
| 250 | + $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 251 | + } |
|
| 252 | + if (isset($row['latitude'])) { |
|
| 253 | + $temp_array['latitude'] = $row['latitude']; |
|
| 254 | + } |
|
| 255 | + if (isset($row['longitude'])) { |
|
| 256 | + $temp_array['longitude'] = $row['longitude']; |
|
| 257 | + } |
|
| 231 | 258 | /* |
| 232 | 259 | if (Connection->tableExists('countries')) { |
| 233 | 260 | $country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']); |
@@ -237,8 +264,12 @@ discard block |
||
| 237 | 264 | } |
| 238 | 265 | } |
| 239 | 266 | */ |
| 240 | - if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints']; |
|
| 241 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
| 267 | + if (isset($row['waypoints'])) { |
|
| 268 | + $temp_array['waypoints'] = $row['waypoints']; |
|
| 269 | + } |
|
| 270 | + if (isset($row['format_source'])) { |
|
| 271 | + $temp_array['format_source'] = $row['format_source']; |
|
| 272 | + } |
|
| 242 | 273 | if (isset($row['route_stop']) && $row['route_stop'] != '') { |
| 243 | 274 | $temp_array['route_stop'] = $row['route_stop']; |
| 244 | 275 | $allroute = explode(' ',$row['route_stop']); |
@@ -254,13 +285,19 @@ discard block |
||
| 254 | 285 | } |
| 255 | 286 | } |
| 256 | 287 | } |
| 257 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
| 288 | + if (isset($row['altitude'])) { |
|
| 289 | + $temp_array['altitude'] = $row['altitude']; |
|
| 290 | + } |
|
| 258 | 291 | if (isset($row['heading'])) { |
| 259 | 292 | $temp_array['heading'] = $row['heading']; |
| 260 | 293 | $heading_direction = $this->parseDirection($row['heading']); |
| 261 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 294 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
| 295 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 296 | + } |
|
| 297 | + } |
|
| 298 | + if (isset($row['ground_speed'])) { |
|
| 299 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 262 | 300 | } |
| 263 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 264 | 301 | $temp_array['image'] = ""; |
| 265 | 302 | $temp_array['image_thumbnail'] = ""; |
| 266 | 303 | $temp_array['image_source'] = ""; |
@@ -268,7 +305,9 @@ discard block |
||
| 268 | 305 | |
| 269 | 306 | if (isset($row['highlight'])) { |
| 270 | 307 | $temp_array['highlight'] = $row['highlight']; |
| 271 | - } else $temp_array['highlight'] = ''; |
|
| 308 | + } else { |
|
| 309 | + $temp_array['highlight'] = ''; |
|
| 310 | + } |
|
| 272 | 311 | |
| 273 | 312 | if (isset($row['date'])) { |
| 274 | 313 | $dateArray = $this->parseDateString($row['date']); |
@@ -324,7 +363,9 @@ discard block |
||
| 324 | 363 | |
| 325 | 364 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
| 326 | 365 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
| 327 | - } else $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 366 | + } else { |
|
| 367 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 368 | + } |
|
| 328 | 369 | } else { |
| 329 | 370 | $temp_array['aircraft_shadow'] = 'default.png'; |
| 330 | 371 | $temp_array['aircraft_name'] = 'N/A'; |
@@ -332,11 +373,17 @@ discard block |
||
| 332 | 373 | } |
| 333 | 374 | } |
| 334 | 375 | $fromsource = NULL; |
| 335 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 336 | - elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 337 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 338 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 339 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 376 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 377 | + $fromsource = $globalAirlinesSource; |
|
| 378 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 379 | + $fromsource = 'vatsim'; |
|
| 380 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 381 | + $fromsource = 'ivao'; |
|
| 382 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 383 | + $fromsource = 'vatsim'; |
|
| 384 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 385 | + $fromsource = 'ivao'; |
|
| 386 | + } |
|
| 340 | 387 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
| 341 | 388 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
| 342 | 389 | if (is_numeric(substr($row['ident'], 2, 1))) { |
@@ -359,12 +406,18 @@ discard block |
||
| 359 | 406 | } |
| 360 | 407 | } else { |
| 361 | 408 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 362 | - if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 363 | - else $temp_array['airline_iata'] = 'N/A'; |
|
| 409 | + if (isset($row['airline_iata'])) { |
|
| 410 | + $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 411 | + } else { |
|
| 412 | + $temp_array['airline_iata'] = 'N/A'; |
|
| 413 | + } |
|
| 364 | 414 | $temp_array['airline_name'] = $row['airline_name']; |
| 365 | 415 | $temp_array['airline_country'] = $row['airline_country']; |
| 366 | - if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 367 | - else $temp_array['airline_callsign'] = 'N/A'; |
|
| 416 | + if (isset($row['airline_callsign'])) { |
|
| 417 | + $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 418 | + } else { |
|
| 419 | + $temp_array['airline_callsign'] = 'N/A'; |
|
| 420 | + } |
|
| 368 | 421 | $temp_array['airline_type'] = $row['airline_type']; |
| 369 | 422 | if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') { |
| 370 | 423 | $airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']); |
@@ -391,7 +444,9 @@ discard block |
||
| 391 | 444 | } |
| 392 | 445 | if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) { |
| 393 | 446 | $owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']); |
| 394 | - if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 447 | + if ($owner_info['owner'] != '') { |
|
| 448 | + $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 449 | + } |
|
| 395 | 450 | $temp_array['aircraft_base'] = $owner_info['base']; |
| 396 | 451 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
| 397 | 452 | } |
@@ -399,9 +454,14 @@ discard block |
||
| 399 | 454 | if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
| 400 | 455 | { |
| 401 | 456 | if ($globalIVAO) { |
| 402 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 403 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 404 | - } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 457 | + if (isset($temp_array['airline_icao'])) { |
|
| 458 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 459 | + } else { |
|
| 460 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 461 | + } |
|
| 462 | + } else { |
|
| 463 | + $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 464 | + } |
|
| 405 | 465 | if (count($image_array) > 0) { |
| 406 | 466 | $temp_array['image'] = $image_array[0]['image']; |
| 407 | 467 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -453,7 +513,9 @@ discard block |
||
| 453 | 513 | //if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') { |
| 454 | 514 | if ($row['departure_airport_icao'] != '') { |
| 455 | 515 | $departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']); |
| 456 | - if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 516 | + if (!isset($departure_airport_array[0]['name'])) { |
|
| 517 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 518 | + } |
|
| 457 | 519 | /* |
| 458 | 520 | } elseif ($row['departure_airport_name'] != '') { |
| 459 | 521 | $temp_array['departure_airport_name'] = $row['departure_airport_name']; |
@@ -461,7 +523,9 @@ discard block |
||
| 461 | 523 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 462 | 524 | $temp_array['departure_airport_icao'] = $row['departure_airport_icao']; |
| 463 | 525 | */ |
| 464 | - } else $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 526 | + } else { |
|
| 527 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 528 | + } |
|
| 465 | 529 | if (isset($departure_airport_array[0]['name'])) { |
| 466 | 530 | $temp_array['departure_airport_name'] = $departure_airport_array[0]['name']; |
| 467 | 531 | $temp_array['departure_airport_city'] = $departure_airport_array[0]['city']; |
@@ -481,8 +545,12 @@ discard block |
||
| 481 | 545 | |
| 482 | 546 | if ($row['arrival_airport_icao'] != '') { |
| 483 | 547 | $arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']); |
| 484 | - if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 485 | - } else $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 548 | + if (count($arrival_airport_array) == 0) { |
|
| 549 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 550 | + } |
|
| 551 | + } else { |
|
| 552 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 553 | + } |
|
| 486 | 554 | if (isset($arrival_airport_array[0]['name'])) { |
| 487 | 555 | $temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name']; |
| 488 | 556 | $temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city']; |
@@ -498,27 +566,45 @@ discard block |
||
| 498 | 566 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
| 499 | 567 | } |
| 500 | 568 | */ |
| 501 | - if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 502 | - if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 503 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
| 504 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
| 505 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
| 569 | + if (isset($row['pilot_id']) && $row['pilot_id'] != '') { |
|
| 570 | + $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 571 | + } |
|
| 572 | + if (isset($row['pilot_name']) && $row['pilot_name'] != '') { |
|
| 573 | + $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 574 | + } |
|
| 575 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
| 576 | + $temp_array['source_name'] = $row['source_name']; |
|
| 577 | + } |
|
| 578 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
| 579 | + $temp_array['over_country'] = $row['over_country']; |
|
| 580 | + } |
|
| 581 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
| 582 | + $temp_array['distance'] = $row['distance']; |
|
| 583 | + } |
|
| 506 | 584 | if (isset($row['squawk'])) { |
| 507 | 585 | $temp_array['squawk'] = $row['squawk']; |
| 508 | 586 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
| 509 | 587 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
| 510 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 588 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 589 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 590 | + } |
|
| 511 | 591 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
| 512 | 592 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
| 513 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 514 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 593 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 594 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 595 | + } |
|
| 596 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) { |
|
| 597 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 598 | + } |
|
| 515 | 599 | } |
| 516 | 600 | |
| 517 | 601 | $temp_array['query_number_rows'] = $num_rows; |
| 518 | 602 | |
| 519 | 603 | $spotter_array[] = $temp_array; |
| 520 | 604 | } |
| 521 | - if ($num_rows == 0) return array(); |
|
| 605 | + if ($num_rows == 0) { |
|
| 606 | + return array(); |
|
| 607 | + } |
|
| 522 | 608 | $spotter_array[0]['query_number_rows'] = $num_rows; |
| 523 | 609 | return $spotter_array; |
| 524 | 610 | } |
@@ -551,7 +637,9 @@ discard block |
||
| 551 | 637 | foreach ($q_array as $q_item){ |
| 552 | 638 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
| 553 | 639 | $additional_query .= " AND ("; |
| 554 | - if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 640 | + if (is_int($q_item)) { |
|
| 641 | + $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 642 | + } |
|
| 555 | 643 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
| 556 | 644 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
| 557 | 645 | $additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
@@ -572,7 +660,9 @@ discard block |
||
| 572 | 660 | $additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR "; |
| 573 | 661 | $additional_query .= "(spotter_output.ident like '%".$q_item."%') OR "; |
| 574 | 662 | $translate = $Translation->ident2icao($q_item); |
| 575 | - if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 663 | + if ($translate != $q_item) { |
|
| 664 | + $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 665 | + } |
|
| 576 | 666 | $additional_query .= "(spotter_output.highlight like '%".$q_item."%')"; |
| 577 | 667 | $additional_query .= ")"; |
| 578 | 668 | } |
@@ -799,7 +889,9 @@ discard block |
||
| 799 | 889 | date_default_timezone_set($globalTimezone); |
| 800 | 890 | $datetime = new DateTime(); |
| 801 | 891 | $offset = $datetime->format('P'); |
| 802 | - } else $offset = '+00:00'; |
|
| 892 | + } else { |
|
| 893 | + $offset = '+00:00'; |
|
| 894 | + } |
|
| 803 | 895 | |
| 804 | 896 | if ($date_array[1] != "") |
| 805 | 897 | { |
@@ -831,8 +923,12 @@ discard block |
||
| 831 | 923 | { |
| 832 | 924 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 833 | 925 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 834 | - } else $limit_query = ""; |
|
| 835 | - } else $limit_query = ""; |
|
| 926 | + } else { |
|
| 927 | + $limit_query = ""; |
|
| 928 | + } |
|
| 929 | + } else { |
|
| 930 | + $limit_query = ""; |
|
| 931 | + } |
|
| 836 | 932 | |
| 837 | 933 | |
| 838 | 934 | if ($sort != "") |
@@ -900,8 +996,12 @@ discard block |
||
| 900 | 996 | { |
| 901 | 997 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 902 | 998 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 903 | - } else $limit_query = ""; |
|
| 904 | - } else $limit_query = ""; |
|
| 999 | + } else { |
|
| 1000 | + $limit_query = ""; |
|
| 1001 | + } |
|
| 1002 | + } else { |
|
| 1003 | + $limit_query = ""; |
|
| 1004 | + } |
|
| 905 | 1005 | |
| 906 | 1006 | if ($sort != "") |
| 907 | 1007 | { |
@@ -1225,7 +1325,9 @@ discard block |
||
| 1225 | 1325 | global $global_query; |
| 1226 | 1326 | |
| 1227 | 1327 | date_default_timezone_set('UTC'); |
| 1228 | - if ($id == '') return array(); |
|
| 1328 | + if ($id == '') { |
|
| 1329 | + return array(); |
|
| 1330 | + } |
|
| 1229 | 1331 | $additional_query = "spotter_output.spotter_id = :id"; |
| 1230 | 1332 | $query_values = array(':id' => $id); |
| 1231 | 1333 | |
@@ -1340,8 +1442,11 @@ discard block |
||
| 1340 | 1442 | if ($sort != "") |
| 1341 | 1443 | { |
| 1342 | 1444 | $search_orderby_array = $this->getOrderBy(); |
| 1343 | - if (isset($search_orderby_array[$sort]['sql'])) $orderby_query = $search_orderby_array[$sort]['sql']; |
|
| 1344 | - else $orderby_query = " ORDER BY spotter_output.date DESC"; |
|
| 1445 | + if (isset($search_orderby_array[$sort]['sql'])) { |
|
| 1446 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
| 1447 | + } else { |
|
| 1448 | + $orderby_query = " ORDER BY spotter_output.date DESC"; |
|
| 1449 | + } |
|
| 1345 | 1450 | } else { |
| 1346 | 1451 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 1347 | 1452 | } |
@@ -1966,7 +2071,9 @@ discard block |
||
| 1966 | 2071 | { |
| 1967 | 2072 | $highlight = $row['highlight']; |
| 1968 | 2073 | } |
| 1969 | - if (isset($highlight)) return $highlight; |
|
| 2074 | + if (isset($highlight)) { |
|
| 2075 | + return $highlight; |
|
| 2076 | + } |
|
| 1970 | 2077 | } |
| 1971 | 2078 | |
| 1972 | 2079 | |
@@ -1994,7 +2101,9 @@ discard block |
||
| 1994 | 2101 | $sth->closeCursor(); |
| 1995 | 2102 | if (count($row) > 0) { |
| 1996 | 2103 | return $row['usage']; |
| 1997 | - } else return ''; |
|
| 2104 | + } else { |
|
| 2105 | + return ''; |
|
| 2106 | + } |
|
| 1998 | 2107 | } |
| 1999 | 2108 | |
| 2000 | 2109 | /** |
@@ -2019,7 +2128,9 @@ discard block |
||
| 2019 | 2128 | $sth->closeCursor(); |
| 2020 | 2129 | if (count($row) > 0) { |
| 2021 | 2130 | return $row['icao']; |
| 2022 | - } else return ''; |
|
| 2131 | + } else { |
|
| 2132 | + return ''; |
|
| 2133 | + } |
|
| 2023 | 2134 | } |
| 2024 | 2135 | |
| 2025 | 2136 | /** |
@@ -2047,7 +2158,9 @@ discard block |
||
| 2047 | 2158 | $airport_longitude = $row['longitude']; |
| 2048 | 2159 | $Common = new Common(); |
| 2049 | 2160 | return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
| 2050 | - } else return ''; |
|
| 2161 | + } else { |
|
| 2162 | + return ''; |
|
| 2163 | + } |
|
| 2051 | 2164 | } |
| 2052 | 2165 | |
| 2053 | 2166 | /** |
@@ -2159,7 +2272,9 @@ discard block |
||
| 2159 | 2272 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2160 | 2273 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2161 | 2274 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2162 | - } else return array(); |
|
| 2275 | + } else { |
|
| 2276 | + return array(); |
|
| 2277 | + } |
|
| 2163 | 2278 | if ($globalDBdriver == 'mysql') { |
| 2164 | 2279 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
| 2165 | 2280 | } else { |
@@ -2194,7 +2309,9 @@ discard block |
||
| 2194 | 2309 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2195 | 2310 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2196 | 2311 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2197 | - } else return array(); |
|
| 2312 | + } else { |
|
| 2313 | + return array(); |
|
| 2314 | + } |
|
| 2198 | 2315 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
| 2199 | 2316 | $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.")"; |
| 2200 | 2317 | //$query = "SELECT waypoints.* FROM waypoints"; |
@@ -2229,7 +2346,9 @@ discard block |
||
| 2229 | 2346 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
| 2230 | 2347 | { |
| 2231 | 2348 | global $globalUseRealAirlines; |
| 2232 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2349 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2350 | + $fromsource = NULL; |
|
| 2351 | + } |
|
| 2233 | 2352 | $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
| 2234 | 2353 | if ($airline_icao == 'NA') { |
| 2235 | 2354 | $airline_array = array(); |
@@ -2298,7 +2417,9 @@ discard block |
||
| 2298 | 2417 | public function getAllAirlineInfoByName($airline_name, $fromsource = NULL) |
| 2299 | 2418 | { |
| 2300 | 2419 | global $globalUseRealAirlines; |
| 2301 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2420 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2421 | + $fromsource = NULL; |
|
| 2422 | + } |
|
| 2302 | 2423 | $airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING)); |
| 2303 | 2424 | $query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1"; |
| 2304 | 2425 | $sth = $this->db->prepare($query); |
@@ -2314,7 +2435,9 @@ discard block |
||
| 2314 | 2435 | $sth->execute(array(':fromsource' => $fromsource)); |
| 2315 | 2436 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2316 | 2437 | $sth->closeCursor(); |
| 2317 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name); |
|
| 2438 | + if ($row['nb'] == 0) { |
|
| 2439 | + $result = $this->getAllAirlineInfoByName($airline_name); |
|
| 2440 | + } |
|
| 2318 | 2441 | } |
| 2319 | 2442 | return $result; |
| 2320 | 2443 | } |
@@ -2377,15 +2500,20 @@ discard block |
||
| 2377 | 2500 | 'A320-211' => 'A320', |
| 2378 | 2501 | '747-8i' => 'B748', |
| 2379 | 2502 | 'A380' => 'A388'); |
| 2380 | - if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
|
| 2503 | + if (isset($all_aircraft[$aircraft_type])) { |
|
| 2504 | + return $all_aircraft[$aircraft_type]; |
|
| 2505 | + } |
|
| 2381 | 2506 | |
| 2382 | 2507 | $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
| 2383 | 2508 | $aircraft_type = strtoupper($aircraft_type); |
| 2384 | 2509 | $sth = $this->db->prepare($query); |
| 2385 | 2510 | $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
| 2386 | 2511 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2387 | - if (isset($result[0]['icao'])) return $result[0]['icao']; |
|
| 2388 | - else return ''; |
|
| 2512 | + if (isset($result[0]['icao'])) { |
|
| 2513 | + return $result[0]['icao']; |
|
| 2514 | + } else { |
|
| 2515 | + return ''; |
|
| 2516 | + } |
|
| 2389 | 2517 | } |
| 2390 | 2518 | |
| 2391 | 2519 | /** |
@@ -2408,9 +2536,13 @@ discard block |
||
| 2408 | 2536 | $sth->closeCursor(); |
| 2409 | 2537 | if (isset($row['icaotypecode'])) { |
| 2410 | 2538 | $icao = $row['icaotypecode']; |
| 2411 | - if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao]; |
|
| 2539 | + if (isset($this->aircraft_correct_icaotype[$icao])) { |
|
| 2540 | + $icao = $this->aircraft_correct_icaotype[$icao]; |
|
| 2541 | + } |
|
| 2412 | 2542 | return $icao; |
| 2413 | - } else return ''; |
|
| 2543 | + } else { |
|
| 2544 | + return ''; |
|
| 2545 | + } |
|
| 2414 | 2546 | } |
| 2415 | 2547 | |
| 2416 | 2548 | /** |
@@ -2433,7 +2565,9 @@ discard block |
||
| 2433 | 2565 | $sth->closeCursor(); |
| 2434 | 2566 | if (isset($row['icaotypecode'])) { |
| 2435 | 2567 | return $row['icaotypecode']; |
| 2436 | - } else return ''; |
|
| 2568 | + } else { |
|
| 2569 | + return ''; |
|
| 2570 | + } |
|
| 2437 | 2571 | } |
| 2438 | 2572 | |
| 2439 | 2573 | /** |
@@ -2479,7 +2613,9 @@ discard block |
||
| 2479 | 2613 | $sth->closeCursor(); |
| 2480 | 2614 | if (isset($row['operator_correct'])) { |
| 2481 | 2615 | return $row['operator_correct']; |
| 2482 | - } else return $operator; |
|
| 2616 | + } else { |
|
| 2617 | + return $operator; |
|
| 2618 | + } |
|
| 2483 | 2619 | } |
| 2484 | 2620 | |
| 2485 | 2621 | /** |
@@ -2492,7 +2628,9 @@ discard block |
||
| 2492 | 2628 | public function getRouteInfo($callsign) |
| 2493 | 2629 | { |
| 2494 | 2630 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
| 2495 | - if ($callsign == '') return array(); |
|
| 2631 | + if ($callsign == '') { |
|
| 2632 | + return array(); |
|
| 2633 | + } |
|
| 2496 | 2634 | $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"; |
| 2497 | 2635 | |
| 2498 | 2636 | $sth = $this->db->prepare($query); |
@@ -2502,7 +2640,9 @@ discard block |
||
| 2502 | 2640 | $sth->closeCursor(); |
| 2503 | 2641 | if (count($row) > 0) { |
| 2504 | 2642 | return $row; |
| 2505 | - } else return array(); |
|
| 2643 | + } else { |
|
| 2644 | + return array(); |
|
| 2645 | + } |
|
| 2506 | 2646 | } |
| 2507 | 2647 | |
| 2508 | 2648 | /** |
@@ -2555,7 +2695,9 @@ discard block |
||
| 2555 | 2695 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 2556 | 2696 | $sth->closeCursor(); |
| 2557 | 2697 | return $result; |
| 2558 | - } else return array(); |
|
| 2698 | + } else { |
|
| 2699 | + return array(); |
|
| 2700 | + } |
|
| 2559 | 2701 | } |
| 2560 | 2702 | |
| 2561 | 2703 | |
@@ -2714,8 +2856,11 @@ discard block |
||
| 2714 | 2856 | $query .= " ORDER BY spotter_output.source_name ASC"; |
| 2715 | 2857 | |
| 2716 | 2858 | $sth = $this->db->prepare($query); |
| 2717 | - if (!empty($query_values)) $sth->execute($query_values); |
|
| 2718 | - else $sth->execute(); |
|
| 2859 | + if (!empty($query_values)) { |
|
| 2860 | + $sth->execute($query_values); |
|
| 2861 | + } else { |
|
| 2862 | + $sth->execute(); |
|
| 2863 | + } |
|
| 2719 | 2864 | |
| 2720 | 2865 | $source_array = array(); |
| 2721 | 2866 | $temp_array = array(); |
@@ -2748,9 +2893,13 @@ discard block |
||
| 2748 | 2893 | WHERE spotter_output.airline_icao <> '' |
| 2749 | 2894 | ORDER BY spotter_output.airline_name ASC"; |
| 2750 | 2895 | */ |
| 2751 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2752 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2753 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2896 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2897 | + $forsource = $globalAirlinesSource; |
|
| 2898 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2899 | + $forsource = 'vatsim'; |
|
| 2900 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2901 | + $forsource = 'ivao'; |
|
| 2902 | + } |
|
| 2754 | 2903 | if ($forsource === NULL) { |
| 2755 | 2904 | $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"; |
| 2756 | 2905 | $query_data = array(); |
@@ -2793,9 +2942,13 @@ discard block |
||
| 2793 | 2942 | { |
| 2794 | 2943 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
| 2795 | 2944 | $filter_query = $this->getFilter($filters,true,true); |
| 2796 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2797 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2798 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2945 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2946 | + $forsource = $globalAirlinesSource; |
|
| 2947 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2948 | + $forsource = 'vatsim'; |
|
| 2949 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2950 | + $forsource = 'ivao'; |
|
| 2951 | + } |
|
| 2799 | 2952 | if ($forsource === NULL) { |
| 2800 | 2953 | $query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC"; |
| 2801 | 2954 | $query_data = array(); |
@@ -3106,7 +3259,9 @@ discard block |
||
| 3106 | 3259 | date_default_timezone_set($globalTimezone); |
| 3107 | 3260 | $datetime = new DateTime(); |
| 3108 | 3261 | $offset = $datetime->format('P'); |
| 3109 | - } else $offset = '+00:00'; |
|
| 3262 | + } else { |
|
| 3263 | + $offset = '+00:00'; |
|
| 3264 | + } |
|
| 3110 | 3265 | if ($airport_icao == '') { |
| 3111 | 3266 | if ($globalDBdriver == 'mysql') { |
| 3112 | 3267 | $query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -3138,7 +3293,9 @@ discard block |
||
| 3138 | 3293 | date_default_timezone_set($globalTimezone); |
| 3139 | 3294 | $datetime = new DateTime(); |
| 3140 | 3295 | $offset = $datetime->format('P'); |
| 3141 | - } else $offset = '+00:00'; |
|
| 3296 | + } else { |
|
| 3297 | + $offset = '+00:00'; |
|
| 3298 | + } |
|
| 3142 | 3299 | if ($airport_icao == '') { |
| 3143 | 3300 | if ($globalDBdriver == 'mysql') { |
| 3144 | 3301 | $query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -3171,7 +3328,9 @@ discard block |
||
| 3171 | 3328 | date_default_timezone_set($globalTimezone); |
| 3172 | 3329 | $datetime = new DateTime(); |
| 3173 | 3330 | $offset = $datetime->format('P'); |
| 3174 | - } else $offset = '+00:00'; |
|
| 3331 | + } else { |
|
| 3332 | + $offset = '+00:00'; |
|
| 3333 | + } |
|
| 3175 | 3334 | if ($airport_icao == '') { |
| 3176 | 3335 | if ($globalDBdriver == 'mysql') { |
| 3177 | 3336 | $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 |
@@ -3210,7 +3369,9 @@ discard block |
||
| 3210 | 3369 | date_default_timezone_set($globalTimezone); |
| 3211 | 3370 | $datetime = new DateTime(); |
| 3212 | 3371 | $offset = $datetime->format('P'); |
| 3213 | - } else $offset = '+00:00'; |
|
| 3372 | + } else { |
|
| 3373 | + $offset = '+00:00'; |
|
| 3374 | + } |
|
| 3214 | 3375 | if ($airport_icao == '') { |
| 3215 | 3376 | if ($globalDBdriver == 'mysql') { |
| 3216 | 3377 | $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 |
@@ -3255,7 +3416,9 @@ discard block |
||
| 3255 | 3416 | date_default_timezone_set($globalTimezone); |
| 3256 | 3417 | $datetime = new DateTime(); |
| 3257 | 3418 | $offset = $datetime->format('P'); |
| 3258 | - } else $offset = '+00:00'; |
|
| 3419 | + } else { |
|
| 3420 | + $offset = '+00:00'; |
|
| 3421 | + } |
|
| 3259 | 3422 | if ($airport_icao == '') { |
| 3260 | 3423 | if ($globalDBdriver == 'mysql') { |
| 3261 | 3424 | $query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -3290,7 +3453,9 @@ discard block |
||
| 3290 | 3453 | date_default_timezone_set($globalTimezone); |
| 3291 | 3454 | $datetime = new DateTime(); |
| 3292 | 3455 | $offset = $datetime->format('P'); |
| 3293 | - } else $offset = '+00:00'; |
|
| 3456 | + } else { |
|
| 3457 | + $offset = '+00:00'; |
|
| 3458 | + } |
|
| 3294 | 3459 | if ($airport_icao == '') { |
| 3295 | 3460 | if ($globalDBdriver == 'mysql') { |
| 3296 | 3461 | $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 |
@@ -3332,7 +3497,9 @@ discard block |
||
| 3332 | 3497 | date_default_timezone_set($globalTimezone); |
| 3333 | 3498 | $datetime = new DateTime(); |
| 3334 | 3499 | $offset = $datetime->format('P'); |
| 3335 | - } else $offset = '+00:00'; |
|
| 3500 | + } else { |
|
| 3501 | + $offset = '+00:00'; |
|
| 3502 | + } |
|
| 3336 | 3503 | if ($airport_icao == '') { |
| 3337 | 3504 | if ($globalDBdriver == 'mysql') { |
| 3338 | 3505 | $query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -3366,7 +3533,9 @@ discard block |
||
| 3366 | 3533 | date_default_timezone_set($globalTimezone); |
| 3367 | 3534 | $datetime = new DateTime(); |
| 3368 | 3535 | $offset = $datetime->format('P'); |
| 3369 | - } else $offset = '+00:00'; |
|
| 3536 | + } else { |
|
| 3537 | + $offset = '+00:00'; |
|
| 3538 | + } |
|
| 3370 | 3539 | if ($airport_icao == '') { |
| 3371 | 3540 | if ($globalDBdriver == 'mysql') { |
| 3372 | 3541 | $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 |
@@ -3414,7 +3583,9 @@ discard block |
||
| 3414 | 3583 | date_default_timezone_set($globalTimezone); |
| 3415 | 3584 | $datetime = new DateTime(); |
| 3416 | 3585 | $offset = $datetime->format('P'); |
| 3417 | - } else $offset = '+00:00'; |
|
| 3586 | + } else { |
|
| 3587 | + $offset = '+00:00'; |
|
| 3588 | + } |
|
| 3418 | 3589 | |
| 3419 | 3590 | if ($globalDBdriver == 'mysql') { |
| 3420 | 3591 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
@@ -3534,7 +3705,9 @@ discard block |
||
| 3534 | 3705 | */ |
| 3535 | 3706 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
| 3536 | 3707 | { |
| 3537 | - if ($groundspeed == '') $groundspeed = NULL; |
|
| 3708 | + if ($groundspeed == '') { |
|
| 3709 | + $groundspeed = NULL; |
|
| 3710 | + } |
|
| 3538 | 3711 | $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'; |
| 3539 | 3712 | $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); |
| 3540 | 3713 | |
@@ -3584,10 +3757,18 @@ discard block |
||
| 3584 | 3757 | $Image = new Image($this->db); |
| 3585 | 3758 | $Common = new Common(); |
| 3586 | 3759 | |
| 3587 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 3588 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 3589 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 3590 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 3760 | + if (!isset($globalIVAO)) { |
|
| 3761 | + $globalIVAO = FALSE; |
|
| 3762 | + } |
|
| 3763 | + if (!isset($globalVATSIM)) { |
|
| 3764 | + $globalVATSIM = FALSE; |
|
| 3765 | + } |
|
| 3766 | + if (!isset($globalphpVMS)) { |
|
| 3767 | + $globalphpVMS = FALSE; |
|
| 3768 | + } |
|
| 3769 | + if (!isset($globalVAM)) { |
|
| 3770 | + $globalVAM = FALSE; |
|
| 3771 | + } |
|
| 3591 | 3772 | date_default_timezone_set('UTC'); |
| 3592 | 3773 | |
| 3593 | 3774 | //getting the registration |
@@ -3600,23 +3781,33 @@ discard block |
||
| 3600 | 3781 | if ($ModeS != '') { |
| 3601 | 3782 | $timeelapsed = microtime(true); |
| 3602 | 3783 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
| 3603 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3784 | + if ($globalDebugTimeElapsed) { |
|
| 3785 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3786 | + } |
|
| 3604 | 3787 | } else { |
| 3605 | 3788 | $myhex = explode('-',$flightaware_id); |
| 3606 | 3789 | if (count($myhex) > 0) { |
| 3607 | 3790 | $timeelapsed = microtime(true); |
| 3608 | 3791 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
| 3609 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3792 | + if ($globalDebugTimeElapsed) { |
|
| 3793 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3794 | + } |
|
| 3610 | 3795 | } |
| 3611 | 3796 | } |
| 3612 | 3797 | } |
| 3613 | 3798 | } |
| 3614 | 3799 | $fromsource = NULL; |
| 3615 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 3616 | - elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 3617 | - elseif ($format_source == 'whazzup') $fromsource = 'ivao'; |
|
| 3618 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 3619 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 3800 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 3801 | + $fromsource = $globalAirlinesSource; |
|
| 3802 | + } elseif ($format_source == 'vatsimtxt') { |
|
| 3803 | + $fromsource = 'vatsim'; |
|
| 3804 | + } elseif ($format_source == 'whazzup') { |
|
| 3805 | + $fromsource = 'ivao'; |
|
| 3806 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 3807 | + $fromsource = 'vatsim'; |
|
| 3808 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 3809 | + $fromsource = 'ivao'; |
|
| 3810 | + } |
|
| 3620 | 3811 | //getting the airline information |
| 3621 | 3812 | if ($ident != "") |
| 3622 | 3813 | { |
@@ -3640,15 +3831,21 @@ discard block |
||
| 3640 | 3831 | if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
| 3641 | 3832 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3642 | 3833 | } |
| 3643 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3834 | + if ($globalDebugTimeElapsed) { |
|
| 3835 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3836 | + } |
|
| 3644 | 3837 | |
| 3645 | 3838 | } else { |
| 3646 | 3839 | $timeelapsed = microtime(true); |
| 3647 | 3840 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3648 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3841 | + if ($globalDebugTimeElapsed) { |
|
| 3842 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3843 | + } |
|
| 3649 | 3844 | } |
| 3650 | 3845 | } |
| 3651 | - } else $airline_array = array(); |
|
| 3846 | + } else { |
|
| 3847 | + $airline_array = array(); |
|
| 3848 | + } |
|
| 3652 | 3849 | |
| 3653 | 3850 | //getting the aircraft information |
| 3654 | 3851 | $aircraft_array = array(); |
@@ -3662,27 +3859,37 @@ discard block |
||
| 3662 | 3859 | { |
| 3663 | 3860 | $timeelapsed = microtime(true); |
| 3664 | 3861 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3665 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3862 | + if ($globalDebugTimeElapsed) { |
|
| 3863 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3864 | + } |
|
| 3666 | 3865 | } else { |
| 3667 | 3866 | $timeelapsed = microtime(true); |
| 3668 | 3867 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3669 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3868 | + if ($globalDebugTimeElapsed) { |
|
| 3869 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3870 | + } |
|
| 3670 | 3871 | } |
| 3671 | 3872 | } |
| 3672 | 3873 | } else { |
| 3673 | 3874 | if ($ModeS != '') { |
| 3674 | 3875 | $timeelapsed = microtime(true); |
| 3675 | 3876 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
| 3676 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3877 | + if ($globalDebugTimeElapsed) { |
|
| 3878 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3879 | + } |
|
| 3677 | 3880 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
| 3678 | 3881 | { |
| 3679 | 3882 | $timeelapsed = microtime(true); |
| 3680 | 3883 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3681 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3884 | + if ($globalDebugTimeElapsed) { |
|
| 3885 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3886 | + } |
|
| 3682 | 3887 | } else { |
| 3683 | 3888 | $timeelapsed = microtime(true); |
| 3684 | 3889 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3685 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3890 | + if ($globalDebugTimeElapsed) { |
|
| 3891 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3892 | + } |
|
| 3686 | 3893 | } |
| 3687 | 3894 | } |
| 3688 | 3895 | } |
@@ -3698,7 +3905,9 @@ discard block |
||
| 3698 | 3905 | } else { |
| 3699 | 3906 | $timeelapsed = microtime(true); |
| 3700 | 3907 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
| 3701 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3908 | + if ($globalDebugTimeElapsed) { |
|
| 3909 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3910 | + } |
|
| 3702 | 3911 | } |
| 3703 | 3912 | } |
| 3704 | 3913 | |
@@ -3713,7 +3922,9 @@ discard block |
||
| 3713 | 3922 | } else { |
| 3714 | 3923 | $timeelapsed = microtime(true); |
| 3715 | 3924 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
| 3716 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3925 | + if ($globalDebugTimeElapsed) { |
|
| 3926 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3927 | + } |
|
| 3717 | 3928 | } |
| 3718 | 3929 | } |
| 3719 | 3930 | |
@@ -3747,7 +3958,9 @@ discard block |
||
| 3747 | 3958 | { |
| 3748 | 3959 | return false; |
| 3749 | 3960 | } |
| 3750 | - } else $altitude = 0; |
|
| 3961 | + } else { |
|
| 3962 | + $altitude = 0; |
|
| 3963 | + } |
|
| 3751 | 3964 | |
| 3752 | 3965 | if ($heading != "") |
| 3753 | 3966 | { |
@@ -3776,7 +3989,9 @@ discard block |
||
| 3776 | 3989 | { |
| 3777 | 3990 | $timeelapsed = microtime(true); |
| 3778 | 3991 | $image_array = $Image->getSpotterImage($registration); |
| 3779 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3992 | + if ($globalDebugTimeElapsed) { |
|
| 3993 | + echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3994 | + } |
|
| 3780 | 3995 | if (!isset($image_array[0]['registration'])) |
| 3781 | 3996 | { |
| 3782 | 3997 | //echo "Add image !!!! \n"; |
@@ -3784,14 +3999,21 @@ discard block |
||
| 3784 | 3999 | } |
| 3785 | 4000 | $timeelapsed = microtime(true); |
| 3786 | 4001 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
| 3787 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3788 | - if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 4002 | + if ($globalDebugTimeElapsed) { |
|
| 4003 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4004 | + } |
|
| 4005 | + if ($owner_info['owner'] != '') { |
|
| 4006 | + $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 4007 | + } |
|
| 3789 | 4008 | } |
| 3790 | 4009 | |
| 3791 | 4010 | if ($globalIVAO && $aircraft_icao != '') |
| 3792 | 4011 | { |
| 3793 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3794 | - else $airline_icao = ''; |
|
| 4012 | + if (isset($airline_array[0]['icao'])) { |
|
| 4013 | + $airline_icao = $airline_array[0]['icao']; |
|
| 4014 | + } else { |
|
| 4015 | + $airline_icao = ''; |
|
| 4016 | + } |
|
| 3795 | 4017 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
| 3796 | 4018 | if (!isset($image_array[0]['registration'])) |
| 3797 | 4019 | { |
@@ -3836,16 +4058,28 @@ discard block |
||
| 3836 | 4058 | { |
| 3837 | 4059 | $arrival_airport_array = $this->getAllAirportInfo('NA'); |
| 3838 | 4060 | } |
| 3839 | - if ($registration == '') $registration = 'NA'; |
|
| 4061 | + if ($registration == '') { |
|
| 4062 | + $registration = 'NA'; |
|
| 4063 | + } |
|
| 3840 | 4064 | if ($latitude == '' && $longitude == '') { |
| 3841 | 4065 | $latitude = 0; |
| 3842 | 4066 | $longitude = 0; |
| 3843 | 4067 | } |
| 3844 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3845 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3846 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3847 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3848 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 4068 | + if ($squawk == '' || $Common->isInteger($squawk) === false) { |
|
| 4069 | + $squawk = NULL; |
|
| 4070 | + } |
|
| 4071 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) { |
|
| 4072 | + $verticalrate = NULL; |
|
| 4073 | + } |
|
| 4074 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
| 4075 | + $heading = 0; |
|
| 4076 | + } |
|
| 4077 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
| 4078 | + $groundspeed = 0; |
|
| 4079 | + } |
|
| 4080 | + if (!isset($aircraft_owner)) { |
|
| 4081 | + $aircraft_owner = NULL; |
|
| 4082 | + } |
|
| 3849 | 4083 | $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) |
| 3850 | 4084 | 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)"; |
| 3851 | 4085 | |
@@ -3856,9 +4090,13 @@ discard block |
||
| 3856 | 4090 | if ($airline_type == '') { |
| 3857 | 4091 | $timeelapsed = microtime(true); |
| 3858 | 4092 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3859 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4093 | + if ($globalDebugTimeElapsed) { |
|
| 4094 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4095 | + } |
|
| 4096 | + } |
|
| 4097 | + if ($airline_type == null) { |
|
| 4098 | + $airline_type = ''; |
|
| 3860 | 4099 | } |
| 3861 | - if ($airline_type == null) $airline_type = ''; |
|
| 3862 | 4100 | $aircraft_type = $aircraft_array[0]['type']; |
| 3863 | 4101 | $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
| 3864 | 4102 | $departure_airport_name = $departure_airport_array[0]['name']; |
@@ -4022,7 +4260,9 @@ discard block |
||
| 4022 | 4260 | } |
| 4023 | 4261 | } |
| 4024 | 4262 | $query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC"; |
| 4025 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4263 | + if ($limit) { |
|
| 4264 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4265 | + } |
|
| 4026 | 4266 | |
| 4027 | 4267 | $sth = $this->db->prepare($query); |
| 4028 | 4268 | $sth->execute($query_values); |
@@ -4095,7 +4335,9 @@ discard block |
||
| 4095 | 4335 | } |
| 4096 | 4336 | |
| 4097 | 4337 | $query .= " GROUP BY spotter_output.pilot_id,s.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 4098 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4338 | + if ($limit) { |
|
| 4339 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4340 | + } |
|
| 4099 | 4341 | |
| 4100 | 4342 | |
| 4101 | 4343 | $sth = $this->db->prepare($query); |
@@ -4139,7 +4381,9 @@ discard block |
||
| 4139 | 4381 | } |
| 4140 | 4382 | } |
| 4141 | 4383 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 4142 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4384 | + if ($limit) { |
|
| 4385 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4386 | + } |
|
| 4143 | 4387 | |
| 4144 | 4388 | |
| 4145 | 4389 | $sth = $this->db->prepare($query); |
@@ -4215,7 +4459,9 @@ discard block |
||
| 4215 | 4459 | } |
| 4216 | 4460 | } |
| 4217 | 4461 | $query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC"; |
| 4218 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4462 | + if ($limit) { |
|
| 4463 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4464 | + } |
|
| 4219 | 4465 | |
| 4220 | 4466 | $sth = $this->db->prepare($query); |
| 4221 | 4467 | $sth->execute($query_values); |
@@ -4257,7 +4503,9 @@ discard block |
||
| 4257 | 4503 | } |
| 4258 | 4504 | } |
| 4259 | 4505 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC"; |
| 4260 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4506 | + if ($limit) { |
|
| 4507 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4508 | + } |
|
| 4261 | 4509 | |
| 4262 | 4510 | |
| 4263 | 4511 | $sth = $this->db->prepare($query); |
@@ -4500,7 +4748,9 @@ discard block |
||
| 4500 | 4748 | date_default_timezone_set($globalTimezone); |
| 4501 | 4749 | $datetime = new DateTime($date); |
| 4502 | 4750 | $offset = $datetime->format('P'); |
| 4503 | - } else $offset = '+00:00'; |
|
| 4751 | + } else { |
|
| 4752 | + $offset = '+00:00'; |
|
| 4753 | + } |
|
| 4504 | 4754 | |
| 4505 | 4755 | if ($globalDBdriver == 'mysql') { |
| 4506 | 4756 | $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
@@ -4548,7 +4798,9 @@ discard block |
||
| 4548 | 4798 | date_default_timezone_set($globalTimezone); |
| 4549 | 4799 | $datetime = new DateTime($date); |
| 4550 | 4800 | $offset = $datetime->format('P'); |
| 4551 | - } else $offset = '+00:00'; |
|
| 4801 | + } else { |
|
| 4802 | + $offset = '+00:00'; |
|
| 4803 | + } |
|
| 4552 | 4804 | |
| 4553 | 4805 | if ($globalDBdriver == 'mysql') { |
| 4554 | 4806 | $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
@@ -4668,9 +4920,13 @@ discard block |
||
| 4668 | 4920 | $sth = $this->db->prepare($query); |
| 4669 | 4921 | $sth->execute($query_values); |
| 4670 | 4922 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 4671 | - if (is_numeric($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
| 4672 | - elseif ($result[0]['duration'] == '') return 0; |
|
| 4673 | - else return $result[0]['duration']; |
|
| 4923 | + if (is_numeric($result[0]['duration'])) { |
|
| 4924 | + return gmdate('H:i:s',$result[0]['duration']); |
|
| 4925 | + } elseif ($result[0]['duration'] == '') { |
|
| 4926 | + return 0; |
|
| 4927 | + } else { |
|
| 4928 | + return $result[0]['duration']; |
|
| 4929 | + } |
|
| 4674 | 4930 | } |
| 4675 | 4931 | |
| 4676 | 4932 | /** |
@@ -4759,8 +5015,11 @@ discard block |
||
| 4759 | 5015 | $sth = $this->db->prepare($query); |
| 4760 | 5016 | $sth->execute($query_values); |
| 4761 | 5017 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 4762 | - if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
| 4763 | - else return $result[0]['duration']; |
|
| 5018 | + if (is_int($result[0]['duration'])) { |
|
| 5019 | + return gmdate('H:i:s',$result[0]['duration']); |
|
| 5020 | + } else { |
|
| 5021 | + return $result[0]['duration']; |
|
| 5022 | + } |
|
| 4764 | 5023 | } |
| 4765 | 5024 | |
| 4766 | 5025 | /** |
@@ -4965,7 +5224,9 @@ discard block |
||
| 4965 | 5224 | } |
| 4966 | 5225 | $query .= " GROUP BY spotter_output.airline_country |
| 4967 | 5226 | ORDER BY airline_country_count DESC"; |
| 4968 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5227 | + if ($limit) { |
|
| 5228 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5229 | + } |
|
| 4969 | 5230 | |
| 4970 | 5231 | $sth = $this->db->prepare($query); |
| 4971 | 5232 | $sth->execute($query_values); |
@@ -4993,7 +5254,9 @@ discard block |
||
| 4993 | 5254 | global $globalDBdriver; |
| 4994 | 5255 | //$filter_query = $this->getFilter($filters,true,true); |
| 4995 | 5256 | $Connection= new Connection($this->db); |
| 4996 | - if (!$Connection->tableExists('countries')) return array(); |
|
| 5257 | + if (!$Connection->tableExists('countries')) { |
|
| 5258 | + return array(); |
|
| 5259 | + } |
|
| 4997 | 5260 | /* |
| 4998 | 5261 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
| 4999 | 5262 | FROM countries c, spotter_output s |
@@ -5025,7 +5288,9 @@ discard block |
||
| 5025 | 5288 | } |
| 5026 | 5289 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT flightaware_id,over_country FROM spotter_live".$filter_query.") l ON c.iso2 = l.over_country "; |
| 5027 | 5290 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
| 5028 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5291 | + if ($limit) { |
|
| 5292 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5293 | + } |
|
| 5029 | 5294 | |
| 5030 | 5295 | |
| 5031 | 5296 | $sth = $this->db->prepare($query); |
@@ -5102,7 +5367,9 @@ discard block |
||
| 5102 | 5367 | } |
| 5103 | 5368 | |
| 5104 | 5369 | $query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 5105 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5370 | + if ($limit) { |
|
| 5371 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5372 | + } |
|
| 5106 | 5373 | |
| 5107 | 5374 | $sth = $this->db->prepare($query); |
| 5108 | 5375 | $sth->execute($query_values); |
@@ -5176,7 +5443,9 @@ discard block |
||
| 5176 | 5443 | } |
| 5177 | 5444 | |
| 5178 | 5445 | $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"; |
| 5179 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5446 | + if ($limit) { |
|
| 5447 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5448 | + } |
|
| 5180 | 5449 | |
| 5181 | 5450 | $sth = $this->db->prepare($query); |
| 5182 | 5451 | $sth->execute($query_values); |
@@ -5223,7 +5492,9 @@ discard block |
||
| 5223 | 5492 | } |
| 5224 | 5493 | |
| 5225 | 5494 | $query .= "GROUP BY EXTRACT(month from spotter_output.date), EXTRACT(year from spotter_output.date), spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 5226 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5495 | + if ($limit) { |
|
| 5496 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5497 | + } |
|
| 5227 | 5498 | |
| 5228 | 5499 | $sth = $this->db->prepare($query); |
| 5229 | 5500 | $sth->execute(); |
@@ -5276,7 +5547,9 @@ discard block |
||
| 5276 | 5547 | if($row['registration'] != "") |
| 5277 | 5548 | { |
| 5278 | 5549 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5279 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5550 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5551 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5552 | + } |
|
| 5280 | 5553 | } |
| 5281 | 5554 | $temp_array['registration_count'] = $row['registration_count']; |
| 5282 | 5555 | |
@@ -5351,7 +5624,9 @@ discard block |
||
| 5351 | 5624 | if($row['registration'] != "") |
| 5352 | 5625 | { |
| 5353 | 5626 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5354 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5627 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5628 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5629 | + } |
|
| 5355 | 5630 | } |
| 5356 | 5631 | $temp_array['registration_count'] = $row['registration_count']; |
| 5357 | 5632 | |
@@ -5458,7 +5733,9 @@ discard block |
||
| 5458 | 5733 | if($row['registration'] != "") |
| 5459 | 5734 | { |
| 5460 | 5735 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5461 | - 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 | + } |
|
| 5462 | 5739 | } |
| 5463 | 5740 | $temp_array['registration_count'] = $row['registration_count']; |
| 5464 | 5741 | $aircraft_array[] = $temp_array; |
@@ -5583,7 +5860,9 @@ discard block |
||
| 5583 | 5860 | date_default_timezone_set($globalTimezone); |
| 5584 | 5861 | $datetime = new DateTime($date); |
| 5585 | 5862 | $offset = $datetime->format('P'); |
| 5586 | - } else $offset = '+00:00'; |
|
| 5863 | + } else { |
|
| 5864 | + $offset = '+00:00'; |
|
| 5865 | + } |
|
| 5587 | 5866 | |
| 5588 | 5867 | if ($globalDBdriver == 'mysql') { |
| 5589 | 5868 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
@@ -5630,7 +5909,9 @@ discard block |
||
| 5630 | 5909 | date_default_timezone_set($globalTimezone); |
| 5631 | 5910 | $datetime = new DateTime($date); |
| 5632 | 5911 | $offset = $datetime->format('P'); |
| 5633 | - } else $offset = '+00:00'; |
|
| 5912 | + } else { |
|
| 5913 | + $offset = '+00:00'; |
|
| 5914 | + } |
|
| 5634 | 5915 | |
| 5635 | 5916 | if ($globalDBdriver == 'mysql') { |
| 5636 | 5917 | $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 |
@@ -5659,7 +5940,9 @@ discard block |
||
| 5659 | 5940 | if($row['registration'] != "") |
| 5660 | 5941 | { |
| 5661 | 5942 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5662 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5943 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5944 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5945 | + } |
|
| 5663 | 5946 | } |
| 5664 | 5947 | $temp_array['registration_count'] = $row['registration_count']; |
| 5665 | 5948 | |
@@ -5684,7 +5967,9 @@ discard block |
||
| 5684 | 5967 | date_default_timezone_set($globalTimezone); |
| 5685 | 5968 | $datetime = new DateTime($date); |
| 5686 | 5969 | $offset = $datetime->format('P'); |
| 5687 | - } else $offset = '+00:00'; |
|
| 5970 | + } else { |
|
| 5971 | + $offset = '+00:00'; |
|
| 5972 | + } |
|
| 5688 | 5973 | |
| 5689 | 5974 | if ($globalDBdriver == 'mysql') { |
| 5690 | 5975 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
@@ -5880,8 +6165,11 @@ discard block |
||
| 5880 | 6165 | if($row['registration'] != "") |
| 5881 | 6166 | { |
| 5882 | 6167 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5883 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5884 | - else $temp_array['image_thumbnail'] = ''; |
|
| 6168 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6169 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6170 | + } else { |
|
| 6171 | + $temp_array['image_thumbnail'] = ''; |
|
| 6172 | + } |
|
| 5885 | 6173 | } |
| 5886 | 6174 | $temp_array['registration_count'] = $row['registration_count']; |
| 5887 | 6175 | $aircraft_array[] = $temp_array; |
@@ -5955,8 +6243,11 @@ discard block |
||
| 5955 | 6243 | if($row['registration'] != "") |
| 5956 | 6244 | { |
| 5957 | 6245 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5958 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5959 | - else $temp_array['image_thumbnail'] = ''; |
|
| 6246 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6247 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6248 | + } else { |
|
| 6249 | + $temp_array['image_thumbnail'] = ''; |
|
| 6250 | + } |
|
| 5960 | 6251 | } |
| 5961 | 6252 | $temp_array['registration_count'] = $row['registration_count']; |
| 5962 | 6253 | $aircraft_array[] = $temp_array; |
@@ -6030,8 +6321,11 @@ discard block |
||
| 6030 | 6321 | if($row['registration'] != "") |
| 6031 | 6322 | { |
| 6032 | 6323 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6033 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6034 | - else $temp_array['image_thumbnail'] = ''; |
|
| 6324 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6325 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6326 | + } else { |
|
| 6327 | + $temp_array['image_thumbnail'] = ''; |
|
| 6328 | + } |
|
| 6035 | 6329 | } |
| 6036 | 6330 | $temp_array['registration_count'] = $row['registration_count']; |
| 6037 | 6331 | $aircraft_array[] = $temp_array; |
@@ -6242,7 +6536,9 @@ discard block |
||
| 6242 | 6536 | if($row['registration'] != "") |
| 6243 | 6537 | { |
| 6244 | 6538 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6245 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6539 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6540 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6541 | + } |
|
| 6246 | 6542 | } |
| 6247 | 6543 | $temp_array['registration_count'] = $row['registration_count']; |
| 6248 | 6544 | |
@@ -6359,7 +6655,9 @@ discard block |
||
| 6359 | 6655 | if($row['registration'] != "") |
| 6360 | 6656 | { |
| 6361 | 6657 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6362 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6658 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6659 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6660 | + } |
|
| 6363 | 6661 | } |
| 6364 | 6662 | $temp_array['registration_count'] = $row['registration_count']; |
| 6365 | 6663 | |
@@ -6525,7 +6823,9 @@ discard block |
||
| 6525 | 6823 | } |
| 6526 | 6824 | } |
| 6527 | 6825 | $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
| 6528 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6826 | + if ($limit) { |
|
| 6827 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6828 | + } |
|
| 6529 | 6829 | |
| 6530 | 6830 | $sth = $this->db->prepare($query); |
| 6531 | 6831 | $sth->execute($query_values); |
@@ -6544,7 +6844,9 @@ discard block |
||
| 6544 | 6844 | if($row['registration'] != "") |
| 6545 | 6845 | { |
| 6546 | 6846 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6547 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6847 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6848 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6849 | + } |
|
| 6548 | 6850 | } |
| 6549 | 6851 | |
| 6550 | 6852 | $aircraft_array[] = $temp_array; |
@@ -6585,7 +6887,9 @@ discard block |
||
| 6585 | 6887 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6586 | 6888 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6587 | 6889 | $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"; |
| 6588 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6890 | + if ($limit) { |
|
| 6891 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6892 | + } |
|
| 6589 | 6893 | |
| 6590 | 6894 | $sth = $this->db->prepare($query); |
| 6591 | 6895 | $sth->execute(); |
@@ -6605,7 +6909,9 @@ discard block |
||
| 6605 | 6909 | if($row['registration'] != "") |
| 6606 | 6910 | { |
| 6607 | 6911 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6608 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6912 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6913 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6914 | + } |
|
| 6609 | 6915 | } |
| 6610 | 6916 | |
| 6611 | 6917 | $aircraft_array[] = $temp_array; |
@@ -6671,7 +6977,9 @@ discard block |
||
| 6671 | 6977 | } |
| 6672 | 6978 | $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6673 | 6979 | ORDER BY airport_departure_icao_count DESC"; |
| 6674 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6980 | + if ($limit) { |
|
| 6981 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6982 | + } |
|
| 6675 | 6983 | |
| 6676 | 6984 | $sth = $this->db->prepare($query); |
| 6677 | 6985 | $sth->execute($query_values); |
@@ -6722,7 +7030,9 @@ discard block |
||
| 6722 | 7030 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6723 | 7031 | $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 |
| 6724 | 7032 | ORDER BY airport_departure_icao_count DESC"; |
| 6725 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7033 | + if ($limit) { |
|
| 7034 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7035 | + } |
|
| 6726 | 7036 | |
| 6727 | 7037 | $sth = $this->db->prepare($query); |
| 6728 | 7038 | $sth->execute(); |
@@ -6800,7 +7110,9 @@ discard block |
||
| 6800 | 7110 | } |
| 6801 | 7111 | $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
| 6802 | 7112 | ORDER BY airport_departure_icao_count DESC"; |
| 6803 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7113 | + if ($limit) { |
|
| 7114 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7115 | + } |
|
| 6804 | 7116 | //echo $query; |
| 6805 | 7117 | $sth = $this->db->prepare($query); |
| 6806 | 7118 | $sth->execute($query_values); |
@@ -6852,7 +7164,9 @@ discard block |
||
| 6852 | 7164 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6853 | 7165 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
| 6854 | 7166 | ORDER BY airport_departure_icao_count DESC"; |
| 6855 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7167 | + if ($limit) { |
|
| 7168 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7169 | + } |
|
| 6856 | 7170 | |
| 6857 | 7171 | $sth = $this->db->prepare($query); |
| 6858 | 7172 | $sth->execute(); |
@@ -7247,7 +7561,9 @@ discard block |
||
| 7247 | 7561 | date_default_timezone_set($globalTimezone); |
| 7248 | 7562 | $datetime = new DateTime($date); |
| 7249 | 7563 | $offset = $datetime->format('P'); |
| 7250 | - } else $offset = '+00:00'; |
|
| 7564 | + } else { |
|
| 7565 | + $offset = '+00:00'; |
|
| 7566 | + } |
|
| 7251 | 7567 | |
| 7252 | 7568 | if ($globalDBdriver == 'mysql') { |
| 7253 | 7569 | $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 |
@@ -7297,7 +7613,9 @@ discard block |
||
| 7297 | 7613 | date_default_timezone_set($globalTimezone); |
| 7298 | 7614 | $datetime = new DateTime($date); |
| 7299 | 7615 | $offset = $datetime->format('P'); |
| 7300 | - } else $offset = '+00:00'; |
|
| 7616 | + } else { |
|
| 7617 | + $offset = '+00:00'; |
|
| 7618 | + } |
|
| 7301 | 7619 | |
| 7302 | 7620 | if ($globalDBdriver == 'mysql') { |
| 7303 | 7621 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
@@ -7646,7 +7964,9 @@ discard block |
||
| 7646 | 7964 | } |
| 7647 | 7965 | $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7648 | 7966 | ORDER BY airport_arrival_icao_count DESC"; |
| 7649 | - if ($limit) $query .= " LIMIT 10"; |
|
| 7967 | + if ($limit) { |
|
| 7968 | + $query .= " LIMIT 10"; |
|
| 7969 | + } |
|
| 7650 | 7970 | |
| 7651 | 7971 | |
| 7652 | 7972 | $sth = $this->db->prepare($query); |
@@ -7666,7 +7986,9 @@ discard block |
||
| 7666 | 7986 | if ($icaoaskey) { |
| 7667 | 7987 | $icao = $row['arrival_airport_icao']; |
| 7668 | 7988 | $airport_array[$icao] = $temp_array; |
| 7669 | - } else $airport_array[] = $temp_array; |
|
| 7989 | + } else { |
|
| 7990 | + $airport_array[] = $temp_array; |
|
| 7991 | + } |
|
| 7670 | 7992 | } |
| 7671 | 7993 | |
| 7672 | 7994 | return $airport_array; |
@@ -7703,7 +8025,9 @@ discard block |
||
| 7703 | 8025 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 7704 | 8026 | $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 |
| 7705 | 8027 | ORDER BY airport_arrival_icao_count DESC"; |
| 7706 | - if ($limit) $query .= " LIMIT 10"; |
|
| 8028 | + if ($limit) { |
|
| 8029 | + $query .= " LIMIT 10"; |
|
| 8030 | + } |
|
| 7707 | 8031 | |
| 7708 | 8032 | |
| 7709 | 8033 | $sth = $this->db->prepare($query); |
@@ -7724,7 +8048,9 @@ discard block |
||
| 7724 | 8048 | if ($icaoaskey) { |
| 7725 | 8049 | $icao = $row['arrival_airport_icao']; |
| 7726 | 8050 | $airport_array[$icao] = $temp_array; |
| 7727 | - } else $airport_array[] = $temp_array; |
|
| 8051 | + } else { |
|
| 8052 | + $airport_array[] = $temp_array; |
|
| 8053 | + } |
|
| 7728 | 8054 | } |
| 7729 | 8055 | |
| 7730 | 8056 | return $airport_array; |
@@ -7787,7 +8113,9 @@ discard block |
||
| 7787 | 8113 | } |
| 7788 | 8114 | $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
| 7789 | 8115 | ORDER BY airport_arrival_icao_count DESC"; |
| 7790 | - if ($limit) $query .= " LIMIT 10"; |
|
| 8116 | + if ($limit) { |
|
| 8117 | + $query .= " LIMIT 10"; |
|
| 8118 | + } |
|
| 7791 | 8119 | |
| 7792 | 8120 | |
| 7793 | 8121 | $sth = $this->db->prepare($query); |
@@ -7806,7 +8134,9 @@ discard block |
||
| 7806 | 8134 | if ($icaoaskey) { |
| 7807 | 8135 | $icao = $row['arrival_airport_icao']; |
| 7808 | 8136 | $airport_array[$icao] = $temp_array; |
| 7809 | - } else $airport_array[] = $temp_array; |
|
| 8137 | + } else { |
|
| 8138 | + $airport_array[] = $temp_array; |
|
| 8139 | + } |
|
| 7810 | 8140 | } |
| 7811 | 8141 | |
| 7812 | 8142 | return $airport_array; |
@@ -7843,7 +8173,9 @@ discard block |
||
| 7843 | 8173 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 7844 | 8174 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
| 7845 | 8175 | ORDER BY airport_arrival_icao_count DESC"; |
| 7846 | - if ($limit) $query .= " LIMIT 10"; |
|
| 8176 | + if ($limit) { |
|
| 8177 | + $query .= " LIMIT 10"; |
|
| 8178 | + } |
|
| 7847 | 8179 | |
| 7848 | 8180 | |
| 7849 | 8181 | $sth = $this->db->prepare($query); |
@@ -7864,7 +8196,9 @@ discard block |
||
| 7864 | 8196 | if ($icaoaskey) { |
| 7865 | 8197 | $icao = $row['arrival_airport_icao']; |
| 7866 | 8198 | $airport_array[$icao] = $temp_array; |
| 7867 | - } else $airport_array[] = $temp_array; |
|
| 8199 | + } else { |
|
| 8200 | + $airport_array[] = $temp_array; |
|
| 8201 | + } |
|
| 7868 | 8202 | } |
| 7869 | 8203 | |
| 7870 | 8204 | return $airport_array; |
@@ -8245,7 +8579,9 @@ discard block |
||
| 8245 | 8579 | date_default_timezone_set($globalTimezone); |
| 8246 | 8580 | $datetime = new DateTime($date); |
| 8247 | 8581 | $offset = $datetime->format('P'); |
| 8248 | - } else $offset = '+00:00'; |
|
| 8582 | + } else { |
|
| 8583 | + $offset = '+00:00'; |
|
| 8584 | + } |
|
| 8249 | 8585 | |
| 8250 | 8586 | if ($globalDBdriver == 'mysql') { |
| 8251 | 8587 | $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 |
@@ -8295,7 +8631,9 @@ discard block |
||
| 8295 | 8631 | date_default_timezone_set($globalTimezone); |
| 8296 | 8632 | $datetime = new DateTime($date); |
| 8297 | 8633 | $offset = $datetime->format('P'); |
| 8298 | - } else $offset = '+00:00'; |
|
| 8634 | + } else { |
|
| 8635 | + $offset = '+00:00'; |
|
| 8636 | + } |
|
| 8299 | 8637 | |
| 8300 | 8638 | if ($globalDBdriver == 'mysql') { |
| 8301 | 8639 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
@@ -8686,7 +9024,9 @@ discard block |
||
| 8686 | 9024 | } |
| 8687 | 9025 | $query .= " GROUP BY spotter_output.arrival_airport_country |
| 8688 | 9026 | ORDER BY airport_arrival_country_count DESC"; |
| 8689 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 9027 | + if ($limit) { |
|
| 9028 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 9029 | + } |
|
| 8690 | 9030 | |
| 8691 | 9031 | |
| 8692 | 9032 | $sth = $this->db->prepare($query); |
@@ -8973,7 +9313,9 @@ discard block |
||
| 8973 | 9313 | date_default_timezone_set($globalTimezone); |
| 8974 | 9314 | $datetime = new DateTime($date); |
| 8975 | 9315 | $offset = $datetime->format('P'); |
| 8976 | - } else $offset = '+00:00'; |
|
| 9316 | + } else { |
|
| 9317 | + $offset = '+00:00'; |
|
| 9318 | + } |
|
| 8977 | 9319 | |
| 8978 | 9320 | if ($globalDBdriver == 'mysql') { |
| 8979 | 9321 | $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 |
@@ -9229,12 +9571,18 @@ discard block |
||
| 9229 | 9571 | $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
| 9230 | 9572 | FROM spotter_output".$filter_query." spotter_output.ident <> ''"; |
| 9231 | 9573 | if ($olderthanmonths > 0) { |
| 9232 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 9233 | - else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 9574 | + if ($globalDBdriver == 'mysql') { |
|
| 9575 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 9576 | + } else { |
|
| 9577 | + $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 9578 | + } |
|
| 9234 | 9579 | } |
| 9235 | 9580 | if ($sincedate != '') { |
| 9236 | - if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 9237 | - else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 9581 | + if ($globalDBdriver == 'mysql') { |
|
| 9582 | + $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 9583 | + } else { |
|
| 9584 | + $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 9585 | + } |
|
| 9238 | 9586 | } |
| 9239 | 9587 | $query_values = array(); |
| 9240 | 9588 | if ($year != '') { |
@@ -9265,7 +9613,9 @@ discard block |
||
| 9265 | 9613 | } |
| 9266 | 9614 | } |
| 9267 | 9615 | $query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 9268 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 9616 | + if ($limit) { |
|
| 9617 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 9618 | + } |
|
| 9269 | 9619 | |
| 9270 | 9620 | $sth = $this->db->prepare($query); |
| 9271 | 9621 | $sth->execute($query_values); |
@@ -9299,15 +9649,23 @@ discard block |
||
| 9299 | 9649 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
| 9300 | 9650 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
| 9301 | 9651 | if ($olderthanmonths > 0) { |
| 9302 | - if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 9303 | - else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 9652 | + if ($globalDBdriver == 'mysql') { |
|
| 9653 | + $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 9654 | + } else { |
|
| 9655 | + $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 9656 | + } |
|
| 9304 | 9657 | } |
| 9305 | 9658 | if ($sincedate != '') { |
| 9306 | - if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 9307 | - else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 9659 | + if ($globalDBdriver == 'mysql') { |
|
| 9660 | + $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 9661 | + } else { |
|
| 9662 | + $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 9663 | + } |
|
| 9308 | 9664 | } |
| 9309 | 9665 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 9310 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 9666 | + if ($limit) { |
|
| 9667 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 9668 | + } |
|
| 9311 | 9669 | |
| 9312 | 9670 | $sth = $this->db->prepare($query); |
| 9313 | 9671 | $sth->execute(); |
@@ -9344,7 +9702,9 @@ discard block |
||
| 9344 | 9702 | date_default_timezone_set($globalTimezone); |
| 9345 | 9703 | $datetime = new DateTime(); |
| 9346 | 9704 | $offset = $datetime->format('P'); |
| 9347 | - } else $offset = '+00:00'; |
|
| 9705 | + } else { |
|
| 9706 | + $offset = '+00:00'; |
|
| 9707 | + } |
|
| 9348 | 9708 | |
| 9349 | 9709 | if ($globalDBdriver == 'mysql') { |
| 9350 | 9710 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9393,7 +9753,9 @@ discard block |
||
| 9393 | 9753 | date_default_timezone_set($globalTimezone); |
| 9394 | 9754 | $datetime = new DateTime(); |
| 9395 | 9755 | $offset = $datetime->format('P'); |
| 9396 | - } else $offset = '+00:00'; |
|
| 9756 | + } else { |
|
| 9757 | + $offset = '+00:00'; |
|
| 9758 | + } |
|
| 9397 | 9759 | $filter_query = $this->getFilter($filters,true,true); |
| 9398 | 9760 | if ($globalDBdriver == 'mysql') { |
| 9399 | 9761 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9442,7 +9804,9 @@ discard block |
||
| 9442 | 9804 | date_default_timezone_set($globalTimezone); |
| 9443 | 9805 | $datetime = new DateTime(); |
| 9444 | 9806 | $offset = $datetime->format('P'); |
| 9445 | - } else $offset = '+00:00'; |
|
| 9807 | + } else { |
|
| 9808 | + $offset = '+00:00'; |
|
| 9809 | + } |
|
| 9446 | 9810 | $filter_query = $this->getFilter($filters,true,true); |
| 9447 | 9811 | if ($globalDBdriver == 'mysql') { |
| 9448 | 9812 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9488,7 +9852,9 @@ discard block |
||
| 9488 | 9852 | date_default_timezone_set($globalTimezone); |
| 9489 | 9853 | $datetime = new DateTime(); |
| 9490 | 9854 | $offset = $datetime->format('P'); |
| 9491 | - } else $offset = '+00:00'; |
|
| 9855 | + } else { |
|
| 9856 | + $offset = '+00:00'; |
|
| 9857 | + } |
|
| 9492 | 9858 | $filter_query = $this->getFilter($filters,true,true); |
| 9493 | 9859 | if ($globalDBdriver == 'mysql') { |
| 9494 | 9860 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9536,7 +9902,9 @@ discard block |
||
| 9536 | 9902 | date_default_timezone_set($globalTimezone); |
| 9537 | 9903 | $datetime = new DateTime(); |
| 9538 | 9904 | $offset = $datetime->format('P'); |
| 9539 | - } else $offset = '+00:00'; |
|
| 9905 | + } else { |
|
| 9906 | + $offset = '+00:00'; |
|
| 9907 | + } |
|
| 9540 | 9908 | |
| 9541 | 9909 | if ($globalDBdriver == 'mysql') { |
| 9542 | 9910 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9584,7 +9952,9 @@ discard block |
||
| 9584 | 9952 | date_default_timezone_set($globalTimezone); |
| 9585 | 9953 | $datetime = new DateTime(); |
| 9586 | 9954 | $offset = $datetime->format('P'); |
| 9587 | - } else $offset = '+00:00'; |
|
| 9955 | + } else { |
|
| 9956 | + $offset = '+00:00'; |
|
| 9957 | + } |
|
| 9588 | 9958 | |
| 9589 | 9959 | if ($globalDBdriver == 'mysql') { |
| 9590 | 9960 | $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 |
@@ -9631,7 +10001,9 @@ discard block |
||
| 9631 | 10001 | date_default_timezone_set($globalTimezone); |
| 9632 | 10002 | $datetime = new DateTime(); |
| 9633 | 10003 | $offset = $datetime->format('P'); |
| 9634 | - } else $offset = '+00:00'; |
|
| 10004 | + } else { |
|
| 10005 | + $offset = '+00:00'; |
|
| 10006 | + } |
|
| 9635 | 10007 | |
| 9636 | 10008 | if ($globalDBdriver == 'mysql') { |
| 9637 | 10009 | $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 |
@@ -9679,7 +10051,9 @@ discard block |
||
| 9679 | 10051 | date_default_timezone_set($globalTimezone); |
| 9680 | 10052 | $datetime = new DateTime(); |
| 9681 | 10053 | $offset = $datetime->format('P'); |
| 9682 | - } else $offset = '+00:00'; |
|
| 10054 | + } else { |
|
| 10055 | + $offset = '+00:00'; |
|
| 10056 | + } |
|
| 9683 | 10057 | $filter_query = $this->getFilter($filters,true,true); |
| 9684 | 10058 | if ($globalDBdriver == 'mysql') { |
| 9685 | 10059 | $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 |
@@ -9724,7 +10098,9 @@ discard block |
||
| 9724 | 10098 | date_default_timezone_set($globalTimezone); |
| 9725 | 10099 | $datetime = new DateTime(); |
| 9726 | 10100 | $offset = $datetime->format('P'); |
| 9727 | - } else $offset = '+00:00'; |
|
| 10101 | + } else { |
|
| 10102 | + $offset = '+00:00'; |
|
| 10103 | + } |
|
| 9728 | 10104 | $filter_query = $this->getFilter($filters,true,true); |
| 9729 | 10105 | |
| 9730 | 10106 | if ($globalDBdriver == 'mysql') { |
@@ -9771,7 +10147,9 @@ discard block |
||
| 9771 | 10147 | date_default_timezone_set($globalTimezone); |
| 9772 | 10148 | $datetime = new DateTime(); |
| 9773 | 10149 | $offset = $datetime->format('P'); |
| 9774 | - } else $offset = '+00:00'; |
|
| 10150 | + } else { |
|
| 10151 | + $offset = '+00:00'; |
|
| 10152 | + } |
|
| 9775 | 10153 | |
| 9776 | 10154 | if ($globalDBdriver == 'mysql') { |
| 9777 | 10155 | $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 |
@@ -9817,7 +10195,9 @@ discard block |
||
| 9817 | 10195 | date_default_timezone_set($globalTimezone); |
| 9818 | 10196 | $datetime = new DateTime(); |
| 9819 | 10197 | $offset = $datetime->format('P'); |
| 9820 | - } else $offset = '+00:00'; |
|
| 10198 | + } else { |
|
| 10199 | + $offset = '+00:00'; |
|
| 10200 | + } |
|
| 9821 | 10201 | $filter_query = $this->getFilter($filters,true,true); |
| 9822 | 10202 | |
| 9823 | 10203 | if ($globalDBdriver == 'mysql') { |
@@ -9864,7 +10244,9 @@ discard block |
||
| 9864 | 10244 | date_default_timezone_set($globalTimezone); |
| 9865 | 10245 | $datetime = new DateTime(); |
| 9866 | 10246 | $offset = $datetime->format('P'); |
| 9867 | - } else $offset = '+00:00'; |
|
| 10247 | + } else { |
|
| 10248 | + $offset = '+00:00'; |
|
| 10249 | + } |
|
| 9868 | 10250 | |
| 9869 | 10251 | if ($globalDBdriver == 'mysql') { |
| 9870 | 10252 | $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 |
@@ -9911,7 +10293,9 @@ discard block |
||
| 9911 | 10293 | date_default_timezone_set($globalTimezone); |
| 9912 | 10294 | $datetime = new DateTime(); |
| 9913 | 10295 | $offset = $datetime->format('P'); |
| 9914 | - } else $offset = '+00:00'; |
|
| 10296 | + } else { |
|
| 10297 | + $offset = '+00:00'; |
|
| 10298 | + } |
|
| 9915 | 10299 | |
| 9916 | 10300 | if ($globalDBdriver == 'mysql') { |
| 9917 | 10301 | $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 |
@@ -9956,7 +10340,9 @@ discard block |
||
| 9956 | 10340 | date_default_timezone_set($globalTimezone); |
| 9957 | 10341 | $datetime = new DateTime(); |
| 9958 | 10342 | $offset = $datetime->format('P'); |
| 9959 | - } else $offset = '+00:00'; |
|
| 10343 | + } else { |
|
| 10344 | + $offset = '+00:00'; |
|
| 10345 | + } |
|
| 9960 | 10346 | $filter_query = $this->getFilter($filters,true,true); |
| 9961 | 10347 | |
| 9962 | 10348 | if ($globalDBdriver == 'mysql') { |
@@ -10004,7 +10390,9 @@ discard block |
||
| 10004 | 10390 | date_default_timezone_set($globalTimezone); |
| 10005 | 10391 | $datetime = new DateTime(); |
| 10006 | 10392 | $offset = $datetime->format('P'); |
| 10007 | - } else $offset = '+00:00'; |
|
| 10393 | + } else { |
|
| 10394 | + $offset = '+00:00'; |
|
| 10395 | + } |
|
| 10008 | 10396 | |
| 10009 | 10397 | if ($globalDBdriver == 'mysql') { |
| 10010 | 10398 | $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 |
@@ -10050,7 +10438,9 @@ discard block |
||
| 10050 | 10438 | date_default_timezone_set($globalTimezone); |
| 10051 | 10439 | $datetime = new DateTime(); |
| 10052 | 10440 | $offset = $datetime->format('P'); |
| 10053 | - } else $offset = '+00:00'; |
|
| 10441 | + } else { |
|
| 10442 | + $offset = '+00:00'; |
|
| 10443 | + } |
|
| 10054 | 10444 | $filter_query = $this->getFilter($filters,true,true); |
| 10055 | 10445 | |
| 10056 | 10446 | if ($globalDBdriver == 'mysql') { |
@@ -10098,7 +10488,9 @@ discard block |
||
| 10098 | 10488 | date_default_timezone_set($globalTimezone); |
| 10099 | 10489 | $datetime = new DateTime(); |
| 10100 | 10490 | $offset = $datetime->format('P'); |
| 10101 | - } else $offset = '+00:00'; |
|
| 10491 | + } else { |
|
| 10492 | + $offset = '+00:00'; |
|
| 10493 | + } |
|
| 10102 | 10494 | |
| 10103 | 10495 | if ($globalDBdriver == 'mysql') { |
| 10104 | 10496 | $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 |
@@ -10145,7 +10537,9 @@ discard block |
||
| 10145 | 10537 | date_default_timezone_set($globalTimezone); |
| 10146 | 10538 | $datetime = new DateTime(); |
| 10147 | 10539 | $offset = $datetime->format('P'); |
| 10148 | - } else $offset = '+00:00'; |
|
| 10540 | + } else { |
|
| 10541 | + $offset = '+00:00'; |
|
| 10542 | + } |
|
| 10149 | 10543 | $filter_query = $this->getFilter($filters,true,true); |
| 10150 | 10544 | if ($globalDBdriver == 'mysql') { |
| 10151 | 10545 | $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 |
@@ -10194,7 +10588,9 @@ discard block |
||
| 10194 | 10588 | date_default_timezone_set($globalTimezone); |
| 10195 | 10589 | $datetime = new DateTime(); |
| 10196 | 10590 | $offset = $datetime->format('P'); |
| 10197 | - } else $offset = '+00:00'; |
|
| 10591 | + } else { |
|
| 10592 | + $offset = '+00:00'; |
|
| 10593 | + } |
|
| 10198 | 10594 | |
| 10199 | 10595 | $orderby_sql = ''; |
| 10200 | 10596 | if ($orderby == "hour") |
@@ -10260,7 +10656,9 @@ discard block |
||
| 10260 | 10656 | date_default_timezone_set($globalTimezone); |
| 10261 | 10657 | $datetime = new DateTime(); |
| 10262 | 10658 | $offset = $datetime->format('P'); |
| 10263 | - } else $offset = '+00:00'; |
|
| 10659 | + } else { |
|
| 10660 | + $offset = '+00:00'; |
|
| 10661 | + } |
|
| 10264 | 10662 | |
| 10265 | 10663 | $orderby_sql = ''; |
| 10266 | 10664 | if ($orderby == "hour") |
@@ -10327,7 +10725,9 @@ discard block |
||
| 10327 | 10725 | date_default_timezone_set($globalTimezone); |
| 10328 | 10726 | $datetime = new DateTime(); |
| 10329 | 10727 | $offset = $datetime->format('P'); |
| 10330 | - } else $offset = '+00:00'; |
|
| 10728 | + } else { |
|
| 10729 | + $offset = '+00:00'; |
|
| 10730 | + } |
|
| 10331 | 10731 | |
| 10332 | 10732 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
| 10333 | 10733 | |
@@ -10378,7 +10778,9 @@ discard block |
||
| 10378 | 10778 | date_default_timezone_set($globalTimezone); |
| 10379 | 10779 | $datetime = new DateTime(); |
| 10380 | 10780 | $offset = $datetime->format('P'); |
| 10381 | - } else $offset = '+00:00'; |
|
| 10781 | + } else { |
|
| 10782 | + $offset = '+00:00'; |
|
| 10783 | + } |
|
| 10382 | 10784 | |
| 10383 | 10785 | if ($globalDBdriver == 'mysql') { |
| 10384 | 10786 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10425,7 +10827,9 @@ discard block |
||
| 10425 | 10827 | date_default_timezone_set($globalTimezone); |
| 10426 | 10828 | $datetime = new DateTime(); |
| 10427 | 10829 | $offset = $datetime->format('P'); |
| 10428 | - } else $offset = '+00:00'; |
|
| 10830 | + } else { |
|
| 10831 | + $offset = '+00:00'; |
|
| 10832 | + } |
|
| 10429 | 10833 | |
| 10430 | 10834 | if ($globalDBdriver == 'mysql') { |
| 10431 | 10835 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10472,7 +10876,9 @@ discard block |
||
| 10472 | 10876 | date_default_timezone_set($globalTimezone); |
| 10473 | 10877 | $datetime = new DateTime(); |
| 10474 | 10878 | $offset = $datetime->format('P'); |
| 10475 | - } else $offset = '+00:00'; |
|
| 10879 | + } else { |
|
| 10880 | + $offset = '+00:00'; |
|
| 10881 | + } |
|
| 10476 | 10882 | |
| 10477 | 10883 | if ($globalDBdriver == 'mysql') { |
| 10478 | 10884 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10520,7 +10926,9 @@ discard block |
||
| 10520 | 10926 | date_default_timezone_set($globalTimezone); |
| 10521 | 10927 | $datetime = new DateTime(); |
| 10522 | 10928 | $offset = $datetime->format('P'); |
| 10523 | - } else $offset = '+00:00'; |
|
| 10929 | + } else { |
|
| 10930 | + $offset = '+00:00'; |
|
| 10931 | + } |
|
| 10524 | 10932 | |
| 10525 | 10933 | if ($globalDBdriver == 'mysql') { |
| 10526 | 10934 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10568,7 +10976,9 @@ discard block |
||
| 10568 | 10976 | date_default_timezone_set($globalTimezone); |
| 10569 | 10977 | $datetime = new DateTime($date); |
| 10570 | 10978 | $offset = $datetime->format('P'); |
| 10571 | - } else $offset = '+00:00'; |
|
| 10979 | + } else { |
|
| 10980 | + $offset = '+00:00'; |
|
| 10981 | + } |
|
| 10572 | 10982 | |
| 10573 | 10983 | if ($globalDBdriver == 'mysql') { |
| 10574 | 10984 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10616,7 +11026,9 @@ discard block |
||
| 10616 | 11026 | date_default_timezone_set($globalTimezone); |
| 10617 | 11027 | $datetime = new DateTime(); |
| 10618 | 11028 | $offset = $datetime->format('P'); |
| 10619 | - } else $offset = '+00:00'; |
|
| 11029 | + } else { |
|
| 11030 | + $offset = '+00:00'; |
|
| 11031 | + } |
|
| 10620 | 11032 | |
| 10621 | 11033 | if ($globalDBdriver == 'mysql') { |
| 10622 | 11034 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10663,7 +11075,9 @@ discard block |
||
| 10663 | 11075 | date_default_timezone_set($globalTimezone); |
| 10664 | 11076 | $datetime = new DateTime(); |
| 10665 | 11077 | $offset = $datetime->format('P'); |
| 10666 | - } else $offset = '+00:00'; |
|
| 11078 | + } else { |
|
| 11079 | + $offset = '+00:00'; |
|
| 11080 | + } |
|
| 10667 | 11081 | |
| 10668 | 11082 | if ($globalDBdriver == 'mysql') { |
| 10669 | 11083 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10710,7 +11124,9 @@ discard block |
||
| 10710 | 11124 | date_default_timezone_set($globalTimezone); |
| 10711 | 11125 | $datetime = new DateTime(); |
| 10712 | 11126 | $offset = $datetime->format('P'); |
| 10713 | - } else $offset = '+00:00'; |
|
| 11127 | + } else { |
|
| 11128 | + $offset = '+00:00'; |
|
| 11129 | + } |
|
| 10714 | 11130 | |
| 10715 | 11131 | if ($globalDBdriver == 'mysql') { |
| 10716 | 11132 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10760,7 +11176,9 @@ discard block |
||
| 10760 | 11176 | date_default_timezone_set($globalTimezone); |
| 10761 | 11177 | $datetime = new DateTime(); |
| 10762 | 11178 | $offset = $datetime->format('P'); |
| 10763 | - } else $offset = '+00:00'; |
|
| 11179 | + } else { |
|
| 11180 | + $offset = '+00:00'; |
|
| 11181 | + } |
|
| 10764 | 11182 | |
| 10765 | 11183 | if ($globalDBdriver == 'mysql') { |
| 10766 | 11184 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10807,7 +11225,9 @@ discard block |
||
| 10807 | 11225 | date_default_timezone_set($globalTimezone); |
| 10808 | 11226 | $datetime = new DateTime(); |
| 10809 | 11227 | $offset = $datetime->format('P'); |
| 10810 | - } else $offset = '+00:00'; |
|
| 11228 | + } else { |
|
| 11229 | + $offset = '+00:00'; |
|
| 11230 | + } |
|
| 10811 | 11231 | |
| 10812 | 11232 | if ($globalDBdriver == 'mysql') { |
| 10813 | 11233 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -11018,8 +11438,11 @@ discard block |
||
| 11018 | 11438 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 11019 | 11439 | } |
| 11020 | 11440 | } |
| 11021 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
| 11022 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11441 | + if (empty($query_values)) { |
|
| 11442 | + $queryi .= $this->getFilter($filters); |
|
| 11443 | + } else { |
|
| 11444 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11445 | + } |
|
| 11023 | 11446 | |
| 11024 | 11447 | $sth = $this->db->prepare($queryi); |
| 11025 | 11448 | $sth->execute($query_values); |
@@ -11097,8 +11520,11 @@ discard block |
||
| 11097 | 11520 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 11098 | 11521 | } |
| 11099 | 11522 | } |
| 11100 | - if ($query == '') $queryi .= $this->getFilter($filters); |
|
| 11101 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11523 | + if ($query == '') { |
|
| 11524 | + $queryi .= $this->getFilter($filters); |
|
| 11525 | + } else { |
|
| 11526 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11527 | + } |
|
| 11102 | 11528 | |
| 11103 | 11529 | |
| 11104 | 11530 | $sth = $this->db->prepare($queryi); |
@@ -11121,7 +11547,9 @@ discard block |
||
| 11121 | 11547 | date_default_timezone_set($globalTimezone); |
| 11122 | 11548 | $datetime = new DateTime(); |
| 11123 | 11549 | $offset = $datetime->format('P'); |
| 11124 | - } else $offset = '+00:00'; |
|
| 11550 | + } else { |
|
| 11551 | + $offset = '+00:00'; |
|
| 11552 | + } |
|
| 11125 | 11553 | |
| 11126 | 11554 | if ($globalDBdriver == 'mysql') { |
| 11127 | 11555 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -11307,7 +11735,9 @@ discard block |
||
| 11307 | 11735 | */ |
| 11308 | 11736 | public function parseDirection($direction = 0) |
| 11309 | 11737 | { |
| 11310 | - if ($direction == '') $direction = 0; |
|
| 11738 | + if ($direction == '') { |
|
| 11739 | + $direction = 0; |
|
| 11740 | + } |
|
| 11311 | 11741 | $direction_array = array(); |
| 11312 | 11742 | $temp_array = array(); |
| 11313 | 11743 | |
@@ -11408,7 +11838,9 @@ discard block |
||
| 11408 | 11838 | if (isset($result->AirlineFlightInfoResult)) |
| 11409 | 11839 | { |
| 11410 | 11840 | $registration = $result->AirlineFlightInfoResult->tailnumber; |
| 11411 | - } else return ''; |
|
| 11841 | + } else { |
|
| 11842 | + return ''; |
|
| 11843 | + } |
|
| 11412 | 11844 | |
| 11413 | 11845 | $registration = $this->convertAircraftRegistration($registration); |
| 11414 | 11846 | |
@@ -11437,7 +11869,9 @@ discard block |
||
| 11437 | 11869 | if (count($row) > 0) { |
| 11438 | 11870 | //return $row['Registration']; |
| 11439 | 11871 | return $row['registration']; |
| 11440 | - } else return ''; |
|
| 11872 | + } else { |
|
| 11873 | + return ''; |
|
| 11874 | + } |
|
| 11441 | 11875 | |
| 11442 | 11876 | } |
| 11443 | 11877 | |
@@ -11460,9 +11894,14 @@ discard block |
||
| 11460 | 11894 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 11461 | 11895 | $sth->closeCursor(); |
| 11462 | 11896 | if (count($row) > 0) { |
| 11463 | - if ($row['type_flight'] == null) return ''; |
|
| 11464 | - else return $row['type_flight']; |
|
| 11465 | - } else return ''; |
|
| 11897 | + if ($row['type_flight'] == null) { |
|
| 11898 | + return ''; |
|
| 11899 | + } else { |
|
| 11900 | + return $row['type_flight']; |
|
| 11901 | + } |
|
| 11902 | + } else { |
|
| 11903 | + return ''; |
|
| 11904 | + } |
|
| 11466 | 11905 | |
| 11467 | 11906 | } |
| 11468 | 11907 | |
@@ -11480,7 +11919,9 @@ discard block |
||
| 11480 | 11919 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 11481 | 11920 | |
| 11482 | 11921 | $Connection = new Connection($this->db); |
| 11483 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 11922 | + if (!$Connection->tableExists('countries')) { |
|
| 11923 | + return ''; |
|
| 11924 | + } |
|
| 11484 | 11925 | |
| 11485 | 11926 | try { |
| 11486 | 11927 | /* |
@@ -11500,9 +11941,13 @@ discard block |
||
| 11500 | 11941 | $sth->closeCursor(); |
| 11501 | 11942 | if (count($row) > 0) { |
| 11502 | 11943 | return $row; |
| 11503 | - } else return ''; |
|
| 11944 | + } else { |
|
| 11945 | + return ''; |
|
| 11946 | + } |
|
| 11504 | 11947 | } catch (PDOException $e) { |
| 11505 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 11948 | + if (isset($globalDebug) && $globalDebug) { |
|
| 11949 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 11950 | + } |
|
| 11506 | 11951 | return ''; |
| 11507 | 11952 | } |
| 11508 | 11953 | |
@@ -11520,7 +11965,9 @@ discard block |
||
| 11520 | 11965 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
| 11521 | 11966 | |
| 11522 | 11967 | $Connection = new Connection($this->db); |
| 11523 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 11968 | + if (!$Connection->tableExists('countries')) { |
|
| 11969 | + return ''; |
|
| 11970 | + } |
|
| 11524 | 11971 | |
| 11525 | 11972 | try { |
| 11526 | 11973 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -11532,9 +11979,13 @@ discard block |
||
| 11532 | 11979 | $sth->closeCursor(); |
| 11533 | 11980 | if (count($row) > 0) { |
| 11534 | 11981 | return $row; |
| 11535 | - } else return ''; |
|
| 11982 | + } else { |
|
| 11983 | + return ''; |
|
| 11984 | + } |
|
| 11536 | 11985 | } catch (PDOException $e) { |
| 11537 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 11986 | + if (isset($globalDebug) && $globalDebug) { |
|
| 11987 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 11988 | + } |
|
| 11538 | 11989 | return ''; |
| 11539 | 11990 | } |
| 11540 | 11991 | |
@@ -11784,7 +12235,9 @@ discard block |
||
| 11784 | 12235 | { |
| 11785 | 12236 | global $globalBitlyAccessToken; |
| 11786 | 12237 | |
| 11787 | - if ($globalBitlyAccessToken == '') return $url; |
|
| 12238 | + if ($globalBitlyAccessToken == '') { |
|
| 12239 | + return $url; |
|
| 12240 | + } |
|
| 11788 | 12241 | |
| 11789 | 12242 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
| 11790 | 12243 | |
@@ -11933,7 +12386,9 @@ discard block |
||
| 11933 | 12386 | |
| 11934 | 12387 | |
| 11935 | 12388 | // routes |
| 11936 | - if ($globalDebug) print "Routes...\n"; |
|
| 12389 | + if ($globalDebug) { |
|
| 12390 | + print "Routes...\n"; |
|
| 12391 | + } |
|
| 11937 | 12392 | if ($globalDBdriver == 'mysql') { |
| 11938 | 12393 | $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)"; |
| 11939 | 12394 | } else { |
@@ -11952,7 +12407,9 @@ discard block |
||
| 11952 | 12407 | } |
| 11953 | 12408 | } |
| 11954 | 12409 | |
| 11955 | - if ($globalDebug) print "Airlines...\n"; |
|
| 12410 | + if ($globalDebug) { |
|
| 12411 | + print "Airlines...\n"; |
|
| 12412 | + } |
|
| 11956 | 12413 | //airlines |
| 11957 | 12414 | if ($globalDBdriver == 'mysql') { |
| 11958 | 12415 | $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)"; |
@@ -11966,10 +12423,15 @@ discard block |
||
| 11966 | 12423 | if (is_numeric(substr($row['ident'], -1, 1))) |
| 11967 | 12424 | { |
| 11968 | 12425 | $fromsource = NULL; |
| 11969 | - if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 11970 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 11971 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 11972 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 12426 | + if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 12427 | + $fromsource = 'vatsim'; |
|
| 12428 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 12429 | + $fromsource = 'ivao'; |
|
| 12430 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 12431 | + $fromsource = 'vatsim'; |
|
| 12432 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 12433 | + $fromsource = 'ivao'; |
|
| 12434 | + } |
|
| 11973 | 12435 | $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
| 11974 | 12436 | if (isset($airline_array[0]['name'])) { |
| 11975 | 12437 | $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"; |
@@ -11979,13 +12441,17 @@ discard block |
||
| 11979 | 12441 | } |
| 11980 | 12442 | } |
| 11981 | 12443 | |
| 11982 | - if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n"; |
|
| 12444 | + if ($globalDebug) { |
|
| 12445 | + print "Remove Duplicate in aircraft_modes...\n"; |
|
| 12446 | + } |
|
| 11983 | 12447 | //duplicate modes |
| 11984 | 12448 | $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"; |
| 11985 | 12449 | $sth = $this->db->prepare($query); |
| 11986 | 12450 | $sth->execute(); |
| 11987 | 12451 | |
| 11988 | - if ($globalDebug) print "Aircraft...\n"; |
|
| 12452 | + if ($globalDebug) { |
|
| 12453 | + print "Aircraft...\n"; |
|
| 12454 | + } |
|
| 11989 | 12455 | //aircraft |
| 11990 | 12456 | if ($globalDBdriver == 'mysql') { |
| 11991 | 12457 | $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)"; |
@@ -12028,26 +12494,38 @@ discard block |
||
| 12028 | 12494 | if (isset($closestAirports[0])) { |
| 12029 | 12495 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
| 12030 | 12496 | $airport_icao = $closestAirports[0]['icao']; |
| 12031 | - if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12497 | + if ($globalDebug) { |
|
| 12498 | + echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12499 | + } |
|
| 12032 | 12500 | } elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') { |
| 12033 | 12501 | foreach ($closestAirports as $airport) { |
| 12034 | 12502 | if ($row['arrival_airport_icao'] == $airport['icao']) { |
| 12035 | 12503 | $airport_icao = $airport['icao']; |
| 12036 | - if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12504 | + if ($globalDebug) { |
|
| 12505 | + echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12506 | + } |
|
| 12037 | 12507 | break; |
| 12038 | 12508 | } |
| 12039 | 12509 | } |
| 12040 | 12510 | } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
| 12041 | 12511 | $airport_icao = $closestAirports[0]['icao']; |
| 12042 | - 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"; |
|
| 12512 | + if ($globalDebug) { |
|
| 12513 | + 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"; |
|
| 12514 | + } |
|
| 12043 | 12515 | } else { |
| 12044 | - 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"; |
|
| 12516 | + if ($globalDebug) { |
|
| 12517 | + 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"; |
|
| 12518 | + } |
|
| 12045 | 12519 | } |
| 12046 | 12520 | } else { |
| 12047 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 12521 | + if ($globalDebug) { |
|
| 12522 | + echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 12523 | + } |
|
| 12048 | 12524 | } |
| 12049 | 12525 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
| 12050 | - if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
|
| 12526 | + if ($globalDebug) { |
|
| 12527 | + echo "Updating airport to ".$airport_icao."...\n"; |
|
| 12528 | + } |
|
| 12051 | 12529 | $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
| 12052 | 12530 | $sthu = $this->db->prepare($update_query); |
| 12053 | 12531 | $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
@@ -39,8 +39,12 @@ discard block |
||
| 39 | 39 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 40 | 40 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
| 41 | 41 | $filter = array(); |
| 42 | - if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
| 43 | - if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
| 42 | + if ($year != '') { |
|
| 43 | + $filter = array_merge($filter,array('year' => $year)); |
|
| 44 | + } |
|
| 45 | + if ($month != '') { |
|
| 46 | + $filter = array_merge($filter,array('month' => $month)); |
|
| 47 | + } |
|
| 44 | 48 | if ($sort != '') |
| 45 | 49 | { |
| 46 | 50 | $spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter); |
@@ -58,8 +62,12 @@ discard block |
||
| 58 | 62 | { |
| 59 | 63 | $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']); |
| 60 | 64 | $ident = $spotter_array[0]['ident']; |
| 61 | - if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
|
| 62 | - if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
|
| 65 | + if (isset($spotter_array[0]['latitude'])) { |
|
| 66 | + $latitude = $spotter_array[0]['latitude']; |
|
| 67 | + } |
|
| 68 | + if (isset($spotter_array[0]['longitude'])) { |
|
| 69 | + $longitude = $spotter_array[0]['longitude']; |
|
| 70 | + } |
|
| 63 | 71 | require_once('header.php'); |
| 64 | 72 | /* |
| 65 | 73 | if (isset($globalArchive) && $globalArchive) { |
@@ -112,12 +120,18 @@ discard block |
||
| 112 | 120 | */ |
| 113 | 121 | print '<div class="info column">'; |
| 114 | 122 | print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>'; |
| 115 | - if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>'; |
|
| 123 | + if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') { |
|
| 124 | + print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>'; |
|
| 125 | + } |
|
| 116 | 126 | if ($year == '' && $month == '') { |
| 117 | 127 | $Stats = new Stats(); |
| 118 | 128 | $flights = $Stats->getStatsPilot($pilot); |
| 119 | - } else $flights = 0; |
|
| 120 | - if ($flight == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter); |
|
| 129 | + } else { |
|
| 130 | + $flights = 0; |
|
| 131 | + } |
|
| 132 | + if ($flight == 0) { |
|
| 133 | + $flights = $Spotter->countFlightsByPilot($pilot,$filter); |
|
| 134 | + } |
|
| 121 | 135 | print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>'; |
| 122 | 136 | $aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter)); |
| 123 | 137 | print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>'; |
@@ -128,7 +142,9 @@ discard block |
||
| 128 | 142 | $airlines = count($Spotter->countAllAirlinesByPilot($pilot,$filter)); |
| 129 | 143 | print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>'; |
| 130 | 144 | $duration = $Spotter->getFlightDurationByPilot($pilot,$filter); |
| 131 | - if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>'; |
|
| 145 | + if ($duration != '0') { |
|
| 146 | + print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>'; |
|
| 147 | + } |
|
| 132 | 148 | print '</div>'; |
| 133 | 149 | |
| 134 | 150 | include('owner-sub-menu.php'); |
@@ -40,8 +40,12 @@ discard block |
||
| 40 | 40 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 41 | 41 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
| 42 | 42 | $filter = array(); |
| 43 | - if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
| 44 | - if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
| 43 | + if ($year != '') { |
|
| 44 | + $filter = array_merge($filter,array('year' => $year)); |
|
| 45 | + } |
|
| 46 | + if ($month != '') { |
|
| 47 | + $filter = array_merge($filter,array('month' => $month)); |
|
| 48 | + } |
|
| 45 | 49 | if ($sort != '') |
| 46 | 50 | { |
| 47 | 51 | $spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter); |
@@ -59,8 +63,12 @@ discard block |
||
| 59 | 63 | { |
| 60 | 64 | $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']); |
| 61 | 65 | //$ident = $spotter_array[0]['ident']; |
| 62 | - if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
|
| 63 | - if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
|
| 66 | + if (isset($spotter_array[0]['latitude'])) { |
|
| 67 | + $latitude = $spotter_array[0]['latitude']; |
|
| 68 | + } |
|
| 69 | + if (isset($spotter_array[0]['longitude'])) { |
|
| 70 | + $longitude = $spotter_array[0]['longitude']; |
|
| 71 | + } |
|
| 64 | 72 | require_once('header.php'); |
| 65 | 73 | /* |
| 66 | 74 | if (isset($globalArchive) && $globalArchive) { |
@@ -115,9 +123,14 @@ discard block |
||
| 115 | 123 | print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>'; |
| 116 | 124 | //print '<div><span class="label">'._("Owner").'</span>'.$spotter_array[0]['aircraft_owner'].'</div>'; |
| 117 | 125 | $Stats = new Stats(); |
| 118 | - if ($year == '' && $month == '') $flights = $Stats->getStatsOwner($owner); |
|
| 119 | - else $flights = 0; |
|
| 120 | - if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner,$filter); |
|
| 126 | + if ($year == '' && $month == '') { |
|
| 127 | + $flights = $Stats->getStatsOwner($owner); |
|
| 128 | + } else { |
|
| 129 | + $flights = 0; |
|
| 130 | + } |
|
| 131 | + if ($flights == 0) { |
|
| 132 | + $flights = $Spotter->countFlightsByOwner($owner,$filter); |
|
| 133 | + } |
|
| 121 | 134 | print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>'; |
| 122 | 135 | $aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner,$filter)); |
| 123 | 136 | print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>'; |
@@ -128,7 +141,9 @@ discard block |
||
| 128 | 141 | $airlines = count($Spotter->countAllAirlinesByOwner($owner,$filter)); |
| 129 | 142 | print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>'; |
| 130 | 143 | $duration = $Spotter->getFlightDurationByOwner($owner,$filter); |
| 131 | - if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>'; |
|
| 144 | + if ($duration != '0') { |
|
| 145 | + print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>'; |
|
| 146 | + } |
|
| 132 | 147 | print '</div>'; |
| 133 | 148 | |
| 134 | 149 | include('owner-sub-menu.php'); |