@@ -7,17 +7,17 @@ discard block |
||
| 7 | 7 | $title = _("Statistics"); |
| 8 | 8 | |
| 9 | 9 | if (!isset($filter_name)) $filter_name = ''; |
| 10 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 10 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 11 | 11 | if ($airline_icao == 'all') { |
| 12 | 12 | unset($_COOKIE['stats_airline_icao']); |
| 13 | - setcookie('stats_airline_icao', '', time()-3600); |
|
| 13 | + setcookie('stats_airline_icao', '', time() - 3600); |
|
| 14 | 14 | $airline_icao = ''; |
| 15 | 15 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 16 | 16 | $airline_icao = $_COOKIE['stats_airline_icao']; |
| 17 | 17 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 18 | 18 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
| 19 | 19 | } |
| 20 | -setcookie('stats_airline_icao',$airline_icao); |
|
| 20 | +setcookie('stats_airline_icao', $airline_icao); |
|
| 21 | 21 | require_once('header.php'); |
| 22 | 22 | |
| 23 | 23 | ?> |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | date_default_timezone_set('UTC'); |
| 38 | 38 | $lastupdate = strtotime($last_update[0]['value']); |
| 39 | 39 | if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
| 40 | - print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
|
| 40 | + print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>'; |
|
| 41 | 41 | } |
| 42 | 42 | ?> |
| 43 | 43 | </div> |
@@ -46,30 +46,30 @@ discard block |
||
| 46 | 46 | ?> |
| 47 | 47 | <?php include('statistics-sub-menu.php'); ?> |
| 48 | 48 | <div class="row global-stats"> |
| 49 | - <div class="col-md-2"><span class="type"><?php echo _("Flights"); ?></span><span><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name)); ?></span></div> |
|
| 50 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 51 | - <div class="col-md-2"><span class="type"><?php echo _("Arrivals seen"); ?></span><span><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name)); ?></span></div> |
|
| 52 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 49 | + <div class="col-md-2"><span class="type"><?php echo _("Flights"); ?></span><span><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name)); ?></span></div> |
|
| 50 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 51 | + <div class="col-md-2"><span class="type"><?php echo _("Arrivals seen"); ?></span><span><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name)); ?></span></div> |
|
| 52 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 53 | 53 | <?php |
| 54 | 54 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
| 55 | 55 | ?> |
| 56 | - <div class="col-md-2"><span class="type"><?php echo _("Pilots"); ?></span><span><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name)); ?></span></div> |
|
| 57 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 56 | + <div class="col-md-2"><span class="type"><?php echo _("Pilots"); ?></span><span><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name)); ?></span></div> |
|
| 57 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 58 | 58 | <?php |
| 59 | 59 | } else { |
| 60 | 60 | ?> |
| 61 | - <div class="col-md-2"><span class="type"><?php echo _("Owners"); ?></span><span><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name)); ?></span></div> |
|
| 62 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 61 | + <div class="col-md-2"><span class="type"><?php echo _("Owners"); ?></span><span><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name)); ?></span></div> |
|
| 62 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 63 | 63 | <?php |
| 64 | 64 | } |
| 65 | 65 | ?> |
| 66 | - <div class="col-md-2"><span class="type"><?php echo _("Aircrafts"); ?></span><span><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name)); ?></span></div> |
|
| 67 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 66 | + <div class="col-md-2"><span class="type"><?php echo _("Aircrafts"); ?></span><span><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name)); ?></span></div> |
|
| 67 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 68 | 68 | <?php |
| 69 | 69 | if ($airline_icao == '') { |
| 70 | 70 | ?> |
| 71 | 71 | <div class="col-md-2"><span class="type"><?php echo _("Airlines"); ?></span><span><?php print number_format($Stats->countOverallAirlines($filter_name)); ?></span></div> |
| 72 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 72 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 73 | 73 | <?php |
| 74 | 74 | } |
| 75 | 75 | ?> |
@@ -77,18 +77,18 @@ discard block |
||
| 77 | 77 | if (!(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS)) { |
| 78 | 78 | ?> |
| 79 | 79 | <div class="col-md-2"><span class="type"><?php echo _("Military"); ?></span><span><?php print number_format($Stats->countOverallMilitaryFlights($filter_name)); ?></span></div> |
| 80 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 80 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 81 | 81 | <?php |
| 82 | 82 | } |
| 83 | 83 | ?> |
| 84 | 84 | </div> |
| 85 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 85 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 86 | 86 | <div class="specific-stats"> |
| 87 | 87 | <div class="row column"> |
| 88 | 88 | <div class="col-md-6"> |
| 89 | 89 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
| 90 | 90 | <?php |
| 91 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name); |
|
| 91 | + $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name); |
|
| 92 | 92 | if (count($aircraft_array) == 0) print _("No data available"); |
| 93 | 93 | else { |
| 94 | 94 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | var data = google.visualization.arrayToDataTable([ |
| 101 | 101 | ["'._("Aircraft").'", "'._("# of times").'"], '; |
| 102 | 102 | $aircraft_data = ''; |
| 103 | - foreach($aircraft_array as $aircraft_item) |
|
| 103 | + foreach ($aircraft_array as $aircraft_item) |
|
| 104 | 104 | { |
| 105 | 105 | $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
| 106 | 106 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | <a href="<?php print $globalURL; ?>/statistics/aircraft" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 128 | 128 | </div> |
| 129 | 129 | </div> |
| 130 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 130 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 131 | 131 | <?php |
| 132 | 132 | // echo $airline_icao; |
| 133 | 133 | if ($airline_icao == '' || $airline_icao == 'all') { |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | <div class="col-md-6"> |
| 136 | 136 | <h2><?php echo _("Top 10 Most Common Airline"); ?></h2> |
| 137 | 137 | <?php |
| 138 | - $airline_array = $Stats->countAllAirlines(true,$filter_name); |
|
| 138 | + $airline_array = $Stats->countAllAirlines(true, $filter_name); |
|
| 139 | 139 | if (count($airline_array) == 0) print _("No data available"); |
| 140 | 140 | else { |
| 141 | 141 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | var data = google.visualization.arrayToDataTable([ |
| 148 | 148 | ["'._("Airline").'", "'._("# of times").'"], '; |
| 149 | 149 | $airline_data = ''; |
| 150 | - foreach($airline_array as $airline_item) |
|
| 150 | + foreach ($airline_array as $airline_item) |
|
| 151 | 151 | { |
| 152 | 152 | $airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
| 153 | 153 | } |
@@ -175,14 +175,14 @@ discard block |
||
| 175 | 175 | </div> |
| 176 | 176 | </div> |
| 177 | 177 | </div> |
| 178 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 178 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 179 | 179 | <?php |
| 180 | 180 | } |
| 181 | 181 | ?> |
| 182 | 182 | <div class="row column"> |
| 183 | 183 | |
| 184 | 184 | <?php |
| 185 | - $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name); |
|
| 185 | + $flightover_array = $Stats->countAllFlightOverCountries($airline_icao, $filter_name); |
|
| 186 | 186 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
| 187 | 187 | if (empty($flightover_array)) { |
| 188 | 188 | ?> |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | ?> |
| 197 | 197 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
| 198 | 198 | <?php |
| 199 | - $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name); |
|
| 199 | + $pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name); |
|
| 200 | 200 | if (count($pilot_array) == 0) print _("No data available"); |
| 201 | 201 | else { |
| 202 | 202 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | var data = google.visualization.arrayToDataTable([ |
| 209 | 209 | ["'._("Pilots").'", "'._("# of times").'"], '; |
| 210 | 210 | $pilot_data = ''; |
| 211 | - foreach($pilot_array as $pilot_item) |
|
| 211 | + foreach ($pilot_array as $pilot_item) |
|
| 212 | 212 | { |
| 213 | 213 | $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
| 214 | 214 | } |
@@ -236,14 +236,14 @@ discard block |
||
| 236 | 236 | </div> |
| 237 | 237 | </div> |
| 238 | 238 | |
| 239 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 239 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 240 | 240 | <?php |
| 241 | 241 | } else { |
| 242 | 242 | ?> |
| 243 | 243 | <div class="col-md-6"> |
| 244 | 244 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
| 245 | 245 | <?php |
| 246 | - $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name); |
|
| 246 | + $owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name); |
|
| 247 | 247 | if (count($owner_array) == 0) print _("No data available"); |
| 248 | 248 | else { |
| 249 | 249 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | var data = google.visualization.arrayToDataTable([ |
| 256 | 256 | ["'._("Owner").'", "'._("# of times").'"], '; |
| 257 | 257 | $owner_data = ''; |
| 258 | - foreach($owner_array as $owner_item) |
|
| 258 | + foreach ($owner_array as $owner_item) |
|
| 259 | 259 | { |
| 260 | 260 | $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
| 261 | 261 | } |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | </div> |
| 284 | 284 | </div> |
| 285 | 285 | |
| 286 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 286 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 287 | 287 | <?php |
| 288 | 288 | } |
| 289 | 289 | if (!empty($flightover_array)) { |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | var data = google.visualization.arrayToDataTable([ |
| 305 | 305 | ["'._("Country").'", "'._("# of times").'"], '; |
| 306 | 306 | $flightover_data = ''; |
| 307 | - foreach($flightover_array as $flightover_item) |
|
| 307 | + foreach ($flightover_array as $flightover_item) |
|
| 308 | 308 | { |
| 309 | 309 | $flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],'; |
| 310 | 310 | } |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | } |
| 338 | 338 | ?> |
| 339 | 339 | </div> |
| 340 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 340 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 341 | 341 | |
| 342 | 342 | |
| 343 | 343 | </div> |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | <div class="col-md-6"> |
| 346 | 346 | <h2><?php echo _("Top 10 Most Common Departure Airports"); ?></h2> |
| 347 | 347 | <?php |
| 348 | - $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name); |
|
| 348 | + $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name); |
|
| 349 | 349 | if (count($airport_airport_array) == 0) print _("No data available"); |
| 350 | 350 | else { |
| 351 | 351 | |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | var data = google.visualization.arrayToDataTable([ |
| 362 | 362 | ["'._("Airport").'", "'._("# of times").'"],'; |
| 363 | 363 | $airport_data = ''; |
| 364 | - foreach($airport_airport_array as $airport_item) |
|
| 364 | + foreach ($airport_airport_array as $airport_item) |
|
| 365 | 365 | { |
| 366 | 366 | $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')'; |
| 367 | 367 | $name = str_replace("'", "", $name); |
@@ -390,12 +390,12 @@ discard block |
||
| 390 | 390 | <a href="<?php print $globalURL; ?>/statistics/airport-departure" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 391 | 391 | </div> |
| 392 | 392 | </div> |
| 393 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 393 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 394 | 394 | |
| 395 | 395 | <div class="col-md-6"> |
| 396 | 396 | <h2><?php echo _("Top 10 Most Common Arrival Airports"); ?></h2> |
| 397 | 397 | <?php |
| 398 | - $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name); |
|
| 398 | + $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name); |
|
| 399 | 399 | if (count($airport_airport_array2) == 0) print _("No data available"); |
| 400 | 400 | else { |
| 401 | 401 | |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | var data = google.visualization.arrayToDataTable([ |
| 412 | 412 | ["'._("Airport").'", "'._("# of times").'"],'; |
| 413 | 413 | $airport_data2 = ''; |
| 414 | - foreach($airport_airport_array2 as $airport_item2) |
|
| 414 | + foreach ($airport_airport_array2 as $airport_item2) |
|
| 415 | 415 | { |
| 416 | 416 | $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')'; |
| 417 | 417 | $name2 = str_replace("'", "", $name2); |
@@ -441,13 +441,13 @@ discard block |
||
| 441 | 441 | </div> |
| 442 | 442 | </div> |
| 443 | 443 | </div> |
| 444 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 444 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 445 | 445 | |
| 446 | 446 | <div class="row column"> |
| 447 | 447 | <div class="col-md-6"> |
| 448 | 448 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
| 449 | 449 | <?php |
| 450 | - $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
| 450 | + $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
| 451 | 451 | if (count($year_array) == 0) print _("No data available"); |
| 452 | 452 | else { |
| 453 | 453 | print '<div id="chart8" class="chart" width="100%"></div> |
@@ -458,9 +458,9 @@ discard block |
||
| 458 | 458 | var data = google.visualization.arrayToDataTable([ |
| 459 | 459 | ["'._("Month").'", "'._("# of Flights").'"], '; |
| 460 | 460 | $year_data = ''; |
| 461 | - foreach($year_array as $year_item) |
|
| 461 | + foreach ($year_array as $year_item) |
|
| 462 | 462 | { |
| 463 | - $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],'; |
|
| 463 | + $year_data .= '[ "'.date('F, Y', strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],'; |
|
| 464 | 464 | } |
| 465 | 465 | $year_data = substr($year_data, 0, -1); |
| 466 | 466 | print $year_data; |
@@ -488,12 +488,12 @@ discard block |
||
| 488 | 488 | <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 489 | 489 | </div> |
| 490 | 490 | </div> |
| 491 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 491 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 492 | 492 | |
| 493 | 493 | <div class="col-md-6"> |
| 494 | 494 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
| 495 | 495 | <?php |
| 496 | - $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
| 496 | + $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name); |
|
| 497 | 497 | if (count($month_array) == 0) print _("No data available"); |
| 498 | 498 | else { |
| 499 | 499 | print '<div id="chart9" class="chart" width="100%"></div> |
@@ -504,9 +504,9 @@ discard block |
||
| 504 | 504 | var data = google.visualization.arrayToDataTable([ |
| 505 | 505 | ["'._("Day").'", "'._("# of Flights").'"], '; |
| 506 | 506 | $month_data = ''; |
| 507 | - foreach($month_array as $month_item) |
|
| 507 | + foreach ($month_array as $month_item) |
|
| 508 | 508 | { |
| 509 | - $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],'; |
|
| 509 | + $month_data .= '[ "'.date('F j, Y', strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],'; |
|
| 510 | 510 | } |
| 511 | 511 | $month_data = substr($month_data, 0, -1); |
| 512 | 512 | print $month_data; |
@@ -534,12 +534,12 @@ discard block |
||
| 534 | 534 | <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 535 | 535 | </div> |
| 536 | 536 | </div> |
| 537 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 537 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 538 | 538 | |
| 539 | 539 | <div class="col-md-6"> |
| 540 | 540 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
| 541 | 541 | <?php |
| 542 | - $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
| 542 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name); |
|
| 543 | 543 | if (empty($date_array)) print _("No data available"); |
| 544 | 544 | else { |
| 545 | 545 | print '<div id="chart5" class="chart" width="100%"></div> |
@@ -551,7 +551,7 @@ discard block |
||
| 551 | 551 | ["'._("Date").'", "'._("# of Flights").'"], '; |
| 552 | 552 | $date_data = ''; |
| 553 | 553 | |
| 554 | - foreach($date_array as $date_item) |
|
| 554 | + foreach ($date_array as $date_item) |
|
| 555 | 555 | { |
| 556 | 556 | $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],'; |
| 557 | 557 | } |
@@ -581,12 +581,12 @@ discard block |
||
| 581 | 581 | <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 582 | 582 | </div> |
| 583 | 583 | </div> |
| 584 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 584 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 585 | 585 | |
| 586 | 586 | <div class="col-md-6"> |
| 587 | 587 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
| 588 | 588 | <?php |
| 589 | - $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
| 589 | + $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name); |
|
| 590 | 590 | if (empty($hour_array)) print _("No data available"); |
| 591 | 591 | else { |
| 592 | 592 | |
@@ -598,7 +598,7 @@ discard block |
||
| 598 | 598 | var data = google.visualization.arrayToDataTable([ |
| 599 | 599 | ["'._("Hour").'", "'._("# of Flights").'"], '; |
| 600 | 600 | $hour_data = ''; |
| 601 | - foreach($hour_array as $hour_item) |
|
| 601 | + foreach ($hour_array as $hour_item) |
|
| 602 | 602 | { |
| 603 | 603 | $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],'; |
| 604 | 604 | } |
@@ -628,21 +628,21 @@ discard block |
||
| 628 | 628 | <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 629 | 629 | </div> |
| 630 | 630 | </div> |
| 631 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 631 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 632 | 632 | </div> |
| 633 | 633 | <?php |
| 634 | 634 | if ($airline_icao == '' && $filter_name == '') { |
| 635 | 635 | ?> |
| 636 | 636 | <div class="row column"> |
| 637 | 637 | <?php |
| 638 | - $polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
|
| 638 | + $polar = $Stats->getStatsSource(date('Y-m-d'), 'polar'); |
|
| 639 | 639 | if (!empty($polar)) { |
| 640 | 640 | print '<h2>'._("Coverage pattern").'</h2>'; |
| 641 | 641 | foreach ($polar as $eachpolar) { |
| 642 | 642 | unset($polar_data); |
| 643 | 643 | $Spotter = new Spotter(); |
| 644 | 644 | $data = json_decode($eachpolar['source_data']); |
| 645 | - foreach($data as $value => $key) { |
|
| 645 | + foreach ($data as $value => $key) { |
|
| 646 | 646 | $direction = $Spotter->parseDirection(($value*22.5)); |
| 647 | 647 | $distance = $key; |
| 648 | 648 | $unit = 'km'; |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | ?> |
| 663 | 663 | <div class="col-md-6"> |
| 664 | 664 | <h4><?php print $eachpolar['source_name']; ?></h4> |
| 665 | - <div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
| 665 | + <div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
| 666 | 666 | <script> |
| 667 | 667 | (function() { |
| 668 | 668 | var margin = {top: 100, right: 100, bottom: 100, left: 100}, |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | color: color, |
| 687 | 687 | unit: '<?php echo $unit; ?>' |
| 688 | 688 | }; |
| 689 | - RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
| 689 | + RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
| 690 | 690 | })(); |
| 691 | 691 | </script> |
| 692 | 692 | </div> |
@@ -698,19 +698,19 @@ discard block |
||
| 698 | 698 | <div class="row column"> |
| 699 | 699 | <div class="col-md-6"> |
| 700 | 700 | <?php |
| 701 | - $msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
|
| 701 | + $msg = $Stats->getStatsSource(date('Y-m-d'), 'msg'); |
|
| 702 | 702 | if (!empty($msg)) { |
| 703 | 703 | print '<h2>'._("Messages received").'</h2>'; |
| 704 | 704 | foreach ($msg as $eachmsg) { |
| 705 | 705 | //$eachmsg = $msg[0]; |
| 706 | 706 | $data = $eachmsg['source_data']; |
| 707 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
| 707 | + if ($data > 500) $max = (round(($data + 100)/100))*100; |
|
| 708 | 708 | else $max = 500; |
| 709 | 709 | ?> |
| 710 | - <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
| 710 | + <div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
| 711 | 711 | <script> |
| 712 | 712 | var g = new JustGage({ |
| 713 | - id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>", |
|
| 713 | + id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>", |
|
| 714 | 714 | value: <?php echo $data; ?>, |
| 715 | 715 | min: 0, |
| 716 | 716 | max: <?php print $max; ?>, |
@@ -730,12 +730,12 @@ discard block |
||
| 730 | 730 | <div class="row column"> |
| 731 | 731 | |
| 732 | 732 | <?php |
| 733 | - $hist = $Stats->getStatsSource(date('Y-m-d'),'hist'); |
|
| 733 | + $hist = $Stats->getStatsSource(date('Y-m-d'), 'hist'); |
|
| 734 | 734 | foreach ($hist as $hists) { |
| 735 | 735 | $hist_data = ''; |
| 736 | 736 | $source = $hists['source_name']; |
| 737 | 737 | $hist_array = json_decode($hists['source_data']); |
| 738 | - foreach($hist_array as $distance => $nb) |
|
| 738 | + foreach ($hist_array as $distance => $nb) |
|
| 739 | 739 | { |
| 740 | 740 | $unit = 'km'; |
| 741 | 741 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
@@ -753,13 +753,13 @@ discard block |
||
| 753 | 753 | $hist_data = substr($hist_data, 0, -1); |
| 754 | 754 | ?> |
| 755 | 755 | <div class="col-md-6"> |
| 756 | - <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2> |
|
| 756 | + <h2><?php echo sprintf(_("Flights Distance for %s"), $source); ?></h2> |
|
| 757 | 757 | <?php |
| 758 | - print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div> |
|
| 758 | + print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div> |
|
| 759 | 759 | <script> |
| 760 | 760 | google.load("visualization", "1", {packages:["corechart"]}); |
| 761 | - google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).'); |
|
| 762 | - function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() { |
|
| 761 | + google.setOnLoadCallback(drawCharthist_'.str_replace(' ', '_', strtolower($source)).'); |
|
| 762 | + function drawCharthist_'.str_replace(' ', '_', strtolower($source)).'() { |
|
| 763 | 763 | var data = google.visualization.arrayToDataTable([ |
| 764 | 764 | ["'._("Distance").'", "'._("# of Flights").'"], '; |
| 765 | 765 | print $hist_data; |
@@ -774,16 +774,16 @@ discard block |
||
| 774 | 774 | colors: ["#1a3151"] |
| 775 | 775 | }; |
| 776 | 776 | |
| 777 | - var chart = new google.visualization.AreaChart(document.getElementById("charthist-'.str_replace(' ','_',strtolower($source)).'")); |
|
| 777 | + var chart = new google.visualization.AreaChart(document.getElementById("charthist-'.str_replace(' ', '_', strtolower($source)).'")); |
|
| 778 | 778 | chart.draw(data, options); |
| 779 | 779 | } |
| 780 | 780 | $(window).resize(function(){ |
| 781 | - drawCharthist_'.str_replace(' ','_',strtolower($source)).'(); |
|
| 781 | + drawCharthist_'.str_replace(' ', '_', strtolower($source)).'(); |
|
| 782 | 782 | }); |
| 783 | 783 | </script>'; |
| 784 | 784 | ?> |
| 785 | 785 | </div> |
| 786 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 786 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 787 | 787 | <?php |
| 788 | 788 | } |
| 789 | 789 | ?> |
@@ -16,15 +16,15 @@ discard block |
||
| 16 | 16 | * @param Array $filter the filter |
| 17 | 17 | * @return Array the SQL part |
| 18 | 18 | */ |
| 19 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 19 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
| 21 | - if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter); |
|
| 22 | - if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter); |
|
| 21 | + if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName], $filter); |
|
| 22 | + if (is_array($globalFilter)) $filter = array_merge($globalFilter, $filter); |
|
| 23 | 23 | $filter_query_join = ''; |
| 24 | 24 | $filter_query_where = ''; |
| 25 | 25 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 26 | 26 | if ($filter['airlines'][0] != '') { |
| 27 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 27 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
@@ -32,19 +32,19 @@ discard block |
||
| 32 | 32 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
| 33 | 33 | } |
| 34 | 34 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
| 35 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 35 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 36 | 36 | } |
| 37 | 37 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 38 | - $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 38 | + $filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 39 | 39 | } |
| 40 | 40 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 41 | 41 | $filter_query_where = " WHERE ident = '".$filter['ident']."'"; |
| 42 | 42 | } |
| 43 | 43 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 44 | 44 | if ($filter_query_where == '') { |
| 45 | - $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 45 | + $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 46 | 46 | } else { |
| 47 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 47 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
@@ -70,8 +70,8 @@ discard block |
||
| 70 | 70 | if ($limit != '') |
| 71 | 71 | { |
| 72 | 72 | $limit_array = explode(',', $limit); |
| 73 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 74 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 73 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 74 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 75 | 75 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 76 | 76 | { |
| 77 | 77 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao'; |
| 116 | 116 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query; |
| 117 | 117 | |
| 118 | - $query = 'SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 118 | + $query = 'SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 119 | 119 | FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query; |
| 120 | 120 | |
| 121 | 121 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date ORDER BY spotter_live.date GROUP BY spotter_live.flightaware_id'.$filter_query; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | //$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE NOW() AT TIME ZONE 'UTC' - '30 SECONDS'->INTERVAL <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
| 126 | 126 | //$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE NOW() AT TIME ZONE 'UTC' - '".$globalLiveInterval." SECONDS'->INTERVAL <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate$orderby_query"; |
| 127 | 127 | //$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao'; |
| 128 | - $query = "SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 128 | + $query = "SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 129 | 129 | FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query; |
| 130 | 130 | } |
| 131 | 131 | // $spotter_array = Spotter->getDataFromDB($query.$limit_query); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | try { |
| 135 | 135 | $sth = $this->db->prepare($query); |
| 136 | 136 | $sth->execute(); |
| 137 | - } catch(PDOException $e) { |
|
| 137 | + } catch (PDOException $e) { |
|
| 138 | 138 | echo $e->getMessage(); |
| 139 | 139 | die; |
| 140 | 140 | } |
@@ -154,12 +154,12 @@ discard block |
||
| 154 | 154 | global $globalDBdriver, $globalLiveInterval; |
| 155 | 155 | date_default_timezone_set('UTC'); |
| 156 | 156 | |
| 157 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 157 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 158 | 158 | |
| 159 | 159 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 160 | 160 | if ($globalDBdriver == 'mysql') { |
| 161 | 161 | |
| 162 | - $query = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 162 | + $query = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 163 | 163 | FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date |
| 164 | 164 | ORDER BY spotter_live.flightaware_id, spotter_live.date'; |
| 165 | 165 | } else { |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | FROM spotter_live WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date |
| 169 | 169 | ".$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao ORDER BY spotter_live.flightaware_id, spotter_live.date'; |
| 170 | 170 | */ |
| 171 | - $query = "SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 171 | + $query = "SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 172 | 172 | FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category, icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date |
| 173 | 173 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
| 174 | 174 | // echo $query; |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | try { |
| 178 | 178 | $sth = $this->db->prepare($query); |
| 179 | 179 | $sth->execute(); |
| 180 | - } catch(PDOException $e) { |
|
| 180 | + } catch (PDOException $e) { |
|
| 181 | 181 | echo $e->getMessage(); |
| 182 | 182 | die; |
| 183 | 183 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | public function getLiveSpotterCount($filter = array()) |
| 195 | 195 | { |
| 196 | 196 | global $globalDBdriver, $globalLiveInterval; |
| 197 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 197 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 198 | 198 | |
| 199 | 199 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 200 | 200 | if ($globalDBdriver == 'mysql') { |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | try { |
| 208 | 208 | $sth = $this->db->prepare($query); |
| 209 | 209 | $sth->execute(); |
| 210 | - } catch(PDOException $e) { |
|
| 210 | + } catch (PDOException $e) { |
|
| 211 | 211 | echo $e->getMessage(); |
| 212 | 212 | die; |
| 213 | 213 | } |
@@ -230,10 +230,10 @@ discard block |
||
| 230 | 230 | $filter_query = $this->getFilter($filter); |
| 231 | 231 | |
| 232 | 232 | if (is_array($coord)) { |
| 233 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 234 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 235 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 236 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 233 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 234 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 235 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 236 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 237 | 237 | } else return array(); |
| 238 | 238 | if ($globalDBdriver == 'mysql') { |
| 239 | 239 | //$query = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | if ($interval == '1m') |
| 287 | 287 | { |
| 288 | 288 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
| 289 | - } else if ($interval == '15m'){ |
|
| 289 | + } else if ($interval == '15m') { |
|
| 290 | 290 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
| 291 | 291 | } |
| 292 | 292 | } |
@@ -294,14 +294,14 @@ discard block |
||
| 294 | 294 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 297 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 298 | 298 | WHERE spotter_live.latitude <> '' |
| 299 | 299 | AND spotter_live.longitude <> '' |
| 300 | 300 | ".$additional_query." |
| 301 | 301 | HAVING distance < :radius |
| 302 | 302 | ORDER BY distance"; |
| 303 | 303 | |
| 304 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 304 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
| 305 | 305 | |
| 306 | 306 | return $spotter_array; |
| 307 | 307 | } |
@@ -319,9 +319,9 @@ discard block |
||
| 319 | 319 | date_default_timezone_set('UTC'); |
| 320 | 320 | |
| 321 | 321 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 322 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 322 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 323 | 323 | |
| 324 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
| 324 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident)); |
|
| 325 | 325 | |
| 326 | 326 | return $spotter_array; |
| 327 | 327 | } |
@@ -332,16 +332,16 @@ discard block |
||
| 332 | 332 | * @return Array the spotter information |
| 333 | 333 | * |
| 334 | 334 | */ |
| 335 | - public function getDateLiveSpotterDataByIdent($ident,$date) |
|
| 335 | + public function getDateLiveSpotterDataByIdent($ident, $date) |
|
| 336 | 336 | { |
| 337 | 337 | $Spotter = new Spotter($this->db); |
| 338 | 338 | date_default_timezone_set('UTC'); |
| 339 | 339 | |
| 340 | 340 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 341 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 341 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 342 | 342 | |
| 343 | - $date = date('c',$date); |
|
| 344 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
| 343 | + $date = date('c', $date); |
|
| 344 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
| 345 | 345 | |
| 346 | 346 | return $spotter_array; |
| 347 | 347 | } |
@@ -358,9 +358,9 @@ discard block |
||
| 358 | 358 | date_default_timezone_set('UTC'); |
| 359 | 359 | |
| 360 | 360 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 361 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 361 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 362 | 362 | |
| 363 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
| 363 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id)); |
|
| 364 | 364 | |
| 365 | 365 | return $spotter_array; |
| 366 | 366 | } |
@@ -371,15 +371,15 @@ discard block |
||
| 371 | 371 | * @return Array the spotter information |
| 372 | 372 | * |
| 373 | 373 | */ |
| 374 | - public function getDateLiveSpotterDataById($id,$date) |
|
| 374 | + public function getDateLiveSpotterDataById($id, $date) |
|
| 375 | 375 | { |
| 376 | 376 | $Spotter = new Spotter($this->db); |
| 377 | 377 | date_default_timezone_set('UTC'); |
| 378 | 378 | |
| 379 | 379 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 380 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 381 | - $date = date('c',$date); |
|
| 382 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
|
| 380 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 381 | + $date = date('c', $date); |
|
| 382 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date)); |
|
| 383 | 383 | |
| 384 | 384 | return $spotter_array; |
| 385 | 385 | } |
@@ -396,13 +396,13 @@ discard block |
||
| 396 | 396 | date_default_timezone_set('UTC'); |
| 397 | 397 | |
| 398 | 398 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 399 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 399 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 400 | 400 | |
| 401 | 401 | try { |
| 402 | 402 | |
| 403 | 403 | $sth = $this->db->prepare($query); |
| 404 | 404 | $sth->execute(array(':ident' => $ident)); |
| 405 | - } catch(PDOException $e) { |
|
| 405 | + } catch (PDOException $e) { |
|
| 406 | 406 | echo $e->getMessage(); |
| 407 | 407 | die; |
| 408 | 408 | } |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | * @return Array the spotter information |
| 418 | 418 | * |
| 419 | 419 | */ |
| 420 | - public function getAllLiveSpotterDataById($id,$liveinterval = false) |
|
| 420 | + public function getAllLiveSpotterDataById($id, $liveinterval = false) |
|
| 421 | 421 | { |
| 422 | 422 | global $globalDBdriver, $globalLiveInterval; |
| 423 | 423 | date_default_timezone_set('UTC'); |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | try { |
| 437 | 437 | $sth = $this->db->prepare($query); |
| 438 | 438 | $sth->execute(array(':id' => $id)); |
| 439 | - } catch(PDOException $e) { |
|
| 439 | + } catch (PDOException $e) { |
|
| 440 | 440 | echo $e->getMessage(); |
| 441 | 441 | die; |
| 442 | 442 | } |
@@ -454,12 +454,12 @@ discard block |
||
| 454 | 454 | { |
| 455 | 455 | date_default_timezone_set('UTC'); |
| 456 | 456 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 457 | - $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
| 457 | + $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
| 458 | 458 | try { |
| 459 | 459 | |
| 460 | 460 | $sth = $this->db->prepare($query); |
| 461 | 461 | $sth->execute(array(':ident' => $ident)); |
| 462 | - } catch(PDOException $e) { |
|
| 462 | + } catch (PDOException $e) { |
|
| 463 | 463 | echo $e->getMessage(); |
| 464 | 464 | die; |
| 465 | 465 | } |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | |
| 490 | 490 | $sth = $this->db->prepare($query); |
| 491 | 491 | $sth->execute(); |
| 492 | - } catch(PDOException $e) { |
|
| 492 | + } catch (PDOException $e) { |
|
| 493 | 493 | return "error"; |
| 494 | 494 | } |
| 495 | 495 | |
@@ -512,14 +512,14 @@ discard block |
||
| 512 | 512 | |
| 513 | 513 | $sth = $this->db->prepare($query); |
| 514 | 514 | $sth->execute(); |
| 515 | - } catch(PDOException $e) { |
|
| 515 | + } catch (PDOException $e) { |
|
| 516 | 516 | return "error"; |
| 517 | 517 | } |
| 518 | 518 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
| 519 | 519 | $i = 0; |
| 520 | - $j =0; |
|
| 520 | + $j = 0; |
|
| 521 | 521 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 522 | - foreach($all as $row) |
|
| 522 | + foreach ($all as $row) |
|
| 523 | 523 | { |
| 524 | 524 | $i++; |
| 525 | 525 | $j++; |
@@ -527,9 +527,9 @@ discard block |
||
| 527 | 527 | if ($globalDebug) echo "."; |
| 528 | 528 | try { |
| 529 | 529 | |
| 530 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 530 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 531 | 531 | $sth->execute(); |
| 532 | - } catch(PDOException $e) { |
|
| 532 | + } catch (PDOException $e) { |
|
| 533 | 533 | return "error"; |
| 534 | 534 | } |
| 535 | 535 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
@@ -540,9 +540,9 @@ discard block |
||
| 540 | 540 | if ($i > 0) { |
| 541 | 541 | try { |
| 542 | 542 | |
| 543 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 543 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 544 | 544 | $sth->execute(); |
| 545 | - } catch(PDOException $e) { |
|
| 545 | + } catch (PDOException $e) { |
|
| 546 | 546 | return "error"; |
| 547 | 547 | } |
| 548 | 548 | } |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | |
| 556 | 556 | $sth = $this->db->prepare($query); |
| 557 | 557 | $sth->execute(); |
| 558 | - } catch(PDOException $e) { |
|
| 558 | + } catch (PDOException $e) { |
|
| 559 | 559 | return "error"; |
| 560 | 560 | } |
| 561 | 561 | /* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
@@ -603,13 +603,13 @@ discard block |
||
| 603 | 603 | public function deleteLiveSpotterDataByIdent($ident) |
| 604 | 604 | { |
| 605 | 605 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 606 | - $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
| 606 | + $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
| 607 | 607 | |
| 608 | 608 | try { |
| 609 | 609 | |
| 610 | 610 | $sth = $this->db->prepare($query); |
| 611 | 611 | $sth->execute(array(':ident' => $ident)); |
| 612 | - } catch(PDOException $e) { |
|
| 612 | + } catch (PDOException $e) { |
|
| 613 | 613 | return "error"; |
| 614 | 614 | } |
| 615 | 615 | |
@@ -625,13 +625,13 @@ discard block |
||
| 625 | 625 | public function deleteLiveSpotterDataById($id) |
| 626 | 626 | { |
| 627 | 627 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 628 | - $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
| 628 | + $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
| 629 | 629 | |
| 630 | 630 | try { |
| 631 | 631 | |
| 632 | 632 | $sth = $this->db->prepare($query); |
| 633 | 633 | $sth->execute(array(':id' => $id)); |
| 634 | - } catch(PDOException $e) { |
|
| 634 | + } catch (PDOException $e) { |
|
| 635 | 635 | return "error"; |
| 636 | 636 | } |
| 637 | 637 | |
@@ -649,13 +649,13 @@ discard block |
||
| 649 | 649 | { |
| 650 | 650 | global $globalDBdriver, $globalTimezone; |
| 651 | 651 | if ($globalDBdriver == 'mysql') { |
| 652 | - $query = 'SELECT spotter_live.ident FROM spotter_live |
|
| 652 | + $query = 'SELECT spotter_live.ident FROM spotter_live |
|
| 653 | 653 | WHERE spotter_live.ident = :ident |
| 654 | 654 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 655 | 655 | AND spotter_live.date < UTC_TIMESTAMP()'; |
| 656 | 656 | $query_data = array(':ident' => $ident); |
| 657 | 657 | } else { |
| 658 | - $query = "SELECT spotter_live.ident FROM spotter_live |
|
| 658 | + $query = "SELECT spotter_live.ident FROM spotter_live |
|
| 659 | 659 | WHERE spotter_live.ident = :ident |
| 660 | 660 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 661 | 661 | AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -664,8 +664,8 @@ discard block |
||
| 664 | 664 | |
| 665 | 665 | $sth = $this->db->prepare($query); |
| 666 | 666 | $sth->execute($query_data); |
| 667 | - $ident_result=''; |
|
| 668 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 667 | + $ident_result = ''; |
|
| 668 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 669 | 669 | { |
| 670 | 670 | $ident_result = $row['ident']; |
| 671 | 671 | } |
@@ -682,13 +682,13 @@ discard block |
||
| 682 | 682 | { |
| 683 | 683 | global $globalDBdriver, $globalTimezone; |
| 684 | 684 | if ($globalDBdriver == 'mysql') { |
| 685 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 685 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 686 | 686 | WHERE spotter_live.ident = :ident |
| 687 | 687 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
| 688 | 688 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 689 | 689 | $query_data = array(':ident' => $ident); |
| 690 | 690 | } else { |
| 691 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 691 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 692 | 692 | WHERE spotter_live.ident = :ident |
| 693 | 693 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
| 694 | 694 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -697,8 +697,8 @@ discard block |
||
| 697 | 697 | |
| 698 | 698 | $sth = $this->db->prepare($query); |
| 699 | 699 | $sth->execute($query_data); |
| 700 | - $ident_result=''; |
|
| 701 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 700 | + $ident_result = ''; |
|
| 701 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 702 | 702 | { |
| 703 | 703 | $ident_result = $row['flightaware_id']; |
| 704 | 704 | } |
@@ -715,13 +715,13 @@ discard block |
||
| 715 | 715 | { |
| 716 | 716 | global $globalDBdriver, $globalTimezone; |
| 717 | 717 | if ($globalDBdriver == 'mysql') { |
| 718 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 718 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 719 | 719 | WHERE spotter_live.flightaware_id = :id |
| 720 | 720 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
| 721 | 721 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 722 | 722 | $query_data = array(':id' => $id); |
| 723 | 723 | } else { |
| 724 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 724 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 725 | 725 | WHERE spotter_live.flightaware_id = :id |
| 726 | 726 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
| 727 | 727 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -730,8 +730,8 @@ discard block |
||
| 730 | 730 | |
| 731 | 731 | $sth = $this->db->prepare($query); |
| 732 | 732 | $sth->execute($query_data); |
| 733 | - $ident_result=''; |
|
| 734 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 733 | + $ident_result = ''; |
|
| 734 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 735 | 735 | { |
| 736 | 736 | $ident_result = $row['flightaware_id']; |
| 737 | 737 | } |
@@ -748,13 +748,13 @@ discard block |
||
| 748 | 748 | { |
| 749 | 749 | global $globalDBdriver, $globalTimezone; |
| 750 | 750 | if ($globalDBdriver == 'mysql') { |
| 751 | - $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 751 | + $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 752 | 752 | WHERE spotter_live.ModeS = :modes |
| 753 | 753 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
| 754 | 754 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 755 | 755 | $query_data = array(':modes' => $modes); |
| 756 | 756 | } else { |
| 757 | - $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 757 | + $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 758 | 758 | WHERE spotter_live.ModeS = :modes |
| 759 | 759 | AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'"; |
| 760 | 760 | // // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
@@ -763,8 +763,8 @@ discard block |
||
| 763 | 763 | |
| 764 | 764 | $sth = $this->db->prepare($query); |
| 765 | 765 | $sth->execute($query_data); |
| 766 | - $ident_result=''; |
|
| 767 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 766 | + $ident_result = ''; |
|
| 767 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 768 | 768 | { |
| 769 | 769 | //$ident_result = $row['spotter_live_id']; |
| 770 | 770 | $ident_result = $row['flightaware_id']; |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | * @return String success or false |
| 784 | 784 | * |
| 785 | 785 | */ |
| 786 | - public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
|
| 786 | + public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '') |
|
| 787 | 787 | { |
| 788 | 788 | global $globalURL, $globalArchive, $globalDebug; |
| 789 | 789 | $Common = new Common(); |
@@ -877,26 +877,26 @@ discard block |
||
| 877 | 877 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
| 878 | 878 | |
| 879 | 879 | |
| 880 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 881 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 882 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 883 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 884 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 885 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 886 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 887 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
| 888 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 889 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 890 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 891 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
| 892 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
| 893 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
| 894 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
| 895 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 896 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 897 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
| 898 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
| 899 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
| 880 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 881 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 882 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 883 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 884 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 885 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 886 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 887 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
| 888 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 889 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 890 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 891 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
| 892 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
| 893 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
| 894 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
| 895 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 896 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 897 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
| 898 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
| 899 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
| 900 | 900 | |
| 901 | 901 | $airline_name = ''; |
| 902 | 902 | $airline_icao = ''; |
@@ -918,26 +918,26 @@ discard block |
||
| 918 | 918 | $arrival_airport_country = ''; |
| 919 | 919 | |
| 920 | 920 | |
| 921 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 922 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 923 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 924 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 921 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 922 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 923 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 924 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 925 | 925 | |
| 926 | - $query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
|
| 926 | + $query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
|
| 927 | 927 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)'; |
| 928 | 928 | |
| 929 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country); |
|
| 929 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country); |
|
| 930 | 930 | //$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'],':airline_country' => $airline_array[0]['country'],':airline_type' => $airline_array[0]['type'],':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_array[0]['type'],':aircraft_manufacturer' => $aircraft_array[0]['manufacturer'],':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date); |
| 931 | 931 | try { |
| 932 | 932 | |
| 933 | 933 | $sth = $this->db->prepare($query); |
| 934 | 934 | $sth->execute($query_values); |
| 935 | - } catch(PDOException $e) { |
|
| 935 | + } catch (PDOException $e) { |
|
| 936 | 936 | return "error : ".$e->getMessage(); |
| 937 | 937 | } |
| 938 | 938 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 939 | 939 | if ($globalDebug) echo '(Add to SBS archive : '; |
| 940 | - $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
| 940 | + $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country); |
|
| 941 | 941 | if ($globalDebug) echo $result.')'; |
| 942 | 942 | } |
| 943 | 943 | return "success"; |
@@ -946,7 +946,7 @@ discard block |
||
| 946 | 946 | |
| 947 | 947 | public function getOrderBy() |
| 948 | 948 | { |
| 949 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
| 949 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
| 950 | 950 | return $orderby; |
| 951 | 951 | } |
| 952 | 952 | |
@@ -18,8 +18,12 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
| 21 | - if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter); |
|
| 22 | - if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter); |
|
| 21 | + if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
|
| 22 | + $filter = array_merge($globalStatsFilters[$globalFilterName],$filter); |
|
| 23 | + } |
|
| 24 | + if (is_array($globalFilter)) { |
|
| 25 | + $filter = array_merge($globalFilter,$filter); |
|
| 26 | + } |
|
| 23 | 27 | $filter_query_join = ''; |
| 24 | 28 | $filter_query_where = ''; |
| 25 | 29 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
@@ -47,8 +51,11 @@ discard block |
||
| 47 | 51 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 48 | 52 | } |
| 49 | 53 | } |
| 50 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 51 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 54 | + if ($filter_query_where == '' && $where) { |
|
| 55 | + $filter_query_where = ' WHERE'; |
|
| 56 | + } elseif ($filter_query_where != '' && $and) { |
|
| 57 | + $filter_query_where .= ' AND'; |
|
| 58 | + } |
|
| 52 | 59 | $filter_query = $filter_query_join.$filter_query_where; |
| 53 | 60 | return $filter_query; |
| 54 | 61 | } |
@@ -84,7 +91,9 @@ discard block |
||
| 84 | 91 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
| 85 | 92 | } |
| 86 | 93 | |
| 87 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 94 | + if (!isset($globalLiveInterval)) { |
|
| 95 | + $globalLiveInterval = '200'; |
|
| 96 | + } |
|
| 88 | 97 | if ($globalDBdriver == 'mysql') { |
| 89 | 98 | //$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
| 90 | 99 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -109,7 +118,9 @@ discard block |
||
| 109 | 118 | |
| 110 | 119 | $filter_query = $this->getFilter($filter); |
| 111 | 120 | |
| 112 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 121 | + if (!isset($globalLiveInterval)) { |
|
| 122 | + $globalLiveInterval = '200'; |
|
| 123 | + } |
|
| 113 | 124 | if ($globalDBdriver == 'mysql') { |
| 114 | 125 | // $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate$orderby_query"; |
| 115 | 126 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao'; |
@@ -156,7 +167,9 @@ discard block |
||
| 156 | 167 | |
| 157 | 168 | $filter_query = $this->getFilter($filter,true,true); |
| 158 | 169 | |
| 159 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 170 | + if (!isset($globalLiveInterval)) { |
|
| 171 | + $globalLiveInterval = '200'; |
|
| 172 | + } |
|
| 160 | 173 | if ($globalDBdriver == 'mysql') { |
| 161 | 174 | |
| 162 | 175 | $query = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
@@ -196,7 +209,9 @@ discard block |
||
| 196 | 209 | global $globalDBdriver, $globalLiveInterval; |
| 197 | 210 | $filter_query = $this->getFilter($filter,true,true); |
| 198 | 211 | |
| 199 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 212 | + if (!isset($globalLiveInterval)) { |
|
| 213 | + $globalLiveInterval = '200'; |
|
| 214 | + } |
|
| 200 | 215 | if ($globalDBdriver == 'mysql') { |
| 201 | 216 | //$query = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query; |
| 202 | 217 | $query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
@@ -226,7 +241,9 @@ discard block |
||
| 226 | 241 | { |
| 227 | 242 | global $globalDBdriver, $globalLiveInterval; |
| 228 | 243 | $Spotter = new Spotter($this->db); |
| 229 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 244 | + if (!isset($globalLiveInterval)) { |
|
| 245 | + $globalLiveInterval = '200'; |
|
| 246 | + } |
|
| 230 | 247 | $filter_query = $this->getFilter($filter); |
| 231 | 248 | |
| 232 | 249 | if (is_array($coord)) { |
@@ -234,7 +251,9 @@ discard block |
||
| 234 | 251 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 235 | 252 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 236 | 253 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 237 | - } else return array(); |
|
| 254 | + } else { |
|
| 255 | + return array(); |
|
| 256 | + } |
|
| 238 | 257 | if ($globalDBdriver == 'mysql') { |
| 239 | 258 | //$query = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
| 240 | 259 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
@@ -425,11 +444,15 @@ discard block |
||
| 425 | 444 | //$query = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date'; |
| 426 | 445 | if ($globalDBdriver == 'mysql') { |
| 427 | 446 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
| 428 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 447 | + if ($liveinterval) { |
|
| 448 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 449 | + } |
|
| 429 | 450 | $query .= ' ORDER BY date'; |
| 430 | 451 | } else { |
| 431 | 452 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
| 432 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 453 | + if ($liveinterval) { |
|
| 454 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 455 | + } |
|
| 433 | 456 | $query .= ' ORDER BY date'; |
| 434 | 457 | } |
| 435 | 458 | |
@@ -524,7 +547,9 @@ discard block |
||
| 524 | 547 | $i++; |
| 525 | 548 | $j++; |
| 526 | 549 | if ($j == 30) { |
| 527 | - if ($globalDebug) echo "."; |
|
| 550 | + if ($globalDebug) { |
|
| 551 | + echo "."; |
|
| 552 | + } |
|
| 528 | 553 | try { |
| 529 | 554 | |
| 530 | 555 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -856,7 +881,9 @@ discard block |
||
| 856 | 881 | { |
| 857 | 882 | return false; |
| 858 | 883 | } |
| 859 | - } else $altitude = 0; |
|
| 884 | + } else { |
|
| 885 | + $altitude = 0; |
|
| 886 | + } |
|
| 860 | 887 | |
| 861 | 888 | if ($heading != '') |
| 862 | 889 | { |
@@ -864,7 +891,9 @@ discard block |
||
| 864 | 891 | { |
| 865 | 892 | return false; |
| 866 | 893 | } |
| 867 | - } else $heading = 0; |
|
| 894 | + } else { |
|
| 895 | + $heading = 0; |
|
| 896 | + } |
|
| 868 | 897 | |
| 869 | 898 | if ($groundspeed != '') |
| 870 | 899 | { |
@@ -872,9 +901,13 @@ discard block |
||
| 872 | 901 | { |
| 873 | 902 | return false; |
| 874 | 903 | } |
| 875 | - } else $groundspeed = 0; |
|
| 904 | + } else { |
|
| 905 | + $groundspeed = 0; |
|
| 906 | + } |
|
| 876 | 907 | date_default_timezone_set('UTC'); |
| 877 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
| 908 | + if ($date == '') { |
|
| 909 | + $date = date("Y-m-d H:i:s", time()); |
|
| 910 | + } |
|
| 878 | 911 | |
| 879 | 912 | |
| 880 | 913 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -918,10 +951,18 @@ discard block |
||
| 918 | 951 | $arrival_airport_country = ''; |
| 919 | 952 | |
| 920 | 953 | |
| 921 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 922 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 923 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 924 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 954 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) { |
|
| 955 | + $squawk = NULL; |
|
| 956 | + } |
|
| 957 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) { |
|
| 958 | + $verticalrate = NULL; |
|
| 959 | + } |
|
| 960 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
| 961 | + $groundspeed = 0; |
|
| 962 | + } |
|
| 963 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
| 964 | + $heading = 0; |
|
| 965 | + } |
|
| 925 | 966 | |
| 926 | 967 | $query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
| 927 | 968 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)'; |
@@ -936,9 +977,13 @@ discard block |
||
| 936 | 977 | return "error : ".$e->getMessage(); |
| 937 | 978 | } |
| 938 | 979 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 939 | - if ($globalDebug) echo '(Add to SBS archive : '; |
|
| 980 | + if ($globalDebug) { |
|
| 981 | + echo '(Add to SBS archive : '; |
|
| 982 | + } |
|
| 940 | 983 | $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
| 941 | - if ($globalDebug) echo $result.')'; |
|
| 984 | + if ($globalDebug) { |
|
| 985 | + echo $result.')'; |
|
| 986 | + } |
|
| 942 | 987 | } |
| 943 | 988 | return "success"; |
| 944 | 989 | |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | require_once(dirname(__FILE__).'/class.Image.php'); |
| 5 | 5 | $global_query = "SELECT spotter_output.* FROM spotter_output"; |
| 6 | 6 | |
| 7 | -class Spotter{ |
|
| 7 | +class Spotter { |
|
| 8 | 8 | public $db; |
| 9 | 9 | |
| 10 | 10 | public function __construct($dbc = null) { |
@@ -17,15 +17,15 @@ discard block |
||
| 17 | 17 | * @param Array $filter the filter |
| 18 | 18 | * @return Array the SQL part |
| 19 | 19 | */ |
| 20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
| 22 | - if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter); |
|
| 23 | - if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter); |
|
| 22 | + if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName], $filter); |
|
| 23 | + if (is_array($globalFilter)) $filter = array_merge($globalFilter, $filter); |
|
| 24 | 24 | $filter_query_join = ''; |
| 25 | 25 | $filter_query_where = ''; |
| 26 | 26 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 27 | 27 | if ($filter['airlines'][0] != '') { |
| 28 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 28 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | |
@@ -33,19 +33,19 @@ discard block |
||
| 33 | 33 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_output.flightaware_id "; |
| 34 | 34 | } |
| 35 | 35 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
| 36 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 36 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 37 | 37 | } |
| 38 | 38 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 39 | - $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 39 | + $filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 40 | 40 | } |
| 41 | 41 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 42 | 42 | $filter_query_where = " WHERE ident = '".$filter['ident']."'"; |
| 43 | 43 | } |
| 44 | 44 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 45 | 45 | if ($filter_query_where == '') { |
| 46 | - $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 46 | + $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 47 | 47 | } else { |
| 48 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 48 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $sth = $this->db->prepare($query.$limitQuery); |
| 94 | 94 | $sth->execute($params); |
| 95 | 95 | } catch (PDOException $e) { |
| 96 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
| 96 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
| 97 | 97 | exit(); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $spotter_array = array(); |
| 104 | 104 | |
| 105 | 105 | |
| 106 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 106 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 107 | 107 | { |
| 108 | 108 | $num_rows++; |
| 109 | 109 | $temp_array = array(); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | if (isset($row['route_stop'])) { |
| 149 | 149 | $temp_array['route_stop'] = $row['route_stop']; |
| 150 | 150 | if ($row['route_stop'] != '') { |
| 151 | - $allroute = explode(' ',$row['route_stop']); |
|
| 151 | + $allroute = explode(' ', $row['route_stop']); |
|
| 152 | 152 | |
| 153 | 153 | foreach ($allroute as $route) { |
| 154 | 154 | $route_airport_array = $this->getAllAirportInfo($route); |
@@ -203,11 +203,11 @@ discard block |
||
| 203 | 203 | { |
| 204 | 204 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
| 205 | 205 | } else { |
| 206 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
| 206 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
| 207 | 207 | } |
| 208 | 208 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
| 209 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
| 210 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
| 209 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
| 210 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
| 211 | 211 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
| 212 | 212 | } |
| 213 | 213 | |
@@ -241,9 +241,9 @@ discard block |
||
| 241 | 241 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
| 242 | 242 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
| 243 | 243 | if (is_numeric(substr($row['ident'], 2, 1))) { |
| 244 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource); |
|
| 244 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource); |
|
| 245 | 245 | } elseif (is_numeric(substr($row['ident'], 3, 1))) { |
| 246 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
|
| 246 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource); |
|
| 247 | 247 | } else { |
| 248 | 248 | $airline_array = $this->getAllAirlineInfo('NA'); |
| 249 | 249 | } |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | $temp_array['airline_type'] = $row['airline_type']; |
| 270 | 270 | } |
| 271 | 271 | if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') { |
| 272 | - $acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3)); |
|
| 272 | + $acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3)); |
|
| 273 | 273 | //$acars_array = ACARS->getLiveAcarsData('BA40YL'); |
| 274 | 274 | if (count($acars_array) > 0) { |
| 275 | 275 | $temp_array['acars'] = $acars_array; |
@@ -286,11 +286,11 @@ discard block |
||
| 286 | 286 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | - if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
|
| 289 | + if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
|
| 290 | 290 | { |
| 291 | 291 | if ($globalIVAO) { |
| 292 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 293 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 292 | + if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']); |
|
| 293 | + else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']); |
|
| 294 | 294 | } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
| 295 | 295 | if (count($image_array) > 0) { |
| 296 | 296 | $temp_array['image'] = $image_array[0]['image']; |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | if (isset($row['arrival_airport_time']) && $row['arrival_airport_time'] != '') { |
| 314 | 314 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
| 315 | 315 | } |
| 316 | - if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
| 316 | + if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
| 317 | 317 | $schedule_array = $Schedule->getSchedule($temp_array['ident']); |
| 318 | 318 | //print_r($schedule_array); |
| 319 | 319 | if (count($schedule_array) > 0) { |
@@ -394,12 +394,12 @@ discard block |
||
| 394 | 394 | if (isset($row['squawk'])) { |
| 395 | 395 | $temp_array['squawk'] = $row['squawk']; |
| 396 | 396 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
| 397 | - $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
|
| 398 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 397 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']); |
|
| 398 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
| 399 | 399 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
| 400 | - $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
|
| 401 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 402 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 400 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']); |
|
| 401 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
| 402 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | $temp_array['query_number_rows'] = $num_rows; |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | * @return Array the spotter information |
| 419 | 419 | * |
| 420 | 420 | */ |
| 421 | - public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filter = array()) |
|
| 421 | + public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filter = array()) |
|
| 422 | 422 | { |
| 423 | 423 | global $globalTimezone, $globalDBdriver; |
| 424 | 424 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | |
| 429 | 429 | $query_values = array(); |
| 430 | 430 | $additional_query = ''; |
| 431 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 431 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 432 | 432 | if ($q != "") |
| 433 | 433 | { |
| 434 | 434 | if (!is_string($q)) |
@@ -436,8 +436,8 @@ discard block |
||
| 436 | 436 | return false; |
| 437 | 437 | } else { |
| 438 | 438 | $q_array = explode(" ", $q); |
| 439 | - foreach ($q_array as $q_item){ |
|
| 440 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 439 | + foreach ($q_array as $q_item) { |
|
| 440 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 441 | 441 | $additional_query .= " AND ("; |
| 442 | 442 | if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
| 443 | 443 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -469,37 +469,37 @@ discard block |
||
| 469 | 469 | |
| 470 | 470 | if ($registration != "") |
| 471 | 471 | { |
| 472 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 472 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 473 | 473 | if (!is_string($registration)) |
| 474 | 474 | { |
| 475 | 475 | return false; |
| 476 | 476 | } else { |
| 477 | 477 | $additional_query .= " AND spotter_output.registration = :registration"; |
| 478 | - $query_values = array_merge($query_values,array(':registration' => $registration)); |
|
| 478 | + $query_values = array_merge($query_values, array(':registration' => $registration)); |
|
| 479 | 479 | } |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | if ($aircraft_icao != "") |
| 483 | 483 | { |
| 484 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 484 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 485 | 485 | if (!is_string($aircraft_icao)) |
| 486 | 486 | { |
| 487 | 487 | return false; |
| 488 | 488 | } else { |
| 489 | 489 | $additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao"; |
| 490 | - $query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao)); |
|
| 490 | + $query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao)); |
|
| 491 | 491 | } |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | if ($aircraft_manufacturer != "") |
| 495 | 495 | { |
| 496 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 496 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 497 | 497 | if (!is_string($aircraft_manufacturer)) |
| 498 | 498 | { |
| 499 | 499 | return false; |
| 500 | 500 | } else { |
| 501 | 501 | $additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer"; |
| 502 | - $query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
|
| 502 | + $query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
|
| 503 | 503 | } |
| 504 | 504 | } |
| 505 | 505 | |
@@ -515,25 +515,25 @@ discard block |
||
| 515 | 515 | |
| 516 | 516 | if ($airline_icao != "") |
| 517 | 517 | { |
| 518 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 518 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 519 | 519 | if (!is_string($airline_icao)) |
| 520 | 520 | { |
| 521 | 521 | return false; |
| 522 | 522 | } else { |
| 523 | 523 | $additional_query .= " AND spotter_output.airline_icao = :airline_icao"; |
| 524 | - $query_values = array_merge($query_values,array(':airline_icao' => $airline_icao)); |
|
| 524 | + $query_values = array_merge($query_values, array(':airline_icao' => $airline_icao)); |
|
| 525 | 525 | } |
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | if ($airline_country != "") |
| 529 | 529 | { |
| 530 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
| 530 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
| 531 | 531 | if (!is_string($airline_country)) |
| 532 | 532 | { |
| 533 | 533 | return false; |
| 534 | 534 | } else { |
| 535 | 535 | $additional_query .= " AND spotter_output.airline_country = :airline_country"; |
| 536 | - $query_values = array_merge($query_values,array(':airline_country' => $airline_country)); |
|
| 536 | + $query_values = array_merge($query_values, array(':airline_country' => $airline_country)); |
|
| 537 | 537 | } |
| 538 | 538 | } |
| 539 | 539 | |
@@ -560,31 +560,31 @@ discard block |
||
| 560 | 560 | |
| 561 | 561 | if ($airport != "") |
| 562 | 562 | { |
| 563 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
| 563 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
| 564 | 564 | if (!is_string($airport)) |
| 565 | 565 | { |
| 566 | 566 | return false; |
| 567 | 567 | } else { |
| 568 | 568 | $additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)"; |
| 569 | - $query_values = array_merge($query_values,array(':airport' => $airport)); |
|
| 569 | + $query_values = array_merge($query_values, array(':airport' => $airport)); |
|
| 570 | 570 | } |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | if ($airport_country != "") |
| 574 | 574 | { |
| 575 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
| 575 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
| 576 | 576 | if (!is_string($airport_country)) |
| 577 | 577 | { |
| 578 | 578 | return false; |
| 579 | 579 | } else { |
| 580 | 580 | $additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)"; |
| 581 | - $query_values = array_merge($query_values,array(':airport_country' => $airport_country)); |
|
| 581 | + $query_values = array_merge($query_values, array(':airport_country' => $airport_country)); |
|
| 582 | 582 | } |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | if ($callsign != "") |
| 586 | 586 | { |
| 587 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 587 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 588 | 588 | if (!is_string($callsign)) |
| 589 | 589 | { |
| 590 | 590 | return false; |
@@ -592,79 +592,79 @@ discard block |
||
| 592 | 592 | $translate = $Translation->ident2icao($callsign); |
| 593 | 593 | if ($translate != $callsign) { |
| 594 | 594 | $additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)"; |
| 595 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
| 595 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
| 596 | 596 | } else { |
| 597 | 597 | $additional_query .= " AND spotter_output.ident = :callsign"; |
| 598 | - $query_values = array_merge($query_values,array(':callsign' => $callsign)); |
|
| 598 | + $query_values = array_merge($query_values, array(':callsign' => $callsign)); |
|
| 599 | 599 | } |
| 600 | 600 | } |
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | if ($owner != "") |
| 604 | 604 | { |
| 605 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 605 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 606 | 606 | if (!is_string($owner)) |
| 607 | 607 | { |
| 608 | 608 | return false; |
| 609 | 609 | } else { |
| 610 | 610 | $additional_query .= " AND spotter_output.owner_name = :owner"; |
| 611 | - $query_values = array_merge($query_values,array(':owner' => $owner)); |
|
| 611 | + $query_values = array_merge($query_values, array(':owner' => $owner)); |
|
| 612 | 612 | } |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | if ($pilot_name != "") |
| 616 | 616 | { |
| 617 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 617 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 618 | 618 | if (!is_string($pilot_name)) |
| 619 | 619 | { |
| 620 | 620 | return false; |
| 621 | 621 | } else { |
| 622 | 622 | $additional_query .= " AND spotter_output.pilot_name = :pilot_name"; |
| 623 | - $query_values = array_merge($query_values,array(':pilot_name' => $pilot_name)); |
|
| 623 | + $query_values = array_merge($query_values, array(':pilot_name' => $pilot_name)); |
|
| 624 | 624 | } |
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | if ($pilot_id != "") |
| 628 | 628 | { |
| 629 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
| 629 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
| 630 | 630 | if (!is_string($pilot_id)) |
| 631 | 631 | { |
| 632 | 632 | return false; |
| 633 | 633 | } else { |
| 634 | 634 | $additional_query .= " AND spotter_output.pilot_id = :pilot_id"; |
| 635 | - $query_values = array_merge($query_values,array(':pilot_id' => $pilot_id)); |
|
| 635 | + $query_values = array_merge($query_values, array(':pilot_id' => $pilot_id)); |
|
| 636 | 636 | } |
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | if ($departure_airport_route != "") |
| 640 | 640 | { |
| 641 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
| 641 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
| 642 | 642 | if (!is_string($departure_airport_route)) |
| 643 | 643 | { |
| 644 | 644 | return false; |
| 645 | 645 | } else { |
| 646 | 646 | $additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route"; |
| 647 | - $query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route)); |
|
| 647 | + $query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route)); |
|
| 648 | 648 | } |
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | if ($arrival_airport_route != "") |
| 652 | 652 | { |
| 653 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
| 653 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
| 654 | 654 | if (!is_string($arrival_airport_route)) |
| 655 | 655 | { |
| 656 | 656 | return false; |
| 657 | 657 | } else { |
| 658 | 658 | $additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route"; |
| 659 | - $query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route)); |
|
| 659 | + $query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route)); |
|
| 660 | 660 | } |
| 661 | 661 | } |
| 662 | 662 | |
| 663 | 663 | if ($altitude != "") |
| 664 | 664 | { |
| 665 | 665 | $altitude_array = explode(",", $altitude); |
| 666 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 667 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 666 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 667 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 668 | 668 | |
| 669 | 669 | if ($altitude_array[1] != "") |
| 670 | 670 | { |
@@ -680,8 +680,8 @@ discard block |
||
| 680 | 680 | if ($date_posted != "") |
| 681 | 681 | { |
| 682 | 682 | $date_array = explode(",", $date_posted); |
| 683 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
| 684 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
| 683 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
| 684 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
| 685 | 685 | |
| 686 | 686 | if ($globalTimezone != '') { |
| 687 | 687 | date_default_timezone_set($globalTimezone); |
@@ -712,8 +712,8 @@ discard block |
||
| 712 | 712 | { |
| 713 | 713 | $limit_array = explode(",", $limit); |
| 714 | 714 | |
| 715 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 716 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 715 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 716 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 717 | 717 | |
| 718 | 718 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 719 | 719 | { |
@@ -742,23 +742,23 @@ discard block |
||
| 742 | 742 | |
| 743 | 743 | |
| 744 | 744 | if ($origLat != "" && $origLon != "" && $dist != "") { |
| 745 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
| 745 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
| 746 | 746 | |
| 747 | 747 | if ($globalDBdriver == 'mysql') { |
| 748 | - $query="SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance |
|
| 748 | + $query = "SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance |
|
| 749 | 749 | FROM spotter_output, spotter_archive".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND spotter_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and spotter_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 750 | 750 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query; |
| 751 | 751 | } else { |
| 752 | - $query="SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
| 752 | + $query = "SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
| 753 | 753 | FROM spotter_output, spotter_archive".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 754 | 754 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query; |
| 755 | 755 | } |
| 756 | 756 | } else { |
| 757 | - $query = "SELECT spotter_output.* FROM spotter_output ".$filter_query." spotter_output.ident <> '' |
|
| 757 | + $query = "SELECT spotter_output.* FROM spotter_output ".$filter_query." spotter_output.ident <> '' |
|
| 758 | 758 | ".$additional_query." |
| 759 | 759 | ".$orderby_query; |
| 760 | 760 | } |
| 761 | - $spotter_array = $this->getDataFromDB($query, $query_values,$limit_query); |
|
| 761 | + $spotter_array = $this->getDataFromDB($query, $query_values, $limit_query); |
|
| 762 | 762 | return $spotter_array; |
| 763 | 763 | } |
| 764 | 764 | |
@@ -781,8 +781,8 @@ discard block |
||
| 781 | 781 | { |
| 782 | 782 | $limit_array = explode(",", $limit); |
| 783 | 783 | |
| 784 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 785 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 784 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 785 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 786 | 786 | |
| 787 | 787 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 788 | 788 | { |
@@ -799,9 +799,9 @@ discard block |
||
| 799 | 799 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 800 | 800 | } |
| 801 | 801 | |
| 802 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
| 802 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
| 803 | 803 | |
| 804 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query); |
|
| 804 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
|
| 805 | 805 | |
| 806 | 806 | return $spotter_array; |
| 807 | 807 | } |
@@ -847,34 +847,34 @@ discard block |
||
| 847 | 847 | { |
| 848 | 848 | return false; |
| 849 | 849 | } else { |
| 850 | - if ($interval == "30m"){ |
|
| 850 | + if ($interval == "30m") { |
|
| 851 | 851 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date '; |
| 852 | - } else if ($interval == "1h"){ |
|
| 852 | + } else if ($interval == "1h") { |
|
| 853 | 853 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date '; |
| 854 | - } else if ($interval == "3h"){ |
|
| 854 | + } else if ($interval == "3h") { |
|
| 855 | 855 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date '; |
| 856 | - } else if ($interval == "6h"){ |
|
| 856 | + } else if ($interval == "6h") { |
|
| 857 | 857 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date '; |
| 858 | - } else if ($interval == "12h"){ |
|
| 858 | + } else if ($interval == "12h") { |
|
| 859 | 859 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date '; |
| 860 | - } else if ($interval == "24h"){ |
|
| 860 | + } else if ($interval == "24h") { |
|
| 861 | 861 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date '; |
| 862 | - } else if ($interval == "7d"){ |
|
| 862 | + } else if ($interval == "7d") { |
|
| 863 | 863 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date '; |
| 864 | - } else if ($interval == "30d"){ |
|
| 864 | + } else if ($interval == "30d") { |
|
| 865 | 865 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date '; |
| 866 | 866 | } |
| 867 | 867 | } |
| 868 | 868 | } |
| 869 | 869 | |
| 870 | - $query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output |
|
| 870 | + $query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output |
|
| 871 | 871 | WHERE spotter_output.latitude <> '' |
| 872 | 872 | AND spotter_output.longitude <> '' |
| 873 | 873 | ".$additional_query." |
| 874 | 874 | HAVING distance < :radius |
| 875 | 875 | ORDER BY distance"; |
| 876 | 876 | |
| 877 | - $spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query); |
|
| 877 | + $spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query); |
|
| 878 | 878 | |
| 879 | 879 | return $spotter_array; |
| 880 | 880 | } |
@@ -886,21 +886,21 @@ discard block |
||
| 886 | 886 | * @return Array the spotter information |
| 887 | 887 | * |
| 888 | 888 | */ |
| 889 | - public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array()) |
|
| 889 | + public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array()) |
|
| 890 | 890 | { |
| 891 | 891 | global $global_query; |
| 892 | 892 | |
| 893 | 893 | date_default_timezone_set('UTC'); |
| 894 | 894 | |
| 895 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 895 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 896 | 896 | |
| 897 | 897 | $limit_query = ''; |
| 898 | 898 | if ($limit != "") |
| 899 | 899 | { |
| 900 | 900 | $limit_array = explode(",", $limit); |
| 901 | 901 | |
| 902 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 903 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 902 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 903 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 904 | 904 | |
| 905 | 905 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 906 | 906 | { |
@@ -917,7 +917,7 @@ discard block |
||
| 917 | 917 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 918 | 918 | } |
| 919 | 919 | |
| 920 | - $query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 920 | + $query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 921 | 921 | |
| 922 | 922 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 923 | 923 | |
@@ -936,15 +936,15 @@ discard block |
||
| 936 | 936 | global $global_query; |
| 937 | 937 | |
| 938 | 938 | date_default_timezone_set('UTC'); |
| 939 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 939 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 940 | 940 | |
| 941 | 941 | $limit_query = ''; |
| 942 | 942 | if ($limit != "") |
| 943 | 943 | { |
| 944 | 944 | $limit_array = explode(",", $limit); |
| 945 | 945 | |
| 946 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 947 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 946 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 947 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 948 | 948 | |
| 949 | 949 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 950 | 950 | { |
@@ -961,7 +961,7 @@ discard block |
||
| 961 | 961 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 962 | 962 | } |
| 963 | 963 | |
| 964 | - $query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 964 | + $query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 965 | 965 | |
| 966 | 966 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 967 | 967 | |
@@ -975,20 +975,20 @@ discard block |
||
| 975 | 975 | * @return Array the spotter information |
| 976 | 976 | * |
| 977 | 977 | */ |
| 978 | - public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array()) |
|
| 978 | + public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array()) |
|
| 979 | 979 | { |
| 980 | 980 | global $global_query; |
| 981 | 981 | |
| 982 | 982 | date_default_timezone_set('UTC'); |
| 983 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 983 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 984 | 984 | |
| 985 | 985 | $limit_query = ''; |
| 986 | 986 | if ($limit != "") |
| 987 | 987 | { |
| 988 | 988 | $limit_array = explode(",", $limit); |
| 989 | 989 | |
| 990 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 991 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 990 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 991 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 992 | 992 | |
| 993 | 993 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 994 | 994 | { |
@@ -1005,7 +1005,7 @@ discard block |
||
| 1005 | 1005 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1006 | 1006 | } |
| 1007 | 1007 | |
| 1008 | - $query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1008 | + $query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1009 | 1009 | |
| 1010 | 1010 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1011 | 1011 | |
@@ -1025,7 +1025,7 @@ discard block |
||
| 1025 | 1025 | |
| 1026 | 1026 | date_default_timezone_set('UTC'); |
| 1027 | 1027 | |
| 1028 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1028 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1029 | 1029 | |
| 1030 | 1030 | $limit_query = ''; |
| 1031 | 1031 | |
@@ -1033,8 +1033,8 @@ discard block |
||
| 1033 | 1033 | { |
| 1034 | 1034 | $limit_array = explode(",", $limit); |
| 1035 | 1035 | |
| 1036 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1037 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1036 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1037 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1038 | 1038 | |
| 1039 | 1039 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1040 | 1040 | { |
@@ -1051,7 +1051,7 @@ discard block |
||
| 1051 | 1051 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1052 | 1052 | } |
| 1053 | 1053 | |
| 1054 | - $query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1054 | + $query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1055 | 1055 | |
| 1056 | 1056 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1057 | 1057 | |
@@ -1070,14 +1070,14 @@ discard block |
||
| 1070 | 1070 | global $global_query; |
| 1071 | 1071 | |
| 1072 | 1072 | date_default_timezone_set('UTC'); |
| 1073 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1073 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1074 | 1074 | $limit_query = ''; |
| 1075 | 1075 | if ($limit != "") |
| 1076 | 1076 | { |
| 1077 | 1077 | $limit_array = explode(",", $limit); |
| 1078 | 1078 | |
| 1079 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1080 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1079 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1080 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1081 | 1081 | |
| 1082 | 1082 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1083 | 1083 | { |
@@ -1094,7 +1094,7 @@ discard block |
||
| 1094 | 1094 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1095 | 1095 | } |
| 1096 | 1096 | |
| 1097 | - $query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1097 | + $query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1098 | 1098 | |
| 1099 | 1099 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1100 | 1100 | |
@@ -1118,9 +1118,9 @@ discard block |
||
| 1118 | 1118 | $query_values = array(':id' => $id); |
| 1119 | 1119 | |
| 1120 | 1120 | //$query = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." "; |
| 1121 | - $query = $global_query." WHERE ".$additional_query." "; |
|
| 1121 | + $query = $global_query." WHERE ".$additional_query." "; |
|
| 1122 | 1122 | |
| 1123 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
| 1123 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
| 1124 | 1124 | |
| 1125 | 1125 | return $spotter_array; |
| 1126 | 1126 | } |
@@ -1158,8 +1158,8 @@ discard block |
||
| 1158 | 1158 | { |
| 1159 | 1159 | $limit_array = explode(",", $limit); |
| 1160 | 1160 | |
| 1161 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1162 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1161 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1162 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1163 | 1163 | |
| 1164 | 1164 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1165 | 1165 | { |
@@ -1200,7 +1200,7 @@ discard block |
||
| 1200 | 1200 | $query_values = array(); |
| 1201 | 1201 | $limit_query = ''; |
| 1202 | 1202 | $additional_query = ''; |
| 1203 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1203 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1204 | 1204 | |
| 1205 | 1205 | if ($aircraft_type != "") |
| 1206 | 1206 | { |
@@ -1217,8 +1217,8 @@ discard block |
||
| 1217 | 1217 | { |
| 1218 | 1218 | $limit_array = explode(",", $limit); |
| 1219 | 1219 | |
| 1220 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1221 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1220 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1221 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1222 | 1222 | |
| 1223 | 1223 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1224 | 1224 | { |
@@ -1258,7 +1258,7 @@ discard block |
||
| 1258 | 1258 | $query_values = array(); |
| 1259 | 1259 | $limit_query = ''; |
| 1260 | 1260 | $additional_query = ''; |
| 1261 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1261 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1262 | 1262 | |
| 1263 | 1263 | if ($registration != "") |
| 1264 | 1264 | { |
@@ -1275,8 +1275,8 @@ discard block |
||
| 1275 | 1275 | { |
| 1276 | 1276 | $limit_array = explode(",", $limit); |
| 1277 | 1277 | |
| 1278 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1279 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1278 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1279 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1280 | 1280 | |
| 1281 | 1281 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1282 | 1282 | { |
@@ -1334,8 +1334,8 @@ discard block |
||
| 1334 | 1334 | { |
| 1335 | 1335 | $limit_array = explode(",", $limit); |
| 1336 | 1336 | |
| 1337 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1338 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1337 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1338 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1339 | 1339 | |
| 1340 | 1340 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1341 | 1341 | { |
@@ -1389,8 +1389,8 @@ discard block |
||
| 1389 | 1389 | { |
| 1390 | 1390 | $limit_array = explode(",", $limit); |
| 1391 | 1391 | |
| 1392 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1393 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1392 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1393 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1394 | 1394 | |
| 1395 | 1395 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1396 | 1396 | { |
@@ -1422,7 +1422,7 @@ discard block |
||
| 1422 | 1422 | * @return Array the spotter information |
| 1423 | 1423 | * |
| 1424 | 1424 | */ |
| 1425 | - public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
| 1425 | + public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
| 1426 | 1426 | { |
| 1427 | 1427 | global $global_query, $globalTimezone, $globalDBdriver; |
| 1428 | 1428 | |
@@ -1430,7 +1430,7 @@ discard block |
||
| 1430 | 1430 | $limit_query = ''; |
| 1431 | 1431 | $additional_query = ''; |
| 1432 | 1432 | |
| 1433 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1433 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1434 | 1434 | |
| 1435 | 1435 | if ($date != "") |
| 1436 | 1436 | { |
@@ -1456,8 +1456,8 @@ discard block |
||
| 1456 | 1456 | { |
| 1457 | 1457 | $limit_array = explode(",", $limit); |
| 1458 | 1458 | |
| 1459 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1460 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1459 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1460 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1461 | 1461 | |
| 1462 | 1462 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1463 | 1463 | { |
@@ -1512,8 +1512,8 @@ discard block |
||
| 1512 | 1512 | { |
| 1513 | 1513 | $limit_array = explode(",", $limit); |
| 1514 | 1514 | |
| 1515 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1516 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1515 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1516 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1517 | 1517 | |
| 1518 | 1518 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1519 | 1519 | { |
@@ -1569,8 +1569,8 @@ discard block |
||
| 1569 | 1569 | { |
| 1570 | 1570 | $limit_array = explode(",", $limit); |
| 1571 | 1571 | |
| 1572 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1573 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1572 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1573 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1574 | 1574 | |
| 1575 | 1575 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1576 | 1576 | { |
@@ -1618,7 +1618,7 @@ discard block |
||
| 1618 | 1618 | { |
| 1619 | 1619 | return false; |
| 1620 | 1620 | } else { |
| 1621 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1621 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1622 | 1622 | $additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)"; |
| 1623 | 1623 | $query_values = array(':departure_airport_icao' => $departure_airport_icao); |
| 1624 | 1624 | } |
@@ -1630,9 +1630,9 @@ discard block |
||
| 1630 | 1630 | { |
| 1631 | 1631 | return false; |
| 1632 | 1632 | } else { |
| 1633 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1633 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1634 | 1634 | $additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)"; |
| 1635 | - $query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 1635 | + $query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 1636 | 1636 | } |
| 1637 | 1637 | } |
| 1638 | 1638 | |
@@ -1640,8 +1640,8 @@ discard block |
||
| 1640 | 1640 | { |
| 1641 | 1641 | $limit_array = explode(",", $limit); |
| 1642 | 1642 | |
| 1643 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1644 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1643 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1644 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1645 | 1645 | |
| 1646 | 1646 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1647 | 1647 | { |
@@ -1680,15 +1680,15 @@ discard block |
||
| 1680 | 1680 | global $global_query; |
| 1681 | 1681 | |
| 1682 | 1682 | date_default_timezone_set('UTC'); |
| 1683 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1683 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1684 | 1684 | $limit_query = ''; |
| 1685 | 1685 | |
| 1686 | 1686 | if ($limit != "") |
| 1687 | 1687 | { |
| 1688 | 1688 | $limit_array = explode(",", $limit); |
| 1689 | 1689 | |
| 1690 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1691 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1690 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1691 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1692 | 1692 | |
| 1693 | 1693 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1694 | 1694 | { |
@@ -1705,7 +1705,7 @@ discard block |
||
| 1705 | 1705 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 1706 | 1706 | } |
| 1707 | 1707 | |
| 1708 | - $query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query; |
|
| 1708 | + $query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query; |
|
| 1709 | 1709 | |
| 1710 | 1710 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1711 | 1711 | |
@@ -1718,19 +1718,19 @@ discard block |
||
| 1718 | 1718 | * @return String the highlight text |
| 1719 | 1719 | * |
| 1720 | 1720 | */ |
| 1721 | - public function getHighlightByRegistration($registration,$filter = array()) |
|
| 1721 | + public function getHighlightByRegistration($registration, $filter = array()) |
|
| 1722 | 1722 | { |
| 1723 | 1723 | global $global_query; |
| 1724 | 1724 | |
| 1725 | 1725 | date_default_timezone_set('UTC'); |
| 1726 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1727 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 1726 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1727 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 1728 | 1728 | |
| 1729 | - $query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration"; |
|
| 1729 | + $query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration"; |
|
| 1730 | 1730 | $sth = $this->db->prepare($query); |
| 1731 | 1731 | $sth->execute(array(':registration' => $registration)); |
| 1732 | 1732 | |
| 1733 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1733 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1734 | 1734 | { |
| 1735 | 1735 | $highlight = $row['highlight']; |
| 1736 | 1736 | } |
@@ -1746,14 +1746,14 @@ discard block |
||
| 1746 | 1746 | * @return String usage |
| 1747 | 1747 | * |
| 1748 | 1748 | */ |
| 1749 | - public function getSquawkUsage($squawk = '',$country = 'FR') |
|
| 1749 | + public function getSquawkUsage($squawk = '', $country = 'FR') |
|
| 1750 | 1750 | { |
| 1751 | 1751 | |
| 1752 | - $squawk = filter_var($squawk,FILTER_SANITIZE_STRING); |
|
| 1753 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 1752 | + $squawk = filter_var($squawk, FILTER_SANITIZE_STRING); |
|
| 1753 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 1754 | 1754 | |
| 1755 | 1755 | $query = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1"; |
| 1756 | - $query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country); |
|
| 1756 | + $query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country); |
|
| 1757 | 1757 | |
| 1758 | 1758 | $sth = $this->db->prepare($query); |
| 1759 | 1759 | $sth->execute($query_values); |
@@ -1775,9 +1775,9 @@ discard block |
||
| 1775 | 1775 | public function getAirportIcao($airport_iata = '') |
| 1776 | 1776 | { |
| 1777 | 1777 | |
| 1778 | - $airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING); |
|
| 1778 | + $airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING); |
|
| 1779 | 1779 | |
| 1780 | - $query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1"; |
|
| 1780 | + $query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1"; |
|
| 1781 | 1781 | $query_values = array(':airport' => $airport_iata); |
| 1782 | 1782 | |
| 1783 | 1783 | $sth = $this->db->prepare($query); |
@@ -1799,12 +1799,12 @@ discard block |
||
| 1799 | 1799 | * @return Float distance to the airport |
| 1800 | 1800 | * |
| 1801 | 1801 | */ |
| 1802 | - public function getAirportDistance($airport_icao,$latitude,$longitude) |
|
| 1802 | + public function getAirportDistance($airport_icao, $latitude, $longitude) |
|
| 1803 | 1803 | { |
| 1804 | 1804 | |
| 1805 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 1805 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 1806 | 1806 | |
| 1807 | - $query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1"; |
|
| 1807 | + $query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1"; |
|
| 1808 | 1808 | $query_values = array(':airport' => $airport_icao); |
| 1809 | 1809 | $sth = $this->db->prepare($query); |
| 1810 | 1810 | $sth->execute($query_values); |
@@ -1814,7 +1814,7 @@ discard block |
||
| 1814 | 1814 | $airport_latitude = $row['latitude']; |
| 1815 | 1815 | $airport_longitude = $row['longitude']; |
| 1816 | 1816 | $Common = new Common(); |
| 1817 | - return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
|
| 1817 | + return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude); |
|
| 1818 | 1818 | } else return ''; |
| 1819 | 1819 | } |
| 1820 | 1820 | |
@@ -1828,11 +1828,11 @@ discard block |
||
| 1828 | 1828 | public function getAllAirportInfo($airport = '') |
| 1829 | 1829 | { |
| 1830 | 1830 | |
| 1831 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
| 1831 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
| 1832 | 1832 | |
| 1833 | 1833 | $query_values = array(); |
| 1834 | 1834 | if ($airport == 'NA') { |
| 1835 | - return array(array('name' => 'Not available','city' => 'N/A', 'country' => 'N/A','iata' => 'NA','icao' => 'NA','altitude' => NULL,'latitude' => 0,'longitude' => 0,'type' => 'NA','home_link' => '','wikipedia_link' => '','image_thumb' => '', 'image' => '')); |
|
| 1835 | + return array(array('name' => 'Not available', 'city' => 'N/A', 'country' => 'N/A', 'iata' => 'NA', 'icao' => 'NA', 'altitude' => NULL, 'latitude' => 0, 'longitude' => 0, 'type' => 'NA', 'home_link' => '', 'wikipedia_link' => '', 'image_thumb' => '', 'image' => '')); |
|
| 1836 | 1836 | } elseif ($airport == '') { |
| 1837 | 1837 | $query = "SELECT airport.name, airport.city, airport.country, airport.iata, airport.icao, airport.latitude, airport.longitude, airport.altitude, airport.type, airport.home_link, airport.wikipedia_link, airport.image_thumb, airport.image FROM airport"; |
| 1838 | 1838 | } else { |
@@ -1880,14 +1880,14 @@ discard block |
||
| 1880 | 1880 | { |
| 1881 | 1881 | $lst_countries = ''; |
| 1882 | 1882 | foreach ($countries as $country) { |
| 1883 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 1883 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 1884 | 1884 | if ($lst_countries == '') { |
| 1885 | 1885 | $lst_countries = "'".$country."'"; |
| 1886 | 1886 | } else { |
| 1887 | 1887 | $lst_countries .= ",'".$country."'"; |
| 1888 | 1888 | } |
| 1889 | 1889 | } |
| 1890 | - $query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")"; |
|
| 1890 | + $query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")"; |
|
| 1891 | 1891 | |
| 1892 | 1892 | $sth = $this->db->prepare($query); |
| 1893 | 1893 | $sth->execute(); |
@@ -1895,7 +1895,7 @@ discard block |
||
| 1895 | 1895 | $airport_array = array(); |
| 1896 | 1896 | $temp_array = array(); |
| 1897 | 1897 | |
| 1898 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1898 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1899 | 1899 | { |
| 1900 | 1900 | $temp_array['name'] = $row['name']; |
| 1901 | 1901 | $temp_array['city'] = $row['city']; |
@@ -1923,10 +1923,10 @@ discard block |
||
| 1923 | 1923 | { |
| 1924 | 1924 | global $globalDBdriver; |
| 1925 | 1925 | if (is_array($coord)) { |
| 1926 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1927 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1928 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1929 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1926 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1927 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1928 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1929 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1930 | 1930 | } else return array(); |
| 1931 | 1931 | if ($globalDBdriver == 'mysql') { |
| 1932 | 1932 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
@@ -1938,7 +1938,7 @@ discard block |
||
| 1938 | 1938 | |
| 1939 | 1939 | $airport_array = array(); |
| 1940 | 1940 | |
| 1941 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1941 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1942 | 1942 | { |
| 1943 | 1943 | $temp_array = $row; |
| 1944 | 1944 | |
@@ -1958,13 +1958,13 @@ discard block |
||
| 1958 | 1958 | public function getAllWaypointsInfobyCoord($coord) |
| 1959 | 1959 | { |
| 1960 | 1960 | if (is_array($coord)) { |
| 1961 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1962 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1963 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1964 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1961 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1962 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1963 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1964 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1965 | 1965 | } else return array(); |
| 1966 | 1966 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
| 1967 | - $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.")"; |
|
| 1967 | + $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.")"; |
|
| 1968 | 1968 | //$query = "SELECT waypoints.* FROM waypoints"; |
| 1969 | 1969 | //$query = "SELECT waypoints.* FROM waypoints INNER JOIN (SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") w ON w.name_end = waypoints.name_begin OR w.name_begin = waypoints.name_begin OR w.name_begin = waypoints.name_end OR w.name_end = waypoints.name_end"; |
| 1970 | 1970 | //$query = "SELECT * FROM waypoints LEFT JOIN waypoints w ON waypoints.name_end = w.name_begin WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
@@ -1976,7 +1976,7 @@ discard block |
||
| 1976 | 1976 | |
| 1977 | 1977 | $waypoints_array = array(); |
| 1978 | 1978 | |
| 1979 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1979 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1980 | 1980 | { |
| 1981 | 1981 | $temp_array = $row; |
| 1982 | 1982 | |
@@ -1998,10 +1998,10 @@ discard block |
||
| 1998 | 1998 | { |
| 1999 | 1999 | global $globalUseRealAirlines; |
| 2000 | 2000 | if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
| 2001 | - $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
|
| 2001 | + $airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING)); |
|
| 2002 | 2002 | if ($airline_icao == 'NA') { |
| 2003 | 2003 | $airline_array = array(); |
| 2004 | - $airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>''); |
|
| 2004 | + $airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>''); |
|
| 2005 | 2005 | return $airline_array; |
| 2006 | 2006 | } else { |
| 2007 | 2007 | if (strlen($airline_icao) == 2) { |
@@ -2022,7 +2022,7 @@ discard block |
||
| 2022 | 2022 | if ($fromsource === NULL) { |
| 2023 | 2023 | $sth->execute(array(':airline_icao' => $airline_icao)); |
| 2024 | 2024 | } else { |
| 2025 | - $sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource)); |
|
| 2025 | + $sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource)); |
|
| 2026 | 2026 | } |
| 2027 | 2027 | /* |
| 2028 | 2028 | $airline_array = array(); |
@@ -2064,12 +2064,12 @@ discard block |
||
| 2064 | 2064 | */ |
| 2065 | 2065 | public function getAllAircraftInfo($aircraft_type) |
| 2066 | 2066 | { |
| 2067 | - $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
|
| 2067 | + $aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING); |
|
| 2068 | 2068 | |
| 2069 | 2069 | if ($aircraft_type == 'NA') { |
| 2070 | - return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL)); |
|
| 2070 | + return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL)); |
|
| 2071 | 2071 | } |
| 2072 | - $query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type"; |
|
| 2072 | + $query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type"; |
|
| 2073 | 2073 | |
| 2074 | 2074 | $sth = $this->db->prepare($query); |
| 2075 | 2075 | $sth->execute(array(':aircraft_type' => $aircraft_type)); |
@@ -2101,7 +2101,7 @@ discard block |
||
| 2101 | 2101 | */ |
| 2102 | 2102 | public function getAircraftIcao($aircraft_type) |
| 2103 | 2103 | { |
| 2104 | - $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
|
| 2104 | + $aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING); |
|
| 2105 | 2105 | $all_aircraft = array('737-300' => 'B733', |
| 2106 | 2106 | '777-200' => 'B772', |
| 2107 | 2107 | '777-200ER' => 'B772', |
@@ -2113,10 +2113,10 @@ discard block |
||
| 2113 | 2113 | 'A380' => 'A388'); |
| 2114 | 2114 | if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
| 2115 | 2115 | |
| 2116 | - $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
|
| 2116 | + $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
|
| 2117 | 2117 | $aircraft_type = strtoupper($aircraft_type); |
| 2118 | 2118 | $sth = $this->db->prepare($query); |
| 2119 | - $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
|
| 2119 | + $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,)); |
|
| 2120 | 2120 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2121 | 2121 | if (isset($result[0]['icao'])) return $result[0]['icao']; |
| 2122 | 2122 | else return ''; |
@@ -2131,9 +2131,9 @@ discard block |
||
| 2131 | 2131 | */ |
| 2132 | 2132 | public function getAllAircraftType($aircraft_modes) |
| 2133 | 2133 | { |
| 2134 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
| 2134 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
| 2135 | 2135 | |
| 2136 | - $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
| 2136 | + $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
| 2137 | 2137 | |
| 2138 | 2138 | $sth = $this->db->prepare($query); |
| 2139 | 2139 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -2154,8 +2154,8 @@ discard block |
||
| 2154 | 2154 | */ |
| 2155 | 2155 | public function getOperator($operator) |
| 2156 | 2156 | { |
| 2157 | - $operator = filter_var($operator,FILTER_SANITIZE_STRING); |
|
| 2158 | - $query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1"; |
|
| 2157 | + $operator = filter_var($operator, FILTER_SANITIZE_STRING); |
|
| 2158 | + $query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1"; |
|
| 2159 | 2159 | |
| 2160 | 2160 | $sth = $this->db->prepare($query); |
| 2161 | 2161 | $sth->execute(array(':operator' => $operator)); |
@@ -2176,9 +2176,9 @@ discard block |
||
| 2176 | 2176 | */ |
| 2177 | 2177 | public function getRouteInfo($callsign) |
| 2178 | 2178 | { |
| 2179 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 2179 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 2180 | 2180 | if ($callsign == '') return array(); |
| 2181 | - $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"; |
|
| 2181 | + $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"; |
|
| 2182 | 2182 | |
| 2183 | 2183 | $sth = $this->db->prepare($query); |
| 2184 | 2184 | $sth->execute(array(':callsign' => $callsign)); |
@@ -2199,9 +2199,9 @@ discard block |
||
| 2199 | 2199 | */ |
| 2200 | 2200 | public function getAircraftInfoByRegistration($registration) |
| 2201 | 2201 | { |
| 2202 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2202 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2203 | 2203 | |
| 2204 | - $query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
| 2204 | + $query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
| 2205 | 2205 | |
| 2206 | 2206 | $sth = $this->db->prepare($query); |
| 2207 | 2207 | $sth->execute(array(':registration' => $registration)); |
@@ -2209,7 +2209,7 @@ discard block |
||
| 2209 | 2209 | $aircraft_array = array(); |
| 2210 | 2210 | $temp_array = array(); |
| 2211 | 2211 | |
| 2212 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2212 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2213 | 2213 | { |
| 2214 | 2214 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 2215 | 2215 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -2231,7 +2231,7 @@ discard block |
||
| 2231 | 2231 | */ |
| 2232 | 2232 | public function getAircraftOwnerByRegistration($registration) |
| 2233 | 2233 | { |
| 2234 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2234 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2235 | 2235 | $Connection = new Connection($this->db); |
| 2236 | 2236 | if ($Connection->tableExists('aircraft_owner')) { |
| 2237 | 2237 | $query = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1"; |
@@ -2253,7 +2253,7 @@ discard block |
||
| 2253 | 2253 | public function getAllFlightsforSitemap() |
| 2254 | 2254 | { |
| 2255 | 2255 | //$query = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT "; |
| 2256 | - $query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0"; |
|
| 2256 | + $query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0"; |
|
| 2257 | 2257 | |
| 2258 | 2258 | $sth = $this->db->prepare($query); |
| 2259 | 2259 | $sth->execute(); |
@@ -2300,7 +2300,7 @@ discard block |
||
| 2300 | 2300 | $manufacturer_array = array(); |
| 2301 | 2301 | $temp_array = array(); |
| 2302 | 2302 | |
| 2303 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2303 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2304 | 2304 | { |
| 2305 | 2305 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 2306 | 2306 | |
@@ -2326,7 +2326,7 @@ discard block |
||
| 2326 | 2326 | ORDER BY spotter_output.aircraft_name ASC"; |
| 2327 | 2327 | |
| 2328 | 2328 | */ |
| 2329 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2329 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2330 | 2330 | $query = "SELECT DISTINCT icao AS aircraft_icao, type AS aircraft_name, manufacturer AS aircraft_manufacturer FROM aircraft".$filter_query." icao <> '' ORDER BY aircraft_manufacturer ASC"; |
| 2331 | 2331 | |
| 2332 | 2332 | $sth = $this->db->prepare($query); |
@@ -2335,7 +2335,7 @@ discard block |
||
| 2335 | 2335 | $aircraft_array = array(); |
| 2336 | 2336 | $temp_array = array(); |
| 2337 | 2337 | |
| 2338 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2338 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2339 | 2339 | { |
| 2340 | 2340 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 2341 | 2341 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
@@ -2356,8 +2356,8 @@ discard block |
||
| 2356 | 2356 | */ |
| 2357 | 2357 | public function getAllAircraftRegistrations($filters = array()) |
| 2358 | 2358 | { |
| 2359 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2360 | - $query = "SELECT DISTINCT spotter_output.registration |
|
| 2359 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2360 | + $query = "SELECT DISTINCT spotter_output.registration |
|
| 2361 | 2361 | FROM spotter_output".$filter_query." spotter_output.registration <> '' |
| 2362 | 2362 | ORDER BY spotter_output.registration ASC"; |
| 2363 | 2363 | |
@@ -2367,7 +2367,7 @@ discard block |
||
| 2367 | 2367 | $aircraft_array = array(); |
| 2368 | 2368 | $temp_array = array(); |
| 2369 | 2369 | |
| 2370 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2370 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2371 | 2371 | { |
| 2372 | 2372 | $temp_array['registration'] = $row['registration']; |
| 2373 | 2373 | |
@@ -2384,11 +2384,11 @@ discard block |
||
| 2384 | 2384 | * @return Array list of source name |
| 2385 | 2385 | * |
| 2386 | 2386 | */ |
| 2387 | - public function getAllSourceName($type = '',$filters = array()) |
|
| 2387 | + public function getAllSourceName($type = '', $filters = array()) |
|
| 2388 | 2388 | { |
| 2389 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2389 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2390 | 2390 | $query_values = array(); |
| 2391 | - $query = "SELECT DISTINCT spotter_output.source_name |
|
| 2391 | + $query = "SELECT DISTINCT spotter_output.source_name |
|
| 2392 | 2392 | FROM spotter_output".$filter_query." spotter_output.source_name <> ''"; |
| 2393 | 2393 | if ($type != '') { |
| 2394 | 2394 | $query_values = array(':type' => $type); |
@@ -2403,7 +2403,7 @@ discard block |
||
| 2403 | 2403 | $source_array = array(); |
| 2404 | 2404 | $temp_array = array(); |
| 2405 | 2405 | |
| 2406 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2406 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2407 | 2407 | { |
| 2408 | 2408 | $temp_array['source_name'] = $row['source_name']; |
| 2409 | 2409 | $source_array[] = $temp_array; |
@@ -2419,11 +2419,11 @@ discard block |
||
| 2419 | 2419 | * @return Array list of airline names |
| 2420 | 2420 | * |
| 2421 | 2421 | */ |
| 2422 | - public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array()) |
|
| 2422 | + public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array()) |
|
| 2423 | 2423 | { |
| 2424 | - global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
|
| 2425 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2426 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
| 2424 | + global $globalAirlinesSource, $globalVATSIM, $globalIVAO; |
|
| 2425 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2426 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
| 2427 | 2427 | if ($airline_type == '' || $airline_type == 'all') { |
| 2428 | 2428 | /* |
| 2429 | 2429 | $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
@@ -2442,7 +2442,7 @@ discard block |
||
| 2442 | 2442 | $query_data = array(':forsource' => $forsource); |
| 2443 | 2443 | } |
| 2444 | 2444 | } else { |
| 2445 | - $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
|
| 2445 | + $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
|
| 2446 | 2446 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 2447 | 2447 | AND spotter_output.airline_type = :airline_type |
| 2448 | 2448 | ORDER BY spotter_output.airline_icao ASC"; |
@@ -2455,7 +2455,7 @@ discard block |
||
| 2455 | 2455 | $airline_array = array(); |
| 2456 | 2456 | $temp_array = array(); |
| 2457 | 2457 | |
| 2458 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2458 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2459 | 2459 | { |
| 2460 | 2460 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 2461 | 2461 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -2475,8 +2475,8 @@ discard block |
||
| 2475 | 2475 | */ |
| 2476 | 2476 | public function getAllAirlineCountries($filters = array()) |
| 2477 | 2477 | { |
| 2478 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2479 | - $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2478 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2479 | + $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2480 | 2480 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' |
| 2481 | 2481 | ORDER BY spotter_output.airline_country ASC"; |
| 2482 | 2482 | |
@@ -2487,7 +2487,7 @@ discard block |
||
| 2487 | 2487 | $airline_array = array(); |
| 2488 | 2488 | $temp_array = array(); |
| 2489 | 2489 | |
| 2490 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2490 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2491 | 2491 | { |
| 2492 | 2492 | $temp_array['airline_country'] = $row['airline_country']; |
| 2493 | 2493 | |
@@ -2507,9 +2507,9 @@ discard block |
||
| 2507 | 2507 | */ |
| 2508 | 2508 | public function getAllAirportNames($filters = array()) |
| 2509 | 2509 | { |
| 2510 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2510 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2511 | 2511 | $airport_array = array(); |
| 2512 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country |
|
| 2512 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country |
|
| 2513 | 2513 | FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' |
| 2514 | 2514 | ORDER BY spotter_output.departure_airport_city ASC"; |
| 2515 | 2515 | |
@@ -2518,7 +2518,7 @@ discard block |
||
| 2518 | 2518 | $sth->execute(); |
| 2519 | 2519 | |
| 2520 | 2520 | $temp_array = array(); |
| 2521 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2521 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2522 | 2522 | { |
| 2523 | 2523 | $temp_array['airport_icao'] = $row['airport_icao']; |
| 2524 | 2524 | $temp_array['airport_name'] = $row['airport_name']; |
@@ -2528,14 +2528,14 @@ discard block |
||
| 2528 | 2528 | $airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array; |
| 2529 | 2529 | } |
| 2530 | 2530 | |
| 2531 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country |
|
| 2531 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country |
|
| 2532 | 2532 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' |
| 2533 | 2533 | ORDER BY spotter_output.arrival_airport_city ASC"; |
| 2534 | 2534 | |
| 2535 | 2535 | $sth = $this->db->prepare($query); |
| 2536 | 2536 | $sth->execute(); |
| 2537 | 2537 | |
| 2538 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2538 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2539 | 2539 | { |
| 2540 | 2540 | // if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao']) |
| 2541 | 2541 | // { |
@@ -2575,21 +2575,21 @@ discard block |
||
| 2575 | 2575 | |
| 2576 | 2576 | $temp_array = array(); |
| 2577 | 2577 | |
| 2578 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2578 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2579 | 2579 | { |
| 2580 | 2580 | $temp_array['airport_country'] = $row['airport_country']; |
| 2581 | 2581 | |
| 2582 | 2582 | $airport_array[$row['airport_country']] = $temp_array; |
| 2583 | 2583 | } |
| 2584 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2585 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2584 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2585 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2586 | 2586 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' |
| 2587 | 2587 | ORDER BY spotter_output.arrival_airport_country ASC"; |
| 2588 | 2588 | |
| 2589 | 2589 | $sth = $this->db->prepare($query); |
| 2590 | 2590 | $sth->execute(); |
| 2591 | 2591 | |
| 2592 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2592 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2593 | 2593 | { |
| 2594 | 2594 | if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country']) |
| 2595 | 2595 | { |
@@ -2612,9 +2612,9 @@ discard block |
||
| 2612 | 2612 | */ |
| 2613 | 2613 | public function getAllCountries($filters = array()) |
| 2614 | 2614 | { |
| 2615 | - $Connection= new Connection($this->db); |
|
| 2615 | + $Connection = new Connection($this->db); |
|
| 2616 | 2616 | if ($Connection->tableExists('countries')) { |
| 2617 | - $query = "SELECT countries.name AS airport_country |
|
| 2617 | + $query = "SELECT countries.name AS airport_country |
|
| 2618 | 2618 | FROM countries |
| 2619 | 2619 | ORDER BY countries.name ASC"; |
| 2620 | 2620 | $sth = $this->db->prepare($query); |
@@ -2623,14 +2623,14 @@ discard block |
||
| 2623 | 2623 | $temp_array = array(); |
| 2624 | 2624 | $country_array = array(); |
| 2625 | 2625 | |
| 2626 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2626 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2627 | 2627 | { |
| 2628 | 2628 | $temp_array['country'] = $row['airport_country']; |
| 2629 | 2629 | $country_array[$row['airport_country']] = $temp_array; |
| 2630 | 2630 | } |
| 2631 | 2631 | } else { |
| 2632 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2633 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country |
|
| 2632 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2633 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country |
|
| 2634 | 2634 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' |
| 2635 | 2635 | ORDER BY spotter_output.departure_airport_country ASC"; |
| 2636 | 2636 | |
@@ -2639,20 +2639,20 @@ discard block |
||
| 2639 | 2639 | |
| 2640 | 2640 | $temp_array = array(); |
| 2641 | 2641 | $country_array = array(); |
| 2642 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2642 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2643 | 2643 | { |
| 2644 | 2644 | $temp_array['country'] = $row['airport_country']; |
| 2645 | 2645 | $country_array[$row['airport_country']] = $temp_array; |
| 2646 | 2646 | } |
| 2647 | 2647 | |
| 2648 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2648 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2649 | 2649 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' |
| 2650 | 2650 | ORDER BY spotter_output.arrival_airport_country ASC"; |
| 2651 | 2651 | |
| 2652 | 2652 | $sth = $this->db->prepare($query); |
| 2653 | 2653 | $sth->execute(); |
| 2654 | 2654 | |
| 2655 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2655 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2656 | 2656 | { |
| 2657 | 2657 | if ($country_array[$row['airport_country']]['country'] != $row['airport_country']) |
| 2658 | 2658 | { |
@@ -2662,14 +2662,14 @@ discard block |
||
| 2662 | 2662 | } |
| 2663 | 2663 | } |
| 2664 | 2664 | |
| 2665 | - $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2665 | + $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2666 | 2666 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' |
| 2667 | 2667 | ORDER BY spotter_output.airline_country ASC"; |
| 2668 | 2668 | |
| 2669 | 2669 | $sth = $this->db->prepare($query); |
| 2670 | 2670 | $sth->execute(); |
| 2671 | 2671 | |
| 2672 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2672 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2673 | 2673 | { |
| 2674 | 2674 | if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country']) |
| 2675 | 2675 | { |
@@ -2693,8 +2693,8 @@ discard block |
||
| 2693 | 2693 | */ |
| 2694 | 2694 | public function getAllIdents($filters = array()) |
| 2695 | 2695 | { |
| 2696 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2697 | - $query = "SELECT DISTINCT spotter_output.ident |
|
| 2696 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2697 | + $query = "SELECT DISTINCT spotter_output.ident |
|
| 2698 | 2698 | FROM spotter_output".$filter_query." spotter_output.ident <> '' |
| 2699 | 2699 | ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0"; |
| 2700 | 2700 | |
@@ -2704,7 +2704,7 @@ discard block |
||
| 2704 | 2704 | $ident_array = array(); |
| 2705 | 2705 | $temp_array = array(); |
| 2706 | 2706 | |
| 2707 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2707 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2708 | 2708 | { |
| 2709 | 2709 | $temp_array['ident'] = $row['ident']; |
| 2710 | 2710 | $ident_array[] = $temp_array; |
@@ -2718,9 +2718,9 @@ discard block |
||
| 2718 | 2718 | * @return Array number, icao, name and city of airports |
| 2719 | 2719 | */ |
| 2720 | 2720 | |
| 2721 | - public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) { |
|
| 2721 | + public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) { |
|
| 2722 | 2722 | global $globalTimezone, $globalDBdriver; |
| 2723 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2723 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2724 | 2724 | if ($globalTimezone != '') { |
| 2725 | 2725 | date_default_timezone_set($globalTimezone); |
| 2726 | 2726 | $datetime = new DateTime(); |
@@ -2785,7 +2785,7 @@ discard block |
||
| 2785 | 2785 | |
| 2786 | 2786 | public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) { |
| 2787 | 2787 | global $globalTimezone, $globalDBdriver; |
| 2788 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2788 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2789 | 2789 | if ($globalTimezone != '') { |
| 2790 | 2790 | date_default_timezone_set($globalTimezone); |
| 2791 | 2791 | $datetime = new DateTime(); |
@@ -2869,7 +2869,7 @@ discard block |
||
| 2869 | 2869 | |
| 2870 | 2870 | public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) { |
| 2871 | 2871 | global $globalTimezone, $globalDBdriver; |
| 2872 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2872 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2873 | 2873 | if ($globalTimezone != '') { |
| 2874 | 2874 | date_default_timezone_set($globalTimezone); |
| 2875 | 2875 | $datetime = new DateTime(); |
@@ -2902,9 +2902,9 @@ discard block |
||
| 2902 | 2902 | * @return Array number, icao, name and city of airports |
| 2903 | 2903 | */ |
| 2904 | 2904 | |
| 2905 | - public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) { |
|
| 2905 | + public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) { |
|
| 2906 | 2906 | global $globalTimezone, $globalDBdriver; |
| 2907 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2907 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2908 | 2908 | if ($globalTimezone != '') { |
| 2909 | 2909 | date_default_timezone_set($globalTimezone); |
| 2910 | 2910 | $datetime = new DateTime(); |
@@ -3036,12 +3036,12 @@ discard block |
||
| 3036 | 3036 | } else $offset = '+00:00'; |
| 3037 | 3037 | |
| 3038 | 3038 | if ($globalDBdriver == 'mysql') { |
| 3039 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
|
| 3039 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
|
| 3040 | 3040 | FROM spotter_output |
| 3041 | 3041 | WHERE spotter_output.date <> '' |
| 3042 | 3042 | ORDER BY spotter_output.date ASC LIMIT 0,200"; |
| 3043 | 3043 | } else { |
| 3044 | - $query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 3044 | + $query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 3045 | 3045 | FROM spotter_output |
| 3046 | 3046 | WHERE spotter_output.date <> '' |
| 3047 | 3047 | ORDER BY spotter_output.date ASC LIMIT 0,200"; |
@@ -3053,7 +3053,7 @@ discard block |
||
| 3053 | 3053 | $date_array = array(); |
| 3054 | 3054 | $temp_array = array(); |
| 3055 | 3055 | |
| 3056 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3056 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3057 | 3057 | { |
| 3058 | 3058 | $temp_array['date'] = $row['date']; |
| 3059 | 3059 | |
@@ -3073,7 +3073,7 @@ discard block |
||
| 3073 | 3073 | */ |
| 3074 | 3074 | public function getAllRoutes() |
| 3075 | 3075 | { |
| 3076 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao |
|
| 3076 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao |
|
| 3077 | 3077 | FROM spotter_output |
| 3078 | 3078 | WHERE spotter_output.ident <> '' |
| 3079 | 3079 | GROUP BY route |
@@ -3084,7 +3084,7 @@ discard block |
||
| 3084 | 3084 | |
| 3085 | 3085 | $routes_array = array(); |
| 3086 | 3086 | $temp_array = array(); |
| 3087 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3087 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3088 | 3088 | { |
| 3089 | 3089 | $temp_array['route'] = $row['route']; |
| 3090 | 3090 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -3103,21 +3103,21 @@ discard block |
||
| 3103 | 3103 | * @return String success or false |
| 3104 | 3104 | * |
| 3105 | 3105 | */ |
| 3106 | - public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL) |
|
| 3106 | + public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL) |
|
| 3107 | 3107 | { |
| 3108 | 3108 | if (!is_numeric(substr($ident, 0, 3))) |
| 3109 | 3109 | { |
| 3110 | 3110 | if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
| 3111 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource); |
|
| 3111 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource); |
|
| 3112 | 3112 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
| 3113 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource); |
|
| 3113 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource); |
|
| 3114 | 3114 | } else { |
| 3115 | 3115 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3116 | 3116 | } |
| 3117 | 3117 | if (count($airline_array) == 0) { |
| 3118 | 3118 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3119 | 3119 | } |
| 3120 | - if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
|
| 3120 | + if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") { |
|
| 3121 | 3121 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3122 | 3122 | } |
| 3123 | 3123 | } else { |
@@ -3130,7 +3130,7 @@ discard block |
||
| 3130 | 3130 | |
| 3131 | 3131 | |
| 3132 | 3132 | $query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id'; |
| 3133 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type); |
|
| 3133 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type); |
|
| 3134 | 3134 | |
| 3135 | 3135 | try { |
| 3136 | 3136 | $sth = $this->db->prepare($query); |
@@ -3151,11 +3151,11 @@ discard block |
||
| 3151 | 3151 | * @return String success or false |
| 3152 | 3152 | * |
| 3153 | 3153 | */ |
| 3154 | - public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
|
| 3154 | + public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '') |
|
| 3155 | 3155 | { |
| 3156 | 3156 | if ($groundspeed == '') $groundspeed = NULL; |
| 3157 | 3157 | $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'; |
| 3158 | - $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); |
|
| 3158 | + $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); |
|
| 3159 | 3159 | |
| 3160 | 3160 | try { |
| 3161 | 3161 | $sth = $this->db->prepare($query); |
@@ -3195,7 +3195,7 @@ discard block |
||
| 3195 | 3195 | * @param String $verticalrate vertival rate of flight |
| 3196 | 3196 | * @return String success or false |
| 3197 | 3197 | */ |
| 3198 | - public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '') |
|
| 3198 | + public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false, $format_source = '', $source_name = '') |
|
| 3199 | 3199 | { |
| 3200 | 3200 | global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM; |
| 3201 | 3201 | |
@@ -3219,13 +3219,13 @@ discard block |
||
| 3219 | 3219 | if ($ModeS != '') { |
| 3220 | 3220 | $timeelapsed = microtime(true); |
| 3221 | 3221 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
| 3222 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3222 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3223 | 3223 | } else { |
| 3224 | - $myhex = explode('-',$flightaware_id); |
|
| 3224 | + $myhex = explode('-', $flightaware_id); |
|
| 3225 | 3225 | if (count($myhex) > 0) { |
| 3226 | 3226 | $timeelapsed = microtime(true); |
| 3227 | 3227 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
| 3228 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3228 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3229 | 3229 | } |
| 3230 | 3230 | } |
| 3231 | 3231 | } |
@@ -3247,24 +3247,24 @@ discard block |
||
| 3247 | 3247 | { |
| 3248 | 3248 | $timeelapsed = microtime(true); |
| 3249 | 3249 | if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
| 3250 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource); |
|
| 3250 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource); |
|
| 3251 | 3251 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
| 3252 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource); |
|
| 3252 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource); |
|
| 3253 | 3253 | } else { |
| 3254 | 3254 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3255 | 3255 | } |
| 3256 | 3256 | if (count($airline_array) == 0) { |
| 3257 | 3257 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3258 | 3258 | } |
| 3259 | - if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
|
| 3259 | + if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") { |
|
| 3260 | 3260 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3261 | 3261 | } |
| 3262 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3262 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3263 | 3263 | |
| 3264 | 3264 | } else { |
| 3265 | 3265 | $timeelapsed = microtime(true); |
| 3266 | 3266 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3267 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3267 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3268 | 3268 | } |
| 3269 | 3269 | } |
| 3270 | 3270 | } else $airline_array = array(); |
@@ -3281,27 +3281,27 @@ discard block |
||
| 3281 | 3281 | { |
| 3282 | 3282 | $timeelapsed = microtime(true); |
| 3283 | 3283 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3284 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3284 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3285 | 3285 | } else { |
| 3286 | 3286 | $timeelapsed = microtime(true); |
| 3287 | 3287 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3288 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3288 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3289 | 3289 | } |
| 3290 | 3290 | } |
| 3291 | 3291 | } else { |
| 3292 | 3292 | if ($ModeS != '') { |
| 3293 | 3293 | $timeelapsed = microtime(true); |
| 3294 | 3294 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
| 3295 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3295 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3296 | 3296 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
| 3297 | 3297 | { |
| 3298 | 3298 | $timeelapsed = microtime(true); |
| 3299 | 3299 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3300 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3300 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3301 | 3301 | } else { |
| 3302 | 3302 | $timeelapsed = microtime(true); |
| 3303 | 3303 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3304 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3304 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3305 | 3305 | } |
| 3306 | 3306 | } |
| 3307 | 3307 | } |
@@ -3316,7 +3316,7 @@ discard block |
||
| 3316 | 3316 | } else { |
| 3317 | 3317 | $timeelapsed = microtime(true); |
| 3318 | 3318 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
| 3319 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3319 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3320 | 3320 | } |
| 3321 | 3321 | } |
| 3322 | 3322 | |
@@ -3330,7 +3330,7 @@ discard block |
||
| 3330 | 3330 | } else { |
| 3331 | 3331 | $timeelapsed = microtime(true); |
| 3332 | 3332 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
| 3333 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3333 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3334 | 3334 | } |
| 3335 | 3335 | } |
| 3336 | 3336 | |
@@ -3394,7 +3394,7 @@ discard block |
||
| 3394 | 3394 | { |
| 3395 | 3395 | $timeelapsed = microtime(true); |
| 3396 | 3396 | $image_array = $Image->getSpotterImage($registration); |
| 3397 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3397 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3398 | 3398 | if (!isset($image_array[0]['registration'])) |
| 3399 | 3399 | { |
| 3400 | 3400 | //echo "Add image !!!! \n"; |
@@ -3402,7 +3402,7 @@ discard block |
||
| 3402 | 3402 | } |
| 3403 | 3403 | $timeelapsed = microtime(true); |
| 3404 | 3404 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
| 3405 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3405 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3406 | 3406 | if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
| 3407 | 3407 | } |
| 3408 | 3408 | |
@@ -3410,33 +3410,33 @@ discard block |
||
| 3410 | 3410 | { |
| 3411 | 3411 | if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
| 3412 | 3412 | else $airline_icao = ''; |
| 3413 | - $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
| 3413 | + $image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao); |
|
| 3414 | 3414 | if (!isset($image_array[0]['registration'])) |
| 3415 | 3415 | { |
| 3416 | 3416 | //echo "Add image !!!! \n"; |
| 3417 | - $Image->addSpotterImage('',$aircraft_icao,$airline_icao); |
|
| 3417 | + $Image->addSpotterImage('', $aircraft_icao, $airline_icao); |
|
| 3418 | 3418 | } |
| 3419 | 3419 | } |
| 3420 | 3420 | |
| 3421 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 3422 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 3423 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 3424 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 3425 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 3426 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 3427 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3428 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3429 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
| 3430 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3431 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 3432 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3433 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
| 3434 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
| 3435 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
| 3436 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
| 3437 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 3438 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 3439 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
| 3421 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 3422 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 3423 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 3424 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 3425 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 3426 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 3427 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3428 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3429 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
| 3430 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3431 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 3432 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3433 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
| 3434 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
| 3435 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
| 3436 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
| 3437 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 3438 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 3439 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
| 3440 | 3440 | |
| 3441 | 3441 | if (count($airline_array) == 0) |
| 3442 | 3442 | { |
@@ -3460,7 +3460,7 @@ discard block |
||
| 3460 | 3460 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
| 3461 | 3461 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
| 3462 | 3462 | if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
| 3463 | - $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) |
|
| 3463 | + $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) |
|
| 3464 | 3464 | 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)"; |
| 3465 | 3465 | |
| 3466 | 3466 | $airline_name = $airline_array[0]['name']; |
@@ -3470,7 +3470,7 @@ discard block |
||
| 3470 | 3470 | if ($airline_type == '') { |
| 3471 | 3471 | $timeelapsed = microtime(true); |
| 3472 | 3472 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3473 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3473 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3474 | 3474 | } |
| 3475 | 3475 | if ($airline_type == null) $airline_type = ''; |
| 3476 | 3476 | $aircraft_type = $aircraft_array[0]['type']; |
@@ -3481,7 +3481,7 @@ discard block |
||
| 3481 | 3481 | $arrival_airport_name = $arrival_airport_array[0]['name']; |
| 3482 | 3482 | $arrival_airport_city = $arrival_airport_array[0]['city']; |
| 3483 | 3483 | $arrival_airport_country = $arrival_airport_array[0]['country']; |
| 3484 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
| 3484 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
| 3485 | 3485 | |
| 3486 | 3486 | try { |
| 3487 | 3487 | |
@@ -3507,13 +3507,13 @@ discard block |
||
| 3507 | 3507 | { |
| 3508 | 3508 | global $globalDBdriver, $globalTimezone; |
| 3509 | 3509 | if ($globalDBdriver == 'mysql') { |
| 3510 | - $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3510 | + $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3511 | 3511 | WHERE spotter_output.ident = :ident |
| 3512 | 3512 | AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 3513 | 3513 | AND spotter_output.date < UTC_TIMESTAMP()"; |
| 3514 | 3514 | $query_data = array(':ident' => $ident); |
| 3515 | 3515 | } else { |
| 3516 | - $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3516 | + $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3517 | 3517 | WHERE spotter_output.ident = :ident |
| 3518 | 3518 | AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 3519 | 3519 | AND spotter_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -3522,8 +3522,8 @@ discard block |
||
| 3522 | 3522 | |
| 3523 | 3523 | $sth = $this->db->prepare($query); |
| 3524 | 3524 | $sth->execute($query_data); |
| 3525 | - $ident_result=''; |
|
| 3526 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3525 | + $ident_result = ''; |
|
| 3526 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3527 | 3527 | { |
| 3528 | 3528 | $ident_result = $row['ident']; |
| 3529 | 3529 | } |
@@ -3549,8 +3549,8 @@ discard block |
||
| 3549 | 3549 | return false; |
| 3550 | 3550 | } else { |
| 3551 | 3551 | $q_array = explode(" ", $q); |
| 3552 | - foreach ($q_array as $q_item){ |
|
| 3553 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 3552 | + foreach ($q_array as $q_item) { |
|
| 3553 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 3554 | 3554 | $additional_query .= " AND ("; |
| 3555 | 3555 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
| 3556 | 3556 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
@@ -3565,11 +3565,11 @@ discard block |
||
| 3565 | 3565 | } |
| 3566 | 3566 | } |
| 3567 | 3567 | if ($globalDBdriver == 'mysql') { |
| 3568 | - $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3568 | + $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3569 | 3569 | WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
| 3570 | 3570 | AND spotter_output.date < UTC_TIMESTAMP()"; |
| 3571 | 3571 | } else { |
| 3572 | - $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3572 | + $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3573 | 3573 | WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
| 3574 | 3574 | AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
| 3575 | 3575 | } |
@@ -3586,11 +3586,11 @@ discard block |
||
| 3586 | 3586 | * @return Array the airline list |
| 3587 | 3587 | * |
| 3588 | 3588 | */ |
| 3589 | - public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 3589 | + public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 3590 | 3590 | { |
| 3591 | 3591 | global $globalDBdriver; |
| 3592 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3593 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3592 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3593 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3594 | 3594 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA' "; |
| 3595 | 3595 | if ($olderthanmonths > 0) { |
| 3596 | 3596 | if ($globalDBdriver == 'mysql') { |
@@ -3614,7 +3614,7 @@ discard block |
||
| 3614 | 3614 | |
| 3615 | 3615 | $airline_array = array(); |
| 3616 | 3616 | $temp_array = array(); |
| 3617 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3617 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3618 | 3618 | { |
| 3619 | 3619 | $temp_array['airline_name'] = $row['airline_name']; |
| 3620 | 3620 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -3631,11 +3631,11 @@ discard block |
||
| 3631 | 3631 | * @return Array the pilots list |
| 3632 | 3632 | * |
| 3633 | 3633 | */ |
| 3634 | - public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 3634 | + public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 3635 | 3635 | { |
| 3636 | 3636 | global $globalDBdriver; |
| 3637 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3638 | - $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count |
|
| 3637 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3638 | + $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count |
|
| 3639 | 3639 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' "; |
| 3640 | 3640 | if ($olderthanmonths > 0) { |
| 3641 | 3641 | if ($globalDBdriver == 'mysql') { |
@@ -3661,7 +3661,7 @@ discard block |
||
| 3661 | 3661 | $airline_array = array(); |
| 3662 | 3662 | $temp_array = array(); |
| 3663 | 3663 | |
| 3664 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3664 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3665 | 3665 | { |
| 3666 | 3666 | $temp_array['pilot_name'] = $row['pilot_name']; |
| 3667 | 3667 | $temp_array['pilot_id'] = $row['pilot_id']; |
@@ -3680,7 +3680,7 @@ discard block |
||
| 3680 | 3680 | public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
| 3681 | 3681 | { |
| 3682 | 3682 | global $globalDBdriver; |
| 3683 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count |
|
| 3683 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count |
|
| 3684 | 3684 | FROM spotter_output WHERE spotter_output.pilot_id <> '' "; |
| 3685 | 3685 | if ($olderthanmonths > 0) { |
| 3686 | 3686 | if ($globalDBdriver == 'mysql') { |
@@ -3706,7 +3706,7 @@ discard block |
||
| 3706 | 3706 | $airline_array = array(); |
| 3707 | 3707 | $temp_array = array(); |
| 3708 | 3708 | |
| 3709 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3709 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3710 | 3710 | { |
| 3711 | 3711 | $temp_array['pilot_name'] = $row['pilot_name']; |
| 3712 | 3712 | $temp_array['pilot_id'] = $row['pilot_id']; |
@@ -3723,11 +3723,11 @@ discard block |
||
| 3723 | 3723 | * @return Array the pilots list |
| 3724 | 3724 | * |
| 3725 | 3725 | */ |
| 3726 | - public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 3726 | + public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 3727 | 3727 | { |
| 3728 | 3728 | global $globalDBdriver; |
| 3729 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3730 | - $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 3729 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3730 | + $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 3731 | 3731 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
| 3732 | 3732 | if ($olderthanmonths > 0) { |
| 3733 | 3733 | if ($globalDBdriver == 'mysql') { |
@@ -3753,7 +3753,7 @@ discard block |
||
| 3753 | 3753 | $airline_array = array(); |
| 3754 | 3754 | $temp_array = array(); |
| 3755 | 3755 | |
| 3756 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3756 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3757 | 3757 | { |
| 3758 | 3758 | $temp_array['owner_name'] = $row['owner_name']; |
| 3759 | 3759 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -3768,11 +3768,11 @@ discard block |
||
| 3768 | 3768 | * @return Array the pilots list |
| 3769 | 3769 | * |
| 3770 | 3770 | */ |
| 3771 | - public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 3771 | + public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 3772 | 3772 | { |
| 3773 | 3773 | global $globalDBdriver; |
| 3774 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3775 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 3774 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3775 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 3776 | 3776 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
| 3777 | 3777 | if ($olderthanmonths > 0) { |
| 3778 | 3778 | if ($globalDBdriver == 'mysql') { |
@@ -3798,7 +3798,7 @@ discard block |
||
| 3798 | 3798 | $airline_array = array(); |
| 3799 | 3799 | $temp_array = array(); |
| 3800 | 3800 | |
| 3801 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3801 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3802 | 3802 | { |
| 3803 | 3803 | $temp_array['owner_name'] = $row['owner_name']; |
| 3804 | 3804 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -3814,11 +3814,11 @@ discard block |
||
| 3814 | 3814 | * @return Array the airline list |
| 3815 | 3815 | * |
| 3816 | 3816 | */ |
| 3817 | - public function countAllAirlinesByAircraft($aircraft_icao,$filters = array()) |
|
| 3817 | + public function countAllAirlinesByAircraft($aircraft_icao, $filters = array()) |
|
| 3818 | 3818 | { |
| 3819 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 3820 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3821 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3819 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 3820 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3821 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3822 | 3822 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 3823 | 3823 | GROUP BY spotter_output.airline_name |
| 3824 | 3824 | ORDER BY airline_count DESC"; |
@@ -3830,7 +3830,7 @@ discard block |
||
| 3830 | 3830 | $airline_array = array(); |
| 3831 | 3831 | $temp_array = array(); |
| 3832 | 3832 | |
| 3833 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3833 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3834 | 3834 | { |
| 3835 | 3835 | $temp_array['airline_name'] = $row['airline_name']; |
| 3836 | 3836 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -3850,11 +3850,11 @@ discard block |
||
| 3850 | 3850 | * @return Array the airline country list |
| 3851 | 3851 | * |
| 3852 | 3852 | */ |
| 3853 | - public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array()) |
|
| 3853 | + public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array()) |
|
| 3854 | 3854 | { |
| 3855 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 3856 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3857 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 3855 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 3856 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3857 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 3858 | 3858 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 3859 | 3859 | GROUP BY spotter_output.airline_country |
| 3860 | 3860 | ORDER BY airline_country_count DESC |
@@ -3867,7 +3867,7 @@ discard block |
||
| 3867 | 3867 | $airline_country_array = array(); |
| 3868 | 3868 | $temp_array = array(); |
| 3869 | 3869 | |
| 3870 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3870 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3871 | 3871 | { |
| 3872 | 3872 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 3873 | 3873 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -3886,11 +3886,11 @@ discard block |
||
| 3886 | 3886 | * @return Array the airline list |
| 3887 | 3887 | * |
| 3888 | 3888 | */ |
| 3889 | - public function countAllAirlinesByAirport($airport_icao,$filters = array()) |
|
| 3889 | + public function countAllAirlinesByAirport($airport_icao, $filters = array()) |
|
| 3890 | 3890 | { |
| 3891 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 3892 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3893 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3891 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 3892 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3893 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3894 | 3894 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) |
| 3895 | 3895 | GROUP BY spotter_output.airline_name |
| 3896 | 3896 | ORDER BY airline_count DESC"; |
@@ -3902,7 +3902,7 @@ discard block |
||
| 3902 | 3902 | $airline_array = array(); |
| 3903 | 3903 | $temp_array = array(); |
| 3904 | 3904 | |
| 3905 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3905 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3906 | 3906 | { |
| 3907 | 3907 | $temp_array['airline_name'] = $row['airline_name']; |
| 3908 | 3908 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -3921,11 +3921,11 @@ discard block |
||
| 3921 | 3921 | * @return Array the airline country list |
| 3922 | 3922 | * |
| 3923 | 3923 | */ |
| 3924 | - public function countAllAirlineCountriesByAirport($airport_icao,$filters = array()) |
|
| 3924 | + public function countAllAirlineCountriesByAirport($airport_icao, $filters = array()) |
|
| 3925 | 3925 | { |
| 3926 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 3927 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3928 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 3926 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 3927 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3928 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 3929 | 3929 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) |
| 3930 | 3930 | GROUP BY spotter_output.airline_country |
| 3931 | 3931 | ORDER BY airline_country_count DESC |
@@ -3938,7 +3938,7 @@ discard block |
||
| 3938 | 3938 | $airline_country_array = array(); |
| 3939 | 3939 | $temp_array = array(); |
| 3940 | 3940 | |
| 3941 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3941 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3942 | 3942 | { |
| 3943 | 3943 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 3944 | 3944 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -3955,11 +3955,11 @@ discard block |
||
| 3955 | 3955 | * @return Array the airline list |
| 3956 | 3956 | * |
| 3957 | 3957 | */ |
| 3958 | - public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 3958 | + public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 3959 | 3959 | { |
| 3960 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 3961 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3962 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3960 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 3961 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3962 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3963 | 3963 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 3964 | 3964 | GROUP BY spotter_output.airline_name |
| 3965 | 3965 | ORDER BY airline_count DESC"; |
@@ -3970,7 +3970,7 @@ discard block |
||
| 3970 | 3970 | $airline_array = array(); |
| 3971 | 3971 | $temp_array = array(); |
| 3972 | 3972 | |
| 3973 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3973 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3974 | 3974 | { |
| 3975 | 3975 | $temp_array['airline_name'] = $row['airline_name']; |
| 3976 | 3976 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -3990,11 +3990,11 @@ discard block |
||
| 3990 | 3990 | * @return Array the airline country list |
| 3991 | 3991 | * |
| 3992 | 3992 | */ |
| 3993 | - public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 3993 | + public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 3994 | 3994 | { |
| 3995 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 3996 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3997 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 3995 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 3996 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3997 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 3998 | 3998 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 3999 | 3999 | GROUP BY spotter_output.airline_country |
| 4000 | 4000 | ORDER BY airline_country_count DESC |
@@ -4007,7 +4007,7 @@ discard block |
||
| 4007 | 4007 | $airline_country_array = array(); |
| 4008 | 4008 | $temp_array = array(); |
| 4009 | 4009 | |
| 4010 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4010 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4011 | 4011 | { |
| 4012 | 4012 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4013 | 4013 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4023,11 +4023,11 @@ discard block |
||
| 4023 | 4023 | * @return Array the airline list |
| 4024 | 4024 | * |
| 4025 | 4025 | */ |
| 4026 | - public function countAllAirlinesByDate($date,$filters = array()) |
|
| 4026 | + public function countAllAirlinesByDate($date, $filters = array()) |
|
| 4027 | 4027 | { |
| 4028 | 4028 | global $globalTimezone, $globalDBdriver; |
| 4029 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4030 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 4029 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4030 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 4031 | 4031 | if ($globalTimezone != '') { |
| 4032 | 4032 | date_default_timezone_set($globalTimezone); |
| 4033 | 4033 | $datetime = new DateTime($date); |
@@ -4035,12 +4035,12 @@ discard block |
||
| 4035 | 4035 | } else $offset = '+00:00'; |
| 4036 | 4036 | |
| 4037 | 4037 | if ($globalDBdriver == 'mysql') { |
| 4038 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4038 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4039 | 4039 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 4040 | 4040 | GROUP BY spotter_output.airline_name |
| 4041 | 4041 | ORDER BY airline_count DESC"; |
| 4042 | 4042 | } else { |
| 4043 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4043 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4044 | 4044 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 4045 | 4045 | GROUP BY spotter_output.airline_name |
| 4046 | 4046 | ORDER BY airline_count DESC"; |
@@ -4051,7 +4051,7 @@ discard block |
||
| 4051 | 4051 | |
| 4052 | 4052 | $airline_array = array(); |
| 4053 | 4053 | $temp_array = array(); |
| 4054 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4054 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4055 | 4055 | { |
| 4056 | 4056 | $temp_array['airline_name'] = $row['airline_name']; |
| 4057 | 4057 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4071,11 +4071,11 @@ discard block |
||
| 4071 | 4071 | * @return Array the airline country list |
| 4072 | 4072 | * |
| 4073 | 4073 | */ |
| 4074 | - public function countAllAirlineCountriesByDate($date,$filters = array()) |
|
| 4074 | + public function countAllAirlineCountriesByDate($date, $filters = array()) |
|
| 4075 | 4075 | { |
| 4076 | 4076 | global $globalTimezone, $globalDBdriver; |
| 4077 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4078 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 4077 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4078 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 4079 | 4079 | if ($globalTimezone != '') { |
| 4080 | 4080 | date_default_timezone_set($globalTimezone); |
| 4081 | 4081 | $datetime = new DateTime($date); |
@@ -4083,13 +4083,13 @@ discard block |
||
| 4083 | 4083 | } else $offset = '+00:00'; |
| 4084 | 4084 | |
| 4085 | 4085 | if ($globalDBdriver == 'mysql') { |
| 4086 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4086 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4087 | 4087 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 4088 | 4088 | GROUP BY spotter_output.airline_country |
| 4089 | 4089 | ORDER BY airline_country_count DESC |
| 4090 | 4090 | LIMIT 10 OFFSET 0"; |
| 4091 | 4091 | } else { |
| 4092 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4092 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4093 | 4093 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 4094 | 4094 | GROUP BY spotter_output.airline_country |
| 4095 | 4095 | ORDER BY airline_country_count DESC |
@@ -4101,7 +4101,7 @@ discard block |
||
| 4101 | 4101 | |
| 4102 | 4102 | $airline_country_array = array(); |
| 4103 | 4103 | $temp_array = array(); |
| 4104 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4104 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4105 | 4105 | { |
| 4106 | 4106 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4107 | 4107 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4118,11 +4118,11 @@ discard block |
||
| 4118 | 4118 | * @return Array the airline list |
| 4119 | 4119 | * |
| 4120 | 4120 | */ |
| 4121 | - public function countAllAirlinesByIdent($ident,$filters = array()) |
|
| 4121 | + public function countAllAirlinesByIdent($ident, $filters = array()) |
|
| 4122 | 4122 | { |
| 4123 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 4124 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4125 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4123 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 4124 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4125 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4126 | 4126 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 4127 | 4127 | GROUP BY spotter_output.airline_name |
| 4128 | 4128 | ORDER BY airline_count DESC"; |
@@ -4134,7 +4134,7 @@ discard block |
||
| 4134 | 4134 | $airline_array = array(); |
| 4135 | 4135 | $temp_array = array(); |
| 4136 | 4136 | |
| 4137 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4137 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4138 | 4138 | { |
| 4139 | 4139 | $temp_array['airline_name'] = $row['airline_name']; |
| 4140 | 4140 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4152,25 +4152,25 @@ discard block |
||
| 4152 | 4152 | * @return Array the airline list |
| 4153 | 4153 | * |
| 4154 | 4154 | */ |
| 4155 | - public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 4155 | + public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 4156 | 4156 | { |
| 4157 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4158 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4159 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4157 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4158 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4159 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4160 | 4160 | |
| 4161 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4161 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4162 | 4162 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 4163 | 4163 | GROUP BY spotter_output.airline_name |
| 4164 | 4164 | ORDER BY airline_count DESC"; |
| 4165 | 4165 | |
| 4166 | 4166 | |
| 4167 | 4167 | $sth = $this->db->prepare($query); |
| 4168 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4168 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4169 | 4169 | |
| 4170 | 4170 | $airline_array = array(); |
| 4171 | 4171 | $temp_array = array(); |
| 4172 | 4172 | |
| 4173 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4173 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4174 | 4174 | { |
| 4175 | 4175 | $temp_array['airline_name'] = $row['airline_name']; |
| 4176 | 4176 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4188,13 +4188,13 @@ discard block |
||
| 4188 | 4188 | * @return Array the airline country list |
| 4189 | 4189 | * |
| 4190 | 4190 | */ |
| 4191 | - public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array()) |
|
| 4191 | + public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 4192 | 4192 | { |
| 4193 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4194 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4195 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4193 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4194 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4195 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4196 | 4196 | |
| 4197 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4197 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4198 | 4198 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 4199 | 4199 | GROUP BY spotter_output.airline_country |
| 4200 | 4200 | ORDER BY airline_country_count DESC |
@@ -4202,11 +4202,11 @@ discard block |
||
| 4202 | 4202 | |
| 4203 | 4203 | |
| 4204 | 4204 | $sth = $this->db->prepare($query); |
| 4205 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4205 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4206 | 4206 | |
| 4207 | 4207 | $airline_country_array = array(); |
| 4208 | 4208 | $temp_array = array(); |
| 4209 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4209 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4210 | 4210 | { |
| 4211 | 4211 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4212 | 4212 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4224,11 +4224,11 @@ discard block |
||
| 4224 | 4224 | * @return Array the airline list |
| 4225 | 4225 | * |
| 4226 | 4226 | */ |
| 4227 | - public function countAllAirlinesByCountry($country,$filters = array()) |
|
| 4227 | + public function countAllAirlinesByCountry($country, $filters = array()) |
|
| 4228 | 4228 | { |
| 4229 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 4230 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4231 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4229 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 4230 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4231 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4232 | 4232 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 4233 | 4233 | GROUP BY spotter_output.airline_name |
| 4234 | 4234 | ORDER BY airline_count DESC"; |
@@ -4239,7 +4239,7 @@ discard block |
||
| 4239 | 4239 | |
| 4240 | 4240 | $airline_array = array(); |
| 4241 | 4241 | $temp_array = array(); |
| 4242 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4242 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4243 | 4243 | { |
| 4244 | 4244 | $temp_array['airline_name'] = $row['airline_name']; |
| 4245 | 4245 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4258,11 +4258,11 @@ discard block |
||
| 4258 | 4258 | * @return Array the airline country list |
| 4259 | 4259 | * |
| 4260 | 4260 | */ |
| 4261 | - public function countAllAirlineCountriesByCountry($country,$filters = array()) |
|
| 4261 | + public function countAllAirlineCountriesByCountry($country, $filters = array()) |
|
| 4262 | 4262 | { |
| 4263 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4264 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 4265 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4263 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4264 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 4265 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4266 | 4266 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 4267 | 4267 | GROUP BY spotter_output.airline_country |
| 4268 | 4268 | ORDER BY airline_country_count DESC |
@@ -4274,7 +4274,7 @@ discard block |
||
| 4274 | 4274 | |
| 4275 | 4275 | $airline_country_array = array(); |
| 4276 | 4276 | $temp_array = array(); |
| 4277 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4277 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4278 | 4278 | { |
| 4279 | 4279 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4280 | 4280 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4293,8 +4293,8 @@ discard block |
||
| 4293 | 4293 | */ |
| 4294 | 4294 | public function countAllAirlineCountries($limit = true, $filters = array()) |
| 4295 | 4295 | { |
| 4296 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4297 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4296 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4297 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4298 | 4298 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' |
| 4299 | 4299 | GROUP BY spotter_output.airline_country |
| 4300 | 4300 | ORDER BY airline_country_count DESC"; |
@@ -4305,7 +4305,7 @@ discard block |
||
| 4305 | 4305 | |
| 4306 | 4306 | $airline_array = array(); |
| 4307 | 4307 | $temp_array = array(); |
| 4308 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4308 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4309 | 4309 | { |
| 4310 | 4310 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4311 | 4311 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4321,11 +4321,11 @@ discard block |
||
| 4321 | 4321 | * @return Array the airline country list |
| 4322 | 4322 | * |
| 4323 | 4323 | */ |
| 4324 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
| 4324 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
| 4325 | 4325 | { |
| 4326 | 4326 | global $globalDBdriver; |
| 4327 | 4327 | //$filter_query = $this->getFilter($filters,true,true); |
| 4328 | - $Connection= new Connection($this->db); |
|
| 4328 | + $Connection = new Connection($this->db); |
|
| 4329 | 4329 | if (!$Connection->tableExists('countries')) return array(); |
| 4330 | 4330 | /* |
| 4331 | 4331 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -4360,7 +4360,7 @@ discard block |
||
| 4360 | 4360 | $flight_array = array(); |
| 4361 | 4361 | $temp_array = array(); |
| 4362 | 4362 | |
| 4363 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4363 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4364 | 4364 | { |
| 4365 | 4365 | $temp_array['flight_count'] = $row['nb']; |
| 4366 | 4366 | $temp_array['flight_country'] = $row['name']; |
@@ -4378,12 +4378,12 @@ discard block |
||
| 4378 | 4378 | * @return Array the aircraft list |
| 4379 | 4379 | * |
| 4380 | 4380 | */ |
| 4381 | - public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 4381 | + public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 4382 | 4382 | { |
| 4383 | 4383 | global $globalDBdriver; |
| 4384 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4384 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4385 | 4385 | |
| 4386 | - $query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4386 | + $query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4387 | 4387 | FROM spotter_output ".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> ''"; |
| 4388 | 4388 | if ($olderthanmonths > 0) { |
| 4389 | 4389 | if ($globalDBdriver == 'mysql') { |
@@ -4408,7 +4408,7 @@ discard block |
||
| 4408 | 4408 | |
| 4409 | 4409 | $aircraft_array = array(); |
| 4410 | 4410 | $temp_array = array(); |
| 4411 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4411 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4412 | 4412 | { |
| 4413 | 4413 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4414 | 4414 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4425,11 +4425,11 @@ discard block |
||
| 4425 | 4425 | * @return Array the aircraft list |
| 4426 | 4426 | * |
| 4427 | 4427 | */ |
| 4428 | - public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 4428 | + public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 4429 | 4429 | { |
| 4430 | 4430 | global $globalDBdriver; |
| 4431 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4432 | - $query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4431 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4432 | + $query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4433 | 4433 | FROM spotter_output".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' "; |
| 4434 | 4434 | if ($olderthanmonths > 0) { |
| 4435 | 4435 | if ($globalDBdriver == 'mysql') { |
@@ -4454,7 +4454,7 @@ discard block |
||
| 4454 | 4454 | |
| 4455 | 4455 | $aircraft_array = array(); |
| 4456 | 4456 | $temp_array = array(); |
| 4457 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4457 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4458 | 4458 | { |
| 4459 | 4459 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 4460 | 4460 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -4473,13 +4473,13 @@ discard block |
||
| 4473 | 4473 | * @return Array the aircraft list |
| 4474 | 4474 | * |
| 4475 | 4475 | */ |
| 4476 | - public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array()) |
|
| 4476 | + public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array()) |
|
| 4477 | 4477 | { |
| 4478 | 4478 | $Image = new Image($this->db); |
| 4479 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4480 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 4479 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4480 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 4481 | 4481 | |
| 4482 | - $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 |
|
| 4482 | + $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 |
|
| 4483 | 4483 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 4484 | 4484 | GROUP BY spotter_output.registration |
| 4485 | 4485 | ORDER BY registration_count DESC"; |
@@ -4490,14 +4490,14 @@ discard block |
||
| 4490 | 4490 | $aircraft_array = array(); |
| 4491 | 4491 | $temp_array = array(); |
| 4492 | 4492 | |
| 4493 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4493 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4494 | 4494 | { |
| 4495 | 4495 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4496 | 4496 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 4497 | 4497 | $temp_array['registration'] = $row['registration']; |
| 4498 | 4498 | $temp_array['airline_name'] = $row['airline_name']; |
| 4499 | 4499 | $temp_array['image_thumbnail'] = ""; |
| 4500 | - if($row['registration'] != "") |
|
| 4500 | + if ($row['registration'] != "") |
|
| 4501 | 4501 | { |
| 4502 | 4502 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4503 | 4503 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4516,11 +4516,11 @@ discard block |
||
| 4516 | 4516 | * @return Array the aircraft list |
| 4517 | 4517 | * |
| 4518 | 4518 | */ |
| 4519 | - public function countAllAircraftTypesByAirline($airline_icao,$filters = array()) |
|
| 4519 | + public function countAllAircraftTypesByAirline($airline_icao, $filters = array()) |
|
| 4520 | 4520 | { |
| 4521 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4522 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 4523 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4521 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4522 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 4523 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4524 | 4524 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao |
| 4525 | 4525 | GROUP BY spotter_output.aircraft_name |
| 4526 | 4526 | ORDER BY aircraft_icao_count DESC"; |
@@ -4531,7 +4531,7 @@ discard block |
||
| 4531 | 4531 | $aircraft_array = array(); |
| 4532 | 4532 | $temp_array = array(); |
| 4533 | 4533 | |
| 4534 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4534 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4535 | 4535 | { |
| 4536 | 4536 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4537 | 4537 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4549,13 +4549,13 @@ discard block |
||
| 4549 | 4549 | * @return Array the aircraft list |
| 4550 | 4550 | * |
| 4551 | 4551 | */ |
| 4552 | - public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array()) |
|
| 4552 | + public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array()) |
|
| 4553 | 4553 | { |
| 4554 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4554 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4555 | 4555 | $Image = new Image($this->db); |
| 4556 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 4556 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 4557 | 4557 | |
| 4558 | - $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 |
|
| 4558 | + $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 |
|
| 4559 | 4559 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao |
| 4560 | 4560 | GROUP BY spotter_output.registration |
| 4561 | 4561 | ORDER BY registration_count DESC"; |
@@ -4565,14 +4565,14 @@ discard block |
||
| 4565 | 4565 | |
| 4566 | 4566 | $aircraft_array = array(); |
| 4567 | 4567 | $temp_array = array(); |
| 4568 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4568 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4569 | 4569 | { |
| 4570 | 4570 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4571 | 4571 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 4572 | 4572 | $temp_array['registration'] = $row['registration']; |
| 4573 | 4573 | $temp_array['airline_name'] = $row['airline_name']; |
| 4574 | 4574 | $temp_array['image_thumbnail'] = ""; |
| 4575 | - if($row['registration'] != "") |
|
| 4575 | + if ($row['registration'] != "") |
|
| 4576 | 4576 | { |
| 4577 | 4577 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4578 | 4578 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4591,11 +4591,11 @@ discard block |
||
| 4591 | 4591 | * @return Array the aircraft list |
| 4592 | 4592 | * |
| 4593 | 4593 | */ |
| 4594 | - public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array()) |
|
| 4594 | + public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array()) |
|
| 4595 | 4595 | { |
| 4596 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4597 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 4598 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 4596 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4597 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 4598 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 4599 | 4599 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao |
| 4600 | 4600 | GROUP BY spotter_output.aircraft_manufacturer |
| 4601 | 4601 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -4606,7 +4606,7 @@ discard block |
||
| 4606 | 4606 | $aircraft_array = array(); |
| 4607 | 4607 | $temp_array = array(); |
| 4608 | 4608 | |
| 4609 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4609 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4610 | 4610 | { |
| 4611 | 4611 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 4612 | 4612 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -4623,12 +4623,12 @@ discard block |
||
| 4623 | 4623 | * @return Array the aircraft list |
| 4624 | 4624 | * |
| 4625 | 4625 | */ |
| 4626 | - public function countAllAircraftTypesByAirport($airport_icao,$filters = array()) |
|
| 4626 | + public function countAllAircraftTypesByAirport($airport_icao, $filters = array()) |
|
| 4627 | 4627 | { |
| 4628 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4629 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 4628 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4629 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 4630 | 4630 | |
| 4631 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4631 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4632 | 4632 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 4633 | 4633 | GROUP BY spotter_output.aircraft_name |
| 4634 | 4634 | ORDER BY aircraft_icao_count DESC"; |
@@ -4638,7 +4638,7 @@ discard block |
||
| 4638 | 4638 | |
| 4639 | 4639 | $aircraft_array = array(); |
| 4640 | 4640 | $temp_array = array(); |
| 4641 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4641 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4642 | 4642 | { |
| 4643 | 4643 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4644 | 4644 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4656,13 +4656,13 @@ discard block |
||
| 4656 | 4656 | * @return Array the aircraft list |
| 4657 | 4657 | * |
| 4658 | 4658 | */ |
| 4659 | - public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array()) |
|
| 4659 | + public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array()) |
|
| 4660 | 4660 | { |
| 4661 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4661 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4662 | 4662 | $Image = new Image($this->db); |
| 4663 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 4663 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 4664 | 4664 | |
| 4665 | - $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 |
|
| 4665 | + $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 |
|
| 4666 | 4666 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 4667 | 4667 | GROUP BY spotter_output.registration |
| 4668 | 4668 | ORDER BY registration_count DESC"; |
@@ -4673,14 +4673,14 @@ discard block |
||
| 4673 | 4673 | |
| 4674 | 4674 | $aircraft_array = array(); |
| 4675 | 4675 | $temp_array = array(); |
| 4676 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4676 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4677 | 4677 | { |
| 4678 | 4678 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4679 | 4679 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 4680 | 4680 | $temp_array['registration'] = $row['registration']; |
| 4681 | 4681 | $temp_array['airline_name'] = $row['airline_name']; |
| 4682 | 4682 | $temp_array['image_thumbnail'] = ""; |
| 4683 | - if($row['registration'] != "") |
|
| 4683 | + if ($row['registration'] != "") |
|
| 4684 | 4684 | { |
| 4685 | 4685 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4686 | 4686 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4698,11 +4698,11 @@ discard block |
||
| 4698 | 4698 | * @return Array the aircraft list |
| 4699 | 4699 | * |
| 4700 | 4700 | */ |
| 4701 | - public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array()) |
|
| 4701 | + public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array()) |
|
| 4702 | 4702 | { |
| 4703 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4704 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 4705 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 4703 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4704 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 4705 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 4706 | 4706 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 4707 | 4707 | GROUP BY spotter_output.aircraft_manufacturer |
| 4708 | 4708 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -4713,7 +4713,7 @@ discard block |
||
| 4713 | 4713 | |
| 4714 | 4714 | $aircraft_array = array(); |
| 4715 | 4715 | $temp_array = array(); |
| 4716 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4716 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4717 | 4717 | { |
| 4718 | 4718 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 4719 | 4719 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -4728,12 +4728,12 @@ discard block |
||
| 4728 | 4728 | * @return Array the aircraft list |
| 4729 | 4729 | * |
| 4730 | 4730 | */ |
| 4731 | - public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 4731 | + public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 4732 | 4732 | { |
| 4733 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4734 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 4733 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4734 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 4735 | 4735 | |
| 4736 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4736 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4737 | 4737 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 4738 | 4738 | GROUP BY spotter_output.aircraft_name |
| 4739 | 4739 | ORDER BY aircraft_icao_count DESC"; |
@@ -4742,7 +4742,7 @@ discard block |
||
| 4742 | 4742 | $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
| 4743 | 4743 | $aircraft_array = array(); |
| 4744 | 4744 | $temp_array = array(); |
| 4745 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4745 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4746 | 4746 | { |
| 4747 | 4747 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4748 | 4748 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4761,11 +4761,11 @@ discard block |
||
| 4761 | 4761 | */ |
| 4762 | 4762 | public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array()) |
| 4763 | 4763 | { |
| 4764 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4764 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4765 | 4765 | $Image = new Image($this->db); |
| 4766 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 4766 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 4767 | 4767 | |
| 4768 | - $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 |
|
| 4768 | + $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 |
|
| 4769 | 4769 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 4770 | 4770 | GROUP BY spotter_output.registration |
| 4771 | 4771 | ORDER BY registration_count DESC"; |
@@ -4775,14 +4775,14 @@ discard block |
||
| 4775 | 4775 | $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
| 4776 | 4776 | $aircraft_array = array(); |
| 4777 | 4777 | $temp_array = array(); |
| 4778 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4778 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4779 | 4779 | { |
| 4780 | 4780 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4781 | 4781 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 4782 | 4782 | $temp_array['registration'] = $row['registration']; |
| 4783 | 4783 | $temp_array['airline_name'] = $row['airline_name']; |
| 4784 | 4784 | $temp_array['image_thumbnail'] = ""; |
| 4785 | - if($row['registration'] != "") |
|
| 4785 | + if ($row['registration'] != "") |
|
| 4786 | 4786 | { |
| 4787 | 4787 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4788 | 4788 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4799,11 +4799,11 @@ discard block |
||
| 4799 | 4799 | * @return Array the aircraft list |
| 4800 | 4800 | * |
| 4801 | 4801 | */ |
| 4802 | - public function countAllAircraftTypesByDate($date,$filters = array()) |
|
| 4802 | + public function countAllAircraftTypesByDate($date, $filters = array()) |
|
| 4803 | 4803 | { |
| 4804 | 4804 | global $globalTimezone, $globalDBdriver; |
| 4805 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4806 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 4805 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4806 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 4807 | 4807 | if ($globalTimezone != '') { |
| 4808 | 4808 | date_default_timezone_set($globalTimezone); |
| 4809 | 4809 | $datetime = new DateTime($date); |
@@ -4811,12 +4811,12 @@ discard block |
||
| 4811 | 4811 | } else $offset = '+00:00'; |
| 4812 | 4812 | |
| 4813 | 4813 | if ($globalDBdriver == 'mysql') { |
| 4814 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4814 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4815 | 4815 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 4816 | 4816 | GROUP BY spotter_output.aircraft_name |
| 4817 | 4817 | ORDER BY aircraft_icao_count DESC"; |
| 4818 | 4818 | } else { |
| 4819 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4819 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4820 | 4820 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 4821 | 4821 | GROUP BY spotter_output.aircraft_name |
| 4822 | 4822 | ORDER BY aircraft_icao_count DESC"; |
@@ -4827,7 +4827,7 @@ discard block |
||
| 4827 | 4827 | |
| 4828 | 4828 | $aircraft_array = array(); |
| 4829 | 4829 | $temp_array = array(); |
| 4830 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4830 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4831 | 4831 | { |
| 4832 | 4832 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4833 | 4833 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4845,12 +4845,12 @@ discard block |
||
| 4845 | 4845 | * @return Array the aircraft list |
| 4846 | 4846 | * |
| 4847 | 4847 | */ |
| 4848 | - public function countAllAircraftRegistrationByDate($date,$filters = array()) |
|
| 4848 | + public function countAllAircraftRegistrationByDate($date, $filters = array()) |
|
| 4849 | 4849 | { |
| 4850 | 4850 | global $globalTimezone, $globalDBdriver; |
| 4851 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4851 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4852 | 4852 | $Image = new Image($this->db); |
| 4853 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 4853 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 4854 | 4854 | if ($globalTimezone != '') { |
| 4855 | 4855 | date_default_timezone_set($globalTimezone); |
| 4856 | 4856 | $datetime = new DateTime($date); |
@@ -4858,12 +4858,12 @@ discard block |
||
| 4858 | 4858 | } else $offset = '+00:00'; |
| 4859 | 4859 | |
| 4860 | 4860 | if ($globalDBdriver == 'mysql') { |
| 4861 | - $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 |
|
| 4861 | + $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 |
|
| 4862 | 4862 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 4863 | 4863 | GROUP BY spotter_output.registration |
| 4864 | 4864 | ORDER BY registration_count DESC"; |
| 4865 | 4865 | } else { |
| 4866 | - $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 |
|
| 4866 | + $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 |
|
| 4867 | 4867 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 4868 | 4868 | GROUP BY spotter_output.registration |
| 4869 | 4869 | ORDER BY registration_count DESC"; |
@@ -4874,14 +4874,14 @@ discard block |
||
| 4874 | 4874 | |
| 4875 | 4875 | $aircraft_array = array(); |
| 4876 | 4876 | $temp_array = array(); |
| 4877 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4877 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4878 | 4878 | { |
| 4879 | 4879 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4880 | 4880 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 4881 | 4881 | $temp_array['registration'] = $row['registration']; |
| 4882 | 4882 | $temp_array['airline_name'] = $row['airline_name']; |
| 4883 | 4883 | $temp_array['image_thumbnail'] = ""; |
| 4884 | - if($row['registration'] != "") |
|
| 4884 | + if ($row['registration'] != "") |
|
| 4885 | 4885 | { |
| 4886 | 4886 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4887 | 4887 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4900,11 +4900,11 @@ discard block |
||
| 4900 | 4900 | * @return Array the aircraft manufacturer list |
| 4901 | 4901 | * |
| 4902 | 4902 | */ |
| 4903 | - public function countAllAircraftManufacturerByDate($date,$filters = array()) |
|
| 4903 | + public function countAllAircraftManufacturerByDate($date, $filters = array()) |
|
| 4904 | 4904 | { |
| 4905 | 4905 | global $globalTimezone, $globalDBdriver; |
| 4906 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4907 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 4906 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4907 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 4908 | 4908 | if ($globalTimezone != '') { |
| 4909 | 4909 | date_default_timezone_set($globalTimezone); |
| 4910 | 4910 | $datetime = new DateTime($date); |
@@ -4912,12 +4912,12 @@ discard block |
||
| 4912 | 4912 | } else $offset = '+00:00'; |
| 4913 | 4913 | |
| 4914 | 4914 | if ($globalDBdriver == 'mysql') { |
| 4915 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 4915 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 4916 | 4916 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 4917 | 4917 | GROUP BY spotter_output.aircraft_manufacturer |
| 4918 | 4918 | ORDER BY aircraft_manufacturer_count DESC"; |
| 4919 | 4919 | } else { |
| 4920 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 4920 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 4921 | 4921 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 4922 | 4922 | GROUP BY spotter_output.aircraft_manufacturer |
| 4923 | 4923 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -4929,7 +4929,7 @@ discard block |
||
| 4929 | 4929 | $aircraft_array = array(); |
| 4930 | 4930 | $temp_array = array(); |
| 4931 | 4931 | |
| 4932 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4932 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4933 | 4933 | { |
| 4934 | 4934 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 4935 | 4935 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -4946,11 +4946,11 @@ discard block |
||
| 4946 | 4946 | * @return Array the aircraft list |
| 4947 | 4947 | * |
| 4948 | 4948 | */ |
| 4949 | - public function countAllAircraftTypesByIdent($ident,$filters = array()) |
|
| 4949 | + public function countAllAircraftTypesByIdent($ident, $filters = array()) |
|
| 4950 | 4950 | { |
| 4951 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4952 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 4953 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4951 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4952 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 4953 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4954 | 4954 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 4955 | 4955 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 4956 | 4956 | ORDER BY aircraft_icao_count DESC"; |
@@ -4961,7 +4961,7 @@ discard block |
||
| 4961 | 4961 | $aircraft_array = array(); |
| 4962 | 4962 | $temp_array = array(); |
| 4963 | 4963 | |
| 4964 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4964 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4965 | 4965 | { |
| 4966 | 4966 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4967 | 4967 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4979,13 +4979,13 @@ discard block |
||
| 4979 | 4979 | * @return Array the aircraft list |
| 4980 | 4980 | * |
| 4981 | 4981 | */ |
| 4982 | - public function countAllAircraftRegistrationByIdent($ident,$filters = array()) |
|
| 4982 | + public function countAllAircraftRegistrationByIdent($ident, $filters = array()) |
|
| 4983 | 4983 | { |
| 4984 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4984 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4985 | 4985 | $Image = new Image($this->db); |
| 4986 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 4986 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 4987 | 4987 | |
| 4988 | - $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 |
|
| 4988 | + $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 |
|
| 4989 | 4989 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident |
| 4990 | 4990 | GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 4991 | 4991 | ORDER BY registration_count DESC"; |
@@ -4997,14 +4997,14 @@ discard block |
||
| 4997 | 4997 | $aircraft_array = array(); |
| 4998 | 4998 | $temp_array = array(); |
| 4999 | 4999 | |
| 5000 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5000 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5001 | 5001 | { |
| 5002 | 5002 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5003 | 5003 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5004 | 5004 | $temp_array['registration'] = $row['registration']; |
| 5005 | 5005 | $temp_array['airline_name'] = $row['airline_name']; |
| 5006 | 5006 | $temp_array['image_thumbnail'] = ""; |
| 5007 | - if($row['registration'] != "") |
|
| 5007 | + if ($row['registration'] != "") |
|
| 5008 | 5008 | { |
| 5009 | 5009 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5010 | 5010 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5023,11 +5023,11 @@ discard block |
||
| 5023 | 5023 | * @return Array the aircraft manufacturer list |
| 5024 | 5024 | * |
| 5025 | 5025 | */ |
| 5026 | - public function countAllAircraftManufacturerByIdent($ident,$filters = array()) |
|
| 5026 | + public function countAllAircraftManufacturerByIdent($ident, $filters = array()) |
|
| 5027 | 5027 | { |
| 5028 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5029 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 5030 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5028 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5029 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 5030 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5031 | 5031 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident |
| 5032 | 5032 | GROUP BY spotter_output.aircraft_manufacturer |
| 5033 | 5033 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5037,7 +5037,7 @@ discard block |
||
| 5037 | 5037 | $sth->execute(array(':ident' => $ident)); |
| 5038 | 5038 | $aircraft_array = array(); |
| 5039 | 5039 | $temp_array = array(); |
| 5040 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5040 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5041 | 5041 | { |
| 5042 | 5042 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5043 | 5043 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5053,24 +5053,24 @@ discard block |
||
| 5053 | 5053 | * @return Array the aircraft list |
| 5054 | 5054 | * |
| 5055 | 5055 | */ |
| 5056 | - public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 5056 | + public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 5057 | 5057 | { |
| 5058 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5059 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5060 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5058 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5059 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5060 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5061 | 5061 | |
| 5062 | 5062 | |
| 5063 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5063 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5064 | 5064 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 5065 | 5065 | GROUP BY spotter_output.aircraft_name |
| 5066 | 5066 | ORDER BY aircraft_icao_count DESC"; |
| 5067 | 5067 | |
| 5068 | 5068 | |
| 5069 | 5069 | $sth = $this->db->prepare($query); |
| 5070 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5070 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5071 | 5071 | $aircraft_array = array(); |
| 5072 | 5072 | $temp_array = array(); |
| 5073 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5073 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5074 | 5074 | { |
| 5075 | 5075 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5076 | 5076 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5086,33 +5086,33 @@ discard block |
||
| 5086 | 5086 | * @return Array the aircraft list |
| 5087 | 5087 | * |
| 5088 | 5088 | */ |
| 5089 | - public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 5089 | + public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 5090 | 5090 | { |
| 5091 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5091 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5092 | 5092 | $Image = new Image($this->db); |
| 5093 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5094 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5093 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5094 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5095 | 5095 | |
| 5096 | - $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 |
|
| 5096 | + $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 |
|
| 5097 | 5097 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 5098 | 5098 | GROUP BY spotter_output.registration |
| 5099 | 5099 | ORDER BY registration_count DESC"; |
| 5100 | 5100 | |
| 5101 | 5101 | |
| 5102 | 5102 | $sth = $this->db->prepare($query); |
| 5103 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5103 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5104 | 5104 | |
| 5105 | 5105 | $aircraft_array = array(); |
| 5106 | 5106 | $temp_array = array(); |
| 5107 | 5107 | |
| 5108 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5108 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5109 | 5109 | { |
| 5110 | 5110 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5111 | 5111 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5112 | 5112 | $temp_array['registration'] = $row['registration']; |
| 5113 | 5113 | $temp_array['airline_name'] = $row['airline_name']; |
| 5114 | 5114 | $temp_array['image_thumbnail'] = ""; |
| 5115 | - if($row['registration'] != "") |
|
| 5115 | + if ($row['registration'] != "") |
|
| 5116 | 5116 | { |
| 5117 | 5117 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5118 | 5118 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5132,25 +5132,25 @@ discard block |
||
| 5132 | 5132 | * @return Array the aircraft manufacturer list |
| 5133 | 5133 | * |
| 5134 | 5134 | */ |
| 5135 | - public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 5135 | + public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 5136 | 5136 | { |
| 5137 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5138 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5139 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5137 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5138 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5139 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5140 | 5140 | |
| 5141 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5141 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5142 | 5142 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 5143 | 5143 | GROUP BY spotter_output.aircraft_manufacturer |
| 5144 | 5144 | ORDER BY aircraft_manufacturer_count DESC"; |
| 5145 | 5145 | |
| 5146 | 5146 | |
| 5147 | 5147 | $sth = $this->db->prepare($query); |
| 5148 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5148 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5149 | 5149 | |
| 5150 | 5150 | $aircraft_array = array(); |
| 5151 | 5151 | $temp_array = array(); |
| 5152 | 5152 | |
| 5153 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5153 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5154 | 5154 | { |
| 5155 | 5155 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5156 | 5156 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5170,11 +5170,11 @@ discard block |
||
| 5170 | 5170 | * @return Array the aircraft list |
| 5171 | 5171 | * |
| 5172 | 5172 | */ |
| 5173 | - public function countAllAircraftTypesByCountry($country,$filters = array()) |
|
| 5173 | + public function countAllAircraftTypesByCountry($country, $filters = array()) |
|
| 5174 | 5174 | { |
| 5175 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5176 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 5177 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5175 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5176 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 5177 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5178 | 5178 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 5179 | 5179 | GROUP BY spotter_output.aircraft_name |
| 5180 | 5180 | ORDER BY aircraft_icao_count DESC"; |
@@ -5186,7 +5186,7 @@ discard block |
||
| 5186 | 5186 | $aircraft_array = array(); |
| 5187 | 5187 | $temp_array = array(); |
| 5188 | 5188 | |
| 5189 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5189 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5190 | 5190 | { |
| 5191 | 5191 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5192 | 5192 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5205,12 +5205,12 @@ discard block |
||
| 5205 | 5205 | * @return Array the aircraft list |
| 5206 | 5206 | * |
| 5207 | 5207 | */ |
| 5208 | - public function countAllAircraftRegistrationByCountry($country,$filters = array()) |
|
| 5208 | + public function countAllAircraftRegistrationByCountry($country, $filters = array()) |
|
| 5209 | 5209 | { |
| 5210 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5210 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5211 | 5211 | $Image = new Image($this->db); |
| 5212 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 5213 | - $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 |
|
| 5212 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 5213 | + $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 |
|
| 5214 | 5214 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) |
| 5215 | 5215 | GROUP BY spotter_output.registration |
| 5216 | 5216 | ORDER BY registration_count DESC"; |
@@ -5222,14 +5222,14 @@ discard block |
||
| 5222 | 5222 | $aircraft_array = array(); |
| 5223 | 5223 | $temp_array = array(); |
| 5224 | 5224 | |
| 5225 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5225 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5226 | 5226 | { |
| 5227 | 5227 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5228 | 5228 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5229 | 5229 | $temp_array['registration'] = $row['registration']; |
| 5230 | 5230 | $temp_array['airline_name'] = $row['airline_name']; |
| 5231 | 5231 | $temp_array['image_thumbnail'] = ""; |
| 5232 | - if($row['registration'] != "") |
|
| 5232 | + if ($row['registration'] != "") |
|
| 5233 | 5233 | { |
| 5234 | 5234 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5235 | 5235 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5249,11 +5249,11 @@ discard block |
||
| 5249 | 5249 | * @return Array the aircraft manufacturer list |
| 5250 | 5250 | * |
| 5251 | 5251 | */ |
| 5252 | - public function countAllAircraftManufacturerByCountry($country,$filters = array()) |
|
| 5252 | + public function countAllAircraftManufacturerByCountry($country, $filters = array()) |
|
| 5253 | 5253 | { |
| 5254 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5255 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 5256 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5254 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5255 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 5256 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5257 | 5257 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) |
| 5258 | 5258 | GROUP BY spotter_output.aircraft_manufacturer |
| 5259 | 5259 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5265,7 +5265,7 @@ discard block |
||
| 5265 | 5265 | $aircraft_array = array(); |
| 5266 | 5266 | $temp_array = array(); |
| 5267 | 5267 | |
| 5268 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5268 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5269 | 5269 | { |
| 5270 | 5270 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5271 | 5271 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5286,8 +5286,8 @@ discard block |
||
| 5286 | 5286 | */ |
| 5287 | 5287 | public function countAllAircraftManufacturers($filters = array()) |
| 5288 | 5288 | { |
| 5289 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5290 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5289 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5290 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5291 | 5291 | FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'"; |
| 5292 | 5292 | $query .= " GROUP BY spotter_output.aircraft_manufacturer |
| 5293 | 5293 | ORDER BY aircraft_manufacturer_count DESC |
@@ -5300,7 +5300,7 @@ discard block |
||
| 5300 | 5300 | $manufacturer_array = array(); |
| 5301 | 5301 | $temp_array = array(); |
| 5302 | 5302 | |
| 5303 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5303 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5304 | 5304 | { |
| 5305 | 5305 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5306 | 5306 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5319,12 +5319,12 @@ discard block |
||
| 5319 | 5319 | * @return Array the aircraft list |
| 5320 | 5320 | * |
| 5321 | 5321 | */ |
| 5322 | - public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 5322 | + public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5323 | 5323 | { |
| 5324 | 5324 | global $globalDBdriver; |
| 5325 | 5325 | $Image = new Image($this->db); |
| 5326 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5327 | - $query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
| 5326 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5327 | + $query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
| 5328 | 5328 | FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'"; |
| 5329 | 5329 | if ($olderthanmonths > 0) { |
| 5330 | 5330 | if ($globalDBdriver == 'mysql') { |
@@ -5352,7 +5352,7 @@ discard block |
||
| 5352 | 5352 | $aircraft_array = array(); |
| 5353 | 5353 | $temp_array = array(); |
| 5354 | 5354 | |
| 5355 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5355 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5356 | 5356 | { |
| 5357 | 5357 | $temp_array['registration'] = $row['registration']; |
| 5358 | 5358 | $temp_array['aircraft_registration_count'] = $row['aircraft_registration_count']; |
@@ -5360,7 +5360,7 @@ discard block |
||
| 5360 | 5360 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5361 | 5361 | $temp_array['airline_name'] = $row['airline_name']; |
| 5362 | 5362 | $temp_array['image_thumbnail'] = ""; |
| 5363 | - if($row['registration'] != "") |
|
| 5363 | + if ($row['registration'] != "") |
|
| 5364 | 5364 | { |
| 5365 | 5365 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5366 | 5366 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5379,12 +5379,12 @@ discard block |
||
| 5379 | 5379 | * @return Array the aircraft list |
| 5380 | 5380 | * |
| 5381 | 5381 | */ |
| 5382 | - public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 5382 | + public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5383 | 5383 | { |
| 5384 | 5384 | global $globalDBdriver; |
| 5385 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5385 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5386 | 5386 | $Image = new Image($this->db); |
| 5387 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
| 5387 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
| 5388 | 5388 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' "; |
| 5389 | 5389 | if ($olderthanmonths > 0) { |
| 5390 | 5390 | if ($globalDBdriver == 'mysql') { |
@@ -5412,7 +5412,7 @@ discard block |
||
| 5412 | 5412 | $aircraft_array = array(); |
| 5413 | 5413 | $temp_array = array(); |
| 5414 | 5414 | |
| 5415 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5415 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5416 | 5416 | { |
| 5417 | 5417 | $temp_array['registration'] = $row['registration']; |
| 5418 | 5418 | $temp_array['aircraft_registration_count'] = $row['aircraft_registration_count']; |
@@ -5421,7 +5421,7 @@ discard block |
||
| 5421 | 5421 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5422 | 5422 | $temp_array['airline_name'] = $row['airline_name']; |
| 5423 | 5423 | $temp_array['image_thumbnail'] = ""; |
| 5424 | - if($row['registration'] != "") |
|
| 5424 | + if ($row['registration'] != "") |
|
| 5425 | 5425 | { |
| 5426 | 5426 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5427 | 5427 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5440,11 +5440,11 @@ discard block |
||
| 5440 | 5440 | * @return Array the airport list |
| 5441 | 5441 | * |
| 5442 | 5442 | */ |
| 5443 | - public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 5443 | + public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5444 | 5444 | { |
| 5445 | 5445 | global $globalDBdriver; |
| 5446 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5447 | - $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 |
|
| 5446 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5447 | + $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 |
|
| 5448 | 5448 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'"; |
| 5449 | 5449 | if ($olderthanmonths > 0) { |
| 5450 | 5450 | if ($globalDBdriver == 'mysql') { |
@@ -5473,7 +5473,7 @@ discard block |
||
| 5473 | 5473 | $airport_array = array(); |
| 5474 | 5474 | $temp_array = array(); |
| 5475 | 5475 | |
| 5476 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5476 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5477 | 5477 | { |
| 5478 | 5478 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 5479 | 5479 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5492,11 +5492,11 @@ discard block |
||
| 5492 | 5492 | * @return Array the airport list |
| 5493 | 5493 | * |
| 5494 | 5494 | */ |
| 5495 | - public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 5495 | + public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5496 | 5496 | { |
| 5497 | 5497 | global $globalDBdriver; |
| 5498 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5499 | - $query = "SELECT DISTINCT spotter_output.airline_icao, 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 |
|
| 5498 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5499 | + $query = "SELECT DISTINCT spotter_output.airline_icao, 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 |
|
| 5500 | 5500 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' "; |
| 5501 | 5501 | if ($olderthanmonths > 0) { |
| 5502 | 5502 | if ($globalDBdriver == 'mysql') { |
@@ -5525,7 +5525,7 @@ discard block |
||
| 5525 | 5525 | $airport_array = array(); |
| 5526 | 5526 | $temp_array = array(); |
| 5527 | 5527 | |
| 5528 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5528 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5529 | 5529 | { |
| 5530 | 5530 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 5531 | 5531 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -5545,11 +5545,11 @@ discard block |
||
| 5545 | 5545 | * @return Array the airport list |
| 5546 | 5546 | * |
| 5547 | 5547 | */ |
| 5548 | - public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 5548 | + public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5549 | 5549 | { |
| 5550 | 5550 | global $globalDBdriver; |
| 5551 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5552 | - $query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
| 5551 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5552 | + $query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
| 5553 | 5553 | FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao"; |
| 5554 | 5554 | if ($olderthanmonths > 0) { |
| 5555 | 5555 | if ($globalDBdriver == 'mysql') { |
@@ -5577,7 +5577,7 @@ discard block |
||
| 5577 | 5577 | $airport_array = array(); |
| 5578 | 5578 | $temp_array = array(); |
| 5579 | 5579 | |
| 5580 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5580 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5581 | 5581 | { |
| 5582 | 5582 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 5583 | 5583 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5596,11 +5596,11 @@ discard block |
||
| 5596 | 5596 | * @return Array the airport list |
| 5597 | 5597 | * |
| 5598 | 5598 | */ |
| 5599 | - public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 5599 | + public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5600 | 5600 | { |
| 5601 | 5601 | global $globalDBdriver; |
| 5602 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5603 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
| 5602 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5603 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
| 5604 | 5604 | FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao "; |
| 5605 | 5605 | if ($olderthanmonths > 0) { |
| 5606 | 5606 | if ($globalDBdriver == 'mysql') { |
@@ -5629,7 +5629,7 @@ discard block |
||
| 5629 | 5629 | $airport_array = array(); |
| 5630 | 5630 | $temp_array = array(); |
| 5631 | 5631 | |
| 5632 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5632 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5633 | 5633 | { |
| 5634 | 5634 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 5635 | 5635 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -5649,11 +5649,11 @@ discard block |
||
| 5649 | 5649 | * @return Array the airport list |
| 5650 | 5650 | * |
| 5651 | 5651 | */ |
| 5652 | - public function countAllDepartureAirportsByAirline($airline_icao,$filters = array()) |
|
| 5652 | + public function countAllDepartureAirportsByAirline($airline_icao, $filters = array()) |
|
| 5653 | 5653 | { |
| 5654 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5655 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 5656 | - $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 |
|
| 5654 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5655 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 5656 | + $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 |
|
| 5657 | 5657 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao |
| 5658 | 5658 | GROUP BY spotter_output.departure_airport_icao |
| 5659 | 5659 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5665,7 +5665,7 @@ discard block |
||
| 5665 | 5665 | $airport_array = array(); |
| 5666 | 5666 | $temp_array = array(); |
| 5667 | 5667 | |
| 5668 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5668 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5669 | 5669 | { |
| 5670 | 5670 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 5671 | 5671 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5687,11 +5687,11 @@ discard block |
||
| 5687 | 5687 | * @return Array the airport list |
| 5688 | 5688 | * |
| 5689 | 5689 | */ |
| 5690 | - public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array()) |
|
| 5690 | + public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array()) |
|
| 5691 | 5691 | { |
| 5692 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5693 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 5694 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5692 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5693 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 5694 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5695 | 5695 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao |
| 5696 | 5696 | GROUP BY spotter_output.departure_airport_country |
| 5697 | 5697 | ORDER BY airport_departure_country_count DESC"; |
@@ -5703,7 +5703,7 @@ discard block |
||
| 5703 | 5703 | $airport_array = array(); |
| 5704 | 5704 | $temp_array = array(); |
| 5705 | 5705 | |
| 5706 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5706 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5707 | 5707 | { |
| 5708 | 5708 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 5709 | 5709 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -5722,11 +5722,11 @@ discard block |
||
| 5722 | 5722 | * @return Array the airport list |
| 5723 | 5723 | * |
| 5724 | 5724 | */ |
| 5725 | - public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array()) |
|
| 5725 | + public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array()) |
|
| 5726 | 5726 | { |
| 5727 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5728 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 5729 | - $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 |
|
| 5727 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5728 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 5729 | + $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 |
|
| 5730 | 5730 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao |
| 5731 | 5731 | GROUP BY spotter_output.departure_airport_icao |
| 5732 | 5732 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5738,7 +5738,7 @@ discard block |
||
| 5738 | 5738 | $airport_array = array(); |
| 5739 | 5739 | $temp_array = array(); |
| 5740 | 5740 | |
| 5741 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5741 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5742 | 5742 | { |
| 5743 | 5743 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 5744 | 5744 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5759,11 +5759,11 @@ discard block |
||
| 5759 | 5759 | * @return Array the airport list |
| 5760 | 5760 | * |
| 5761 | 5761 | */ |
| 5762 | - public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
|
| 5762 | + public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array()) |
|
| 5763 | 5763 | { |
| 5764 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5765 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 5766 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5764 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5765 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 5766 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5767 | 5767 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 5768 | 5768 | GROUP BY spotter_output.departure_airport_country |
| 5769 | 5769 | ORDER BY airport_departure_country_count DESC"; |
@@ -5775,7 +5775,7 @@ discard block |
||
| 5775 | 5775 | $airport_array = array(); |
| 5776 | 5776 | $temp_array = array(); |
| 5777 | 5777 | |
| 5778 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5778 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5779 | 5779 | { |
| 5780 | 5780 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 5781 | 5781 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -5793,11 +5793,11 @@ discard block |
||
| 5793 | 5793 | * @return Array the airport list |
| 5794 | 5794 | * |
| 5795 | 5795 | */ |
| 5796 | - public function countAllDepartureAirportsByRegistration($registration,$filters = array()) |
|
| 5796 | + public function countAllDepartureAirportsByRegistration($registration, $filters = array()) |
|
| 5797 | 5797 | { |
| 5798 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5799 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 5800 | - $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 |
|
| 5798 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5799 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 5800 | + $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 |
|
| 5801 | 5801 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration |
| 5802 | 5802 | GROUP BY spotter_output.departure_airport_icao |
| 5803 | 5803 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5809,7 +5809,7 @@ discard block |
||
| 5809 | 5809 | $airport_array = array(); |
| 5810 | 5810 | $temp_array = array(); |
| 5811 | 5811 | |
| 5812 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5812 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5813 | 5813 | { |
| 5814 | 5814 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 5815 | 5815 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5830,11 +5830,11 @@ discard block |
||
| 5830 | 5830 | * @return Array the airport list |
| 5831 | 5831 | * |
| 5832 | 5832 | */ |
| 5833 | - public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array()) |
|
| 5833 | + public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array()) |
|
| 5834 | 5834 | { |
| 5835 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5836 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 5837 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5835 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5836 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 5837 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5838 | 5838 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration |
| 5839 | 5839 | GROUP BY spotter_output.departure_airport_country |
| 5840 | 5840 | ORDER BY airport_departure_country_count DESC"; |
@@ -5846,7 +5846,7 @@ discard block |
||
| 5846 | 5846 | $airport_array = array(); |
| 5847 | 5847 | $temp_array = array(); |
| 5848 | 5848 | |
| 5849 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5849 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5850 | 5850 | { |
| 5851 | 5851 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 5852 | 5852 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -5864,11 +5864,11 @@ discard block |
||
| 5864 | 5864 | * @return Array the airport list |
| 5865 | 5865 | * |
| 5866 | 5866 | */ |
| 5867 | - public function countAllDepartureAirportsByAirport($airport_icao,$filters = array()) |
|
| 5867 | + public function countAllDepartureAirportsByAirport($airport_icao, $filters = array()) |
|
| 5868 | 5868 | { |
| 5869 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5870 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 5871 | - $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 |
|
| 5869 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5870 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 5871 | + $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 |
|
| 5872 | 5872 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao |
| 5873 | 5873 | GROUP BY spotter_output.departure_airport_icao |
| 5874 | 5874 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5880,7 +5880,7 @@ discard block |
||
| 5880 | 5880 | $airport_array = array(); |
| 5881 | 5881 | $temp_array = array(); |
| 5882 | 5882 | |
| 5883 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5883 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5884 | 5884 | { |
| 5885 | 5885 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 5886 | 5886 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5901,11 +5901,11 @@ discard block |
||
| 5901 | 5901 | * @return Array the airport list |
| 5902 | 5902 | * |
| 5903 | 5903 | */ |
| 5904 | - public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array()) |
|
| 5904 | + public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array()) |
|
| 5905 | 5905 | { |
| 5906 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5907 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 5908 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5906 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5907 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 5908 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5909 | 5909 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao |
| 5910 | 5910 | GROUP BY spotter_output.departure_airport_country |
| 5911 | 5911 | ORDER BY airport_departure_country_count DESC"; |
@@ -5917,7 +5917,7 @@ discard block |
||
| 5917 | 5917 | $airport_array = array(); |
| 5918 | 5918 | $temp_array = array(); |
| 5919 | 5919 | |
| 5920 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5920 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5921 | 5921 | { |
| 5922 | 5922 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 5923 | 5923 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -5936,11 +5936,11 @@ discard block |
||
| 5936 | 5936 | * @return Array the airport list |
| 5937 | 5937 | * |
| 5938 | 5938 | */ |
| 5939 | - public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 5939 | + public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 5940 | 5940 | { |
| 5941 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5942 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 5943 | - $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 |
|
| 5941 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5942 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 5943 | + $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 |
|
| 5944 | 5944 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 5945 | 5945 | GROUP BY spotter_output.departure_airport_icao |
| 5946 | 5946 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5952,7 +5952,7 @@ discard block |
||
| 5952 | 5952 | $airport_array = array(); |
| 5953 | 5953 | $temp_array = array(); |
| 5954 | 5954 | |
| 5955 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5955 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5956 | 5956 | { |
| 5957 | 5957 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 5958 | 5958 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5973,11 +5973,11 @@ discard block |
||
| 5973 | 5973 | * @return Array the airport list |
| 5974 | 5974 | * |
| 5975 | 5975 | */ |
| 5976 | - public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 5976 | + public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 5977 | 5977 | { |
| 5978 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5979 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 5980 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5978 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5979 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 5980 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5981 | 5981 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 5982 | 5982 | GROUP BY spotter_output.departure_airport_country |
| 5983 | 5983 | ORDER BY airport_departure_country_count DESC"; |
@@ -5989,7 +5989,7 @@ discard block |
||
| 5989 | 5989 | $airport_array = array(); |
| 5990 | 5990 | $temp_array = array(); |
| 5991 | 5991 | |
| 5992 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5992 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5993 | 5993 | { |
| 5994 | 5994 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 5995 | 5995 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6007,11 +6007,11 @@ discard block |
||
| 6007 | 6007 | * @return Array the airport list |
| 6008 | 6008 | * |
| 6009 | 6009 | */ |
| 6010 | - public function countAllDepartureAirportsByDate($date,$filters = array()) |
|
| 6010 | + public function countAllDepartureAirportsByDate($date, $filters = array()) |
|
| 6011 | 6011 | { |
| 6012 | 6012 | global $globalTimezone, $globalDBdriver; |
| 6013 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6014 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 6013 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6014 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 6015 | 6015 | if ($globalTimezone != '') { |
| 6016 | 6016 | date_default_timezone_set($globalTimezone); |
| 6017 | 6017 | $datetime = new DateTime($date); |
@@ -6019,12 +6019,12 @@ discard block |
||
| 6019 | 6019 | } else $offset = '+00:00'; |
| 6020 | 6020 | |
| 6021 | 6021 | if ($globalDBdriver == 'mysql') { |
| 6022 | - $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 |
|
| 6022 | + $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 |
|
| 6023 | 6023 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 6024 | 6024 | GROUP BY spotter_output.departure_airport_icao |
| 6025 | 6025 | ORDER BY airport_departure_icao_count DESC"; |
| 6026 | 6026 | } else { |
| 6027 | - $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 |
|
| 6027 | + $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 |
|
| 6028 | 6028 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 6029 | 6029 | GROUP BY spotter_output.departure_airport_icao |
| 6030 | 6030 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6036,7 +6036,7 @@ discard block |
||
| 6036 | 6036 | $airport_array = array(); |
| 6037 | 6037 | $temp_array = array(); |
| 6038 | 6038 | |
| 6039 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6039 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6040 | 6040 | { |
| 6041 | 6041 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6042 | 6042 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6057,11 +6057,11 @@ discard block |
||
| 6057 | 6057 | * @return Array the airport list |
| 6058 | 6058 | * |
| 6059 | 6059 | */ |
| 6060 | - public function countAllDepartureAirportCountriesByDate($date,$filters = array()) |
|
| 6060 | + public function countAllDepartureAirportCountriesByDate($date, $filters = array()) |
|
| 6061 | 6061 | { |
| 6062 | 6062 | global $globalTimezone, $globalDBdriver; |
| 6063 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6064 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 6063 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6064 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 6065 | 6065 | if ($globalTimezone != '') { |
| 6066 | 6066 | date_default_timezone_set($globalTimezone); |
| 6067 | 6067 | $datetime = new DateTime($date); |
@@ -6069,12 +6069,12 @@ discard block |
||
| 6069 | 6069 | } else $offset = '+00:00'; |
| 6070 | 6070 | |
| 6071 | 6071 | if ($globalDBdriver == 'mysql') { |
| 6072 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6072 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6073 | 6073 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 6074 | 6074 | GROUP BY spotter_output.departure_airport_country |
| 6075 | 6075 | ORDER BY airport_departure_country_count DESC"; |
| 6076 | 6076 | } else { |
| 6077 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6077 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6078 | 6078 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 6079 | 6079 | GROUP BY spotter_output.departure_airport_country |
| 6080 | 6080 | ORDER BY airport_departure_country_count DESC"; |
@@ -6086,7 +6086,7 @@ discard block |
||
| 6086 | 6086 | $airport_array = array(); |
| 6087 | 6087 | $temp_array = array(); |
| 6088 | 6088 | |
| 6089 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6089 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6090 | 6090 | { |
| 6091 | 6091 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6092 | 6092 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6104,11 +6104,11 @@ discard block |
||
| 6104 | 6104 | * @return Array the airport list |
| 6105 | 6105 | * |
| 6106 | 6106 | */ |
| 6107 | - public function countAllDepartureAirportsByIdent($ident,$filters = array()) |
|
| 6107 | + public function countAllDepartureAirportsByIdent($ident, $filters = array()) |
|
| 6108 | 6108 | { |
| 6109 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6110 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 6111 | - $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 |
|
| 6109 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6110 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 6111 | + $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 |
|
| 6112 | 6112 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.ident = :ident |
| 6113 | 6113 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6114 | 6114 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6120,7 +6120,7 @@ discard block |
||
| 6120 | 6120 | $airport_array = array(); |
| 6121 | 6121 | $temp_array = array(); |
| 6122 | 6122 | |
| 6123 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6123 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6124 | 6124 | { |
| 6125 | 6125 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6126 | 6126 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6142,11 +6142,11 @@ discard block |
||
| 6142 | 6142 | * @return Array the airport list |
| 6143 | 6143 | * |
| 6144 | 6144 | */ |
| 6145 | - public function countAllDepartureAirportCountriesByIdent($ident,$filters = array()) |
|
| 6145 | + public function countAllDepartureAirportCountriesByIdent($ident, $filters = array()) |
|
| 6146 | 6146 | { |
| 6147 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6148 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 6149 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6147 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6148 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 6149 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6150 | 6150 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident |
| 6151 | 6151 | GROUP BY spotter_output.departure_airport_country |
| 6152 | 6152 | ORDER BY airport_departure_country_count DESC"; |
@@ -6158,7 +6158,7 @@ discard block |
||
| 6158 | 6158 | $airport_array = array(); |
| 6159 | 6159 | $temp_array = array(); |
| 6160 | 6160 | |
| 6161 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6161 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6162 | 6162 | { |
| 6163 | 6163 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6164 | 6164 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6177,12 +6177,12 @@ discard block |
||
| 6177 | 6177 | * @return Array the airport list |
| 6178 | 6178 | * |
| 6179 | 6179 | */ |
| 6180 | - public function countAllDepartureAirportsByCountry($country,$filters = array()) |
|
| 6180 | + public function countAllDepartureAirportsByCountry($country, $filters = array()) |
|
| 6181 | 6181 | { |
| 6182 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6183 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 6182 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6183 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 6184 | 6184 | |
| 6185 | - $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 |
|
| 6185 | + $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 |
|
| 6186 | 6186 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 6187 | 6187 | GROUP BY spotter_output.departure_airport_icao |
| 6188 | 6188 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6194,7 +6194,7 @@ discard block |
||
| 6194 | 6194 | $airport_array = array(); |
| 6195 | 6195 | $temp_array = array(); |
| 6196 | 6196 | |
| 6197 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6197 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6198 | 6198 | { |
| 6199 | 6199 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6200 | 6200 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6215,11 +6215,11 @@ discard block |
||
| 6215 | 6215 | * @return Array the airport list |
| 6216 | 6216 | * |
| 6217 | 6217 | */ |
| 6218 | - public function countAllDepartureAirportCountriesByCountry($country,$filters = array()) |
|
| 6218 | + public function countAllDepartureAirportCountriesByCountry($country, $filters = array()) |
|
| 6219 | 6219 | { |
| 6220 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6221 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 6222 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6220 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6221 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 6222 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6223 | 6223 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 6224 | 6224 | GROUP BY spotter_output.departure_airport_country |
| 6225 | 6225 | ORDER BY airport_departure_country_count DESC"; |
@@ -6231,7 +6231,7 @@ discard block |
||
| 6231 | 6231 | $airport_array = array(); |
| 6232 | 6232 | $temp_array = array(); |
| 6233 | 6233 | |
| 6234 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6234 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6235 | 6235 | { |
| 6236 | 6236 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6237 | 6237 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6249,11 +6249,11 @@ discard block |
||
| 6249 | 6249 | * @return Array the airport list |
| 6250 | 6250 | * |
| 6251 | 6251 | */ |
| 6252 | - public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
|
| 6252 | + public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
| 6253 | 6253 | { |
| 6254 | 6254 | global $globalDBdriver; |
| 6255 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6256 | - $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 |
|
| 6255 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6256 | + $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 |
|
| 6257 | 6257 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'"; |
| 6258 | 6258 | if ($olderthanmonths > 0) { |
| 6259 | 6259 | if ($globalDBdriver == 'mysql') { |
@@ -6288,7 +6288,7 @@ discard block |
||
| 6288 | 6288 | $airport_array = array(); |
| 6289 | 6289 | $temp_array = array(); |
| 6290 | 6290 | |
| 6291 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6291 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6292 | 6292 | { |
| 6293 | 6293 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6294 | 6294 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6311,11 +6311,11 @@ discard block |
||
| 6311 | 6311 | * @return Array the airport list |
| 6312 | 6312 | * |
| 6313 | 6313 | */ |
| 6314 | - public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
|
| 6314 | + public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
| 6315 | 6315 | { |
| 6316 | 6316 | global $globalDBdriver; |
| 6317 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6318 | - $query = "SELECT DISTINCT spotter_output.airline_icao, 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 |
|
| 6317 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6318 | + $query = "SELECT DISTINCT spotter_output.airline_icao, 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 |
|
| 6319 | 6319 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' "; |
| 6320 | 6320 | if ($olderthanmonths > 0) { |
| 6321 | 6321 | if ($globalDBdriver == 'mysql') { |
@@ -6350,7 +6350,7 @@ discard block |
||
| 6350 | 6350 | $airport_array = array(); |
| 6351 | 6351 | $temp_array = array(); |
| 6352 | 6352 | |
| 6353 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6353 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6354 | 6354 | { |
| 6355 | 6355 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 6356 | 6356 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
@@ -6375,11 +6375,11 @@ discard block |
||
| 6375 | 6375 | * @return Array the airport list |
| 6376 | 6376 | * |
| 6377 | 6377 | */ |
| 6378 | - public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
|
| 6378 | + public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
| 6379 | 6379 | { |
| 6380 | 6380 | global $globalDBdriver; |
| 6381 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6382 | - $query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
| 6381 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6382 | + $query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
| 6383 | 6383 | FROM spotter_output, airport".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao"; |
| 6384 | 6384 | if ($olderthanmonths > 0) { |
| 6385 | 6385 | if ($globalDBdriver == 'mysql') { |
@@ -6413,7 +6413,7 @@ discard block |
||
| 6413 | 6413 | $airport_array = array(); |
| 6414 | 6414 | $temp_array = array(); |
| 6415 | 6415 | |
| 6416 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6416 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6417 | 6417 | { |
| 6418 | 6418 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6419 | 6419 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6436,11 +6436,11 @@ discard block |
||
| 6436 | 6436 | * @return Array the airport list |
| 6437 | 6437 | * |
| 6438 | 6438 | */ |
| 6439 | - public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
|
| 6439 | + public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
| 6440 | 6440 | { |
| 6441 | 6441 | global $globalDBdriver; |
| 6442 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6443 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
| 6442 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6443 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
| 6444 | 6444 | FROM spotter_output, airport".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao "; |
| 6445 | 6445 | if ($olderthanmonths > 0) { |
| 6446 | 6446 | if ($globalDBdriver == 'mysql') { |
@@ -6475,7 +6475,7 @@ discard block |
||
| 6475 | 6475 | $airport_array = array(); |
| 6476 | 6476 | $temp_array = array(); |
| 6477 | 6477 | |
| 6478 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6478 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6479 | 6479 | { |
| 6480 | 6480 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6481 | 6481 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6501,9 +6501,9 @@ discard block |
||
| 6501 | 6501 | */ |
| 6502 | 6502 | public function countAllArrivalAirportsByAirline($airline_icao, $filters = array()) |
| 6503 | 6503 | { |
| 6504 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6505 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 6506 | - $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 |
|
| 6504 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6505 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 6506 | + $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 |
|
| 6507 | 6507 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao |
| 6508 | 6508 | GROUP BY spotter_output.arrival_airport_icao |
| 6509 | 6509 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6514,7 +6514,7 @@ discard block |
||
| 6514 | 6514 | $airport_array = array(); |
| 6515 | 6515 | $temp_array = array(); |
| 6516 | 6516 | |
| 6517 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6517 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6518 | 6518 | { |
| 6519 | 6519 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6520 | 6520 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6535,12 +6535,12 @@ discard block |
||
| 6535 | 6535 | * @return Array the airport list |
| 6536 | 6536 | * |
| 6537 | 6537 | */ |
| 6538 | - public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array()) |
|
| 6538 | + public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array()) |
|
| 6539 | 6539 | { |
| 6540 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6541 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 6540 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6541 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 6542 | 6542 | |
| 6543 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6543 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6544 | 6544 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao |
| 6545 | 6545 | GROUP BY spotter_output.arrival_airport_country |
| 6546 | 6546 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6552,7 +6552,7 @@ discard block |
||
| 6552 | 6552 | $airport_array = array(); |
| 6553 | 6553 | $temp_array = array(); |
| 6554 | 6554 | |
| 6555 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6555 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6556 | 6556 | { |
| 6557 | 6557 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 6558 | 6558 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6570,11 +6570,11 @@ discard block |
||
| 6570 | 6570 | * @return Array the airport list |
| 6571 | 6571 | * |
| 6572 | 6572 | */ |
| 6573 | - public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array()) |
|
| 6573 | + public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array()) |
|
| 6574 | 6574 | { |
| 6575 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6576 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 6577 | - $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 |
|
| 6575 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6576 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 6577 | + $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 |
|
| 6578 | 6578 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao |
| 6579 | 6579 | GROUP BY spotter_output.arrival_airport_icao |
| 6580 | 6580 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6586,7 +6586,7 @@ discard block |
||
| 6586 | 6586 | $airport_array = array(); |
| 6587 | 6587 | $temp_array = array(); |
| 6588 | 6588 | |
| 6589 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6589 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6590 | 6590 | { |
| 6591 | 6591 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6592 | 6592 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6608,11 +6608,11 @@ discard block |
||
| 6608 | 6608 | * @return Array the airport list |
| 6609 | 6609 | * |
| 6610 | 6610 | */ |
| 6611 | - public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
|
| 6611 | + public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array()) |
|
| 6612 | 6612 | { |
| 6613 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6614 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 6615 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6613 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6614 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 6615 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6616 | 6616 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 6617 | 6617 | GROUP BY spotter_output.arrival_airport_country |
| 6618 | 6618 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6624,7 +6624,7 @@ discard block |
||
| 6624 | 6624 | $airport_array = array(); |
| 6625 | 6625 | $temp_array = array(); |
| 6626 | 6626 | |
| 6627 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6627 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6628 | 6628 | { |
| 6629 | 6629 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 6630 | 6630 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6642,12 +6642,12 @@ discard block |
||
| 6642 | 6642 | * @return Array the airport list |
| 6643 | 6643 | * |
| 6644 | 6644 | */ |
| 6645 | - public function countAllArrivalAirportsByRegistration($registration,$filters = array()) |
|
| 6645 | + public function countAllArrivalAirportsByRegistration($registration, $filters = array()) |
|
| 6646 | 6646 | { |
| 6647 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6648 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 6647 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6648 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 6649 | 6649 | |
| 6650 | - $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 |
|
| 6650 | + $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 |
|
| 6651 | 6651 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.registration = :registration |
| 6652 | 6652 | GROUP BY spotter_output.arrival_airport_icao |
| 6653 | 6653 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6659,7 +6659,7 @@ discard block |
||
| 6659 | 6659 | $airport_array = array(); |
| 6660 | 6660 | $temp_array = array(); |
| 6661 | 6661 | |
| 6662 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6662 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6663 | 6663 | { |
| 6664 | 6664 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6665 | 6665 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6680,11 +6680,11 @@ discard block |
||
| 6680 | 6680 | * @return Array the airport list |
| 6681 | 6681 | * |
| 6682 | 6682 | */ |
| 6683 | - public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array()) |
|
| 6683 | + public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array()) |
|
| 6684 | 6684 | { |
| 6685 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6686 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 6687 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6685 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6686 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 6687 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6688 | 6688 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration |
| 6689 | 6689 | GROUP BY spotter_output.arrival_airport_country |
| 6690 | 6690 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6696,7 +6696,7 @@ discard block |
||
| 6696 | 6696 | $airport_array = array(); |
| 6697 | 6697 | $temp_array = array(); |
| 6698 | 6698 | |
| 6699 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6699 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6700 | 6700 | { |
| 6701 | 6701 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 6702 | 6702 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6715,11 +6715,11 @@ discard block |
||
| 6715 | 6715 | * @return Array the airport list |
| 6716 | 6716 | * |
| 6717 | 6717 | */ |
| 6718 | - public function countAllArrivalAirportsByAirport($airport_icao,$filters = array()) |
|
| 6718 | + public function countAllArrivalAirportsByAirport($airport_icao, $filters = array()) |
|
| 6719 | 6719 | { |
| 6720 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6721 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 6722 | - $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 |
|
| 6720 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6721 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 6722 | + $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 |
|
| 6723 | 6723 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.departure_airport_icao = :airport_icao |
| 6724 | 6724 | GROUP BY spotter_output.arrival_airport_icao |
| 6725 | 6725 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6731,7 +6731,7 @@ discard block |
||
| 6731 | 6731 | $airport_array = array(); |
| 6732 | 6732 | $temp_array = array(); |
| 6733 | 6733 | |
| 6734 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6734 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6735 | 6735 | { |
| 6736 | 6736 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6737 | 6737 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6752,11 +6752,11 @@ discard block |
||
| 6752 | 6752 | * @return Array the airport list |
| 6753 | 6753 | * |
| 6754 | 6754 | */ |
| 6755 | - public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array()) |
|
| 6755 | + public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array()) |
|
| 6756 | 6756 | { |
| 6757 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6758 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 6759 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6757 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6758 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 6759 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6760 | 6760 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao |
| 6761 | 6761 | GROUP BY spotter_output.arrival_airport_country |
| 6762 | 6762 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6768,7 +6768,7 @@ discard block |
||
| 6768 | 6768 | $airport_array = array(); |
| 6769 | 6769 | $temp_array = array(); |
| 6770 | 6770 | |
| 6771 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6771 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6772 | 6772 | { |
| 6773 | 6773 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 6774 | 6774 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6786,11 +6786,11 @@ discard block |
||
| 6786 | 6786 | * @return Array the airport list |
| 6787 | 6787 | * |
| 6788 | 6788 | */ |
| 6789 | - public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 6789 | + public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 6790 | 6790 | { |
| 6791 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6792 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 6793 | - $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 |
|
| 6791 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6792 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 6793 | + $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 |
|
| 6794 | 6794 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 6795 | 6795 | GROUP BY spotter_output.arrival_airport_icao |
| 6796 | 6796 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6802,7 +6802,7 @@ discard block |
||
| 6802 | 6802 | $airport_array = array(); |
| 6803 | 6803 | $temp_array = array(); |
| 6804 | 6804 | |
| 6805 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6805 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6806 | 6806 | { |
| 6807 | 6807 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6808 | 6808 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6824,11 +6824,11 @@ discard block |
||
| 6824 | 6824 | * @return Array the airport list |
| 6825 | 6825 | * |
| 6826 | 6826 | */ |
| 6827 | - public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 6827 | + public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 6828 | 6828 | { |
| 6829 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6830 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 6831 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6829 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6830 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 6831 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6832 | 6832 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 6833 | 6833 | GROUP BY spotter_output.arrival_airport_country |
| 6834 | 6834 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6840,7 +6840,7 @@ discard block |
||
| 6840 | 6840 | $airport_array = array(); |
| 6841 | 6841 | $temp_array = array(); |
| 6842 | 6842 | |
| 6843 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6843 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6844 | 6844 | { |
| 6845 | 6845 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 6846 | 6846 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6859,11 +6859,11 @@ discard block |
||
| 6859 | 6859 | * @return Array the airport list |
| 6860 | 6860 | * |
| 6861 | 6861 | */ |
| 6862 | - public function countAllArrivalAirportsByDate($date,$filters = array()) |
|
| 6862 | + public function countAllArrivalAirportsByDate($date, $filters = array()) |
|
| 6863 | 6863 | { |
| 6864 | 6864 | global $globalTimezone, $globalDBdriver; |
| 6865 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6866 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 6865 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6866 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 6867 | 6867 | if ($globalTimezone != '') { |
| 6868 | 6868 | date_default_timezone_set($globalTimezone); |
| 6869 | 6869 | $datetime = new DateTime($date); |
@@ -6871,12 +6871,12 @@ discard block |
||
| 6871 | 6871 | } else $offset = '+00:00'; |
| 6872 | 6872 | |
| 6873 | 6873 | if ($globalDBdriver == 'mysql') { |
| 6874 | - $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 |
|
| 6874 | + $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 |
|
| 6875 | 6875 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 6876 | 6876 | GROUP BY spotter_output.arrival_airport_icao |
| 6877 | 6877 | ORDER BY airport_arrival_icao_count DESC"; |
| 6878 | 6878 | } else { |
| 6879 | - $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 |
|
| 6879 | + $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 |
|
| 6880 | 6880 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 6881 | 6881 | GROUP BY spotter_output.arrival_airport_icao |
| 6882 | 6882 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6888,7 +6888,7 @@ discard block |
||
| 6888 | 6888 | $airport_array = array(); |
| 6889 | 6889 | $temp_array = array(); |
| 6890 | 6890 | |
| 6891 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6891 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6892 | 6892 | { |
| 6893 | 6893 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6894 | 6894 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6912,8 +6912,8 @@ discard block |
||
| 6912 | 6912 | public function countAllArrivalAirportCountriesByDate($date, $filters = array()) |
| 6913 | 6913 | { |
| 6914 | 6914 | global $globalTimezone, $globalDBdriver; |
| 6915 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6916 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 6915 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6916 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 6917 | 6917 | if ($globalTimezone != '') { |
| 6918 | 6918 | date_default_timezone_set($globalTimezone); |
| 6919 | 6919 | $datetime = new DateTime($date); |
@@ -6921,12 +6921,12 @@ discard block |
||
| 6921 | 6921 | } else $offset = '+00:00'; |
| 6922 | 6922 | |
| 6923 | 6923 | if ($globalDBdriver == 'mysql') { |
| 6924 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6924 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6925 | 6925 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 6926 | 6926 | GROUP BY spotter_output.arrival_airport_country |
| 6927 | 6927 | ORDER BY airport_arrival_country_count DESC"; |
| 6928 | 6928 | } else { |
| 6929 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6929 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6930 | 6930 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 6931 | 6931 | GROUP BY spotter_output.arrival_airport_country |
| 6932 | 6932 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6938,7 +6938,7 @@ discard block |
||
| 6938 | 6938 | $airport_array = array(); |
| 6939 | 6939 | $temp_array = array(); |
| 6940 | 6940 | |
| 6941 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6941 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6942 | 6942 | { |
| 6943 | 6943 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 6944 | 6944 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6956,11 +6956,11 @@ discard block |
||
| 6956 | 6956 | * @return Array the airport list |
| 6957 | 6957 | * |
| 6958 | 6958 | */ |
| 6959 | - public function countAllArrivalAirportsByIdent($ident,$filters = array()) |
|
| 6959 | + public function countAllArrivalAirportsByIdent($ident, $filters = array()) |
|
| 6960 | 6960 | { |
| 6961 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6962 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 6963 | - $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 |
|
| 6961 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6962 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 6963 | + $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 |
|
| 6964 | 6964 | FROM spotter_output".$filter_query." WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.ident = :ident |
| 6965 | 6965 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6966 | 6966 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6972,7 +6972,7 @@ discard block |
||
| 6972 | 6972 | $airport_array = array(); |
| 6973 | 6973 | $temp_array = array(); |
| 6974 | 6974 | |
| 6975 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6975 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6976 | 6976 | { |
| 6977 | 6977 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6978 | 6978 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6995,9 +6995,9 @@ discard block |
||
| 6995 | 6995 | */ |
| 6996 | 6996 | public function countAllArrivalAirportCountriesByIdent($ident, $filters = array()) |
| 6997 | 6997 | { |
| 6998 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6999 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 7000 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6998 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6999 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 7000 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7001 | 7001 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident |
| 7002 | 7002 | GROUP BY spotter_output.arrival_airport_country |
| 7003 | 7003 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7009,7 +7009,7 @@ discard block |
||
| 7009 | 7009 | $airport_array = array(); |
| 7010 | 7010 | $temp_array = array(); |
| 7011 | 7011 | |
| 7012 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7012 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7013 | 7013 | { |
| 7014 | 7014 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7015 | 7015 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7028,11 +7028,11 @@ discard block |
||
| 7028 | 7028 | * @return Array the airport list |
| 7029 | 7029 | * |
| 7030 | 7030 | */ |
| 7031 | - public function countAllArrivalAirportsByCountry($country,$filters = array()) |
|
| 7031 | + public function countAllArrivalAirportsByCountry($country, $filters = array()) |
|
| 7032 | 7032 | { |
| 7033 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7034 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 7035 | - $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 |
|
| 7033 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7034 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 7035 | + $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 |
|
| 7036 | 7036 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 7037 | 7037 | GROUP BY spotter_output.arrival_airport_icao |
| 7038 | 7038 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7044,7 +7044,7 @@ discard block |
||
| 7044 | 7044 | $airport_array = array(); |
| 7045 | 7045 | $temp_array = array(); |
| 7046 | 7046 | |
| 7047 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7047 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7048 | 7048 | { |
| 7049 | 7049 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7050 | 7050 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7065,11 +7065,11 @@ discard block |
||
| 7065 | 7065 | * @return Array the airport list |
| 7066 | 7066 | * |
| 7067 | 7067 | */ |
| 7068 | - public function countAllArrivalAirportCountriesByCountry($country,$filters = array()) |
|
| 7068 | + public function countAllArrivalAirportCountriesByCountry($country, $filters = array()) |
|
| 7069 | 7069 | { |
| 7070 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7071 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 7072 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7070 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7071 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 7072 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7073 | 7073 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 7074 | 7074 | GROUP BY spotter_output.arrival_airport_country |
| 7075 | 7075 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7081,7 +7081,7 @@ discard block |
||
| 7081 | 7081 | $airport_array = array(); |
| 7082 | 7082 | $temp_array = array(); |
| 7083 | 7083 | |
| 7084 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7084 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7085 | 7085 | { |
| 7086 | 7086 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7087 | 7087 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7102,7 +7102,7 @@ discard block |
||
| 7102 | 7102 | */ |
| 7103 | 7103 | public function countAllDepartureCountries($filters = array()) |
| 7104 | 7104 | { |
| 7105 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7105 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7106 | 7106 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
| 7107 | 7107 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA'"; |
| 7108 | 7108 | $query .= " GROUP BY spotter_output.departure_airport_country |
@@ -7116,7 +7116,7 @@ discard block |
||
| 7116 | 7116 | $airport_array = array(); |
| 7117 | 7117 | $temp_array = array(); |
| 7118 | 7118 | |
| 7119 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7119 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7120 | 7120 | { |
| 7121 | 7121 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
| 7122 | 7122 | $temp_array['airport_departure_country'] = $row['departure_airport_country']; |
@@ -7134,9 +7134,9 @@ discard block |
||
| 7134 | 7134 | * @return Array the airport arrival list |
| 7135 | 7135 | * |
| 7136 | 7136 | */ |
| 7137 | - public function countAllArrivalCountries($limit = true,$filters = array()) |
|
| 7137 | + public function countAllArrivalCountries($limit = true, $filters = array()) |
|
| 7138 | 7138 | { |
| 7139 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7139 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7140 | 7140 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
| 7141 | 7141 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'"; |
| 7142 | 7142 | $query .= " GROUP BY spotter_output.arrival_airport_country |
@@ -7150,7 +7150,7 @@ discard block |
||
| 7150 | 7150 | $airport_array = array(); |
| 7151 | 7151 | $temp_array = array(); |
| 7152 | 7152 | |
| 7153 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7153 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7154 | 7154 | { |
| 7155 | 7155 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
| 7156 | 7156 | $temp_array['airport_arrival_country'] = $row['arrival_airport_country']; |
@@ -7173,8 +7173,8 @@ discard block |
||
| 7173 | 7173 | */ |
| 7174 | 7174 | public function countAllRoutes($filters = array()) |
| 7175 | 7175 | { |
| 7176 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7177 | - $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 |
|
| 7176 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7177 | + $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 |
|
| 7178 | 7178 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> 'NA' |
| 7179 | 7179 | GROUP BY route,spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 7180 | 7180 | ORDER BY route_count DESC |
@@ -7187,7 +7187,7 @@ discard block |
||
| 7187 | 7187 | $routes_array = array(); |
| 7188 | 7188 | $temp_array = array(); |
| 7189 | 7189 | |
| 7190 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7190 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7191 | 7191 | { |
| 7192 | 7192 | $temp_array['route_count'] = $row['route_count']; |
| 7193 | 7193 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7214,11 +7214,11 @@ discard block |
||
| 7214 | 7214 | * @return Array the route list |
| 7215 | 7215 | * |
| 7216 | 7216 | */ |
| 7217 | - public function countAllRoutesByAircraft($aircraft_icao,$filters = array()) |
|
| 7217 | + public function countAllRoutesByAircraft($aircraft_icao, $filters = array()) |
|
| 7218 | 7218 | { |
| 7219 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7220 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 7221 | - $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 |
|
| 7219 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7220 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 7221 | + $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 |
|
| 7222 | 7222 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 7223 | 7223 | GROUP BY route |
| 7224 | 7224 | ORDER BY route_count DESC"; |
@@ -7229,7 +7229,7 @@ discard block |
||
| 7229 | 7229 | $routes_array = array(); |
| 7230 | 7230 | $temp_array = array(); |
| 7231 | 7231 | |
| 7232 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7232 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7233 | 7233 | { |
| 7234 | 7234 | $temp_array['route_count'] = $row['route_count']; |
| 7235 | 7235 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7256,9 +7256,9 @@ discard block |
||
| 7256 | 7256 | */ |
| 7257 | 7257 | public function countAllRoutesByRegistration($registration, $filters = array()) |
| 7258 | 7258 | { |
| 7259 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7259 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7260 | 7260 | $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
| 7261 | - $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 |
|
| 7261 | + $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 |
|
| 7262 | 7262 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration |
| 7263 | 7263 | GROUP BY route |
| 7264 | 7264 | ORDER BY route_count DESC"; |
@@ -7270,7 +7270,7 @@ discard block |
||
| 7270 | 7270 | $routes_array = array(); |
| 7271 | 7271 | $temp_array = array(); |
| 7272 | 7272 | |
| 7273 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7273 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7274 | 7274 | { |
| 7275 | 7275 | $temp_array['route_count'] = $row['route_count']; |
| 7276 | 7276 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7298,9 +7298,9 @@ discard block |
||
| 7298 | 7298 | */ |
| 7299 | 7299 | public function countAllRoutesByAirline($airline_icao, $filters = array()) |
| 7300 | 7300 | { |
| 7301 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7302 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 7303 | - $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 |
|
| 7301 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7302 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 7303 | + $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 |
|
| 7304 | 7304 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao |
| 7305 | 7305 | GROUP BY route |
| 7306 | 7306 | ORDER BY route_count DESC"; |
@@ -7312,7 +7312,7 @@ discard block |
||
| 7312 | 7312 | $routes_array = array(); |
| 7313 | 7313 | $temp_array = array(); |
| 7314 | 7314 | |
| 7315 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7315 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7316 | 7316 | { |
| 7317 | 7317 | $temp_array['route_count'] = $row['route_count']; |
| 7318 | 7318 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7340,9 +7340,9 @@ discard block |
||
| 7340 | 7340 | */ |
| 7341 | 7341 | public function countAllRoutesByAirport($airport_icao, $filters = array()) |
| 7342 | 7342 | { |
| 7343 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7344 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 7345 | - $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 |
|
| 7343 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7344 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 7345 | + $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 |
|
| 7346 | 7346 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 7347 | 7347 | GROUP BY route |
| 7348 | 7348 | ORDER BY route_count DESC"; |
@@ -7353,7 +7353,7 @@ discard block |
||
| 7353 | 7353 | $routes_array = array(); |
| 7354 | 7354 | $temp_array = array(); |
| 7355 | 7355 | |
| 7356 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7356 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7357 | 7357 | { |
| 7358 | 7358 | $temp_array['route_count'] = $row['route_count']; |
| 7359 | 7359 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7381,9 +7381,9 @@ discard block |
||
| 7381 | 7381 | */ |
| 7382 | 7382 | public function countAllRoutesByCountry($country, $filters = array()) |
| 7383 | 7383 | { |
| 7384 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7385 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 7386 | - $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 |
|
| 7384 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7385 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 7386 | + $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 |
|
| 7387 | 7387 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 7388 | 7388 | GROUP BY route |
| 7389 | 7389 | ORDER BY route_count DESC"; |
@@ -7394,7 +7394,7 @@ discard block |
||
| 7394 | 7394 | $routes_array = array(); |
| 7395 | 7395 | $temp_array = array(); |
| 7396 | 7396 | |
| 7397 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7397 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7398 | 7398 | { |
| 7399 | 7399 | $temp_array['route_count'] = $row['route_count']; |
| 7400 | 7400 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7422,8 +7422,8 @@ discard block |
||
| 7422 | 7422 | public function countAllRoutesByDate($date, $filters = array()) |
| 7423 | 7423 | { |
| 7424 | 7424 | global $globalTimezone, $globalDBdriver; |
| 7425 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7426 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 7425 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7426 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 7427 | 7427 | if ($globalTimezone != '') { |
| 7428 | 7428 | date_default_timezone_set($globalTimezone); |
| 7429 | 7429 | $datetime = new DateTime($date); |
@@ -7431,12 +7431,12 @@ discard block |
||
| 7431 | 7431 | } else $offset = '+00:00'; |
| 7432 | 7432 | |
| 7433 | 7433 | if ($globalDBdriver == 'mysql') { |
| 7434 | - $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 |
|
| 7434 | + $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 |
|
| 7435 | 7435 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 7436 | 7436 | GROUP BY route |
| 7437 | 7437 | ORDER BY route_count DESC"; |
| 7438 | 7438 | } else { |
| 7439 | - $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 |
|
| 7439 | + $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 |
|
| 7440 | 7440 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 7441 | 7441 | GROUP BY route |
| 7442 | 7442 | ORDER BY route_count DESC"; |
@@ -7448,7 +7448,7 @@ discard block |
||
| 7448 | 7448 | $routes_array = array(); |
| 7449 | 7449 | $temp_array = array(); |
| 7450 | 7450 | |
| 7451 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7451 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7452 | 7452 | { |
| 7453 | 7453 | $temp_array['route_count'] = $row['route_count']; |
| 7454 | 7454 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7475,9 +7475,9 @@ discard block |
||
| 7475 | 7475 | */ |
| 7476 | 7476 | public function countAllRoutesByIdent($ident, $filters = array()) |
| 7477 | 7477 | { |
| 7478 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7479 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 7480 | - $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 |
|
| 7478 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7479 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 7480 | + $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 |
|
| 7481 | 7481 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident |
| 7482 | 7482 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7483 | 7483 | ORDER BY route_count DESC"; |
@@ -7489,7 +7489,7 @@ discard block |
||
| 7489 | 7489 | $routes_array = array(); |
| 7490 | 7490 | $temp_array = array(); |
| 7491 | 7491 | |
| 7492 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7492 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7493 | 7493 | { |
| 7494 | 7494 | $temp_array['route_count'] = $row['route_count']; |
| 7495 | 7495 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7516,9 +7516,9 @@ discard block |
||
| 7516 | 7516 | */ |
| 7517 | 7517 | public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array()) |
| 7518 | 7518 | { |
| 7519 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7520 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 7521 | - $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 |
|
| 7519 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7520 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 7521 | + $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 |
|
| 7522 | 7522 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 7523 | 7523 | GROUP BY route |
| 7524 | 7524 | ORDER BY route_count DESC"; |
@@ -7530,7 +7530,7 @@ discard block |
||
| 7530 | 7530 | $routes_array = array(); |
| 7531 | 7531 | $temp_array = array(); |
| 7532 | 7532 | |
| 7533 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7533 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7534 | 7534 | { |
| 7535 | 7535 | $temp_array['route_count'] = $row['route_count']; |
| 7536 | 7536 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7558,8 +7558,8 @@ discard block |
||
| 7558 | 7558 | */ |
| 7559 | 7559 | public function countAllRoutesWithWaypoints($filters = array()) |
| 7560 | 7560 | { |
| 7561 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7562 | - $query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, 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 |
|
| 7561 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7562 | + $query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, 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 |
|
| 7563 | 7563 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' |
| 7564 | 7564 | GROUP BY route, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7565 | 7565 | ORDER BY route_count DESC |
@@ -7572,7 +7572,7 @@ discard block |
||
| 7572 | 7572 | $routes_array = array(); |
| 7573 | 7573 | $temp_array = array(); |
| 7574 | 7574 | |
| 7575 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7575 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7576 | 7576 | { |
| 7577 | 7577 | $temp_array['spotter_id'] = $row['spotter_id']; |
| 7578 | 7578 | $temp_array['route_count'] = $row['route_count']; |
@@ -7597,11 +7597,11 @@ discard block |
||
| 7597 | 7597 | * @return Array the callsign list |
| 7598 | 7598 | * |
| 7599 | 7599 | */ |
| 7600 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 7600 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 7601 | 7601 | { |
| 7602 | 7602 | global $globalDBdriver; |
| 7603 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7604 | - $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
|
| 7603 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7604 | + $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
|
| 7605 | 7605 | FROM spotter_output".$filter_query." spotter_output.ident <> '' "; |
| 7606 | 7606 | if ($olderthanmonths > 0) { |
| 7607 | 7607 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -7620,7 +7620,7 @@ discard block |
||
| 7620 | 7620 | $callsign_array = array(); |
| 7621 | 7621 | $temp_array = array(); |
| 7622 | 7622 | |
| 7623 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7623 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7624 | 7624 | { |
| 7625 | 7625 | $temp_array['callsign_icao'] = $row['ident']; |
| 7626 | 7626 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -7642,8 +7642,8 @@ discard block |
||
| 7642 | 7642 | public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
| 7643 | 7643 | { |
| 7644 | 7644 | global $globalDBdriver; |
| 7645 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7646 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
|
| 7645 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7646 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
|
| 7647 | 7647 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
| 7648 | 7648 | if ($olderthanmonths > 0) { |
| 7649 | 7649 | if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
@@ -7662,7 +7662,7 @@ discard block |
||
| 7662 | 7662 | $callsign_array = array(); |
| 7663 | 7663 | $temp_array = array(); |
| 7664 | 7664 | |
| 7665 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7665 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7666 | 7666 | { |
| 7667 | 7667 | $temp_array['callsign_icao'] = $row['ident']; |
| 7668 | 7668 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -7716,7 +7716,7 @@ discard block |
||
| 7716 | 7716 | $date_array = array(); |
| 7717 | 7717 | $temp_array = array(); |
| 7718 | 7718 | |
| 7719 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7719 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7720 | 7720 | { |
| 7721 | 7721 | $temp_array['date_name'] = $row['date_name']; |
| 7722 | 7722 | $temp_array['date_count'] = $row['date_count']; |
@@ -7741,15 +7741,15 @@ discard block |
||
| 7741 | 7741 | $datetime = new DateTime(); |
| 7742 | 7742 | $offset = $datetime->format('P'); |
| 7743 | 7743 | } else $offset = '+00:00'; |
| 7744 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7744 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7745 | 7745 | if ($globalDBdriver == 'mysql') { |
| 7746 | - $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 7746 | + $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 7747 | 7747 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 7748 | 7748 | GROUP BY spotter_output.airline_icao, date_name |
| 7749 | 7749 | ORDER BY date_count DESC |
| 7750 | 7750 | LIMIT 10 OFFSET 0"; |
| 7751 | 7751 | } else { |
| 7752 | - $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 7752 | + $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 7753 | 7753 | FROM spotter_output |
| 7754 | 7754 | WHERE spotter_output.airline_icao <> '' |
| 7755 | 7755 | GROUP BY spotter_output.airline_icao, date_name |
@@ -7764,7 +7764,7 @@ discard block |
||
| 7764 | 7764 | $date_array = array(); |
| 7765 | 7765 | $temp_array = array(); |
| 7766 | 7766 | |
| 7767 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7767 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7768 | 7768 | { |
| 7769 | 7769 | $temp_array['date_name'] = $row['date_name']; |
| 7770 | 7770 | $temp_array['date_count'] = $row['date_count']; |
@@ -7790,7 +7790,7 @@ discard block |
||
| 7790 | 7790 | $datetime = new DateTime(); |
| 7791 | 7791 | $offset = $datetime->format('P'); |
| 7792 | 7792 | } else $offset = '+00:00'; |
| 7793 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7793 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7794 | 7794 | if ($globalDBdriver == 'mysql') { |
| 7795 | 7795 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 7796 | 7796 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -7811,7 +7811,7 @@ discard block |
||
| 7811 | 7811 | $date_array = array(); |
| 7812 | 7812 | $temp_array = array(); |
| 7813 | 7813 | |
| 7814 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7814 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7815 | 7815 | { |
| 7816 | 7816 | $temp_array['date_name'] = $row['date_name']; |
| 7817 | 7817 | $temp_array['date_count'] = $row['date_count']; |
@@ -7836,7 +7836,7 @@ discard block |
||
| 7836 | 7836 | $datetime = new DateTime(); |
| 7837 | 7837 | $offset = $datetime->format('P'); |
| 7838 | 7838 | } else $offset = '+00:00'; |
| 7839 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7839 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7840 | 7840 | if ($globalDBdriver == 'mysql') { |
| 7841 | 7841 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 7842 | 7842 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -7857,7 +7857,7 @@ discard block |
||
| 7857 | 7857 | $date_array = array(); |
| 7858 | 7858 | $temp_array = array(); |
| 7859 | 7859 | |
| 7860 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7860 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7861 | 7861 | { |
| 7862 | 7862 | $temp_array['date_name'] = $row['date_name']; |
| 7863 | 7863 | $temp_array['date_count'] = $row['date_count']; |
@@ -7878,7 +7878,7 @@ discard block |
||
| 7878 | 7878 | public function countAllDatesLastMonthByAirlines($filters = array()) |
| 7879 | 7879 | { |
| 7880 | 7880 | global $globalTimezone, $globalDBdriver; |
| 7881 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7881 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7882 | 7882 | if ($globalTimezone != '') { |
| 7883 | 7883 | date_default_timezone_set($globalTimezone); |
| 7884 | 7884 | $datetime = new DateTime(); |
@@ -7886,13 +7886,13 @@ discard block |
||
| 7886 | 7886 | } else $offset = '+00:00'; |
| 7887 | 7887 | |
| 7888 | 7888 | if ($globalDBdriver == 'mysql') { |
| 7889 | - $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 7889 | + $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 7890 | 7890 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH) |
| 7891 | 7891 | GROUP BY spotter_output.airline_icao, date_name |
| 7892 | 7892 | ORDER BY spotter_output.date ASC"; |
| 7893 | 7893 | $query_data = array(':offset' => $offset); |
| 7894 | 7894 | } else { |
| 7895 | - $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 7895 | + $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 7896 | 7896 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS' |
| 7897 | 7897 | GROUP BY spotter_output.airline_icao, date_name |
| 7898 | 7898 | ORDER BY date_name ASC"; |
@@ -7905,7 +7905,7 @@ discard block |
||
| 7905 | 7905 | $date_array = array(); |
| 7906 | 7906 | $temp_array = array(); |
| 7907 | 7907 | |
| 7908 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7908 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7909 | 7909 | { |
| 7910 | 7910 | $temp_array['date_name'] = $row['date_name']; |
| 7911 | 7911 | $temp_array['date_count'] = $row['date_count']; |
@@ -7952,7 +7952,7 @@ discard block |
||
| 7952 | 7952 | $date_array = array(); |
| 7953 | 7953 | $temp_array = array(); |
| 7954 | 7954 | |
| 7955 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7955 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7956 | 7956 | { |
| 7957 | 7957 | $temp_array['month_name'] = $row['month_name']; |
| 7958 | 7958 | $temp_array['year_name'] = $row['year_name']; |
@@ -7973,7 +7973,7 @@ discard block |
||
| 7973 | 7973 | public function countAllMonthsByAirlines($filters = array()) |
| 7974 | 7974 | { |
| 7975 | 7975 | global $globalTimezone, $globalDBdriver; |
| 7976 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7976 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7977 | 7977 | if ($globalTimezone != '') { |
| 7978 | 7978 | date_default_timezone_set($globalTimezone); |
| 7979 | 7979 | $datetime = new DateTime(); |
@@ -7981,12 +7981,12 @@ discard block |
||
| 7981 | 7981 | } else $offset = '+00:00'; |
| 7982 | 7982 | |
| 7983 | 7983 | if ($globalDBdriver == 'mysql') { |
| 7984 | - $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 |
|
| 7984 | + $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 |
|
| 7985 | 7985 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 7986 | 7986 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 7987 | 7987 | ORDER BY date_count DESC"; |
| 7988 | 7988 | } else { |
| 7989 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 7989 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 7990 | 7990 | FROM spotter_output |
| 7991 | 7991 | WHERE spotter_output.airline_icao <> '' |
| 7992 | 7992 | GROUP BY spotter_output.airline_icao, year_name, month_name |
@@ -8000,7 +8000,7 @@ discard block |
||
| 8000 | 8000 | $date_array = array(); |
| 8001 | 8001 | $temp_array = array(); |
| 8002 | 8002 | |
| 8003 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8003 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8004 | 8004 | { |
| 8005 | 8005 | $temp_array['month_name'] = $row['month_name']; |
| 8006 | 8006 | $temp_array['year_name'] = $row['year_name']; |
@@ -8027,14 +8027,14 @@ discard block |
||
| 8027 | 8027 | $datetime = new DateTime(); |
| 8028 | 8028 | $offset = $datetime->format('P'); |
| 8029 | 8029 | } else $offset = '+00:00'; |
| 8030 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8030 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8031 | 8031 | if ($globalDBdriver == 'mysql') { |
| 8032 | - $query = "SELECT YEAR(CONVERT_TZ(s.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(s.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
| 8032 | + $query = "SELECT YEAR(CONVERT_TZ(s.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(s.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
| 8033 | 8033 | FROM spotter_output s".$filter_query." s.airline_type = 'military' |
| 8034 | 8034 | GROUP BY year_name, month_name |
| 8035 | 8035 | ORDER BY date_count DESC"; |
| 8036 | 8036 | } else { |
| 8037 | - $query = "SELECT EXTRACT(YEAR FROM s.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM s.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 8037 | + $query = "SELECT EXTRACT(YEAR FROM s.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM s.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 8038 | 8038 | FROM spotter_output s".$filter_query." s.airline_type = 'military' |
| 8039 | 8039 | GROUP BY year_name, month_name |
| 8040 | 8040 | ORDER BY date_count DESC"; |
@@ -8046,7 +8046,7 @@ discard block |
||
| 8046 | 8046 | $date_array = array(); |
| 8047 | 8047 | $temp_array = array(); |
| 8048 | 8048 | |
| 8049 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8049 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8050 | 8050 | { |
| 8051 | 8051 | $temp_array['month_name'] = $row['month_name']; |
| 8052 | 8052 | $temp_array['year_name'] = $row['year_name']; |
@@ -8072,15 +8072,15 @@ discard block |
||
| 8072 | 8072 | $datetime = new DateTime(); |
| 8073 | 8073 | $offset = $datetime->format('P'); |
| 8074 | 8074 | } else $offset = '+00:00'; |
| 8075 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8075 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8076 | 8076 | |
| 8077 | 8077 | if ($globalDBdriver == 'mysql') { |
| 8078 | - $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 owner_name) as date_count |
|
| 8078 | + $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 owner_name) as date_count |
|
| 8079 | 8079 | FROM spotter_output".$filter_query." owner_name <> '' |
| 8080 | 8080 | GROUP BY year_name, month_name |
| 8081 | 8081 | ORDER BY date_count DESC"; |
| 8082 | 8082 | } else { |
| 8083 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 8083 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 8084 | 8084 | FROM spotter_output".$filter_query." owner_name <> '' |
| 8085 | 8085 | GROUP BY year_name, month_name |
| 8086 | 8086 | ORDER BY date_count DESC"; |
@@ -8092,7 +8092,7 @@ discard block |
||
| 8092 | 8092 | $date_array = array(); |
| 8093 | 8093 | $temp_array = array(); |
| 8094 | 8094 | |
| 8095 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8095 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8096 | 8096 | { |
| 8097 | 8097 | $temp_array['month_name'] = $row['month_name']; |
| 8098 | 8098 | $temp_array['year_name'] = $row['year_name']; |
@@ -8113,7 +8113,7 @@ discard block |
||
| 8113 | 8113 | public function countAllMonthsOwnersByAirlines($filters = array()) |
| 8114 | 8114 | { |
| 8115 | 8115 | global $globalTimezone, $globalDBdriver; |
| 8116 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8116 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8117 | 8117 | if ($globalTimezone != '') { |
| 8118 | 8118 | date_default_timezone_set($globalTimezone); |
| 8119 | 8119 | $datetime = new DateTime(); |
@@ -8121,12 +8121,12 @@ discard block |
||
| 8121 | 8121 | } else $offset = '+00:00'; |
| 8122 | 8122 | |
| 8123 | 8123 | if ($globalDBdriver == 'mysql') { |
| 8124 | - $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 |
|
| 8124 | + $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 |
|
| 8125 | 8125 | FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' |
| 8126 | 8126 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8127 | 8127 | ORDER BY date_count DESC"; |
| 8128 | 8128 | } else { |
| 8129 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 8129 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 8130 | 8130 | FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' |
| 8131 | 8131 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8132 | 8132 | ORDER BY date_count DESC"; |
@@ -8138,7 +8138,7 @@ discard block |
||
| 8138 | 8138 | $date_array = array(); |
| 8139 | 8139 | $temp_array = array(); |
| 8140 | 8140 | |
| 8141 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8141 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8142 | 8142 | { |
| 8143 | 8143 | $temp_array['month_name'] = $row['month_name']; |
| 8144 | 8144 | $temp_array['year_name'] = $row['year_name']; |
@@ -8165,15 +8165,15 @@ discard block |
||
| 8165 | 8165 | $datetime = new DateTime(); |
| 8166 | 8166 | $offset = $datetime->format('P'); |
| 8167 | 8167 | } else $offset = '+00:00'; |
| 8168 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8168 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8169 | 8169 | |
| 8170 | 8170 | if ($globalDBdriver == 'mysql') { |
| 8171 | - $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 pilot_id) as date_count |
|
| 8171 | + $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 pilot_id) as date_count |
|
| 8172 | 8172 | FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL |
| 8173 | 8173 | GROUP BY year_name, month_name |
| 8174 | 8174 | ORDER BY date_count DESC"; |
| 8175 | 8175 | } else { |
| 8176 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 8176 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 8177 | 8177 | FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL |
| 8178 | 8178 | GROUP BY year_name, month_name |
| 8179 | 8179 | ORDER BY date_count DESC"; |
@@ -8185,7 +8185,7 @@ discard block |
||
| 8185 | 8185 | $date_array = array(); |
| 8186 | 8186 | $temp_array = array(); |
| 8187 | 8187 | |
| 8188 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8188 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8189 | 8189 | { |
| 8190 | 8190 | $temp_array['month_name'] = $row['month_name']; |
| 8191 | 8191 | $temp_array['year_name'] = $row['year_name']; |
@@ -8206,7 +8206,7 @@ discard block |
||
| 8206 | 8206 | public function countAllMonthsPilotsByAirlines($filters = array()) |
| 8207 | 8207 | { |
| 8208 | 8208 | global $globalTimezone, $globalDBdriver; |
| 8209 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8209 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8210 | 8210 | if ($globalTimezone != '') { |
| 8211 | 8211 | date_default_timezone_set($globalTimezone); |
| 8212 | 8212 | $datetime = new DateTime(); |
@@ -8214,12 +8214,12 @@ discard block |
||
| 8214 | 8214 | } else $offset = '+00:00'; |
| 8215 | 8215 | |
| 8216 | 8216 | if ($globalDBdriver == 'mysql') { |
| 8217 | - $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 |
|
| 8217 | + $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 |
|
| 8218 | 8218 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL |
| 8219 | 8219 | GROUP BY spotter_output.airline_icao,year_name, month_name |
| 8220 | 8220 | ORDER BY date_count DESC"; |
| 8221 | 8221 | } else { |
| 8222 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 8222 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 8223 | 8223 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL |
| 8224 | 8224 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8225 | 8225 | ORDER BY date_count DESC"; |
@@ -8231,7 +8231,7 @@ discard block |
||
| 8231 | 8231 | $date_array = array(); |
| 8232 | 8232 | $temp_array = array(); |
| 8233 | 8233 | |
| 8234 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8234 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8235 | 8235 | { |
| 8236 | 8236 | $temp_array['month_name'] = $row['month_name']; |
| 8237 | 8237 | $temp_array['year_name'] = $row['year_name']; |
@@ -8253,7 +8253,7 @@ discard block |
||
| 8253 | 8253 | public function countAllMonthsAirlines($filters = array()) |
| 8254 | 8254 | { |
| 8255 | 8255 | global $globalTimezone, $globalDBdriver; |
| 8256 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8256 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8257 | 8257 | if ($globalTimezone != '') { |
| 8258 | 8258 | date_default_timezone_set($globalTimezone); |
| 8259 | 8259 | $datetime = new DateTime(); |
@@ -8261,12 +8261,12 @@ discard block |
||
| 8261 | 8261 | } else $offset = '+00:00'; |
| 8262 | 8262 | |
| 8263 | 8263 | if ($globalDBdriver == 'mysql') { |
| 8264 | - $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 |
|
| 8264 | + $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 |
|
| 8265 | 8265 | FROM spotter_output".$filter_query." airline_icao <> '' |
| 8266 | 8266 | GROUP BY year_name, month_name |
| 8267 | 8267 | ORDER BY date_count DESC"; |
| 8268 | 8268 | } else { |
| 8269 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count |
|
| 8269 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count |
|
| 8270 | 8270 | FROM spotter_output".$filter_query." airline_icao <> '' |
| 8271 | 8271 | GROUP BY year_name, month_name |
| 8272 | 8272 | ORDER BY date_count DESC"; |
@@ -8278,7 +8278,7 @@ discard block |
||
| 8278 | 8278 | $date_array = array(); |
| 8279 | 8279 | $temp_array = array(); |
| 8280 | 8280 | |
| 8281 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8281 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8282 | 8282 | { |
| 8283 | 8283 | $temp_array['month_name'] = $row['month_name']; |
| 8284 | 8284 | $temp_array['year_name'] = $row['year_name']; |
@@ -8304,15 +8304,15 @@ discard block |
||
| 8304 | 8304 | $datetime = new DateTime(); |
| 8305 | 8305 | $offset = $datetime->format('P'); |
| 8306 | 8306 | } else $offset = '+00:00'; |
| 8307 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8307 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8308 | 8308 | |
| 8309 | 8309 | if ($globalDBdriver == 'mysql') { |
| 8310 | - $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 aircraft_icao) as date_count |
|
| 8310 | + $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 aircraft_icao) as date_count |
|
| 8311 | 8311 | FROM spotter_output".$filter_query." aircraft_icao <> '' |
| 8312 | 8312 | GROUP BY year_name, month_name |
| 8313 | 8313 | ORDER BY date_count DESC"; |
| 8314 | 8314 | } else { |
| 8315 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8315 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8316 | 8316 | FROM spotter_output".$filter_query." aircraft_icao <> '' |
| 8317 | 8317 | GROUP BY year_name, month_name |
| 8318 | 8318 | ORDER BY date_count DESC"; |
@@ -8324,7 +8324,7 @@ discard block |
||
| 8324 | 8324 | $date_array = array(); |
| 8325 | 8325 | $temp_array = array(); |
| 8326 | 8326 | |
| 8327 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8327 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8328 | 8328 | { |
| 8329 | 8329 | $temp_array['month_name'] = $row['month_name']; |
| 8330 | 8330 | $temp_array['year_name'] = $row['year_name']; |
@@ -8346,7 +8346,7 @@ discard block |
||
| 8346 | 8346 | public function countAllMonthsAircraftsByAirlines($filters = array()) |
| 8347 | 8347 | { |
| 8348 | 8348 | global $globalTimezone, $globalDBdriver; |
| 8349 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8349 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8350 | 8350 | if ($globalTimezone != '') { |
| 8351 | 8351 | date_default_timezone_set($globalTimezone); |
| 8352 | 8352 | $datetime = new DateTime(); |
@@ -8354,12 +8354,12 @@ discard block |
||
| 8354 | 8354 | } else $offset = '+00:00'; |
| 8355 | 8355 | |
| 8356 | 8356 | if ($globalDBdriver == 'mysql') { |
| 8357 | - $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 |
|
| 8357 | + $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 |
|
| 8358 | 8358 | FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' |
| 8359 | 8359 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8360 | 8360 | ORDER BY date_count DESC"; |
| 8361 | 8361 | } else { |
| 8362 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8362 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8363 | 8363 | FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' |
| 8364 | 8364 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8365 | 8365 | ORDER BY date_count DESC"; |
@@ -8371,7 +8371,7 @@ discard block |
||
| 8371 | 8371 | $date_array = array(); |
| 8372 | 8372 | $temp_array = array(); |
| 8373 | 8373 | |
| 8374 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8374 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8375 | 8375 | { |
| 8376 | 8376 | $temp_array['month_name'] = $row['month_name']; |
| 8377 | 8377 | $temp_array['year_name'] = $row['year_name']; |
@@ -8398,15 +8398,15 @@ discard block |
||
| 8398 | 8398 | $datetime = new DateTime(); |
| 8399 | 8399 | $offset = $datetime->format('P'); |
| 8400 | 8400 | } else $offset = '+00:00'; |
| 8401 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8401 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8402 | 8402 | |
| 8403 | 8403 | if ($globalDBdriver == 'mysql') { |
| 8404 | - $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(real_arrival_airport_icao) as date_count |
|
| 8404 | + $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(real_arrival_airport_icao) as date_count |
|
| 8405 | 8405 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' |
| 8406 | 8406 | GROUP BY year_name, month_name |
| 8407 | 8407 | ORDER BY date_count DESC"; |
| 8408 | 8408 | } else { |
| 8409 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8409 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8410 | 8410 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' |
| 8411 | 8411 | GROUP BY year_name, month_name |
| 8412 | 8412 | ORDER BY date_count DESC"; |
@@ -8418,7 +8418,7 @@ discard block |
||
| 8418 | 8418 | $date_array = array(); |
| 8419 | 8419 | $temp_array = array(); |
| 8420 | 8420 | |
| 8421 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8421 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8422 | 8422 | { |
| 8423 | 8423 | $temp_array['month_name'] = $row['month_name']; |
| 8424 | 8424 | $temp_array['year_name'] = $row['year_name']; |
@@ -8440,7 +8440,7 @@ discard block |
||
| 8440 | 8440 | public function countAllMonthsRealArrivalsByAirlines($filters = array()) |
| 8441 | 8441 | { |
| 8442 | 8442 | global $globalTimezone, $globalDBdriver; |
| 8443 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8443 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8444 | 8444 | if ($globalTimezone != '') { |
| 8445 | 8445 | date_default_timezone_set($globalTimezone); |
| 8446 | 8446 | $datetime = new DateTime(); |
@@ -8448,12 +8448,12 @@ discard block |
||
| 8448 | 8448 | } else $offset = '+00:00'; |
| 8449 | 8449 | |
| 8450 | 8450 | if ($globalDBdriver == 'mysql') { |
| 8451 | - $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 |
|
| 8451 | + $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 |
|
| 8452 | 8452 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' |
| 8453 | 8453 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8454 | 8454 | ORDER BY date_count DESC"; |
| 8455 | 8455 | } else { |
| 8456 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8456 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8457 | 8457 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' |
| 8458 | 8458 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8459 | 8459 | ORDER BY date_count DESC"; |
@@ -8465,7 +8465,7 @@ discard block |
||
| 8465 | 8465 | $date_array = array(); |
| 8466 | 8466 | $temp_array = array(); |
| 8467 | 8467 | |
| 8468 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8468 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8469 | 8469 | { |
| 8470 | 8470 | $temp_array['month_name'] = $row['month_name']; |
| 8471 | 8471 | $temp_array['year_name'] = $row['year_name']; |
@@ -8493,7 +8493,7 @@ discard block |
||
| 8493 | 8493 | $datetime = new DateTime(); |
| 8494 | 8494 | $offset = $datetime->format('P'); |
| 8495 | 8495 | } else $offset = '+00:00'; |
| 8496 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8496 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8497 | 8497 | if ($globalDBdriver == 'mysql') { |
| 8498 | 8498 | $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 |
| 8499 | 8499 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -8514,7 +8514,7 @@ discard block |
||
| 8514 | 8514 | $date_array = array(); |
| 8515 | 8515 | $temp_array = array(); |
| 8516 | 8516 | |
| 8517 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8517 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8518 | 8518 | { |
| 8519 | 8519 | $temp_array['year_name'] = $row['year_name']; |
| 8520 | 8520 | $temp_array['month_name'] = $row['month_name']; |
@@ -8534,7 +8534,7 @@ discard block |
||
| 8534 | 8534 | * @return Array the hour list |
| 8535 | 8535 | * |
| 8536 | 8536 | */ |
| 8537 | - public function countAllHours($orderby,$filters = array()) |
|
| 8537 | + public function countAllHours($orderby, $filters = array()) |
|
| 8538 | 8538 | { |
| 8539 | 8539 | global $globalTimezone, $globalDBdriver; |
| 8540 | 8540 | if ($globalTimezone != '') { |
@@ -8582,7 +8582,7 @@ discard block |
||
| 8582 | 8582 | $hour_array = array(); |
| 8583 | 8583 | $temp_array = array(); |
| 8584 | 8584 | |
| 8585 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8585 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8586 | 8586 | { |
| 8587 | 8587 | $temp_array['hour_name'] = $row['hour_name']; |
| 8588 | 8588 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8602,7 +8602,7 @@ discard block |
||
| 8602 | 8602 | public function countAllHoursByAirlines($orderby, $filters = array()) |
| 8603 | 8603 | { |
| 8604 | 8604 | global $globalTimezone, $globalDBdriver; |
| 8605 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8605 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8606 | 8606 | if ($globalTimezone != '') { |
| 8607 | 8607 | date_default_timezone_set($globalTimezone); |
| 8608 | 8608 | $datetime = new DateTime(); |
@@ -8620,7 +8620,7 @@ discard block |
||
| 8620 | 8620 | } |
| 8621 | 8621 | |
| 8622 | 8622 | if ($globalDBdriver == 'mysql') { |
| 8623 | - $query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8623 | + $query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8624 | 8624 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 8625 | 8625 | GROUP BY spotter_output.airline_icao, hour_name |
| 8626 | 8626 | ".$orderby_sql; |
@@ -8633,7 +8633,7 @@ discard block |
||
| 8633 | 8633 | */ |
| 8634 | 8634 | $query_data = array(':offset' => $offset); |
| 8635 | 8635 | } else { |
| 8636 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8636 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8637 | 8637 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 8638 | 8638 | GROUP BY spotter_output.airline_icao, hour_name |
| 8639 | 8639 | ".$orderby_sql; |
@@ -8646,7 +8646,7 @@ discard block |
||
| 8646 | 8646 | $hour_array = array(); |
| 8647 | 8647 | $temp_array = array(); |
| 8648 | 8648 | |
| 8649 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8649 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8650 | 8650 | { |
| 8651 | 8651 | $temp_array['hour_name'] = $row['hour_name']; |
| 8652 | 8652 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8669,34 +8669,34 @@ discard block |
||
| 8669 | 8669 | public function countAllHoursByAirline($airline_icao, $filters = array()) |
| 8670 | 8670 | { |
| 8671 | 8671 | global $globalTimezone, $globalDBdriver; |
| 8672 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8672 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8673 | 8673 | if ($globalTimezone != '') { |
| 8674 | 8674 | date_default_timezone_set($globalTimezone); |
| 8675 | 8675 | $datetime = new DateTime(); |
| 8676 | 8676 | $offset = $datetime->format('P'); |
| 8677 | 8677 | } else $offset = '+00:00'; |
| 8678 | 8678 | |
| 8679 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 8679 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 8680 | 8680 | |
| 8681 | 8681 | if ($globalDBdriver == 'mysql') { |
| 8682 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8682 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8683 | 8683 | FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao |
| 8684 | 8684 | GROUP BY hour_name |
| 8685 | 8685 | ORDER BY hour_name ASC"; |
| 8686 | 8686 | } else { |
| 8687 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8687 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8688 | 8688 | FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao |
| 8689 | 8689 | GROUP BY hour_name |
| 8690 | 8690 | ORDER BY hour_name ASC"; |
| 8691 | 8691 | } |
| 8692 | 8692 | |
| 8693 | 8693 | $sth = $this->db->prepare($query); |
| 8694 | - $sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset)); |
|
| 8694 | + $sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset)); |
|
| 8695 | 8695 | |
| 8696 | 8696 | $hour_array = array(); |
| 8697 | 8697 | $temp_array = array(); |
| 8698 | 8698 | |
| 8699 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8699 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8700 | 8700 | { |
| 8701 | 8701 | $temp_array['hour_name'] = $row['hour_name']; |
| 8702 | 8702 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8719,8 +8719,8 @@ discard block |
||
| 8719 | 8719 | public function countAllHoursByAircraft($aircraft_icao, $filters = array()) |
| 8720 | 8720 | { |
| 8721 | 8721 | global $globalTimezone, $globalDBdriver; |
| 8722 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8723 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 8722 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8723 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 8724 | 8724 | if ($globalTimezone != '') { |
| 8725 | 8725 | date_default_timezone_set($globalTimezone); |
| 8726 | 8726 | $datetime = new DateTime(); |
@@ -8728,24 +8728,24 @@ discard block |
||
| 8728 | 8728 | } else $offset = '+00:00'; |
| 8729 | 8729 | |
| 8730 | 8730 | if ($globalDBdriver == 'mysql') { |
| 8731 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8731 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8732 | 8732 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao |
| 8733 | 8733 | GROUP BY hour_name |
| 8734 | 8734 | ORDER BY hour_name ASC"; |
| 8735 | 8735 | } else { |
| 8736 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8736 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8737 | 8737 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao |
| 8738 | 8738 | GROUP BY hour_name |
| 8739 | 8739 | ORDER BY hour_name ASC"; |
| 8740 | 8740 | } |
| 8741 | 8741 | |
| 8742 | 8742 | $sth = $this->db->prepare($query); |
| 8743 | - $sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset)); |
|
| 8743 | + $sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset)); |
|
| 8744 | 8744 | |
| 8745 | 8745 | $hour_array = array(); |
| 8746 | 8746 | $temp_array = array(); |
| 8747 | 8747 | |
| 8748 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8748 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8749 | 8749 | { |
| 8750 | 8750 | $temp_array['hour_name'] = $row['hour_name']; |
| 8751 | 8751 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8766,8 +8766,8 @@ discard block |
||
| 8766 | 8766 | public function countAllHoursByRegistration($registration, $filters = array()) |
| 8767 | 8767 | { |
| 8768 | 8768 | global $globalTimezone, $globalDBdriver; |
| 8769 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8770 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 8769 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8770 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 8771 | 8771 | if ($globalTimezone != '') { |
| 8772 | 8772 | date_default_timezone_set($globalTimezone); |
| 8773 | 8773 | $datetime = new DateTime(); |
@@ -8775,24 +8775,24 @@ discard block |
||
| 8775 | 8775 | } else $offset = '+00:00'; |
| 8776 | 8776 | |
| 8777 | 8777 | if ($globalDBdriver == 'mysql') { |
| 8778 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8778 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8779 | 8779 | FROM spotter_output".$filter_query." spotter_output.registration = :registration |
| 8780 | 8780 | GROUP BY hour_name |
| 8781 | 8781 | ORDER BY hour_name ASC"; |
| 8782 | 8782 | } else { |
| 8783 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8783 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8784 | 8784 | FROM spotter_output".$filter_query." spotter_output.registration = :registration |
| 8785 | 8785 | GROUP BY hour_name |
| 8786 | 8786 | ORDER BY hour_name ASC"; |
| 8787 | 8787 | } |
| 8788 | 8788 | |
| 8789 | 8789 | $sth = $this->db->prepare($query); |
| 8790 | - $sth->execute(array(':registration' => $registration,':offset' => $offset)); |
|
| 8790 | + $sth->execute(array(':registration' => $registration, ':offset' => $offset)); |
|
| 8791 | 8791 | |
| 8792 | 8792 | $hour_array = array(); |
| 8793 | 8793 | $temp_array = array(); |
| 8794 | 8794 | |
| 8795 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8795 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8796 | 8796 | { |
| 8797 | 8797 | $temp_array['hour_name'] = $row['hour_name']; |
| 8798 | 8798 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8813,8 +8813,8 @@ discard block |
||
| 8813 | 8813 | public function countAllHoursByAirport($airport_icao, $filters = array()) |
| 8814 | 8814 | { |
| 8815 | 8815 | global $globalTimezone, $globalDBdriver; |
| 8816 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8817 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 8816 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8817 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 8818 | 8818 | if ($globalTimezone != '') { |
| 8819 | 8819 | date_default_timezone_set($globalTimezone); |
| 8820 | 8820 | $datetime = new DateTime(); |
@@ -8822,24 +8822,24 @@ discard block |
||
| 8822 | 8822 | } else $offset = '+00:00'; |
| 8823 | 8823 | |
| 8824 | 8824 | if ($globalDBdriver == 'mysql') { |
| 8825 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8825 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8826 | 8826 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 8827 | 8827 | GROUP BY hour_name |
| 8828 | 8828 | ORDER BY hour_name ASC"; |
| 8829 | 8829 | } else { |
| 8830 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8830 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8831 | 8831 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 8832 | 8832 | GROUP BY hour_name |
| 8833 | 8833 | ORDER BY hour_name ASC"; |
| 8834 | 8834 | } |
| 8835 | 8835 | |
| 8836 | 8836 | $sth = $this->db->prepare($query); |
| 8837 | - $sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset)); |
|
| 8837 | + $sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset)); |
|
| 8838 | 8838 | |
| 8839 | 8839 | $hour_array = array(); |
| 8840 | 8840 | $temp_array = array(); |
| 8841 | 8841 | |
| 8842 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8842 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8843 | 8843 | { |
| 8844 | 8844 | $temp_array['hour_name'] = $row['hour_name']; |
| 8845 | 8845 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8858,11 +8858,11 @@ discard block |
||
| 8858 | 8858 | * @return Array the hour list |
| 8859 | 8859 | * |
| 8860 | 8860 | */ |
| 8861 | - public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array()) |
|
| 8861 | + public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 8862 | 8862 | { |
| 8863 | 8863 | global $globalTimezone, $globalDBdriver; |
| 8864 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8865 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 8864 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8865 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 8866 | 8866 | if ($globalTimezone != '') { |
| 8867 | 8867 | date_default_timezone_set($globalTimezone); |
| 8868 | 8868 | $datetime = new DateTime(); |
@@ -8870,24 +8870,24 @@ discard block |
||
| 8870 | 8870 | } else $offset = '+00:00'; |
| 8871 | 8871 | |
| 8872 | 8872 | if ($globalDBdriver == 'mysql') { |
| 8873 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8873 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8874 | 8874 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 8875 | 8875 | GROUP BY hour_name |
| 8876 | 8876 | ORDER BY hour_name ASC"; |
| 8877 | 8877 | } else { |
| 8878 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8878 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8879 | 8879 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 8880 | 8880 | GROUP BY hour_name |
| 8881 | 8881 | ORDER BY hour_name ASC"; |
| 8882 | 8882 | } |
| 8883 | 8883 | |
| 8884 | 8884 | $sth = $this->db->prepare($query); |
| 8885 | - $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset)); |
|
| 8885 | + $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset)); |
|
| 8886 | 8886 | |
| 8887 | 8887 | $hour_array = array(); |
| 8888 | 8888 | $temp_array = array(); |
| 8889 | 8889 | |
| 8890 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8890 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8891 | 8891 | { |
| 8892 | 8892 | $temp_array['hour_name'] = $row['hour_name']; |
| 8893 | 8893 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8909,8 +8909,8 @@ discard block |
||
| 8909 | 8909 | public function countAllHoursByDate($date, $filters = array()) |
| 8910 | 8910 | { |
| 8911 | 8911 | global $globalTimezone, $globalDBdriver; |
| 8912 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8913 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 8912 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8913 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 8914 | 8914 | if ($globalTimezone != '') { |
| 8915 | 8915 | date_default_timezone_set($globalTimezone); |
| 8916 | 8916 | $datetime = new DateTime($date); |
@@ -8918,12 +8918,12 @@ discard block |
||
| 8918 | 8918 | } else $offset = '+00:00'; |
| 8919 | 8919 | |
| 8920 | 8920 | if ($globalDBdriver == 'mysql') { |
| 8921 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8921 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8922 | 8922 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 8923 | 8923 | GROUP BY hour_name |
| 8924 | 8924 | ORDER BY hour_name ASC"; |
| 8925 | 8925 | } else { |
| 8926 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8926 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8927 | 8927 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
| 8928 | 8928 | GROUP BY hour_name |
| 8929 | 8929 | ORDER BY hour_name ASC"; |
@@ -8935,7 +8935,7 @@ discard block |
||
| 8935 | 8935 | $hour_array = array(); |
| 8936 | 8936 | $temp_array = array(); |
| 8937 | 8937 | |
| 8938 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8938 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8939 | 8939 | { |
| 8940 | 8940 | $temp_array['hour_name'] = $row['hour_name']; |
| 8941 | 8941 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8957,8 +8957,8 @@ discard block |
||
| 8957 | 8957 | public function countAllHoursByIdent($ident, $filters = array()) |
| 8958 | 8958 | { |
| 8959 | 8959 | global $globalTimezone, $globalDBdriver; |
| 8960 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8961 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 8960 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8961 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 8962 | 8962 | if ($globalTimezone != '') { |
| 8963 | 8963 | date_default_timezone_set($globalTimezone); |
| 8964 | 8964 | $datetime = new DateTime(); |
@@ -8966,12 +8966,12 @@ discard block |
||
| 8966 | 8966 | } else $offset = '+00:00'; |
| 8967 | 8967 | |
| 8968 | 8968 | if ($globalDBdriver == 'mysql') { |
| 8969 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8969 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8970 | 8970 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 8971 | 8971 | GROUP BY hour_name |
| 8972 | 8972 | ORDER BY hour_name ASC"; |
| 8973 | 8973 | } else { |
| 8974 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8974 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8975 | 8975 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 8976 | 8976 | GROUP BY hour_name |
| 8977 | 8977 | ORDER BY hour_name ASC"; |
@@ -8979,12 +8979,12 @@ discard block |
||
| 8979 | 8979 | |
| 8980 | 8980 | |
| 8981 | 8981 | $sth = $this->db->prepare($query); |
| 8982 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
| 8982 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
| 8983 | 8983 | |
| 8984 | 8984 | $hour_array = array(); |
| 8985 | 8985 | $temp_array = array(); |
| 8986 | 8986 | |
| 8987 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8987 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8988 | 8988 | { |
| 8989 | 8989 | $temp_array['hour_name'] = $row['hour_name']; |
| 8990 | 8990 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9003,12 +9003,12 @@ discard block |
||
| 9003 | 9003 | * @return Array the hour list |
| 9004 | 9004 | * |
| 9005 | 9005 | */ |
| 9006 | - public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array()) |
|
| 9006 | + public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 9007 | 9007 | { |
| 9008 | 9008 | global $globalTimezone, $globalDBdriver; |
| 9009 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9010 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 9011 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 9009 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9010 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 9011 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 9012 | 9012 | if ($globalTimezone != '') { |
| 9013 | 9013 | date_default_timezone_set($globalTimezone); |
| 9014 | 9014 | $datetime = new DateTime(); |
@@ -9016,24 +9016,24 @@ discard block |
||
| 9016 | 9016 | } else $offset = '+00:00'; |
| 9017 | 9017 | |
| 9018 | 9018 | if ($globalDBdriver == 'mysql') { |
| 9019 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9019 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9020 | 9020 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 9021 | 9021 | GROUP BY hour_name |
| 9022 | 9022 | ORDER BY hour_name ASC"; |
| 9023 | 9023 | } else { |
| 9024 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9024 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9025 | 9025 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 9026 | 9026 | GROUP BY hour_name |
| 9027 | 9027 | ORDER BY hour_name ASC"; |
| 9028 | 9028 | } |
| 9029 | 9029 | |
| 9030 | 9030 | $sth = $this->db->prepare($query); |
| 9031 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset)); |
|
| 9031 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset)); |
|
| 9032 | 9032 | |
| 9033 | 9033 | $hour_array = array(); |
| 9034 | 9034 | $temp_array = array(); |
| 9035 | 9035 | |
| 9036 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9036 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9037 | 9037 | { |
| 9038 | 9038 | $temp_array['hour_name'] = $row['hour_name']; |
| 9039 | 9039 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9054,8 +9054,8 @@ discard block |
||
| 9054 | 9054 | public function countAllHoursByCountry($country, $filters = array()) |
| 9055 | 9055 | { |
| 9056 | 9056 | global $globalTimezone, $globalDBdriver; |
| 9057 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9058 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 9057 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9058 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 9059 | 9059 | if ($globalTimezone != '') { |
| 9060 | 9060 | date_default_timezone_set($globalTimezone); |
| 9061 | 9061 | $datetime = new DateTime(); |
@@ -9063,24 +9063,24 @@ discard block |
||
| 9063 | 9063 | } else $offset = '+00:00'; |
| 9064 | 9064 | |
| 9065 | 9065 | if ($globalDBdriver == 'mysql') { |
| 9066 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9066 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9067 | 9067 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 9068 | 9068 | GROUP BY hour_name |
| 9069 | 9069 | ORDER BY hour_name ASC"; |
| 9070 | 9070 | } else { |
| 9071 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9071 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9072 | 9072 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 9073 | 9073 | GROUP BY hour_name |
| 9074 | 9074 | ORDER BY hour_name ASC"; |
| 9075 | 9075 | } |
| 9076 | 9076 | |
| 9077 | 9077 | $sth = $this->db->prepare($query); |
| 9078 | - $sth->execute(array(':country' => $country,':offset' => $offset)); |
|
| 9078 | + $sth->execute(array(':country' => $country, ':offset' => $offset)); |
|
| 9079 | 9079 | |
| 9080 | 9080 | $hour_array = array(); |
| 9081 | 9081 | $temp_array = array(); |
| 9082 | 9082 | |
| 9083 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9083 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9084 | 9084 | { |
| 9085 | 9085 | $temp_array['hour_name'] = $row['hour_name']; |
| 9086 | 9086 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9102,8 +9102,8 @@ discard block |
||
| 9102 | 9102 | */ |
| 9103 | 9103 | public function countOverallAircrafts($filters = array()) |
| 9104 | 9104 | { |
| 9105 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9106 | - $query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count |
|
| 9105 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9106 | + $query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count |
|
| 9107 | 9107 | FROM spotter_output".$filter_query." spotter_output.ident <> ''"; |
| 9108 | 9108 | $sth = $this->db->prepare($query); |
| 9109 | 9109 | $sth->execute(); |
@@ -9118,8 +9118,8 @@ discard block |
||
| 9118 | 9118 | */ |
| 9119 | 9119 | public function countOverallArrival($filters = array()) |
| 9120 | 9120 | { |
| 9121 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9122 | - $query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count |
|
| 9121 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9122 | + $query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count |
|
| 9123 | 9123 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''"; |
| 9124 | 9124 | |
| 9125 | 9125 | $sth = $this->db->prepare($query); |
@@ -9135,8 +9135,8 @@ discard block |
||
| 9135 | 9135 | */ |
| 9136 | 9136 | public function countOverallPilots($filters = array()) |
| 9137 | 9137 | { |
| 9138 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9139 | - $query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count |
|
| 9138 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9139 | + $query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count |
|
| 9140 | 9140 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''"; |
| 9141 | 9141 | $sth = $this->db->prepare($query); |
| 9142 | 9142 | $sth->execute(); |
@@ -9151,8 +9151,8 @@ discard block |
||
| 9151 | 9151 | */ |
| 9152 | 9152 | public function countOverallOwners($filters = array()) |
| 9153 | 9153 | { |
| 9154 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9155 | - $query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count |
|
| 9154 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9155 | + $query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count |
|
| 9156 | 9156 | FROM spotter_output".$filter_query." spotter_output.owner_name <> ''"; |
| 9157 | 9157 | $sth = $this->db->prepare($query); |
| 9158 | 9158 | $sth->execute(); |
@@ -9185,8 +9185,8 @@ discard block |
||
| 9185 | 9185 | */ |
| 9186 | 9186 | public function countOverallMilitaryFlights($filters = array()) |
| 9187 | 9187 | { |
| 9188 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9189 | - $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
|
| 9188 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9189 | + $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
|
| 9190 | 9190 | FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'"; |
| 9191 | 9191 | |
| 9192 | 9192 | $sth = $this->db->prepare($query); |
@@ -9223,7 +9223,7 @@ discard block |
||
| 9223 | 9223 | public function countAllHoursFromToday($filters = array()) |
| 9224 | 9224 | { |
| 9225 | 9225 | global $globalTimezone, $globalDBdriver; |
| 9226 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9226 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9227 | 9227 | if ($globalTimezone != '') { |
| 9228 | 9228 | date_default_timezone_set($globalTimezone); |
| 9229 | 9229 | $datetime = new DateTime(); |
@@ -9231,12 +9231,12 @@ discard block |
||
| 9231 | 9231 | } else $offset = '+00:00'; |
| 9232 | 9232 | |
| 9233 | 9233 | if ($globalDBdriver == 'mysql') { |
| 9234 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9234 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9235 | 9235 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE() |
| 9236 | 9236 | GROUP BY hour_name |
| 9237 | 9237 | ORDER BY hour_name ASC"; |
| 9238 | 9238 | } else { |
| 9239 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9239 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9240 | 9240 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
| 9241 | 9241 | GROUP BY hour_name |
| 9242 | 9242 | ORDER BY hour_name ASC"; |
@@ -9248,7 +9248,7 @@ discard block |
||
| 9248 | 9248 | $hour_array = array(); |
| 9249 | 9249 | $temp_array = array(); |
| 9250 | 9250 | |
| 9251 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9251 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9252 | 9252 | { |
| 9253 | 9253 | $temp_array['hour_name'] = $row['hour_name']; |
| 9254 | 9254 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9267,14 +9267,14 @@ discard block |
||
| 9267 | 9267 | public function getUpcomingFlights($limit = '', $sort = '', $filters = array()) |
| 9268 | 9268 | { |
| 9269 | 9269 | global $global_query, $globalDBdriver, $globalTimezone; |
| 9270 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9270 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9271 | 9271 | date_default_timezone_set('UTC'); |
| 9272 | 9272 | $limit_query = ''; |
| 9273 | 9273 | if ($limit != "") |
| 9274 | 9274 | { |
| 9275 | 9275 | $limit_array = explode(",", $limit); |
| 9276 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 9277 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 9276 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 9277 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 9278 | 9278 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 9279 | 9279 | { |
| 9280 | 9280 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -9327,7 +9327,7 @@ discard block |
||
| 9327 | 9327 | GROUP BY spotter_output.ident,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time, to_char(spotter_output.date,'HH') |
| 9328 | 9328 | HAVING count(spotter_output.ident) > 5$orderby_query"; |
| 9329 | 9329 | //echo $query; |
| 9330 | - $spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone)); |
|
| 9330 | + $spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone)); |
|
| 9331 | 9331 | /* |
| 9332 | 9332 | $sth = $this->db->prepare($query); |
| 9333 | 9333 | $sth->execute(array(':timezone' => $globalTimezone)); |
@@ -9346,9 +9346,9 @@ discard block |
||
| 9346 | 9346 | */ |
| 9347 | 9347 | public function getSpotterIDBasedOnFlightAwareID($flightaware_id) |
| 9348 | 9348 | { |
| 9349 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 9349 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 9350 | 9350 | |
| 9351 | - $query = "SELECT spotter_output.spotter_id |
|
| 9351 | + $query = "SELECT spotter_output.spotter_id |
|
| 9352 | 9352 | FROM spotter_output |
| 9353 | 9353 | WHERE spotter_output.flightaware_id = '".$flightaware_id."'"; |
| 9354 | 9354 | |
@@ -9356,7 +9356,7 @@ discard block |
||
| 9356 | 9356 | $sth = $this->db->prepare($query); |
| 9357 | 9357 | $sth->execute(); |
| 9358 | 9358 | |
| 9359 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9359 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9360 | 9360 | { |
| 9361 | 9361 | return $row['spotter_id']; |
| 9362 | 9362 | } |
@@ -9381,23 +9381,23 @@ discard block |
||
| 9381 | 9381 | } |
| 9382 | 9382 | |
| 9383 | 9383 | $current_date = date("Y-m-d H:i:s"); |
| 9384 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
| 9384 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
| 9385 | 9385 | |
| 9386 | 9386 | $diff = abs(strtotime($current_date) - strtotime($date)); |
| 9387 | 9387 | |
| 9388 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
| 9388 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
| 9389 | 9389 | $years = $time_array['years']; |
| 9390 | 9390 | |
| 9391 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
| 9391 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
| 9392 | 9392 | $months = $time_array['months']; |
| 9393 | 9393 | |
| 9394 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
| 9394 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
| 9395 | 9395 | $days = $time_array['days']; |
| 9396 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
| 9396 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
| 9397 | 9397 | $hours = $time_array['hours']; |
| 9398 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
| 9398 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
| 9399 | 9399 | $minutes = $time_array['minutes']; |
| 9400 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 9400 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 9401 | 9401 | |
| 9402 | 9402 | return $time_array; |
| 9403 | 9403 | } |
@@ -9423,63 +9423,63 @@ discard block |
||
| 9423 | 9423 | $temp_array['direction_degree'] = $direction; |
| 9424 | 9424 | $temp_array['direction_shortname'] = "N"; |
| 9425 | 9425 | $temp_array['direction_fullname'] = "North"; |
| 9426 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
| 9426 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
| 9427 | 9427 | $temp_array['direction_degree'] = $direction; |
| 9428 | 9428 | $temp_array['direction_shortname'] = "NNE"; |
| 9429 | 9429 | $temp_array['direction_fullname'] = "North-Northeast"; |
| 9430 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
| 9430 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
| 9431 | 9431 | $temp_array['direction_degree'] = $direction; |
| 9432 | 9432 | $temp_array['direction_shortname'] = "NE"; |
| 9433 | 9433 | $temp_array['direction_fullname'] = "Northeast"; |
| 9434 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
| 9434 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
| 9435 | 9435 | $temp_array['direction_degree'] = $direction; |
| 9436 | 9436 | $temp_array['direction_shortname'] = "ENE"; |
| 9437 | 9437 | $temp_array['direction_fullname'] = "East-Northeast"; |
| 9438 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
| 9438 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
| 9439 | 9439 | $temp_array['direction_degree'] = $direction; |
| 9440 | 9440 | $temp_array['direction_shortname'] = "E"; |
| 9441 | 9441 | $temp_array['direction_fullname'] = "East"; |
| 9442 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
| 9442 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
| 9443 | 9443 | $temp_array['direction_degree'] = $direction; |
| 9444 | 9444 | $temp_array['direction_shortname'] = "ESE"; |
| 9445 | 9445 | $temp_array['direction_fullname'] = "East-Southeast"; |
| 9446 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
| 9446 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
| 9447 | 9447 | $temp_array['direction_degree'] = $direction; |
| 9448 | 9448 | $temp_array['direction_shortname'] = "SE"; |
| 9449 | 9449 | $temp_array['direction_fullname'] = "Southeast"; |
| 9450 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
| 9450 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
| 9451 | 9451 | $temp_array['direction_degree'] = $direction; |
| 9452 | 9452 | $temp_array['direction_shortname'] = "SSE"; |
| 9453 | 9453 | $temp_array['direction_fullname'] = "South-Southeast"; |
| 9454 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
| 9454 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
| 9455 | 9455 | $temp_array['direction_degree'] = $direction; |
| 9456 | 9456 | $temp_array['direction_shortname'] = "S"; |
| 9457 | 9457 | $temp_array['direction_fullname'] = "South"; |
| 9458 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
| 9458 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
| 9459 | 9459 | $temp_array['direction_degree'] = $direction; |
| 9460 | 9460 | $temp_array['direction_shortname'] = "SSW"; |
| 9461 | 9461 | $temp_array['direction_fullname'] = "South-Southwest"; |
| 9462 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
| 9462 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
| 9463 | 9463 | $temp_array['direction_degree'] = $direction; |
| 9464 | 9464 | $temp_array['direction_shortname'] = "SW"; |
| 9465 | 9465 | $temp_array['direction_fullname'] = "Southwest"; |
| 9466 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
| 9466 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
| 9467 | 9467 | $temp_array['direction_degree'] = $direction; |
| 9468 | 9468 | $temp_array['direction_shortname'] = "WSW"; |
| 9469 | 9469 | $temp_array['direction_fullname'] = "West-Southwest"; |
| 9470 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
| 9470 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
| 9471 | 9471 | $temp_array['direction_degree'] = $direction; |
| 9472 | 9472 | $temp_array['direction_shortname'] = "W"; |
| 9473 | 9473 | $temp_array['direction_fullname'] = "West"; |
| 9474 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
| 9474 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
| 9475 | 9475 | $temp_array['direction_degree'] = $direction; |
| 9476 | 9476 | $temp_array['direction_shortname'] = "WNW"; |
| 9477 | 9477 | $temp_array['direction_fullname'] = "West-Northwest"; |
| 9478 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
| 9478 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
| 9479 | 9479 | $temp_array['direction_degree'] = $direction; |
| 9480 | 9480 | $temp_array['direction_shortname'] = "NW"; |
| 9481 | 9481 | $temp_array['direction_fullname'] = "Northwest"; |
| 9482 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
| 9482 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
| 9483 | 9483 | $temp_array['direction_degree'] = $direction; |
| 9484 | 9484 | $temp_array['direction_shortname'] = "NNW"; |
| 9485 | 9485 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -9532,9 +9532,9 @@ discard block |
||
| 9532 | 9532 | */ |
| 9533 | 9533 | public function getAircraftRegistrationBymodeS($aircraft_modes) |
| 9534 | 9534 | { |
| 9535 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
| 9535 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
| 9536 | 9536 | |
| 9537 | - $query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
| 9537 | + $query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
| 9538 | 9538 | |
| 9539 | 9539 | $sth = $this->db->prepare($query); |
| 9540 | 9540 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -9557,9 +9557,9 @@ discard block |
||
| 9557 | 9557 | */ |
| 9558 | 9558 | public function getAircraftTypeBymodeS($aircraft_modes) |
| 9559 | 9559 | { |
| 9560 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
| 9560 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
| 9561 | 9561 | |
| 9562 | - $query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
| 9562 | + $query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
| 9563 | 9563 | |
| 9564 | 9564 | $sth = $this->db->prepare($query); |
| 9565 | 9565 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -9580,11 +9580,11 @@ discard block |
||
| 9580 | 9580 | * @param Float $longitude longitute of the flight |
| 9581 | 9581 | * @return String the countrie |
| 9582 | 9582 | */ |
| 9583 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
| 9583 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
| 9584 | 9584 | { |
| 9585 | 9585 | global $globalDBdriver, $globalDebug; |
| 9586 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 9587 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 9586 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 9587 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 9588 | 9588 | |
| 9589 | 9589 | $Connection = new Connection($this->db); |
| 9590 | 9590 | if (!$Connection->tableExists('countries')) return ''; |
@@ -9624,19 +9624,19 @@ discard block |
||
| 9624 | 9624 | */ |
| 9625 | 9625 | public function convertAircraftRegistration($registration) |
| 9626 | 9626 | { |
| 9627 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 9627 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 9628 | 9628 | $registration_prefix = ''; |
| 9629 | 9629 | $registration_1 = substr($registration, 0, 1); |
| 9630 | 9630 | $registration_2 = substr($registration, 0, 2); |
| 9631 | 9631 | |
| 9632 | 9632 | //first get the prefix based on two characters |
| 9633 | - $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2"; |
|
| 9633 | + $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2"; |
|
| 9634 | 9634 | |
| 9635 | 9635 | |
| 9636 | 9636 | $sth = $this->db->prepare($query); |
| 9637 | 9637 | $sth->execute(array(':registration_2' => $registration_2)); |
| 9638 | 9638 | |
| 9639 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9639 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9640 | 9640 | { |
| 9641 | 9641 | $registration_prefix = $row['registration_prefix']; |
| 9642 | 9642 | } |
@@ -9644,11 +9644,11 @@ discard block |
||
| 9644 | 9644 | //if we didn't find a two chracter prefix lets just search the one with one character |
| 9645 | 9645 | if ($registration_prefix == '') |
| 9646 | 9646 | { |
| 9647 | - $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1"; |
|
| 9647 | + $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1"; |
|
| 9648 | 9648 | $sth = $this->db->prepare($query); |
| 9649 | 9649 | $sth->execute(array(':registration_1' => $registration_1)); |
| 9650 | 9650 | |
| 9651 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9651 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9652 | 9652 | { |
| 9653 | 9653 | $registration_prefix = $row['registration_prefix']; |
| 9654 | 9654 | } |
@@ -9662,7 +9662,7 @@ discard block |
||
| 9662 | 9662 | } else { |
| 9663 | 9663 | $registration = preg_replace("/^(.{1})/", "$1-", $registration); |
| 9664 | 9664 | } |
| 9665 | - } else if(strlen($registration_prefix) == 2){ |
|
| 9665 | + } else if (strlen($registration_prefix) == 2) { |
|
| 9666 | 9666 | if (0 === strpos($registration, 'N')) { |
| 9667 | 9667 | $registration = preg_replace("/^(.{2})/", "$1", $registration); |
| 9668 | 9668 | } else { |
@@ -9681,17 +9681,17 @@ discard block |
||
| 9681 | 9681 | */ |
| 9682 | 9682 | public function countryFromAircraftRegistration($registration) |
| 9683 | 9683 | { |
| 9684 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 9684 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 9685 | 9685 | |
| 9686 | 9686 | $registration_prefix = ''; |
| 9687 | - $registration_test = explode('-',$registration); |
|
| 9687 | + $registration_test = explode('-', $registration); |
|
| 9688 | 9688 | $country = ''; |
| 9689 | 9689 | if ($registration_test[0] != $registration) { |
| 9690 | 9690 | $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
| 9691 | 9691 | |
| 9692 | 9692 | $sth = $this->db->prepare($query); |
| 9693 | 9693 | $sth->execute(array(':registration_1' => $registration_test[0])); |
| 9694 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9694 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9695 | 9695 | { |
| 9696 | 9696 | //$registration_prefix = $row['registration_prefix']; |
| 9697 | 9697 | $country = $row['country']; |
@@ -9702,13 +9702,13 @@ discard block |
||
| 9702 | 9702 | |
| 9703 | 9703 | $country = ''; |
| 9704 | 9704 | //first get the prefix based on two characters |
| 9705 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
| 9705 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
| 9706 | 9706 | |
| 9707 | 9707 | |
| 9708 | 9708 | $sth = $this->db->prepare($query); |
| 9709 | 9709 | $sth->execute(array(':registration_2' => $registration_2)); |
| 9710 | 9710 | |
| 9711 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9711 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9712 | 9712 | { |
| 9713 | 9713 | $registration_prefix = $row['registration_prefix']; |
| 9714 | 9714 | $country = $row['country']; |
@@ -9717,12 +9717,12 @@ discard block |
||
| 9717 | 9717 | //if we didn't find a two chracter prefix lets just search the one with one character |
| 9718 | 9718 | if ($registration_prefix == "") |
| 9719 | 9719 | { |
| 9720 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 9720 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 9721 | 9721 | |
| 9722 | 9722 | $sth = $this->db->prepare($query); |
| 9723 | 9723 | $sth->execute(array(':registration_1' => $registration_1)); |
| 9724 | 9724 | |
| 9725 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9725 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9726 | 9726 | { |
| 9727 | 9727 | //$registration_prefix = $row['registration_prefix']; |
| 9728 | 9728 | $country = $row['country']; |
@@ -9739,9 +9739,9 @@ discard block |
||
| 9739 | 9739 | * @param String $flightaware_id flightaware_id from spotter_output table |
| 9740 | 9740 | * @param String $highlight New highlight value |
| 9741 | 9741 | */ |
| 9742 | - public function setHighlightFlight($flightaware_id,$highlight) { |
|
| 9742 | + public function setHighlightFlight($flightaware_id, $highlight) { |
|
| 9743 | 9743 | |
| 9744 | - $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
|
| 9744 | + $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
|
| 9745 | 9745 | $sth = $this->db->prepare($query); |
| 9746 | 9746 | $sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight)); |
| 9747 | 9747 | } |
@@ -9770,7 +9770,7 @@ discard block |
||
| 9770 | 9770 | |
| 9771 | 9771 | $bitly_data = json_decode($bitly_data); |
| 9772 | 9772 | $bitly_url = ''; |
| 9773 | - if ($bitly_data->status_txt = "OK"){ |
|
| 9773 | + if ($bitly_data->status_txt = "OK") { |
|
| 9774 | 9774 | $bitly_url = $bitly_data->data->url; |
| 9775 | 9775 | } |
| 9776 | 9776 | |
@@ -9780,7 +9780,7 @@ discard block |
||
| 9780 | 9780 | |
| 9781 | 9781 | public function getOrderBy() |
| 9782 | 9782 | { |
| 9783 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC")); |
|
| 9783 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC")); |
|
| 9784 | 9784 | |
| 9785 | 9785 | return $orderby; |
| 9786 | 9786 | |
@@ -9914,14 +9914,14 @@ discard block |
||
| 9914 | 9914 | } |
| 9915 | 9915 | $sth = $this->db->prepare($query); |
| 9916 | 9916 | $sth->execute(); |
| 9917 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9917 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9918 | 9918 | { |
| 9919 | 9919 | $departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']); |
| 9920 | 9920 | $arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']); |
| 9921 | 9921 | if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) { |
| 9922 | - $update_query="UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id"; |
|
| 9922 | + $update_query = "UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id"; |
|
| 9923 | 9923 | $sthu = $this->db->prepare($update_query); |
| 9924 | - $sthu->execute(array(':fromicao' => $row['fromairport_icao'],':toicao' => $row['toairport_icao'],':spotter_id' => $row['spotter_id'],':departure_airport_name' => $departure_airport_array[0]['name'],':departure_airport_city' => $departure_airport_array[0]['city'],':departure_airport_country' => $departure_airport_array[0]['country'],':arrival_airport_name' => $arrival_airport_array[0]['name'],':arrival_airport_city' => $arrival_airport_array[0]['city'],':arrival_airport_country' => $arrival_airport_array[0]['country'])); |
|
| 9924 | + $sthu->execute(array(':fromicao' => $row['fromairport_icao'], ':toicao' => $row['toairport_icao'], ':spotter_id' => $row['spotter_id'], ':departure_airport_name' => $departure_airport_array[0]['name'], ':departure_airport_city' => $departure_airport_array[0]['city'], ':departure_airport_country' => $departure_airport_array[0]['country'], ':arrival_airport_name' => $arrival_airport_array[0]['name'], ':arrival_airport_city' => $arrival_airport_array[0]['city'], ':arrival_airport_country' => $arrival_airport_array[0]['country'])); |
|
| 9925 | 9925 | } |
| 9926 | 9926 | } |
| 9927 | 9927 | |
@@ -9934,7 +9934,7 @@ discard block |
||
| 9934 | 9934 | } |
| 9935 | 9935 | $sth = $this->db->prepare($query); |
| 9936 | 9936 | $sth->execute(); |
| 9937 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9937 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9938 | 9938 | { |
| 9939 | 9939 | if (is_numeric(substr($row['ident'], -1, 1))) |
| 9940 | 9940 | { |
@@ -9943,11 +9943,11 @@ discard block |
||
| 9943 | 9943 | elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
| 9944 | 9944 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
| 9945 | 9945 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
| 9946 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
|
| 9946 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource); |
|
| 9947 | 9947 | if (isset($airline_array[0]['name'])) { |
| 9948 | - $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"; |
|
| 9948 | + $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"; |
|
| 9949 | 9949 | $sthu = $this->db->prepare($update_query); |
| 9950 | - $sthu->execute(array(':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id'])); |
|
| 9950 | + $sthu->execute(array(':airline_name' => $airline_array[0]['name'], ':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id'])); |
|
| 9951 | 9951 | } |
| 9952 | 9952 | } |
| 9953 | 9953 | } |
@@ -9967,18 +9967,18 @@ discard block |
||
| 9967 | 9967 | } |
| 9968 | 9968 | $sth = $this->db->prepare($query); |
| 9969 | 9969 | $sth->execute(); |
| 9970 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9970 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9971 | 9971 | { |
| 9972 | 9972 | if ($row['aircraft_icao'] != '') { |
| 9973 | 9973 | $aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']); |
| 9974 | - if ($row['registration'] != ""){ |
|
| 9974 | + if ($row['registration'] != "") { |
|
| 9975 | 9975 | $image_array = $Image->getSpotterImage($row['registration']); |
| 9976 | 9976 | if (count($image_array) == 0) { |
| 9977 | 9977 | $Image->addSpotterImage($row['registration']); |
| 9978 | 9978 | } |
| 9979 | 9979 | } |
| 9980 | 9980 | if (count($aircraft_name) > 0) { |
| 9981 | - $update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id"; |
|
| 9981 | + $update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id"; |
|
| 9982 | 9982 | $sthu = $this->db->prepare($update_query); |
| 9983 | 9983 | $sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id'])); |
| 9984 | 9984 | } |
@@ -9993,10 +9993,10 @@ discard block |
||
| 9993 | 9993 | $query = "SELECT spotter_output.spotter_id, spotter_output.last_latitude, spotter_output.last_longitude, spotter_output.last_altitude, spotter_output.arrival_airport_icao, spotter_output.real_arrival_airport_icao FROM spotter_output"; |
| 9994 | 9994 | $sth = $this->db->prepare($query); |
| 9995 | 9995 | $sth->execute(); |
| 9996 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9996 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9997 | 9997 | { |
| 9998 | 9998 | if ($row['last_latitude'] != '' && $row['last_longitude'] != '') { |
| 9999 | - $closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist); |
|
| 9999 | + $closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist); |
|
| 10000 | 10000 | $airport_icao = ''; |
| 10001 | 10001 | if (isset($closestAirports[0])) { |
| 10002 | 10002 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
@@ -10010,7 +10010,7 @@ discard block |
||
| 10010 | 10010 | break; |
| 10011 | 10011 | } |
| 10012 | 10012 | } |
| 10013 | - } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
|
| 10013 | + } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) { |
|
| 10014 | 10014 | $airport_icao = $closestAirports[0]['icao']; |
| 10015 | 10015 | 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"; |
| 10016 | 10016 | } else { |
@@ -10021,28 +10021,28 @@ discard block |
||
| 10021 | 10021 | } |
| 10022 | 10022 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
| 10023 | 10023 | if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
| 10024 | - $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
|
| 10024 | + $update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
|
| 10025 | 10025 | $sthu = $this->db->prepare($update_query); |
| 10026 | - $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
|
| 10026 | + $sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id'])); |
|
| 10027 | 10027 | } |
| 10028 | 10028 | } |
| 10029 | 10029 | } |
| 10030 | 10030 | } |
| 10031 | 10031 | |
| 10032 | - public function closestAirports($origLat,$origLon,$dist = 10) { |
|
| 10032 | + public function closestAirports($origLat, $origLon, $dist = 10) { |
|
| 10033 | 10033 | global $globalDBdriver; |
| 10034 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
| 10034 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
| 10035 | 10035 | /* |
| 10036 | 10036 | $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - abs(latitude))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(abs(latitude)*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
| 10037 | 10037 | FROM airport WHERE longitude between ($origLon-$dist/abs(cos(radians($origLat))*69)) and ($origLon+$dist/abs(cos(radians($origLat))*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 10038 | 10038 | having distance < $dist ORDER BY distance limit 100;"; |
| 10039 | 10039 | */ |
| 10040 | 10040 | if ($globalDBdriver == 'mysql') { |
| 10041 | - $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
|
| 10041 | + $query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
|
| 10042 | 10042 | FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 10043 | 10043 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
| 10044 | 10044 | } else { |
| 10045 | - $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance |
|
| 10045 | + $query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance |
|
| 10046 | 10046 | FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 10047 | 10047 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
| 10048 | 10048 | } |
@@ -17,14 +17,14 @@ discard block |
||
| 17 | 17 | $this->db = $Connection->db(); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - public function addLastStatsUpdate($type,$stats_date) { |
|
| 20 | + public function addLastStatsUpdate($type, $stats_date) { |
|
| 21 | 21 | $query = "DELETE FROM config WHERE name = :type; |
| 22 | 22 | INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
| 23 | - $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
| 23 | + $query_values = array('type' => $type, ':stats_date' => $stats_date); |
|
| 24 | 24 | try { |
| 25 | 25 | $sth = $this->db->prepare($query); |
| 26 | 26 | $sth->execute($query_values); |
| 27 | - } catch(PDOException $e) { |
|
| 27 | + } catch (PDOException $e) { |
|
| 28 | 28 | return "error : ".$e->getMessage(); |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | try { |
| 35 | 35 | $sth = $this->db->prepare($query); |
| 36 | 36 | $sth->execute(array(':type' => $type)); |
| 37 | - } catch(PDOException $e) { |
|
| 37 | + } catch (PDOException $e) { |
|
| 38 | 38 | echo "error : ".$e->getMessage(); |
| 39 | 39 | } |
| 40 | 40 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -46,31 +46,31 @@ discard block |
||
| 46 | 46 | try { |
| 47 | 47 | $sth = $this->db->prepare($query); |
| 48 | 48 | $sth->execute(array(':filter_name' => $filter_name)); |
| 49 | - } catch(PDOException $e) { |
|
| 49 | + } catch (PDOException $e) { |
|
| 50 | 50 | echo "error : ".$e->getMessage(); |
| 51 | 51 | } |
| 52 | 52 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 53 | 53 | return $all; |
| 54 | 54 | } |
| 55 | - public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
|
| 55 | + public function getAllAircraftTypes($stats_airline = '', $filter_name = '') { |
|
| 56 | 56 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 57 | 57 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
| 58 | 58 | try { |
| 59 | 59 | $sth = $this->db->prepare($query); |
| 60 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 61 | - } catch(PDOException $e) { |
|
| 60 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 61 | + } catch (PDOException $e) { |
|
| 62 | 62 | echo "error : ".$e->getMessage(); |
| 63 | 63 | } |
| 64 | 64 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 65 | 65 | return $all; |
| 66 | 66 | } |
| 67 | - public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
|
| 67 | + public function getAllAirportNames($stats_airline = '', $filter_name = '') { |
|
| 68 | 68 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 69 | 69 | $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
| 70 | 70 | try { |
| 71 | 71 | $sth = $this->db->prepare($query); |
| 72 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 73 | - } catch(PDOException $e) { |
|
| 72 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 73 | + } catch (PDOException $e) { |
|
| 74 | 74 | echo "error : ".$e->getMessage(); |
| 75 | 75 | } |
| 76 | 76 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -85,22 +85,22 @@ discard block |
||
| 85 | 85 | else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
| 86 | 86 | try { |
| 87 | 87 | $sth = $this->db->prepare($query); |
| 88 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 89 | - } catch(PDOException $e) { |
|
| 88 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 89 | + } catch (PDOException $e) { |
|
| 90 | 90 | echo "error : ".$e->getMessage(); |
| 91 | 91 | } |
| 92 | 92 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 93 | 93 | if (empty($all)) { |
| 94 | 94 | $filters = array('airlines' => array($stats_airline)); |
| 95 | 95 | if ($filter_name != '') { |
| 96 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 96 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 97 | 97 | } |
| 98 | 98 | $Spotter = new Spotter($this->db); |
| 99 | - $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
| 99 | + $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters); |
|
| 100 | 100 | } |
| 101 | 101 | return $all; |
| 102 | 102 | } |
| 103 | - public function countAllAirlineCountries($limit = true,$filter_name = '') { |
|
| 103 | + public function countAllAirlineCountries($limit = true, $filter_name = '') { |
|
| 104 | 104 | global $globalStatsFilters; |
| 105 | 105 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 106 | 106 | if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | try { |
| 109 | 109 | $sth = $this->db->prepare($query); |
| 110 | 110 | $sth->execute(array(':filter_name' => $filter_name)); |
| 111 | - } catch(PDOException $e) { |
|
| 111 | + } catch (PDOException $e) { |
|
| 112 | 112 | echo "error : ".$e->getMessage(); |
| 113 | 113 | } |
| 114 | 114 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -116,28 +116,28 @@ discard block |
||
| 116 | 116 | $Spotter = new Spotter($this->db); |
| 117 | 117 | $filters = array(); |
| 118 | 118 | if ($filter_name != '') { |
| 119 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 119 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 120 | 120 | } |
| 121 | - $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
| 121 | + $all = $Spotter->countAllAirlineCountries($limit, $filters); |
|
| 122 | 122 | } |
| 123 | 123 | return $all; |
| 124 | 124 | } |
| 125 | - public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') { |
|
| 125 | + public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '') { |
|
| 126 | 126 | global $globalStatsFilters; |
| 127 | 127 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 128 | 128 | if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
| 129 | 129 | else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
| 130 | 130 | try { |
| 131 | 131 | $sth = $this->db->prepare($query); |
| 132 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 133 | - } catch(PDOException $e) { |
|
| 132 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 133 | + } catch (PDOException $e) { |
|
| 134 | 134 | echo "error : ".$e->getMessage(); |
| 135 | 135 | } |
| 136 | 136 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 137 | 137 | if (empty($all)) { |
| 138 | 138 | $filters = array('airlines' => array($stats_airline)); |
| 139 | 139 | if ($filter_name != '') { |
| 140 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 140 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 141 | 141 | } |
| 142 | 142 | $Spotter = new Spotter($this->db); |
| 143 | 143 | $all = $Spotter->countAllAircraftManufacturers($filters); |
@@ -152,18 +152,18 @@ discard block |
||
| 152 | 152 | else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
| 153 | 153 | try { |
| 154 | 154 | $sth = $this->db->prepare($query); |
| 155 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 156 | - } catch(PDOException $e) { |
|
| 155 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 156 | + } catch (PDOException $e) { |
|
| 157 | 157 | echo "error : ".$e->getMessage(); |
| 158 | 158 | } |
| 159 | 159 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 160 | 160 | if (empty($all)) { |
| 161 | 161 | $filters = array('airlines' => array($stats_airline)); |
| 162 | 162 | if ($filter_name != '') { |
| 163 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 163 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 164 | 164 | } |
| 165 | 165 | $Spotter = new Spotter($this->db); |
| 166 | - $all = $Spotter->countAllArrivalCountries($limit,$filters); |
|
| 166 | + $all = $Spotter->countAllArrivalCountries($limit, $filters); |
|
| 167 | 167 | } |
| 168 | 168 | return $all; |
| 169 | 169 | } |
@@ -174,15 +174,15 @@ discard block |
||
| 174 | 174 | else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
| 175 | 175 | try { |
| 176 | 176 | $sth = $this->db->prepare($query); |
| 177 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 178 | - } catch(PDOException $e) { |
|
| 177 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 178 | + } catch (PDOException $e) { |
|
| 179 | 179 | echo "error : ".$e->getMessage(); |
| 180 | 180 | } |
| 181 | 181 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 182 | 182 | if (empty($all)) { |
| 183 | 183 | $filters = array('airlines' => array($stats_airline)); |
| 184 | 184 | if ($filter_name != '') { |
| 185 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 185 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 186 | 186 | } |
| 187 | 187 | $Spotter = new Spotter($this->db); |
| 188 | 188 | $all = $Spotter->countAllDepartureCountries($filters); |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | return $all; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - public function countAllAirlines($limit = true,$filter_name = '') { |
|
| 193 | + public function countAllAirlines($limit = true, $filter_name = '') { |
|
| 194 | 194 | global $globalStatsFilters; |
| 195 | 195 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 196 | 196 | if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | try { |
| 199 | 199 | $sth = $this->db->prepare($query); |
| 200 | 200 | $sth->execute(array(':filter_name' => $filter_name)); |
| 201 | - } catch(PDOException $e) { |
|
| 201 | + } catch (PDOException $e) { |
|
| 202 | 202 | echo "error : ".$e->getMessage(); |
| 203 | 203 | } |
| 204 | 204 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -206,58 +206,58 @@ discard block |
||
| 206 | 206 | $Spotter = new Spotter($this->db); |
| 207 | 207 | $filters = array(); |
| 208 | 208 | if ($filter_name != '') { |
| 209 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 209 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
| 212 | + $all = $Spotter->countAllAirlines($limit, 0, '', $filters); |
|
| 213 | 213 | } |
| 214 | 214 | return $all; |
| 215 | 215 | } |
| 216 | - public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') { |
|
| 216 | + public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '') { |
|
| 217 | 217 | global $globalStatsFilters; |
| 218 | 218 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 219 | 219 | if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
| 220 | 220 | else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
| 221 | 221 | try { |
| 222 | 222 | $sth = $this->db->prepare($query); |
| 223 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 224 | - } catch(PDOException $e) { |
|
| 223 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 224 | + } catch (PDOException $e) { |
|
| 225 | 225 | echo "error : ".$e->getMessage(); |
| 226 | 226 | } |
| 227 | 227 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 228 | 228 | if (empty($all)) { |
| 229 | 229 | $filters = array('airlines' => array($stats_airline)); |
| 230 | 230 | if ($filter_name != '') { |
| 231 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 231 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 232 | 232 | } |
| 233 | 233 | $Spotter = new Spotter($this->db); |
| 234 | - $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
| 234 | + $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters); |
|
| 235 | 235 | } |
| 236 | 236 | return $all; |
| 237 | 237 | } |
| 238 | - public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') { |
|
| 238 | + public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '') { |
|
| 239 | 239 | global $globalStatsFilters; |
| 240 | 240 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 241 | 241 | if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
| 242 | 242 | else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
| 243 | 243 | try { |
| 244 | 244 | $sth = $this->db->prepare($query); |
| 245 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 246 | - } catch(PDOException $e) { |
|
| 245 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 246 | + } catch (PDOException $e) { |
|
| 247 | 247 | echo "error : ".$e->getMessage(); |
| 248 | 248 | } |
| 249 | 249 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 250 | 250 | if (empty($all)) { |
| 251 | 251 | $filters = array('airlines' => array($stats_airline)); |
| 252 | 252 | if ($filter_name != '') { |
| 253 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 253 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 254 | 254 | } |
| 255 | 255 | $Spotter = new Spotter($this->db); |
| 256 | - $all = $Spotter->countAllCallsigns($limit,0,'',$filters); |
|
| 256 | + $all = $Spotter->countAllCallsigns($limit, 0, '', $filters); |
|
| 257 | 257 | } |
| 258 | 258 | return $all; |
| 259 | 259 | } |
| 260 | - public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') { |
|
| 260 | + public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '') { |
|
| 261 | 261 | $Connection = new Connection(); |
| 262 | 262 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 263 | 263 | if ($Connection->tableExists('countries')) { |
@@ -265,8 +265,8 @@ discard block |
||
| 265 | 265 | else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
| 266 | 266 | try { |
| 267 | 267 | $sth = $this->db->prepare($query); |
| 268 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 269 | - } catch(PDOException $e) { |
|
| 268 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 269 | + } catch (PDOException $e) { |
|
| 270 | 270 | echo "error : ".$e->getMessage(); |
| 271 | 271 | } |
| 272 | 272 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -281,70 +281,70 @@ discard block |
||
| 281 | 281 | return array(); |
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | - public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') { |
|
| 284 | + public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '') { |
|
| 285 | 285 | global $globalStatsFilters; |
| 286 | 286 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 287 | 287 | if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
| 288 | 288 | else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
| 289 | 289 | try { |
| 290 | 290 | $sth = $this->db->prepare($query); |
| 291 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 292 | - } catch(PDOException $e) { |
|
| 291 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 292 | + } catch (PDOException $e) { |
|
| 293 | 293 | echo "error : ".$e->getMessage(); |
| 294 | 294 | } |
| 295 | 295 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 296 | 296 | if (empty($all)) { |
| 297 | 297 | $filters = array('airlines' => array($stats_airline)); |
| 298 | 298 | if ($filter_name != '') { |
| 299 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 299 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 300 | 300 | } |
| 301 | 301 | $Spotter = new Spotter($this->db); |
| 302 | - $all = $Spotter->countAllPilots($limit,0,'',$filters); |
|
| 302 | + $all = $Spotter->countAllPilots($limit, 0, '', $filters); |
|
| 303 | 303 | } |
| 304 | 304 | return $all; |
| 305 | 305 | } |
| 306 | - public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') { |
|
| 306 | + public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '') { |
|
| 307 | 307 | global $globalStatsFilters; |
| 308 | 308 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 309 | 309 | if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
| 310 | 310 | else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
| 311 | 311 | try { |
| 312 | 312 | $sth = $this->db->prepare($query); |
| 313 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 314 | - } catch(PDOException $e) { |
|
| 313 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 314 | + } catch (PDOException $e) { |
|
| 315 | 315 | echo "error : ".$e->getMessage(); |
| 316 | 316 | } |
| 317 | 317 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 318 | 318 | if (empty($all)) { |
| 319 | 319 | $filters = array('airlines' => array($stats_airline)); |
| 320 | 320 | if ($filter_name != '') { |
| 321 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 321 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 322 | 322 | } |
| 323 | 323 | $Spotter = new Spotter($this->db); |
| 324 | - $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
| 324 | + $all = $Spotter->countAllOwners($limit, 0, '', $filters); |
|
| 325 | 325 | } |
| 326 | 326 | return $all; |
| 327 | 327 | } |
| 328 | - public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') { |
|
| 328 | + public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '') { |
|
| 329 | 329 | global $globalStatsFilters; |
| 330 | 330 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 331 | 331 | if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
| 332 | 332 | else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
| 333 | 333 | try { |
| 334 | 334 | $sth = $this->db->prepare($query); |
| 335 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 336 | - } catch(PDOException $e) { |
|
| 335 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 336 | + } catch (PDOException $e) { |
|
| 337 | 337 | echo "error : ".$e->getMessage(); |
| 338 | 338 | } |
| 339 | 339 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 340 | 340 | if (empty($all)) { |
| 341 | 341 | $filters = array('airlines' => array($stats_airline)); |
| 342 | 342 | if ($filter_name != '') { |
| 343 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 343 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 344 | 344 | } |
| 345 | 345 | $Spotter = new Spotter($this->db); |
| 346 | - $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
| 347 | - $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
| 346 | + $pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters); |
|
| 347 | + $dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters); |
|
| 348 | 348 | $all = array(); |
| 349 | 349 | foreach ($pall as $value) { |
| 350 | 350 | $icao = $value['airport_departure_icao']; |
@@ -361,30 +361,30 @@ discard block |
||
| 361 | 361 | foreach ($all as $key => $row) { |
| 362 | 362 | $count[$key] = $row['airport_departure_icao_count']; |
| 363 | 363 | } |
| 364 | - array_multisort($count,SORT_DESC,$all); |
|
| 364 | + array_multisort($count, SORT_DESC, $all); |
|
| 365 | 365 | } |
| 366 | 366 | return $all; |
| 367 | 367 | } |
| 368 | - public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') { |
|
| 368 | + public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '') { |
|
| 369 | 369 | global $globalStatsFilters; |
| 370 | 370 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 371 | 371 | if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
| 372 | 372 | else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
| 373 | 373 | try { |
| 374 | 374 | $sth = $this->db->prepare($query); |
| 375 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 376 | - } catch(PDOException $e) { |
|
| 375 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 376 | + } catch (PDOException $e) { |
|
| 377 | 377 | echo "error : ".$e->getMessage(); |
| 378 | 378 | } |
| 379 | 379 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 380 | 380 | if (empty($all)) { |
| 381 | 381 | $filters = array('airlines' => array($stats_airline)); |
| 382 | 382 | if ($filter_name != '') { |
| 383 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 383 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 384 | 384 | } |
| 385 | 385 | $Spotter = new Spotter($this->db); |
| 386 | - $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters); |
|
| 387 | - $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters); |
|
| 386 | + $pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters); |
|
| 387 | + $dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters); |
|
| 388 | 388 | $all = array(); |
| 389 | 389 | foreach ($pall as $value) { |
| 390 | 390 | $icao = $value['airport_arrival_icao']; |
@@ -401,12 +401,12 @@ discard block |
||
| 401 | 401 | foreach ($all as $key => $row) { |
| 402 | 402 | $count[$key] = $row['airport_arrival_icao_count']; |
| 403 | 403 | } |
| 404 | - array_multisort($count,SORT_DESC,$all); |
|
| 404 | + array_multisort($count, SORT_DESC, $all); |
|
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | return $all; |
| 408 | 408 | } |
| 409 | - public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
|
| 409 | + public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') { |
|
| 410 | 410 | global $globalDBdriver, $globalStatsFilters; |
| 411 | 411 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 412 | 412 | if ($globalDBdriver == 'mysql') { |
@@ -416,18 +416,18 @@ discard block |
||
| 416 | 416 | if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 417 | 417 | else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 418 | 418 | } |
| 419 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 419 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 420 | 420 | try { |
| 421 | 421 | $sth = $this->db->prepare($query); |
| 422 | 422 | $sth->execute($query_data); |
| 423 | - } catch(PDOException $e) { |
|
| 423 | + } catch (PDOException $e) { |
|
| 424 | 424 | echo "error : ".$e->getMessage(); |
| 425 | 425 | } |
| 426 | 426 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 427 | 427 | if (empty($all)) { |
| 428 | 428 | $filters = array('airlines' => array($stats_airline)); |
| 429 | 429 | if ($filter_name != '') { |
| 430 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 430 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 431 | 431 | } |
| 432 | 432 | $Spotter = new Spotter($this->db); |
| 433 | 433 | $all = $Spotter->countAllMonthsLastYear($filters); |
@@ -436,29 +436,29 @@ discard block |
||
| 436 | 436 | return $all; |
| 437 | 437 | } |
| 438 | 438 | |
| 439 | - public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
|
| 439 | + public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') { |
|
| 440 | 440 | global $globalStatsFilters; |
| 441 | 441 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 442 | 442 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 443 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 443 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 444 | 444 | try { |
| 445 | 445 | $sth = $this->db->prepare($query); |
| 446 | 446 | $sth->execute($query_data); |
| 447 | - } catch(PDOException $e) { |
|
| 447 | + } catch (PDOException $e) { |
|
| 448 | 448 | echo "error : ".$e->getMessage(); |
| 449 | 449 | } |
| 450 | 450 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 451 | 451 | if (empty($all)) { |
| 452 | 452 | $filters = array('airlines' => array($stats_airline)); |
| 453 | 453 | if ($filter_name != '') { |
| 454 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 454 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 455 | 455 | } |
| 456 | 456 | $Spotter = new Spotter($this->db); |
| 457 | 457 | $all = $Spotter->countAllDatesLastMonth($filters); |
| 458 | 458 | } |
| 459 | 459 | return $all; |
| 460 | 460 | } |
| 461 | - public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
|
| 461 | + public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') { |
|
| 462 | 462 | global $globalDBdriver, $globalStatsFilters; |
| 463 | 463 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 464 | 464 | if ($globalDBdriver == 'mysql') { |
@@ -466,40 +466,40 @@ discard block |
||
| 466 | 466 | } else { |
| 467 | 467 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 468 | 468 | } |
| 469 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 469 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 470 | 470 | try { |
| 471 | 471 | $sth = $this->db->prepare($query); |
| 472 | 472 | $sth->execute($query_data); |
| 473 | - } catch(PDOException $e) { |
|
| 473 | + } catch (PDOException $e) { |
|
| 474 | 474 | echo "error : ".$e->getMessage(); |
| 475 | 475 | } |
| 476 | 476 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 477 | 477 | if (empty($all)) { |
| 478 | 478 | $filters = array('airlines' => array($stats_airline)); |
| 479 | 479 | if ($filter_name != '') { |
| 480 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 480 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 481 | 481 | } |
| 482 | 482 | $Spotter = new Spotter($this->db); |
| 483 | 483 | $all = $Spotter->countAllDatesLast7Days($filters); |
| 484 | 484 | } |
| 485 | 485 | return $all; |
| 486 | 486 | } |
| 487 | - public function countAllDates($stats_airline = '',$filter_name = '') { |
|
| 487 | + public function countAllDates($stats_airline = '', $filter_name = '') { |
|
| 488 | 488 | global $globalStatsFilters; |
| 489 | 489 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 490 | 490 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 491 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 491 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 492 | 492 | try { |
| 493 | 493 | $sth = $this->db->prepare($query); |
| 494 | 494 | $sth->execute($query_data); |
| 495 | - } catch(PDOException $e) { |
|
| 495 | + } catch (PDOException $e) { |
|
| 496 | 496 | echo "error : ".$e->getMessage(); |
| 497 | 497 | } |
| 498 | 498 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 499 | 499 | if (empty($all)) { |
| 500 | 500 | $filters = array('airlines' => array($stats_airline)); |
| 501 | 501 | if ($filter_name != '') { |
| 502 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 502 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 503 | 503 | } |
| 504 | 504 | $Spotter = new Spotter($this->db); |
| 505 | 505 | $all = $Spotter->countAllDates($filters); |
@@ -514,35 +514,35 @@ discard block |
||
| 514 | 514 | try { |
| 515 | 515 | $sth = $this->db->prepare($query); |
| 516 | 516 | $sth->execute($query_data); |
| 517 | - } catch(PDOException $e) { |
|
| 517 | + } catch (PDOException $e) { |
|
| 518 | 518 | echo "error : ".$e->getMessage(); |
| 519 | 519 | } |
| 520 | 520 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 521 | 521 | if (empty($all)) { |
| 522 | 522 | $filters = array(); |
| 523 | 523 | if ($filter_name != '') { |
| 524 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 524 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 525 | 525 | } |
| 526 | 526 | $Spotter = new Spotter($this->db); |
| 527 | 527 | $all = $Spotter->countAllDatesByAirlines($filters); |
| 528 | 528 | } |
| 529 | 529 | return $all; |
| 530 | 530 | } |
| 531 | - public function countAllMonths($stats_airline = '',$filter_name = '') { |
|
| 531 | + public function countAllMonths($stats_airline = '', $filter_name = '') { |
|
| 532 | 532 | global $globalStatsFilters; |
| 533 | 533 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 534 | 534 | $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 535 | 535 | try { |
| 536 | 536 | $sth = $this->db->prepare($query); |
| 537 | 537 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
| 538 | - } catch(PDOException $e) { |
|
| 538 | + } catch (PDOException $e) { |
|
| 539 | 539 | echo "error : ".$e->getMessage(); |
| 540 | 540 | } |
| 541 | 541 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 542 | 542 | if (empty($all)) { |
| 543 | 543 | $filters = array('airlines' => array($stats_airline)); |
| 544 | 544 | if ($filter_name != '') { |
| 545 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 545 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 546 | 546 | } |
| 547 | 547 | $Spotter = new Spotter($this->db); |
| 548 | 548 | $all = $Spotter->countAllMonths($filters); |
@@ -556,21 +556,21 @@ discard block |
||
| 556 | 556 | try { |
| 557 | 557 | $sth = $this->db->prepare($query); |
| 558 | 558 | $sth->execute(array(':filter_name' => $filter_name)); |
| 559 | - } catch(PDOException $e) { |
|
| 559 | + } catch (PDOException $e) { |
|
| 560 | 560 | echo "error : ".$e->getMessage(); |
| 561 | 561 | } |
| 562 | 562 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 563 | 563 | if (empty($all)) { |
| 564 | 564 | $filters = array(); |
| 565 | 565 | if ($filter_name != '') { |
| 566 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 566 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 567 | 567 | } |
| 568 | 568 | $Spotter = new Spotter($this->db); |
| 569 | 569 | $all = $Spotter->countAllMilitaryMonths($filters); |
| 570 | 570 | } |
| 571 | 571 | return $all; |
| 572 | 572 | } |
| 573 | - public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
|
| 573 | + public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') { |
|
| 574 | 574 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
| 575 | 575 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 576 | 576 | if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -587,17 +587,17 @@ discard block |
||
| 587 | 587 | try { |
| 588 | 588 | $sth = $this->db->prepare($query); |
| 589 | 589 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
| 590 | - } catch(PDOException $e) { |
|
| 590 | + } catch (PDOException $e) { |
|
| 591 | 591 | echo "error : ".$e->getMessage(); |
| 592 | 592 | } |
| 593 | 593 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 594 | 594 | if (empty($all)) { |
| 595 | 595 | $filters = array('airlines' => array($stats_airline)); |
| 596 | 596 | if ($filter_name != '') { |
| 597 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 597 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 598 | 598 | } |
| 599 | 599 | $Spotter = new Spotter($this->db); |
| 600 | - $all = $Spotter->countAllHours($orderby,$filters); |
|
| 600 | + $all = $Spotter->countAllHours($orderby, $filters); |
|
| 601 | 601 | } |
| 602 | 602 | return $all; |
| 603 | 603 | } |
@@ -605,11 +605,11 @@ discard block |
||
| 605 | 605 | public function countOverallFlights($stats_airline = '', $filter_name = '') { |
| 606 | 606 | global $globalStatsFilters; |
| 607 | 607 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 608 | - $all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline,$filter_name); |
|
| 608 | + $all = $this->getSumStats('flights_bymonth', date('Y'), $stats_airline, $filter_name); |
|
| 609 | 609 | if (empty($all)) { |
| 610 | 610 | $filters = array('airlines' => array($stats_airline)); |
| 611 | 611 | if ($filter_name != '') { |
| 612 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 612 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 613 | 613 | } |
| 614 | 614 | $Spotter = new Spotter($this->db); |
| 615 | 615 | $all = $Spotter->countOverallFlights($filters); |
@@ -619,39 +619,39 @@ discard block |
||
| 619 | 619 | public function countOverallMilitaryFlights($filter_name = '') { |
| 620 | 620 | global $globalStatsFilters; |
| 621 | 621 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 622 | - $all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name); |
|
| 622 | + $all = $this->getSumStats('military_flights_bymonth', date('Y'), '', $filter_name); |
|
| 623 | 623 | if (empty($all)) { |
| 624 | 624 | $filters = array(); |
| 625 | 625 | if ($filter_name != '') { |
| 626 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 626 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 627 | 627 | } |
| 628 | 628 | $Spotter = new Spotter($this->db); |
| 629 | 629 | $all = $Spotter->countOverallMilitaryFlights($filters); |
| 630 | 630 | } |
| 631 | 631 | return $all; |
| 632 | 632 | } |
| 633 | - public function countOverallArrival($stats_airline = '',$filter_name = '') { |
|
| 633 | + public function countOverallArrival($stats_airline = '', $filter_name = '') { |
|
| 634 | 634 | global $globalStatsFilters; |
| 635 | 635 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 636 | - $all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline,$filter_name); |
|
| 636 | + $all = $this->getSumStats('realarrivals_bymonth', date('Y'), $stats_airline, $filter_name); |
|
| 637 | 637 | if (empty($all)) { |
| 638 | 638 | $filters = array('airlines' => array($stats_airline)); |
| 639 | 639 | if ($filter_name != '') { |
| 640 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 640 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 641 | 641 | } |
| 642 | 642 | $Spotter = new Spotter($this->db); |
| 643 | 643 | $all = $Spotter->countOverallArrival($filters); |
| 644 | 644 | } |
| 645 | 645 | return $all; |
| 646 | 646 | } |
| 647 | - public function countOverallAircrafts($stats_airline = '',$filter_name = '') { |
|
| 647 | + public function countOverallAircrafts($stats_airline = '', $filter_name = '') { |
|
| 648 | 648 | global $globalStatsFilters; |
| 649 | 649 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 650 | - $all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline,$filter_name); |
|
| 650 | + $all = $this->getSumStats('aircrafts_bymonth', date('Y'), $stats_airline, $filter_name); |
|
| 651 | 651 | if (empty($all)) { |
| 652 | 652 | $filters = array('airlines' => array($stats_airline)); |
| 653 | 653 | if ($filter_name != '') { |
| 654 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 654 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 655 | 655 | } |
| 656 | 656 | $Spotter = new Spotter($this->db); |
| 657 | 657 | $all = $Spotter->countOverallAircrafts($filters); |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | try { |
| 666 | 666 | $sth = $this->db->prepare($query); |
| 667 | 667 | $sth->execute(array(':filter_name' => $filter_name)); |
| 668 | - } catch(PDOException $e) { |
|
| 668 | + } catch (PDOException $e) { |
|
| 669 | 669 | echo "error : ".$e->getMessage(); |
| 670 | 670 | } |
| 671 | 671 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -674,14 +674,14 @@ discard block |
||
| 674 | 674 | if (empty($all)) { |
| 675 | 675 | $filters = array(); |
| 676 | 676 | if ($filter_name != '') { |
| 677 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 677 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 678 | 678 | } |
| 679 | 679 | $Spotter = new Spotter($this->db); |
| 680 | 680 | $all = $Spotter->countOverallAirlines($filters); |
| 681 | 681 | } |
| 682 | 682 | return $all; |
| 683 | 683 | } |
| 684 | - public function countOverallOwners($stats_airline = '',$filter_name = '') { |
|
| 684 | + public function countOverallOwners($stats_airline = '', $filter_name = '') { |
|
| 685 | 685 | global $globalStatsFilters; |
| 686 | 686 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 687 | 687 | /* |
@@ -695,25 +695,25 @@ discard block |
||
| 695 | 695 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 696 | 696 | $all = $result[0]['nb_owner']; |
| 697 | 697 | */ |
| 698 | - $all = $this->getSumStats('owners_bymonth',date('Y'),$stats_airline,$filter_name); |
|
| 698 | + $all = $this->getSumStats('owners_bymonth', date('Y'), $stats_airline, $filter_name); |
|
| 699 | 699 | if (empty($all)) { |
| 700 | 700 | $filters = array('airlines' => array($stats_airline)); |
| 701 | 701 | if ($filter_name != '') { |
| 702 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 702 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 703 | 703 | } |
| 704 | 704 | $Spotter = new Spotter($this->db); |
| 705 | 705 | $all = $Spotter->countOverallOwners($filters); |
| 706 | 706 | } |
| 707 | 707 | return $all; |
| 708 | 708 | } |
| 709 | - public function countOverallPilots($stats_airline = '',$filter_name = '') { |
|
| 709 | + public function countOverallPilots($stats_airline = '', $filter_name = '') { |
|
| 710 | 710 | global $globalStatsFilters; |
| 711 | 711 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 712 | - $all = $this->getSumStats('pilots_bymonth',date('Y'),$stats_airline,$filter_name); |
|
| 712 | + $all = $this->getSumStats('pilots_bymonth', date('Y'), $stats_airline, $filter_name); |
|
| 713 | 713 | if (empty($all)) { |
| 714 | 714 | $filters = array('airlines' => array($stats_airline)); |
| 715 | 715 | if ($filter_name != '') { |
| 716 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 716 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 717 | 717 | } |
| 718 | 718 | $Spotter = new Spotter($this->db); |
| 719 | 719 | $all = $Spotter->countOverallPilots($filters); |
@@ -721,33 +721,33 @@ discard block |
||
| 721 | 721 | return $all; |
| 722 | 722 | } |
| 723 | 723 | |
| 724 | - public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
|
| 724 | + public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') { |
|
| 725 | 725 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 726 | 726 | $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date"; |
| 727 | - $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 727 | + $query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 728 | 728 | try { |
| 729 | 729 | $sth = $this->db->prepare($query); |
| 730 | 730 | $sth->execute($query_values); |
| 731 | - } catch(PDOException $e) { |
|
| 731 | + } catch (PDOException $e) { |
|
| 732 | 732 | echo "error : ".$e->getMessage(); |
| 733 | 733 | } |
| 734 | 734 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 735 | 735 | return $all; |
| 736 | 736 | } |
| 737 | - public function getStats($type,$stats_airline = '', $filter_name = '') { |
|
| 737 | + public function getStats($type, $stats_airline = '', $filter_name = '') { |
|
| 738 | 738 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 739 | 739 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
| 740 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 740 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 741 | 741 | try { |
| 742 | 742 | $sth = $this->db->prepare($query); |
| 743 | 743 | $sth->execute($query_values); |
| 744 | - } catch(PDOException $e) { |
|
| 744 | + } catch (PDOException $e) { |
|
| 745 | 745 | echo "error : ".$e->getMessage(); |
| 746 | 746 | } |
| 747 | 747 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 748 | 748 | return $all; |
| 749 | 749 | } |
| 750 | - public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') { |
|
| 750 | + public function getSumStats($type, $year, $stats_airline = '', $filter_name = '') { |
|
| 751 | 751 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 752 | 752 | global $globalArchiveMonths, $globalDBdriver; |
| 753 | 753 | if ($globalDBdriver == 'mysql') { |
@@ -755,11 +755,11 @@ discard block |
||
| 755 | 755 | } else { |
| 756 | 756 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 757 | 757 | } |
| 758 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 758 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 759 | 759 | try { |
| 760 | 760 | $sth = $this->db->prepare($query); |
| 761 | 761 | $sth->execute($query_values); |
| 762 | - } catch(PDOException $e) { |
|
| 762 | + } catch (PDOException $e) { |
|
| 763 | 763 | echo "error : ".$e->getMessage(); |
| 764 | 764 | } |
| 765 | 765 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | try { |
| 778 | 778 | $sth = $this->db->prepare($query); |
| 779 | 779 | $sth->execute($query_values); |
| 780 | - } catch(PDOException $e) { |
|
| 780 | + } catch (PDOException $e) { |
|
| 781 | 781 | echo "error : ".$e->getMessage(); |
| 782 | 782 | } |
| 783 | 783 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -794,7 +794,7 @@ discard block |
||
| 794 | 794 | try { |
| 795 | 795 | $sth = $this->db->prepare($query); |
| 796 | 796 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
| 797 | - } catch(PDOException $e) { |
|
| 797 | + } catch (PDOException $e) { |
|
| 798 | 798 | echo "error : ".$e->getMessage(); |
| 799 | 799 | } |
| 800 | 800 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | try { |
| 812 | 812 | $sth = $this->db->prepare($query); |
| 813 | 813 | $sth->execute(array(':filter_name' => $filter_name)); |
| 814 | - } catch(PDOException $e) { |
|
| 814 | + } catch (PDOException $e) { |
|
| 815 | 815 | echo "error : ".$e->getMessage(); |
| 816 | 816 | } |
| 817 | 817 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -828,7 +828,7 @@ discard block |
||
| 828 | 828 | try { |
| 829 | 829 | $sth = $this->db->prepare($query); |
| 830 | 830 | $sth->execute(array(':filter_name' => $filter_name)); |
| 831 | - } catch(PDOException $e) { |
|
| 831 | + } catch (PDOException $e) { |
|
| 832 | 832 | echo "error : ".$e->getMessage(); |
| 833 | 833 | } |
| 834 | 834 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -845,14 +845,14 @@ discard block |
||
| 845 | 845 | try { |
| 846 | 846 | $sth = $this->db->prepare($query); |
| 847 | 847 | $sth->execute(array(':filter_name' => $filter_name)); |
| 848 | - } catch(PDOException $e) { |
|
| 848 | + } catch (PDOException $e) { |
|
| 849 | 849 | echo "error : ".$e->getMessage(); |
| 850 | 850 | } |
| 851 | 851 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 852 | 852 | return $all[0]['total']; |
| 853 | 853 | } |
| 854 | 854 | |
| 855 | - public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
| 855 | + public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
| 856 | 856 | global $globalDBdriver; |
| 857 | 857 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 858 | 858 | if ($globalDBdriver == 'mysql') { |
@@ -860,15 +860,15 @@ discard block |
||
| 860 | 860 | } else { |
| 861 | 861 | $query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 862 | 862 | } |
| 863 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 863 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 864 | 864 | try { |
| 865 | 865 | $sth = $this->db->prepare($query); |
| 866 | 866 | $sth->execute($query_values); |
| 867 | - } catch(PDOException $e) { |
|
| 867 | + } catch (PDOException $e) { |
|
| 868 | 868 | return "error : ".$e->getMessage(); |
| 869 | 869 | } |
| 870 | 870 | } |
| 871 | - public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
| 871 | + public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
| 872 | 872 | global $globalDBdriver; |
| 873 | 873 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 874 | 874 | if ($globalDBdriver == 'mysql') { |
@@ -877,219 +877,219 @@ discard block |
||
| 877 | 877 | //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
| 878 | 878 | $query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 879 | 879 | } |
| 880 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 880 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 881 | 881 | try { |
| 882 | 882 | $sth = $this->db->prepare($query); |
| 883 | 883 | $sth->execute($query_values); |
| 884 | - } catch(PDOException $e) { |
|
| 884 | + } catch (PDOException $e) { |
|
| 885 | 885 | return "error : ".$e->getMessage(); |
| 886 | 886 | } |
| 887 | 887 | } |
| 888 | - public function getStatsSource($date,$stats_type = '') { |
|
| 888 | + public function getStatsSource($date, $stats_type = '') { |
|
| 889 | 889 | if ($stats_type == '') { |
| 890 | 890 | $query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name"; |
| 891 | 891 | $query_values = array(':date' => $date); |
| 892 | 892 | } else { |
| 893 | 893 | $query = "SELECT * FROM stats_source WHERE stats_date = :date AND stats_type = :stats_type ORDER BY source_name"; |
| 894 | - $query_values = array(':date' => $date,':stats_type' => $stats_type); |
|
| 894 | + $query_values = array(':date' => $date, ':stats_type' => $stats_type); |
|
| 895 | 895 | } |
| 896 | 896 | try { |
| 897 | 897 | $sth = $this->db->prepare($query); |
| 898 | 898 | $sth->execute($query_values); |
| 899 | - } catch(PDOException $e) { |
|
| 899 | + } catch (PDOException $e) { |
|
| 900 | 900 | echo "error : ".$e->getMessage(); |
| 901 | 901 | } |
| 902 | 902 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 903 | 903 | return $all; |
| 904 | 904 | } |
| 905 | 905 | |
| 906 | - public function addStatSource($data,$source_name,$stats_type,$date) { |
|
| 906 | + public function addStatSource($data, $source_name, $stats_type, $date) { |
|
| 907 | 907 | global $globalDBdriver; |
| 908 | 908 | if ($globalDBdriver == 'mysql') { |
| 909 | 909 | $query = "INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) VALUES (:data,:source_name,:stats_type,:stats_date) ON DUPLICATE KEY UPDATE source_data = :data"; |
| 910 | 910 | } else { |
| 911 | 911 | $query = "UPDATE stats_source SET source_data = :data WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type; INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) SELECT :data,:source_name,:stats_type,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats_source WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type);"; |
| 912 | 912 | } |
| 913 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
| 913 | + $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type); |
|
| 914 | 914 | try { |
| 915 | 915 | $sth = $this->db->prepare($query); |
| 916 | 916 | $sth->execute($query_values); |
| 917 | - } catch(PDOException $e) { |
|
| 917 | + } catch (PDOException $e) { |
|
| 918 | 918 | return "error : ".$e->getMessage(); |
| 919 | 919 | } |
| 920 | 920 | } |
| 921 | - public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
|
| 921 | + public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') { |
|
| 922 | 922 | $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
| 923 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 923 | + $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 924 | 924 | try { |
| 925 | 925 | $sth = $this->db->prepare($query); |
| 926 | 926 | $sth->execute($query_values); |
| 927 | - } catch(PDOException $e) { |
|
| 927 | + } catch (PDOException $e) { |
|
| 928 | 928 | return "error : ".$e->getMessage(); |
| 929 | 929 | } |
| 930 | 930 | } |
| 931 | - public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '') { |
|
| 931 | + public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '') { |
|
| 932 | 932 | global $globalDBdriver; |
| 933 | 933 | if ($globalDBdriver == 'mysql') { |
| 934 | 934 | $query = "INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) VALUES (:aircraft_icao,:registration,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt"; |
| 935 | 935 | } else { |
| 936 | 936 | $query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:registration,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 937 | 937 | } |
| 938 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 938 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 939 | 939 | try { |
| 940 | 940 | $sth = $this->db->prepare($query); |
| 941 | 941 | $sth->execute($query_values); |
| 942 | - } catch(PDOException $e) { |
|
| 942 | + } catch (PDOException $e) { |
|
| 943 | 943 | return "error : ".$e->getMessage(); |
| 944 | 944 | } |
| 945 | 945 | } |
| 946 | - public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '') { |
|
| 946 | + public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '') { |
|
| 947 | 947 | global $globalDBdriver; |
| 948 | 948 | if ($globalDBdriver == 'mysql') { |
| 949 | 949 | $query = "INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) VALUES (:callsign_icao,:airline_icao,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt"; |
| 950 | 950 | } else { |
| 951 | 951 | $query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) SELECT :callsign_icao,:airline_icao,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name);"; |
| 952 | 952 | } |
| 953 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 953 | + $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 954 | 954 | try { |
| 955 | 955 | $sth = $this->db->prepare($query); |
| 956 | 956 | $sth->execute($query_values); |
| 957 | - } catch(PDOException $e) { |
|
| 957 | + } catch (PDOException $e) { |
|
| 958 | 958 | return "error : ".$e->getMessage(); |
| 959 | 959 | } |
| 960 | 960 | } |
| 961 | - public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '') { |
|
| 961 | + public function addStatCountry($iso2, $iso3, $name, $cnt, $filter_name = '') { |
|
| 962 | 962 | global $globalDBdriver; |
| 963 | 963 | if ($globalDBdriver == 'mysql') { |
| 964 | 964 | $query = "INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) VALUES (:iso2,:iso3,:name,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt"; |
| 965 | 965 | } else { |
| 966 | 966 | $query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name; INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) SELECT :iso2,:iso3,:name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name);"; |
| 967 | 967 | } |
| 968 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
| 968 | + $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 969 | 969 | try { |
| 970 | 970 | $sth = $this->db->prepare($query); |
| 971 | 971 | $sth->execute($query_values); |
| 972 | - } catch(PDOException $e) { |
|
| 972 | + } catch (PDOException $e) { |
|
| 973 | 973 | return "error : ".$e->getMessage(); |
| 974 | 974 | } |
| 975 | 975 | } |
| 976 | - public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') { |
|
| 976 | + public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') { |
|
| 977 | 977 | global $globalDBdriver; |
| 978 | 978 | if ($globalDBdriver == 'mysql') { |
| 979 | 979 | $query = "INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline, filter_name) VALUES (:aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, stats_airline = :stats_airline"; |
| 980 | 980 | } else { |
| 981 | 981 | $query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, filter_name = :filter_name WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 982 | 982 | } |
| 983 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 983 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':aircraft_name' => $aircraft_name, ':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 984 | 984 | try { |
| 985 | 985 | $sth = $this->db->prepare($query); |
| 986 | 986 | $sth->execute($query_values); |
| 987 | - } catch(PDOException $e) { |
|
| 987 | + } catch (PDOException $e) { |
|
| 988 | 988 | return "error : ".$e->getMessage(); |
| 989 | 989 | } |
| 990 | 990 | } |
| 991 | - public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '') { |
|
| 991 | + public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '') { |
|
| 992 | 992 | global $globalDBdriver; |
| 993 | 993 | if ($globalDBdriver == 'mysql') { |
| 994 | 994 | $query = "INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) VALUES (:airline_icao,:airline_name,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt,airline_name = :airline_name"; |
| 995 | 995 | } else { |
| 996 | 996 | $query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao AND filter_name = :filter_name; INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) SELECT :airline_icao,:airline_name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao AND filter_name = :filter_name);"; |
| 997 | 997 | } |
| 998 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
| 998 | + $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 999 | 999 | try { |
| 1000 | 1000 | $sth = $this->db->prepare($query); |
| 1001 | 1001 | $sth->execute($query_values); |
| 1002 | - } catch(PDOException $e) { |
|
| 1002 | + } catch (PDOException $e) { |
|
| 1003 | 1003 | return "error : ".$e->getMessage(); |
| 1004 | 1004 | } |
| 1005 | 1005 | } |
| 1006 | - public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '') { |
|
| 1006 | + public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '') { |
|
| 1007 | 1007 | global $globalDBdriver; |
| 1008 | 1008 | if ($globalDBdriver == 'mysql') { |
| 1009 | 1009 | $query = "INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) VALUES (:owner_name,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt"; |
| 1010 | 1010 | } else { |
| 1011 | 1011 | $query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) SELECT :owner_name,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 1012 | 1012 | } |
| 1013 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1013 | + $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 1014 | 1014 | try { |
| 1015 | 1015 | $sth = $this->db->prepare($query); |
| 1016 | 1016 | $sth->execute($query_values); |
| 1017 | - } catch(PDOException $e) { |
|
| 1017 | + } catch (PDOException $e) { |
|
| 1018 | 1018 | return "error : ".$e->getMessage(); |
| 1019 | 1019 | } |
| 1020 | 1020 | } |
| 1021 | - public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '') { |
|
| 1021 | + public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '') { |
|
| 1022 | 1022 | global $globalDBdriver; |
| 1023 | 1023 | if ($globalDBdriver == 'mysql') { |
| 1024 | 1024 | $query = "INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name) VALUES (:pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, pilot_name = :pilot_name"; |
| 1025 | 1025 | } else { |
| 1026 | 1026 | $query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 1027 | 1027 | } |
| 1028 | - $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1028 | + $query_values = array(':pilot_id' => $pilot_id, ':cnt' => $cnt, ':pilot_name' => $pilot_name, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 1029 | 1029 | try { |
| 1030 | 1030 | $sth = $this->db->prepare($query); |
| 1031 | 1031 | $sth->execute($query_values); |
| 1032 | - } catch(PDOException $e) { |
|
| 1032 | + } catch (PDOException $e) { |
|
| 1033 | 1033 | return "error : ".$e->getMessage(); |
| 1034 | 1034 | } |
| 1035 | 1035 | } |
| 1036 | - public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
| 1036 | + public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
|
| 1037 | 1037 | global $globalDBdriver; |
| 1038 | 1038 | if ($globalDBdriver == 'mysql') { |
| 1039 | 1039 | $query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE departure = departure+:departure"; |
| 1040 | 1040 | } else { |
| 1041 | 1041 | $query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; |
| 1042 | 1042 | } |
| 1043 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
| 1043 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 1044 | 1044 | try { |
| 1045 | 1045 | $sth = $this->db->prepare($query); |
| 1046 | 1046 | $sth->execute($query_values); |
| 1047 | - } catch(PDOException $e) { |
|
| 1047 | + } catch (PDOException $e) { |
|
| 1048 | 1048 | return "error : ".$e->getMessage(); |
| 1049 | 1049 | } |
| 1050 | 1050 | } |
| 1051 | - public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
| 1051 | + public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
|
| 1052 | 1052 | global $globalDBdriver; |
| 1053 | 1053 | if ($globalDBdriver == 'mysql') { |
| 1054 | 1054 | $query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE departure = :departure"; |
| 1055 | 1055 | } else { |
| 1056 | 1056 | $query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 1057 | 1057 | } |
| 1058 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
| 1058 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 1059 | 1059 | try { |
| 1060 | 1060 | $sth = $this->db->prepare($query); |
| 1061 | 1061 | $sth->execute($query_values); |
| 1062 | - } catch(PDOException $e) { |
|
| 1062 | + } catch (PDOException $e) { |
|
| 1063 | 1063 | return "error : ".$e->getMessage(); |
| 1064 | 1064 | } |
| 1065 | 1065 | } |
| 1066 | - public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
| 1066 | + public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
|
| 1067 | 1067 | global $globalDBdriver; |
| 1068 | 1068 | if ($globalDBdriver == 'mysql') { |
| 1069 | 1069 | $query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE arrival = arrival+:arrival"; |
| 1070 | 1070 | } else { |
| 1071 | 1071 | $query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; |
| 1072 | 1072 | } |
| 1073 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
| 1073 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 1074 | 1074 | try { |
| 1075 | 1075 | $sth = $this->db->prepare($query); |
| 1076 | 1076 | $sth->execute($query_values); |
| 1077 | - } catch(PDOException $e) { |
|
| 1077 | + } catch (PDOException $e) { |
|
| 1078 | 1078 | return "error : ".$e->getMessage(); |
| 1079 | 1079 | } |
| 1080 | 1080 | } |
| 1081 | - public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
| 1081 | + public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
|
| 1082 | 1082 | global $globalDBdriver; |
| 1083 | 1083 | if ($globalDBdriver == 'mysql') { |
| 1084 | 1084 | $query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE arrival = :arrival"; |
| 1085 | 1085 | } else { |
| 1086 | 1086 | $query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 1087 | 1087 | } |
| 1088 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival, ':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
| 1088 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 1089 | 1089 | try { |
| 1090 | 1090 | $sth = $this->db->prepare($query); |
| 1091 | 1091 | $sth->execute($query_values); |
| 1092 | - } catch(PDOException $e) { |
|
| 1092 | + } catch (PDOException $e) { |
|
| 1093 | 1093 | return "error : ".$e->getMessage(); |
| 1094 | 1094 | } |
| 1095 | 1095 | } |
@@ -1100,7 +1100,7 @@ discard block |
||
| 1100 | 1100 | try { |
| 1101 | 1101 | $sth = $this->db->prepare($query); |
| 1102 | 1102 | $sth->execute($query_values); |
| 1103 | - } catch(PDOException $e) { |
|
| 1103 | + } catch (PDOException $e) { |
|
| 1104 | 1104 | return "error : ".$e->getMessage(); |
| 1105 | 1105 | } |
| 1106 | 1106 | } |
@@ -1110,7 +1110,7 @@ discard block |
||
| 1110 | 1110 | try { |
| 1111 | 1111 | $sth = $this->db->prepare($query); |
| 1112 | 1112 | $sth->execute($query_values); |
| 1113 | - } catch(PDOException $e) { |
|
| 1113 | + } catch (PDOException $e) { |
|
| 1114 | 1114 | return "error : ".$e->getMessage(); |
| 1115 | 1115 | } |
| 1116 | 1116 | } |
@@ -1120,7 +1120,7 @@ discard block |
||
| 1120 | 1120 | try { |
| 1121 | 1121 | $sth = $this->db->prepare($query); |
| 1122 | 1122 | $sth->execute($query_values); |
| 1123 | - } catch(PDOException $e) { |
|
| 1123 | + } catch (PDOException $e) { |
|
| 1124 | 1124 | return "error : ".$e->getMessage(); |
| 1125 | 1125 | } |
| 1126 | 1126 | } |
@@ -1358,33 +1358,33 @@ discard block |
||
| 1358 | 1358 | $last_update_day = $last_update[0]['value']; |
| 1359 | 1359 | } else $last_update_day = '2012-12-12 12:12:12'; |
| 1360 | 1360 | $Spotter = new Spotter($this->db); |
| 1361 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
|
| 1361 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day); |
|
| 1362 | 1362 | foreach ($alldata as $number) { |
| 1363 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer']); |
|
| 1363 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer']); |
|
| 1364 | 1364 | } |
| 1365 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
|
| 1365 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day); |
|
| 1366 | 1366 | foreach ($alldata as $number) { |
| 1367 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name']); |
|
| 1367 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name']); |
|
| 1368 | 1368 | } |
| 1369 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
|
| 1369 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day); |
|
| 1370 | 1370 | foreach ($alldata as $number) { |
| 1371 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao']); |
|
| 1371 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao']); |
|
| 1372 | 1372 | } |
| 1373 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
|
| 1373 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day); |
|
| 1374 | 1374 | foreach ($alldata as $number) { |
| 1375 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']); |
|
| 1375 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']); |
|
| 1376 | 1376 | } |
| 1377 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
|
| 1377 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day); |
|
| 1378 | 1378 | foreach ($alldata as $number) { |
| 1379 | - $this->addStatOwner($number['owner_name'],$number['owner_count']); |
|
| 1379 | + $this->addStatOwner($number['owner_name'], $number['owner_count']); |
|
| 1380 | 1380 | } |
| 1381 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
|
| 1381 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day); |
|
| 1382 | 1382 | foreach ($alldata as $number) { |
| 1383 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name']); |
|
| 1383 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name']); |
|
| 1384 | 1384 | } |
| 1385 | 1385 | |
| 1386 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
|
| 1387 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
| 1386 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day); |
|
| 1387 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day); |
|
| 1388 | 1388 | $alldata = array(); |
| 1389 | 1389 | |
| 1390 | 1390 | foreach ($pall as $value) { |
@@ -1401,12 +1401,12 @@ discard block |
||
| 1401 | 1401 | foreach ($alldata as $key => $row) { |
| 1402 | 1402 | $count[$key] = $row['airport_departure_icao_count']; |
| 1403 | 1403 | } |
| 1404 | - array_multisort($count,SORT_DESC,$alldata); |
|
| 1404 | + array_multisort($count, SORT_DESC, $alldata); |
|
| 1405 | 1405 | foreach ($alldata as $number) { |
| 1406 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']); |
|
| 1406 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count']); |
|
| 1407 | 1407 | } |
| 1408 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
|
| 1409 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
| 1408 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day); |
|
| 1409 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day); |
|
| 1410 | 1410 | $alldata = array(); |
| 1411 | 1411 | foreach ($pall as $value) { |
| 1412 | 1412 | $icao = $value['airport_arrival_icao']; |
@@ -1422,15 +1422,15 @@ discard block |
||
| 1422 | 1422 | foreach ($alldata as $key => $row) { |
| 1423 | 1423 | $count[$key] = $row['airport_arrival_icao_count']; |
| 1424 | 1424 | } |
| 1425 | - array_multisort($count,SORT_DESC,$alldata); |
|
| 1425 | + array_multisort($count, SORT_DESC, $alldata); |
|
| 1426 | 1426 | foreach ($alldata as $number) { |
| 1427 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']); |
|
| 1427 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count']); |
|
| 1428 | 1428 | } |
| 1429 | 1429 | if ($Connection->tableExists('countries')) { |
| 1430 | 1430 | $SpotterArchive = new SpotterArchive(); |
| 1431 | - $alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
|
| 1431 | + $alldata = $SpotterArchive->countAllFlightOverCountries(false, 0, $last_update_day); |
|
| 1432 | 1432 | foreach ($alldata as $number) { |
| 1433 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count']); |
|
| 1433 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count']); |
|
| 1434 | 1434 | } |
| 1435 | 1435 | } |
| 1436 | 1436 | |
@@ -1443,31 +1443,31 @@ discard block |
||
| 1443 | 1443 | $lastyear = false; |
| 1444 | 1444 | foreach ($alldata as $number) { |
| 1445 | 1445 | if ($number['year_name'] != date('Y')) $lastyear = true; |
| 1446 | - $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
| 1446 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
| 1447 | 1447 | } |
| 1448 | 1448 | $alldata = $Spotter->countAllMilitaryMonths(); |
| 1449 | 1449 | foreach ($alldata as $number) { |
| 1450 | - $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
| 1450 | + $this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
| 1451 | 1451 | } |
| 1452 | 1452 | $alldata = $Spotter->countAllMonthsOwners(); |
| 1453 | 1453 | foreach ($alldata as $number) { |
| 1454 | - $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
| 1454 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
| 1455 | 1455 | } |
| 1456 | 1456 | $alldata = $Spotter->countAllMonthsPilots(); |
| 1457 | 1457 | foreach ($alldata as $number) { |
| 1458 | - $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
| 1458 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
| 1459 | 1459 | } |
| 1460 | 1460 | $alldata = $Spotter->countAllMonthsAirlines(); |
| 1461 | 1461 | foreach ($alldata as $number) { |
| 1462 | - $this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
| 1462 | + $this->addStat('airlines_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
| 1463 | 1463 | } |
| 1464 | 1464 | $alldata = $Spotter->countAllMonthsAircrafts(); |
| 1465 | 1465 | foreach ($alldata as $number) { |
| 1466 | - $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
| 1466 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
| 1467 | 1467 | } |
| 1468 | 1468 | $alldata = $Spotter->countAllMonthsRealArrivals(); |
| 1469 | 1469 | foreach ($alldata as $number) { |
| 1470 | - $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
| 1470 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
| 1471 | 1471 | } |
| 1472 | 1472 | echo 'Airports data...'."\n"; |
| 1473 | 1473 | echo '...Departure'."\n"; |
@@ -1512,7 +1512,7 @@ discard block |
||
| 1512 | 1512 | } |
| 1513 | 1513 | $alldata = $pall; |
| 1514 | 1514 | foreach ($alldata as $number) { |
| 1515 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
|
| 1515 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']); |
|
| 1516 | 1516 | } |
| 1517 | 1517 | echo '...Arrival'."\n"; |
| 1518 | 1518 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
@@ -1554,7 +1554,7 @@ discard block |
||
| 1554 | 1554 | } |
| 1555 | 1555 | $alldata = $pall; |
| 1556 | 1556 | foreach ($alldata as $number) { |
| 1557 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
|
| 1557 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']); |
|
| 1558 | 1558 | } |
| 1559 | 1559 | |
| 1560 | 1560 | echo 'Flights data...'."\n"; |
@@ -1562,28 +1562,28 @@ discard block |
||
| 1562 | 1562 | echo '-> countAllDatesLastMonth...'."\n"; |
| 1563 | 1563 | $alldata = $Spotter->countAllDatesLastMonth(); |
| 1564 | 1564 | foreach ($alldata as $number) { |
| 1565 | - $this->addStatFlight('month',$number['date_name'],$number['date_count']); |
|
| 1565 | + $this->addStatFlight('month', $number['date_name'], $number['date_count']); |
|
| 1566 | 1566 | } |
| 1567 | 1567 | echo '-> countAllDates...'."\n"; |
| 1568 | 1568 | $previousdata = $this->countAllDates(); |
| 1569 | 1569 | $previousdatabyairlines = $this->countAllDatesByAirlines(); |
| 1570 | 1570 | $this->deleteStatFlight('date'); |
| 1571 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates()); |
|
| 1571 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates()); |
|
| 1572 | 1572 | $values = array(); |
| 1573 | 1573 | foreach ($alldata as $cnt) { |
| 1574 | 1574 | $values[] = $cnt['date_count']; |
| 1575 | 1575 | } |
| 1576 | - array_multisort($values,SORT_DESC,$alldata); |
|
| 1577 | - array_splice($alldata,11); |
|
| 1576 | + array_multisort($values, SORT_DESC, $alldata); |
|
| 1577 | + array_splice($alldata, 11); |
|
| 1578 | 1578 | foreach ($alldata as $number) { |
| 1579 | - $this->addStatFlight('date',$number['date_name'],$number['date_count']); |
|
| 1579 | + $this->addStatFlight('date', $number['date_name'], $number['date_count']); |
|
| 1580 | 1580 | } |
| 1581 | 1581 | |
| 1582 | 1582 | $this->deleteStatFlight('hour'); |
| 1583 | 1583 | echo '-> countAllHours...'."\n"; |
| 1584 | 1584 | $alldata = $Spotter->countAllHours('hour'); |
| 1585 | 1585 | foreach ($alldata as $number) { |
| 1586 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count']); |
|
| 1586 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count']); |
|
| 1587 | 1587 | } |
| 1588 | 1588 | |
| 1589 | 1589 | |
@@ -1591,29 +1591,29 @@ discard block |
||
| 1591 | 1591 | // Count by airlines |
| 1592 | 1592 | echo '--- Stats by airlines ---'."\n"; |
| 1593 | 1593 | $Spotter = new Spotter($this->db); |
| 1594 | - $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
|
| 1594 | + $alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day); |
|
| 1595 | 1595 | foreach ($alldata as $number) { |
| 1596 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao']); |
|
| 1596 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao']); |
|
| 1597 | 1597 | } |
| 1598 | - $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
|
| 1598 | + $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day); |
|
| 1599 | 1599 | foreach ($alldata as $number) { |
| 1600 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao']); |
|
| 1600 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao']); |
|
| 1601 | 1601 | } |
| 1602 | - $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
|
| 1602 | + $alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day); |
|
| 1603 | 1603 | foreach ($alldata as $number) { |
| 1604 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']); |
|
| 1604 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']); |
|
| 1605 | 1605 | } |
| 1606 | - $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
|
| 1606 | + $alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day); |
|
| 1607 | 1607 | foreach ($alldata as $number) { |
| 1608 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao']); |
|
| 1608 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao']); |
|
| 1609 | 1609 | } |
| 1610 | - $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
|
| 1610 | + $alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day); |
|
| 1611 | 1611 | foreach ($alldata as $number) { |
| 1612 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao']); |
|
| 1612 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao']); |
|
| 1613 | 1613 | } |
| 1614 | 1614 | |
| 1615 | - $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
|
| 1616 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
| 1615 | + $pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
| 1616 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
| 1617 | 1617 | //$alldata = array(); |
| 1618 | 1618 | foreach ($dall as $value) { |
| 1619 | 1619 | $icao = $value['airport_departure_icao']; |
@@ -1632,10 +1632,10 @@ discard block |
||
| 1632 | 1632 | } |
| 1633 | 1633 | $alldata = $pall; |
| 1634 | 1634 | foreach ($alldata as $number) { |
| 1635 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao']); |
|
| 1635 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], $number['airline_icao']); |
|
| 1636 | 1636 | } |
| 1637 | - $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
|
| 1638 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
| 1637 | + $pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
| 1638 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
| 1639 | 1639 | //$alldata = array(); |
| 1640 | 1640 | foreach ($dall as $value) { |
| 1641 | 1641 | $icao = $value['airport_arrival_icao']; |
@@ -1654,30 +1654,30 @@ discard block |
||
| 1654 | 1654 | } |
| 1655 | 1655 | $alldata = $pall; |
| 1656 | 1656 | foreach ($alldata as $number) { |
| 1657 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao']); |
|
| 1657 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], $number['airline_icao']); |
|
| 1658 | 1658 | } |
| 1659 | 1659 | $Spotter = new Spotter($this->db); |
| 1660 | 1660 | $alldata = $Spotter->countAllMonthsByAirlines(); |
| 1661 | 1661 | $lastyear = false; |
| 1662 | 1662 | foreach ($alldata as $number) { |
| 1663 | 1663 | if ($number['year_name'] != date('Y')) $lastyear = true; |
| 1664 | - $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
| 1664 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
| 1665 | 1665 | } |
| 1666 | 1666 | $alldata = $Spotter->countAllMonthsOwnersByAirlines(); |
| 1667 | 1667 | foreach ($alldata as $number) { |
| 1668 | - $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
| 1668 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
| 1669 | 1669 | } |
| 1670 | 1670 | $alldata = $Spotter->countAllMonthsPilotsByAirlines(); |
| 1671 | 1671 | foreach ($alldata as $number) { |
| 1672 | - $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
| 1672 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
| 1673 | 1673 | } |
| 1674 | 1674 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines(); |
| 1675 | 1675 | foreach ($alldata as $number) { |
| 1676 | - $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
| 1676 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
| 1677 | 1677 | } |
| 1678 | 1678 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines(); |
| 1679 | 1679 | foreach ($alldata as $number) { |
| 1680 | - $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
| 1680 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
| 1681 | 1681 | } |
| 1682 | 1682 | echo '...Departure'."\n"; |
| 1683 | 1683 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
@@ -1700,7 +1700,7 @@ discard block |
||
| 1700 | 1700 | } |
| 1701 | 1701 | $alldata = $pall; |
| 1702 | 1702 | foreach ($alldata as $number) { |
| 1703 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']); |
|
| 1703 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], $number['airline_icao']); |
|
| 1704 | 1704 | } |
| 1705 | 1705 | echo '...Arrival'."\n"; |
| 1706 | 1706 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
@@ -1723,32 +1723,32 @@ discard block |
||
| 1723 | 1723 | } |
| 1724 | 1724 | $alldata = $pall; |
| 1725 | 1725 | foreach ($alldata as $number) { |
| 1726 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']); |
|
| 1726 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], $number['airline_icao']); |
|
| 1727 | 1727 | } |
| 1728 | 1728 | |
| 1729 | 1729 | echo 'Flights data...'."\n"; |
| 1730 | 1730 | echo '-> countAllDatesLastMonth...'."\n"; |
| 1731 | 1731 | $alldata = $Spotter->countAllDatesLastMonthByAirlines(); |
| 1732 | 1732 | foreach ($alldata as $number) { |
| 1733 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
|
| 1733 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
| 1734 | 1734 | } |
| 1735 | 1735 | echo '-> countAllDates...'."\n"; |
| 1736 | 1736 | //$previousdata = $this->countAllDatesByAirlines(); |
| 1737 | - $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines()); |
|
| 1737 | + $alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines()); |
|
| 1738 | 1738 | $values = array(); |
| 1739 | 1739 | foreach ($alldata as $cnt) { |
| 1740 | 1740 | $values[] = $cnt['date_count']; |
| 1741 | 1741 | } |
| 1742 | - array_multisort($values,SORT_DESC,$alldata); |
|
| 1743 | - array_splice($alldata,11); |
|
| 1742 | + array_multisort($values, SORT_DESC, $alldata); |
|
| 1743 | + array_splice($alldata, 11); |
|
| 1744 | 1744 | foreach ($alldata as $number) { |
| 1745 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
|
| 1745 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
| 1746 | 1746 | } |
| 1747 | 1747 | |
| 1748 | 1748 | echo '-> countAllHours...'."\n"; |
| 1749 | 1749 | $alldata = $Spotter->countAllHoursByAirlines('hour'); |
| 1750 | 1750 | foreach ($alldata as $number) { |
| 1751 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
|
| 1751 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']); |
|
| 1752 | 1752 | } |
| 1753 | 1753 | |
| 1754 | 1754 | |
@@ -1759,33 +1759,33 @@ discard block |
||
| 1759 | 1759 | // Count by filter |
| 1760 | 1760 | echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
| 1761 | 1761 | $Spotter = new Spotter($this->db); |
| 1762 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
|
| 1762 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter); |
|
| 1763 | 1763 | foreach ($alldata as $number) { |
| 1764 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name); |
|
| 1764 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name); |
|
| 1765 | 1765 | } |
| 1766 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter); |
|
| 1766 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter); |
|
| 1767 | 1767 | foreach ($alldata as $number) { |
| 1768 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name); |
|
| 1768 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name); |
|
| 1769 | 1769 | } |
| 1770 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter); |
|
| 1770 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter); |
|
| 1771 | 1771 | foreach ($alldata as $number) { |
| 1772 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name); |
|
| 1772 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name); |
|
| 1773 | 1773 | } |
| 1774 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter); |
|
| 1774 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter); |
|
| 1775 | 1775 | foreach ($alldata as $number) { |
| 1776 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name); |
|
| 1776 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name); |
|
| 1777 | 1777 | } |
| 1778 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter); |
|
| 1778 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter); |
|
| 1779 | 1779 | foreach ($alldata as $number) { |
| 1780 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name); |
|
| 1780 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name); |
|
| 1781 | 1781 | } |
| 1782 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter); |
|
| 1782 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter); |
|
| 1783 | 1783 | foreach ($alldata as $number) { |
| 1784 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name); |
|
| 1784 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name); |
|
| 1785 | 1785 | } |
| 1786 | 1786 | |
| 1787 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
|
| 1788 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
| 1787 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter); |
|
| 1788 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter); |
|
| 1789 | 1789 | $alldata = array(); |
| 1790 | 1790 | foreach ($pall as $value) { |
| 1791 | 1791 | $icao = $value['airport_departure_icao']; |
@@ -1801,12 +1801,12 @@ discard block |
||
| 1801 | 1801 | foreach ($alldata as $key => $row) { |
| 1802 | 1802 | $count[$key] = $row['airport_departure_icao_count']; |
| 1803 | 1803 | } |
| 1804 | - array_multisort($count,SORT_DESC,$alldata); |
|
| 1804 | + array_multisort($count, SORT_DESC, $alldata); |
|
| 1805 | 1805 | foreach ($alldata as $number) { |
| 1806 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name); |
|
| 1806 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', $filter_name); |
|
| 1807 | 1807 | } |
| 1808 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,$filter); |
|
| 1809 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter); |
|
| 1808 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, $filter); |
|
| 1809 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, $filter); |
|
| 1810 | 1810 | $alldata = array(); |
| 1811 | 1811 | foreach ($pall as $value) { |
| 1812 | 1812 | $icao = $value['airport_arrival_icao']; |
@@ -1822,36 +1822,36 @@ discard block |
||
| 1822 | 1822 | foreach ($alldata as $key => $row) { |
| 1823 | 1823 | $count[$key] = $row['airport_arrival_icao_count']; |
| 1824 | 1824 | } |
| 1825 | - array_multisort($count,SORT_DESC,$alldata); |
|
| 1825 | + array_multisort($count, SORT_DESC, $alldata); |
|
| 1826 | 1826 | foreach ($alldata as $number) { |
| 1827 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name); |
|
| 1827 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', $filter_name); |
|
| 1828 | 1828 | } |
| 1829 | 1829 | $Spotter = new Spotter($this->db); |
| 1830 | 1830 | $alldata = $Spotter->countAllMonths($filter); |
| 1831 | 1831 | $lastyear = false; |
| 1832 | 1832 | foreach ($alldata as $number) { |
| 1833 | 1833 | if ($number['year_name'] != date('Y')) $lastyear = true; |
| 1834 | - $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
| 1834 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
| 1835 | 1835 | } |
| 1836 | 1836 | $alldata = $Spotter->countAllMonthsOwners($filter); |
| 1837 | 1837 | foreach ($alldata as $number) { |
| 1838 | - $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
| 1838 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
| 1839 | 1839 | } |
| 1840 | 1840 | $alldata = $Spotter->countAllMonthsPilots($filter); |
| 1841 | 1841 | foreach ($alldata as $number) { |
| 1842 | - $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
| 1842 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
| 1843 | 1843 | } |
| 1844 | 1844 | $alldata = $Spotter->countAllMonthsAircrafts($filter); |
| 1845 | 1845 | foreach ($alldata as $number) { |
| 1846 | - $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
| 1846 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
| 1847 | 1847 | } |
| 1848 | 1848 | $alldata = $Spotter->countAllMonthsRealArrivals($filter); |
| 1849 | 1849 | foreach ($alldata as $number) { |
| 1850 | - $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
| 1850 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
| 1851 | 1851 | } |
| 1852 | 1852 | echo '...Departure'."\n"; |
| 1853 | - $pall = $Spotter->getLast7DaysAirportsDeparture('',$filter); |
|
| 1854 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
| 1853 | + $pall = $Spotter->getLast7DaysAirportsDeparture('', $filter); |
|
| 1854 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter); |
|
| 1855 | 1855 | foreach ($dall as $value) { |
| 1856 | 1856 | $icao = $value['departure_airport_icao']; |
| 1857 | 1857 | $ddate = $value['date']; |
@@ -1869,11 +1869,11 @@ discard block |
||
| 1869 | 1869 | } |
| 1870 | 1870 | $alldata = $pall; |
| 1871 | 1871 | foreach ($alldata as $number) { |
| 1872 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],'',$filter_name); |
|
| 1872 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], '', $filter_name); |
|
| 1873 | 1873 | } |
| 1874 | 1874 | echo '...Arrival'."\n"; |
| 1875 | - $pall = $Spotter->getLast7DaysAirportsArrival('',$filter); |
|
| 1876 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
| 1875 | + $pall = $Spotter->getLast7DaysAirportsArrival('', $filter); |
|
| 1876 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter); |
|
| 1877 | 1877 | foreach ($dall as $value) { |
| 1878 | 1878 | $icao = $value['arrival_airport_icao']; |
| 1879 | 1879 | $ddate = $value['date']; |
@@ -1891,32 +1891,32 @@ discard block |
||
| 1891 | 1891 | } |
| 1892 | 1892 | $alldata = $pall; |
| 1893 | 1893 | foreach ($alldata as $number) { |
| 1894 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],'',$filter_name); |
|
| 1894 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], '', $filter_name); |
|
| 1895 | 1895 | } |
| 1896 | 1896 | |
| 1897 | 1897 | echo 'Flights data...'."\n"; |
| 1898 | 1898 | echo '-> countAllDatesLastMonth...'."\n"; |
| 1899 | 1899 | $alldata = $Spotter->countAllDatesLastMonth($filter); |
| 1900 | 1900 | foreach ($alldata as $number) { |
| 1901 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name); |
|
| 1901 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name); |
|
| 1902 | 1902 | } |
| 1903 | 1903 | echo '-> countAllDates...'."\n"; |
| 1904 | - $previousdata = $this->countAllDates('',$filter_name); |
|
| 1905 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter)); |
|
| 1904 | + $previousdata = $this->countAllDates('', $filter_name); |
|
| 1905 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter)); |
|
| 1906 | 1906 | $values = array(); |
| 1907 | 1907 | foreach ($alldata as $cnt) { |
| 1908 | 1908 | $values[] = $cnt['date_count']; |
| 1909 | 1909 | } |
| 1910 | - array_multisort($values,SORT_DESC,$alldata); |
|
| 1911 | - array_splice($alldata,11); |
|
| 1910 | + array_multisort($values, SORT_DESC, $alldata); |
|
| 1911 | + array_splice($alldata, 11); |
|
| 1912 | 1912 | foreach ($alldata as $number) { |
| 1913 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name); |
|
| 1913 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name); |
|
| 1914 | 1914 | } |
| 1915 | 1915 | |
| 1916 | 1916 | echo '-> countAllHours...'."\n"; |
| 1917 | - $alldata = $Spotter->countAllHours('hour',$filter); |
|
| 1917 | + $alldata = $Spotter->countAllHours('hour', $filter); |
|
| 1918 | 1918 | foreach ($alldata as $number) { |
| 1919 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name); |
|
| 1919 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name); |
|
| 1920 | 1920 | } |
| 1921 | 1921 | } |
| 1922 | 1922 | |
@@ -1927,16 +1927,16 @@ discard block |
||
| 1927 | 1927 | // SUM all previous month to put as year |
| 1928 | 1928 | $previous_year = date('Y'); |
| 1929 | 1929 | $previous_year--; |
| 1930 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
| 1931 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
| 1932 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
| 1933 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
| 1930 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
| 1931 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
| 1932 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
| 1933 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
| 1934 | 1934 | $allairlines = $this->getAllAirlineNames(); |
| 1935 | 1935 | foreach ($allairlines as $data) { |
| 1936 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
| 1937 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
| 1938 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
| 1939 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
| 1936 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
| 1937 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
| 1938 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
| 1939 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
| 1940 | 1940 | } |
| 1941 | 1941 | |
| 1942 | 1942 | if (isset($globalArchiveYear) && $globalArchiveYear) { |
@@ -1945,7 +1945,7 @@ discard block |
||
| 1945 | 1945 | try { |
| 1946 | 1946 | $sth = $this->db->prepare($query); |
| 1947 | 1947 | $sth->execute(); |
| 1948 | - } catch(PDOException $e) { |
|
| 1948 | + } catch (PDOException $e) { |
|
| 1949 | 1949 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
| 1950 | 1950 | } |
| 1951 | 1951 | } |
@@ -1954,7 +1954,7 @@ discard block |
||
| 1954 | 1954 | try { |
| 1955 | 1955 | $sth = $this->db->prepare($query); |
| 1956 | 1956 | $sth->execute(); |
| 1957 | - } catch(PDOException $e) { |
|
| 1957 | + } catch (PDOException $e) { |
|
| 1958 | 1958 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
| 1959 | 1959 | } |
| 1960 | 1960 | } |
@@ -1976,7 +1976,7 @@ discard block |
||
| 1976 | 1976 | try { |
| 1977 | 1977 | $sth = $this->db->prepare($query); |
| 1978 | 1978 | $sth->execute(); |
| 1979 | - } catch(PDOException $e) { |
|
| 1979 | + } catch (PDOException $e) { |
|
| 1980 | 1980 | return "error : ".$e->getMessage(); |
| 1981 | 1981 | } |
| 1982 | 1982 | } |
@@ -1990,13 +1990,13 @@ discard block |
||
| 1990 | 1990 | try { |
| 1991 | 1991 | $sth = $this->db->prepare($query); |
| 1992 | 1992 | $sth->execute(); |
| 1993 | - } catch(PDOException $e) { |
|
| 1993 | + } catch (PDOException $e) { |
|
| 1994 | 1994 | return "error : ".$e->getMessage(); |
| 1995 | 1995 | } |
| 1996 | 1996 | } |
| 1997 | 1997 | echo 'Insert last stats update date...'."\n"; |
| 1998 | 1998 | date_default_timezone_set('UTC'); |
| 1999 | - $this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s')); |
|
| 1999 | + $this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s')); |
|
| 2000 | 2000 | //} |
| 2001 | 2001 | } |
| 2002 | 2002 | } |
@@ -12,7 +12,9 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | public function __construct($dbc = null) { |
| 14 | 14 | global $globalFilterName; |
| 15 | - if (isset($globalFilterName)) $this->filter_name = $globalFilterName; |
|
| 15 | + if (isset($globalFilterName)) { |
|
| 16 | + $this->filter_name = $globalFilterName; |
|
| 17 | + } |
|
| 16 | 18 | $Connection = new Connection($dbc); |
| 17 | 19 | $this->db = $Connection->db(); |
| 18 | 20 | } |
@@ -41,7 +43,9 @@ discard block |
||
| 41 | 43 | return $all; |
| 42 | 44 | } |
| 43 | 45 | public function getAllAirlineNames($filter_name = '') { |
| 44 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 46 | + if ($filter_name == '') { |
|
| 47 | + $filter_name = $this->filter_name; |
|
| 48 | + } |
|
| 45 | 49 | $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
| 46 | 50 | try { |
| 47 | 51 | $sth = $this->db->prepare($query); |
@@ -53,7 +57,9 @@ discard block |
||
| 53 | 57 | return $all; |
| 54 | 58 | } |
| 55 | 59 | public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
| 56 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 60 | + if ($filter_name == '') { |
|
| 61 | + $filter_name = $this->filter_name; |
|
| 62 | + } |
|
| 57 | 63 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
| 58 | 64 | try { |
| 59 | 65 | $sth = $this->db->prepare($query); |
@@ -65,7 +71,9 @@ discard block |
||
| 65 | 71 | return $all; |
| 66 | 72 | } |
| 67 | 73 | public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
| 68 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 74 | + if ($filter_name == '') { |
|
| 75 | + $filter_name = $this->filter_name; |
|
| 76 | + } |
|
| 69 | 77 | $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
| 70 | 78 | try { |
| 71 | 79 | $sth = $this->db->prepare($query); |
@@ -80,9 +88,14 @@ discard block |
||
| 80 | 88 | |
| 81 | 89 | public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '') { |
| 82 | 90 | global $globalStatsFilters; |
| 83 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 84 | - if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 85 | - else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 91 | + if ($filter_name == '') { |
|
| 92 | + $filter_name = $this->filter_name; |
|
| 93 | + } |
|
| 94 | + if ($limit) { |
|
| 95 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 96 | + } else { |
|
| 97 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 98 | + } |
|
| 86 | 99 | try { |
| 87 | 100 | $sth = $this->db->prepare($query); |
| 88 | 101 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -102,9 +115,14 @@ discard block |
||
| 102 | 115 | } |
| 103 | 116 | public function countAllAirlineCountries($limit = true,$filter_name = '') { |
| 104 | 117 | global $globalStatsFilters; |
| 105 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 106 | - if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 107 | - else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC"; |
|
| 118 | + if ($filter_name == '') { |
|
| 119 | + $filter_name = $this->filter_name; |
|
| 120 | + } |
|
| 121 | + if ($limit) { |
|
| 122 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 123 | + } else { |
|
| 124 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC"; |
|
| 125 | + } |
|
| 108 | 126 | try { |
| 109 | 127 | $sth = $this->db->prepare($query); |
| 110 | 128 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -124,9 +142,14 @@ discard block |
||
| 124 | 142 | } |
| 125 | 143 | public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') { |
| 126 | 144 | global $globalStatsFilters; |
| 127 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 128 | - if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
| 129 | - else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
| 145 | + if ($filter_name == '') { |
|
| 146 | + $filter_name = $this->filter_name; |
|
| 147 | + } |
|
| 148 | + if ($limit) { |
|
| 149 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
| 150 | + } else { |
|
| 151 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
| 152 | + } |
|
| 130 | 153 | try { |
| 131 | 154 | $sth = $this->db->prepare($query); |
| 132 | 155 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -147,9 +170,14 @@ discard block |
||
| 147 | 170 | |
| 148 | 171 | public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '') { |
| 149 | 172 | global $globalStatsFilters; |
| 150 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 151 | - if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 152 | - else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
|
| 173 | + if ($filter_name == '') { |
|
| 174 | + $filter_name = $this->filter_name; |
|
| 175 | + } |
|
| 176 | + if ($limit) { |
|
| 177 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 178 | + } else { |
|
| 179 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
|
| 180 | + } |
|
| 153 | 181 | try { |
| 154 | 182 | $sth = $this->db->prepare($query); |
| 155 | 183 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -169,9 +197,14 @@ discard block |
||
| 169 | 197 | } |
| 170 | 198 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '') { |
| 171 | 199 | global $globalStatsFilters; |
| 172 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 173 | - if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 174 | - else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
|
| 200 | + if ($filter_name == '') { |
|
| 201 | + $filter_name = $this->filter_name; |
|
| 202 | + } |
|
| 203 | + if ($limit) { |
|
| 204 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 205 | + } else { |
|
| 206 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
|
| 207 | + } |
|
| 175 | 208 | try { |
| 176 | 209 | $sth = $this->db->prepare($query); |
| 177 | 210 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -192,9 +225,14 @@ discard block |
||
| 192 | 225 | |
| 193 | 226 | public function countAllAirlines($limit = true,$filter_name = '') { |
| 194 | 227 | global $globalStatsFilters; |
| 195 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 196 | - if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 197 | - else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC"; |
|
| 228 | + if ($filter_name == '') { |
|
| 229 | + $filter_name = $this->filter_name; |
|
| 230 | + } |
|
| 231 | + if ($limit) { |
|
| 232 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 233 | + } else { |
|
| 234 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC"; |
|
| 235 | + } |
|
| 198 | 236 | try { |
| 199 | 237 | $sth = $this->db->prepare($query); |
| 200 | 238 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -215,9 +253,14 @@ discard block |
||
| 215 | 253 | } |
| 216 | 254 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') { |
| 217 | 255 | global $globalStatsFilters; |
| 218 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 219 | - if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
| 220 | - else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
| 256 | + if ($filter_name == '') { |
|
| 257 | + $filter_name = $this->filter_name; |
|
| 258 | + } |
|
| 259 | + if ($limit) { |
|
| 260 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
| 261 | + } else { |
|
| 262 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
| 263 | + } |
|
| 221 | 264 | try { |
| 222 | 265 | $sth = $this->db->prepare($query); |
| 223 | 266 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -237,9 +280,14 @@ discard block |
||
| 237 | 280 | } |
| 238 | 281 | public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') { |
| 239 | 282 | global $globalStatsFilters; |
| 240 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 241 | - if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 242 | - else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
| 283 | + if ($filter_name == '') { |
|
| 284 | + $filter_name = $this->filter_name; |
|
| 285 | + } |
|
| 286 | + if ($limit) { |
|
| 287 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 288 | + } else { |
|
| 289 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
| 290 | + } |
|
| 243 | 291 | try { |
| 244 | 292 | $sth = $this->db->prepare($query); |
| 245 | 293 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -259,10 +307,15 @@ discard block |
||
| 259 | 307 | } |
| 260 | 308 | public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') { |
| 261 | 309 | $Connection = new Connection(); |
| 262 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 310 | + if ($filter_name == '') { |
|
| 311 | + $filter_name = $this->filter_name; |
|
| 312 | + } |
|
| 263 | 313 | if ($Connection->tableExists('countries')) { |
| 264 | - if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
| 265 | - else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
| 314 | + if ($limit) { |
|
| 315 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
| 316 | + } else { |
|
| 317 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
| 318 | + } |
|
| 266 | 319 | try { |
| 267 | 320 | $sth = $this->db->prepare($query); |
| 268 | 321 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -283,9 +336,14 @@ discard block |
||
| 283 | 336 | } |
| 284 | 337 | public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') { |
| 285 | 338 | global $globalStatsFilters; |
| 286 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 287 | - if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
|
| 288 | - else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
|
| 339 | + if ($filter_name == '') { |
|
| 340 | + $filter_name = $this->filter_name; |
|
| 341 | + } |
|
| 342 | + if ($limit) { |
|
| 343 | + $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
|
| 344 | + } else { |
|
| 345 | + $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
|
| 346 | + } |
|
| 289 | 347 | try { |
| 290 | 348 | $sth = $this->db->prepare($query); |
| 291 | 349 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -305,9 +363,14 @@ discard block |
||
| 305 | 363 | } |
| 306 | 364 | public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') { |
| 307 | 365 | global $globalStatsFilters; |
| 308 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 309 | - if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
| 310 | - else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
| 366 | + if ($filter_name == '') { |
|
| 367 | + $filter_name = $this->filter_name; |
|
| 368 | + } |
|
| 369 | + if ($limit) { |
|
| 370 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
| 371 | + } else { |
|
| 372 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
| 373 | + } |
|
| 311 | 374 | try { |
| 312 | 375 | $sth = $this->db->prepare($query); |
| 313 | 376 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -327,9 +390,14 @@ discard block |
||
| 327 | 390 | } |
| 328 | 391 | public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') { |
| 329 | 392 | global $globalStatsFilters; |
| 330 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 331 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 332 | - else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
| 393 | + if ($filter_name == '') { |
|
| 394 | + $filter_name = $this->filter_name; |
|
| 395 | + } |
|
| 396 | + if ($limit) { |
|
| 397 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 398 | + } else { |
|
| 399 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
| 400 | + } |
|
| 333 | 401 | try { |
| 334 | 402 | $sth = $this->db->prepare($query); |
| 335 | 403 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -355,7 +423,9 @@ discard block |
||
| 355 | 423 | $icao = $value['airport_departure_icao']; |
| 356 | 424 | if (isset($all[$icao])) { |
| 357 | 425 | $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 358 | - } else $all[$icao] = $value; |
|
| 426 | + } else { |
|
| 427 | + $all[$icao] = $value; |
|
| 428 | + } |
|
| 359 | 429 | } |
| 360 | 430 | $count = array(); |
| 361 | 431 | foreach ($all as $key => $row) { |
@@ -367,9 +437,14 @@ discard block |
||
| 367 | 437 | } |
| 368 | 438 | public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') { |
| 369 | 439 | global $globalStatsFilters; |
| 370 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 371 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 372 | - else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
| 440 | + if ($filter_name == '') { |
|
| 441 | + $filter_name = $this->filter_name; |
|
| 442 | + } |
|
| 443 | + if ($limit) { |
|
| 444 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 445 | + } else { |
|
| 446 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
| 447 | + } |
|
| 373 | 448 | try { |
| 374 | 449 | $sth = $this->db->prepare($query); |
| 375 | 450 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -395,7 +470,9 @@ discard block |
||
| 395 | 470 | $icao = $value['airport_arrival_icao']; |
| 396 | 471 | if (isset($all[$icao])) { |
| 397 | 472 | $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 398 | - } else $all[$icao] = $value; |
|
| 473 | + } else { |
|
| 474 | + $all[$icao] = $value; |
|
| 475 | + } |
|
| 399 | 476 | } |
| 400 | 477 | $count = array(); |
| 401 | 478 | foreach ($all as $key => $row) { |
@@ -408,13 +485,21 @@ discard block |
||
| 408 | 485 | } |
| 409 | 486 | public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
| 410 | 487 | global $globalDBdriver, $globalStatsFilters; |
| 411 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 488 | + if ($filter_name == '') { |
|
| 489 | + $filter_name = $this->filter_name; |
|
| 490 | + } |
|
| 412 | 491 | if ($globalDBdriver == 'mysql') { |
| 413 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 414 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 492 | + if ($limit) { |
|
| 493 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 494 | + } else { |
|
| 495 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 496 | + } |
|
| 415 | 497 | } else { |
| 416 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 417 | - else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 498 | + if ($limit) { |
|
| 499 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 500 | + } else { |
|
| 501 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 502 | + } |
|
| 418 | 503 | } |
| 419 | 504 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 420 | 505 | try { |
@@ -438,7 +523,9 @@ discard block |
||
| 438 | 523 | |
| 439 | 524 | public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
| 440 | 525 | global $globalStatsFilters; |
| 441 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 526 | + if ($filter_name == '') { |
|
| 527 | + $filter_name = $this->filter_name; |
|
| 528 | + } |
|
| 442 | 529 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 443 | 530 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 444 | 531 | try { |
@@ -460,7 +547,9 @@ discard block |
||
| 460 | 547 | } |
| 461 | 548 | public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
| 462 | 549 | global $globalDBdriver, $globalStatsFilters; |
| 463 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 550 | + if ($filter_name == '') { |
|
| 551 | + $filter_name = $this->filter_name; |
|
| 552 | + } |
|
| 464 | 553 | if ($globalDBdriver == 'mysql') { |
| 465 | 554 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 466 | 555 | } else { |
@@ -486,7 +575,9 @@ discard block |
||
| 486 | 575 | } |
| 487 | 576 | public function countAllDates($stats_airline = '',$filter_name = '') { |
| 488 | 577 | global $globalStatsFilters; |
| 489 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 578 | + if ($filter_name == '') { |
|
| 579 | + $filter_name = $this->filter_name; |
|
| 580 | + } |
|
| 490 | 581 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 491 | 582 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 492 | 583 | try { |
@@ -508,7 +599,9 @@ discard block |
||
| 508 | 599 | } |
| 509 | 600 | public function countAllDatesByAirlines($filter_name = '') { |
| 510 | 601 | global $globalStatsFilters; |
| 511 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 602 | + if ($filter_name == '') { |
|
| 603 | + $filter_name = $this->filter_name; |
|
| 604 | + } |
|
| 512 | 605 | $query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name"; |
| 513 | 606 | $query_data = array('filter_name' => $filter_name); |
| 514 | 607 | try { |
@@ -530,7 +623,9 @@ discard block |
||
| 530 | 623 | } |
| 531 | 624 | public function countAllMonths($stats_airline = '',$filter_name = '') { |
| 532 | 625 | global $globalStatsFilters; |
| 533 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 626 | + if ($filter_name == '') { |
|
| 627 | + $filter_name = $this->filter_name; |
|
| 628 | + } |
|
| 534 | 629 | $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 535 | 630 | try { |
| 536 | 631 | $sth = $this->db->prepare($query); |
@@ -551,7 +646,9 @@ discard block |
||
| 551 | 646 | } |
| 552 | 647 | public function countAllMilitaryMonths($filter_name = '') { |
| 553 | 648 | global $globalStatsFilters; |
| 554 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 649 | + if ($filter_name == '') { |
|
| 650 | + $filter_name = $this->filter_name; |
|
| 651 | + } |
|
| 555 | 652 | $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name"; |
| 556 | 653 | try { |
| 557 | 654 | $sth = $this->db->prepare($query); |
@@ -572,9 +669,14 @@ discard block |
||
| 572 | 669 | } |
| 573 | 670 | public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
| 574 | 671 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
| 575 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 576 | - if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 577 | - else $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 672 | + if ($filter_name == '') { |
|
| 673 | + $filter_name = $this->filter_name; |
|
| 674 | + } |
|
| 675 | + if ($limit) { |
|
| 676 | + $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 677 | + } else { |
|
| 678 | + $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 679 | + } |
|
| 578 | 680 | if ($orderby == 'hour') { |
| 579 | 681 | /* |
| 580 | 682 | if ($globalDBdriver == 'mysql') { |
@@ -583,7 +685,9 @@ discard block |
||
| 583 | 685 | */ |
| 584 | 686 | $query .= " ORDER BY CAST(flight_date AS integer) ASC"; |
| 585 | 687 | } |
| 586 | - if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
|
| 688 | + if ($orderby == 'count') { |
|
| 689 | + $query .= " ORDER BY hour_count DESC"; |
|
| 690 | + } |
|
| 587 | 691 | try { |
| 588 | 692 | $sth = $this->db->prepare($query); |
| 589 | 693 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
@@ -604,7 +708,9 @@ discard block |
||
| 604 | 708 | |
| 605 | 709 | public function countOverallFlights($stats_airline = '', $filter_name = '') { |
| 606 | 710 | global $globalStatsFilters; |
| 607 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 711 | + if ($filter_name == '') { |
|
| 712 | + $filter_name = $this->filter_name; |
|
| 713 | + } |
|
| 608 | 714 | $all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline,$filter_name); |
| 609 | 715 | if (empty($all)) { |
| 610 | 716 | $filters = array('airlines' => array($stats_airline)); |
@@ -618,7 +724,9 @@ discard block |
||
| 618 | 724 | } |
| 619 | 725 | public function countOverallMilitaryFlights($filter_name = '') { |
| 620 | 726 | global $globalStatsFilters; |
| 621 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 727 | + if ($filter_name == '') { |
|
| 728 | + $filter_name = $this->filter_name; |
|
| 729 | + } |
|
| 622 | 730 | $all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name); |
| 623 | 731 | if (empty($all)) { |
| 624 | 732 | $filters = array(); |
@@ -632,7 +740,9 @@ discard block |
||
| 632 | 740 | } |
| 633 | 741 | public function countOverallArrival($stats_airline = '',$filter_name = '') { |
| 634 | 742 | global $globalStatsFilters; |
| 635 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 743 | + if ($filter_name == '') { |
|
| 744 | + $filter_name = $this->filter_name; |
|
| 745 | + } |
|
| 636 | 746 | $all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline,$filter_name); |
| 637 | 747 | if (empty($all)) { |
| 638 | 748 | $filters = array('airlines' => array($stats_airline)); |
@@ -646,7 +756,9 @@ discard block |
||
| 646 | 756 | } |
| 647 | 757 | public function countOverallAircrafts($stats_airline = '',$filter_name = '') { |
| 648 | 758 | global $globalStatsFilters; |
| 649 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 759 | + if ($filter_name == '') { |
|
| 760 | + $filter_name = $this->filter_name; |
|
| 761 | + } |
|
| 650 | 762 | $all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline,$filter_name); |
| 651 | 763 | if (empty($all)) { |
| 652 | 764 | $filters = array('airlines' => array($stats_airline)); |
@@ -660,7 +772,9 @@ discard block |
||
| 660 | 772 | } |
| 661 | 773 | public function countOverallAirlines($filter_name = '') { |
| 662 | 774 | global $globalStatsFilters; |
| 663 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 775 | + if ($filter_name == '') { |
|
| 776 | + $filter_name = $this->filter_name; |
|
| 777 | + } |
|
| 664 | 778 | $query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name"; |
| 665 | 779 | try { |
| 666 | 780 | $sth = $this->db->prepare($query); |
@@ -683,7 +797,9 @@ discard block |
||
| 683 | 797 | } |
| 684 | 798 | public function countOverallOwners($stats_airline = '',$filter_name = '') { |
| 685 | 799 | global $globalStatsFilters; |
| 686 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 800 | + if ($filter_name == '') { |
|
| 801 | + $filter_name = $this->filter_name; |
|
| 802 | + } |
|
| 687 | 803 | /* |
| 688 | 804 | $query = "SELECT COUNT(*) AS nb_owner FROM stats_owner"; |
| 689 | 805 | try { |
@@ -708,7 +824,9 @@ discard block |
||
| 708 | 824 | } |
| 709 | 825 | public function countOverallPilots($stats_airline = '',$filter_name = '') { |
| 710 | 826 | global $globalStatsFilters; |
| 711 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 827 | + if ($filter_name == '') { |
|
| 828 | + $filter_name = $this->filter_name; |
|
| 829 | + } |
|
| 712 | 830 | $all = $this->getSumStats('pilots_bymonth',date('Y'),$stats_airline,$filter_name); |
| 713 | 831 | if (empty($all)) { |
| 714 | 832 | $filters = array('airlines' => array($stats_airline)); |
@@ -722,7 +840,9 @@ discard block |
||
| 722 | 840 | } |
| 723 | 841 | |
| 724 | 842 | public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
| 725 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 843 | + if ($filter_name == '') { |
|
| 844 | + $filter_name = $this->filter_name; |
|
| 845 | + } |
|
| 726 | 846 | $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date"; |
| 727 | 847 | $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
| 728 | 848 | try { |
@@ -735,7 +855,9 @@ discard block |
||
| 735 | 855 | return $all; |
| 736 | 856 | } |
| 737 | 857 | public function getStats($type,$stats_airline = '', $filter_name = '') { |
| 738 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 858 | + if ($filter_name == '') { |
|
| 859 | + $filter_name = $this->filter_name; |
|
| 860 | + } |
|
| 739 | 861 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
| 740 | 862 | $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 741 | 863 | try { |
@@ -748,7 +870,9 @@ discard block |
||
| 748 | 870 | return $all; |
| 749 | 871 | } |
| 750 | 872 | public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') { |
| 751 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 873 | + if ($filter_name == '') { |
|
| 874 | + $filter_name = $this->filter_name; |
|
| 875 | + } |
|
| 752 | 876 | global $globalArchiveMonths, $globalDBdriver; |
| 753 | 877 | if ($globalDBdriver == 'mysql') { |
| 754 | 878 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -767,7 +891,9 @@ discard block |
||
| 767 | 891 | } |
| 768 | 892 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
| 769 | 893 | global $globalArchiveMonths, $globalDBdriver; |
| 770 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 894 | + if ($filter_name == '') { |
|
| 895 | + $filter_name = $this->filter_name; |
|
| 896 | + } |
|
| 771 | 897 | if ($globalDBdriver == 'mysql') { |
| 772 | 898 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 773 | 899 | } else { |
@@ -785,7 +911,9 @@ discard block |
||
| 785 | 911 | } |
| 786 | 912 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
| 787 | 913 | global $globalArchiveMonths, $globalDBdriver; |
| 788 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 914 | + if ($filter_name == '') { |
|
| 915 | + $filter_name = $this->filter_name; |
|
| 916 | + } |
|
| 789 | 917 | if ($globalDBdriver == 'mysql') { |
| 790 | 918 | $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 791 | 919 | } else { |
@@ -802,7 +930,9 @@ discard block |
||
| 802 | 930 | } |
| 803 | 931 | public function getStatsAirlineTotal($filter_name = '') { |
| 804 | 932 | global $globalArchiveMonths, $globalDBdriver; |
| 805 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 933 | + if ($filter_name == '') { |
|
| 934 | + $filter_name = $this->filter_name; |
|
| 935 | + } |
|
| 806 | 936 | if ($globalDBdriver == 'mysql') { |
| 807 | 937 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
| 808 | 938 | } else { |
@@ -819,7 +949,9 @@ discard block |
||
| 819 | 949 | } |
| 820 | 950 | public function getStatsOwnerTotal($filter_name = '') { |
| 821 | 951 | global $globalArchiveMonths, $globalDBdriver; |
| 822 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 952 | + if ($filter_name == '') { |
|
| 953 | + $filter_name = $this->filter_name; |
|
| 954 | + } |
|
| 823 | 955 | if ($globalDBdriver == 'mysql') { |
| 824 | 956 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
| 825 | 957 | } else { |
@@ -836,7 +968,9 @@ discard block |
||
| 836 | 968 | } |
| 837 | 969 | public function getStatsPilotTotal($filter_name = '') { |
| 838 | 970 | global $globalArchiveMonths, $globalDBdriver; |
| 839 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 971 | + if ($filter_name == '') { |
|
| 972 | + $filter_name = $this->filter_name; |
|
| 973 | + } |
|
| 840 | 974 | if ($globalDBdriver == 'mysql') { |
| 841 | 975 | $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
| 842 | 976 | } else { |
@@ -854,7 +988,9 @@ discard block |
||
| 854 | 988 | |
| 855 | 989 | public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 856 | 990 | global $globalDBdriver; |
| 857 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 991 | + if ($filter_name == '') { |
|
| 992 | + $filter_name = $this->filter_name; |
|
| 993 | + } |
|
| 858 | 994 | if ($globalDBdriver == 'mysql') { |
| 859 | 995 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt"; |
| 860 | 996 | } else { |
@@ -870,7 +1006,9 @@ discard block |
||
| 870 | 1006 | } |
| 871 | 1007 | public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 872 | 1008 | global $globalDBdriver; |
| 873 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1009 | + if ($filter_name == '') { |
|
| 1010 | + $filter_name = $this->filter_name; |
|
| 1011 | + } |
|
| 874 | 1012 | if ($globalDBdriver == 'mysql') { |
| 875 | 1013 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
| 876 | 1014 | } else { |
@@ -1356,7 +1494,9 @@ discard block |
||
| 1356 | 1494 | echo 'Update stats !'."\n"; |
| 1357 | 1495 | if (isset($last_update[0]['value'])) { |
| 1358 | 1496 | $last_update_day = $last_update[0]['value']; |
| 1359 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
| 1497 | + } else { |
|
| 1498 | + $last_update_day = '2012-12-12 12:12:12'; |
|
| 1499 | + } |
|
| 1360 | 1500 | $Spotter = new Spotter($this->db); |
| 1361 | 1501 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
| 1362 | 1502 | foreach ($alldata as $number) { |
@@ -1395,7 +1535,9 @@ discard block |
||
| 1395 | 1535 | $icao = $value['airport_departure_icao']; |
| 1396 | 1536 | if (isset($alldata[$icao])) { |
| 1397 | 1537 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 1398 | - } else $alldata[$icao] = $value; |
|
| 1538 | + } else { |
|
| 1539 | + $alldata[$icao] = $value; |
|
| 1540 | + } |
|
| 1399 | 1541 | } |
| 1400 | 1542 | $count = array(); |
| 1401 | 1543 | foreach ($alldata as $key => $row) { |
@@ -1416,7 +1558,9 @@ discard block |
||
| 1416 | 1558 | $icao = $value['airport_arrival_icao']; |
| 1417 | 1559 | if (isset($alldata[$icao])) { |
| 1418 | 1560 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 1419 | - } else $alldata[$icao] = $value; |
|
| 1561 | + } else { |
|
| 1562 | + $alldata[$icao] = $value; |
|
| 1563 | + } |
|
| 1420 | 1564 | } |
| 1421 | 1565 | $count = array(); |
| 1422 | 1566 | foreach ($alldata as $key => $row) { |
@@ -1442,7 +1586,9 @@ discard block |
||
| 1442 | 1586 | $alldata = $Spotter->countAllMonths(); |
| 1443 | 1587 | $lastyear = false; |
| 1444 | 1588 | foreach ($alldata as $number) { |
| 1445 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 1589 | + if ($number['year_name'] != date('Y')) { |
|
| 1590 | + $lastyear = true; |
|
| 1591 | + } |
|
| 1446 | 1592 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 1447 | 1593 | } |
| 1448 | 1594 | $alldata = $Spotter->countAllMilitaryMonths(); |
@@ -1660,7 +1806,9 @@ discard block |
||
| 1660 | 1806 | $alldata = $Spotter->countAllMonthsByAirlines(); |
| 1661 | 1807 | $lastyear = false; |
| 1662 | 1808 | foreach ($alldata as $number) { |
| 1663 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 1809 | + if ($number['year_name'] != date('Y')) { |
|
| 1810 | + $lastyear = true; |
|
| 1811 | + } |
|
| 1664 | 1812 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
| 1665 | 1813 | } |
| 1666 | 1814 | $alldata = $Spotter->countAllMonthsOwnersByAirlines(); |
@@ -1752,7 +1900,9 @@ discard block |
||
| 1752 | 1900 | } |
| 1753 | 1901 | |
| 1754 | 1902 | |
| 1755 | - if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array(); |
|
| 1903 | + if (!isset($globalStatsFilters) || $globalStatsFilters == '') { |
|
| 1904 | + $globalStatsFilters = array(); |
|
| 1905 | + } |
|
| 1756 | 1906 | foreach ($globalStatsFilters as $name => $filter) { |
| 1757 | 1907 | //$filter_name = $filter['name']; |
| 1758 | 1908 | $filter_name = $name; |
@@ -1795,7 +1945,9 @@ discard block |
||
| 1795 | 1945 | $icao = $value['airport_departure_icao']; |
| 1796 | 1946 | if (isset($alldata[$icao])) { |
| 1797 | 1947 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 1798 | - } else $alldata[$icao] = $value; |
|
| 1948 | + } else { |
|
| 1949 | + $alldata[$icao] = $value; |
|
| 1950 | + } |
|
| 1799 | 1951 | } |
| 1800 | 1952 | $count = array(); |
| 1801 | 1953 | foreach ($alldata as $key => $row) { |
@@ -1816,7 +1968,9 @@ discard block |
||
| 1816 | 1968 | $icao = $value['airport_arrival_icao']; |
| 1817 | 1969 | if (isset($alldata[$icao])) { |
| 1818 | 1970 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 1819 | - } else $alldata[$icao] = $value; |
|
| 1971 | + } else { |
|
| 1972 | + $alldata[$icao] = $value; |
|
| 1973 | + } |
|
| 1820 | 1974 | } |
| 1821 | 1975 | $count = array(); |
| 1822 | 1976 | foreach ($alldata as $key => $row) { |
@@ -1830,7 +1984,9 @@ discard block |
||
| 1830 | 1984 | $alldata = $Spotter->countAllMonths($filter); |
| 1831 | 1985 | $lastyear = false; |
| 1832 | 1986 | foreach ($alldata as $number) { |
| 1833 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 1987 | + if ($number['year_name'] != date('Y')) { |
|
| 1988 | + $lastyear = true; |
|
| 1989 | + } |
|
| 1834 | 1990 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
| 1835 | 1991 | } |
| 1836 | 1992 | $alldata = $Spotter->countAllMonthsOwners($filter); |
@@ -24,13 +24,21 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | print '<div class="select-item"><form action="'.$globalURL.'/airline" method="post"><select name="airline_type" class="selectpicker" data-live-search="true">'; |
| 26 | 26 | print '<option value="all"'; |
| 27 | - if ($airline_type == 'all') print 'selected="selected" '; |
|
| 27 | + if ($airline_type == 'all') { |
|
| 28 | + print 'selected="selected" '; |
|
| 29 | + } |
|
| 28 | 30 | print '>'._("All").'</option><option value="passenger"'; |
| 29 | - if ($airline_type == 'passenger') print 'selected="selected" '; |
|
| 31 | + if ($airline_type == 'passenger') { |
|
| 32 | + print 'selected="selected" '; |
|
| 33 | + } |
|
| 30 | 34 | print '>'._("Passenger").'</option><option value="cargo"'; |
| 31 | - if ($airline_type == 'cargo') print 'selected="selected" '; |
|
| 35 | + if ($airline_type == 'cargo') { |
|
| 36 | + print 'selected="selected" '; |
|
| 37 | + } |
|
| 32 | 38 | print '>'._("Cargo").'</option><option value="military"'; |
| 33 | - if ($airline_type == 'military') print 'selected="selected" '; |
|
| 39 | + if ($airline_type == 'military') { |
|
| 40 | + print 'selected="selected" '; |
|
| 41 | + } |
|
| 34 | 42 | print '>'._("Military").'</option></select>'; |
| 35 | 43 | print '<button type="submit"><i class="fa fa-angle-double-right"></i></button></form></div>'; |
| 36 | 44 | |
@@ -57,7 +65,9 @@ discard block |
||
| 57 | 65 | $firstLetter = mb_strtoupper(mb_substr($value['airline_name'], 0, 1),'UTF-8'); |
| 58 | 66 | if($previous !== $firstLetter) |
| 59 | 67 | { |
| 60 | - if ($previous !== null) print ' | '; |
|
| 68 | + if ($previous !== null) { |
|
| 69 | + print ' | '; |
|
| 70 | + } |
|
| 61 | 71 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
| 62 | 72 | } |
| 63 | 73 | $previous = $firstLetter; |
@@ -70,7 +80,9 @@ discard block |
||
| 70 | 80 | { |
| 71 | 81 | if($previous !== $firstLetter) |
| 72 | 82 | { |
| 73 | - if ($previous !== null) print '</div>'; |
|
| 83 | + if ($previous !== null) { |
|
| 84 | + print '</div>'; |
|
| 85 | + } |
|
| 74 | 86 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
| 75 | 87 | } |
| 76 | 88 | $previous = $firstLetter; |