@@ -5,7 +5,9 @@ |
||
| 5 | 5 | $Spotter = new Spotter(); |
| 6 | 6 | $title = _("Statistics").' - '._("Most common Route by Waypoint"); |
| 7 | 7 | require_once('header.php'); |
| 8 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 8 | +if (!isset($filter_name)) { |
|
| 9 | + $filter_name = ''; |
|
| 10 | +} |
|
| 9 | 11 | include('statistics-sub-menu.php'); |
| 10 | 12 | |
| 11 | 13 | print '<div class="info"> |
@@ -5,7 +5,9 @@ |
||
| 5 | 5 | $Spotter = new Spotter(); |
| 6 | 6 | $title = _("Statistics").' - '._("Most common Route by Airport"); |
| 7 | 7 | require_once('header.php'); |
| 8 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 8 | +if (!isset($filter_name)) { |
|
| 9 | + $filter_name = ''; |
|
| 10 | +} |
|
| 9 | 11 | include('statistics-sub-menu.php'); |
| 10 | 12 | |
| 11 | 13 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -6,11 +6,15 @@ discard block |
||
| 6 | 6 | $beginpage = microtime(true); |
| 7 | 7 | $Stats = new Stats(); |
| 8 | 8 | |
| 9 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 9 | +if (!isset($filter_name)) { |
|
| 10 | + $filter_name = ''; |
|
| 11 | +} |
|
| 10 | 12 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 11 | 13 | if ($airline_icao == '' && isset($globalFilter)) { |
| 12 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 13 | -} |
|
| 14 | + if (isset($globalFilter['airline'])) { |
|
| 15 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 16 | + } |
|
| 17 | + } |
|
| 14 | 18 | if ($airline_icao != '' && $airline_icao != 'all') { |
| 15 | 19 | $Spotter = new Spotter(); |
| 16 | 20 | $airline_info = $Spotter->getAllAirlineInfo($airline_icao); |
@@ -41,14 +45,21 @@ discard block |
||
| 41 | 45 | <script type="text/javascript" src="<?php echo $globalURL; ?>/js/datamaps.world.min.js"></script> |
| 42 | 46 | <div class="column"> |
| 43 | 47 | <div class="info"> |
| 44 | - <h1><?php if (isset($airline_name)) echo _("Statistics for ").$airline_name; else echo _("Statistics"); ?></h1> |
|
| 48 | + <h1><?php if (isset($airline_name)) { |
|
| 49 | + echo _("Statistics for ").$airline_name; |
|
| 50 | +} else { |
|
| 51 | + echo _("Statistics"); |
|
| 52 | +} |
|
| 53 | +?></h1> |
|
| 45 | 54 | <?php |
| 46 | 55 | $last_update = $Stats->getLastStatsUpdate(); |
| 47 | 56 | //if (isset($last_update[0]['value'])) print '<!-- Last update : '.$last_update[0]['value'].' -->'; |
| 48 | 57 | if (isset($last_update[0]['value'])) { |
| 49 | 58 | date_default_timezone_set('UTC'); |
| 50 | 59 | $lastupdate = strtotime($last_update[0]['value']); |
| 51 | - if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
|
| 60 | + if (isset($globalTimezone) && $globalTimezone != '') { |
|
| 61 | + date_default_timezone_set($globalTimezone); |
|
| 62 | + } |
|
| 52 | 63 | print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
| 53 | 64 | } |
| 54 | 65 | ?> |
@@ -100,8 +111,9 @@ discard block |
||
| 100 | 111 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
| 101 | 112 | <?php |
| 102 | 113 | $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
| 103 | - if (count($aircraft_array) == 0) print _("No data available"); |
|
| 104 | - else { |
|
| 114 | + if (count($aircraft_array) == 0) { |
|
| 115 | + print _("No data available"); |
|
| 116 | + } else { |
|
| 105 | 117 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
| 106 | 118 | $aircraft_data = ''; |
| 107 | 119 | foreach($aircraft_array as $aircraft_item) |
@@ -123,11 +135,17 @@ discard block |
||
| 123 | 135 | <?php |
| 124 | 136 | if ($year != '' && $month != '') { |
| 125 | 137 | ?> |
| 126 | - <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 138 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 139 | + echo '/'.$airline_icao; |
|
| 140 | +} |
|
| 141 | +?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 127 | 142 | <?php |
| 128 | 143 | } else { |
| 129 | 144 | ?> |
| 130 | - <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 145 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 146 | + echo '/'.$airline_icao; |
|
| 147 | +} |
|
| 148 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 131 | 149 | <?php |
| 132 | 150 | } |
| 133 | 151 | ?> |
@@ -158,11 +176,15 @@ discard block |
||
| 158 | 176 | print '</script>'; |
| 159 | 177 | if ($year != '' && $month != '') { |
| 160 | 178 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
| 161 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
| 179 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 180 | + echo '/'.$airline_icao; |
|
| 181 | + } |
|
| 162 | 182 | print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
| 163 | 183 | } else { |
| 164 | 184 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
| 165 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
| 185 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 186 | + echo '/'.$airline_icao; |
|
| 187 | + } |
|
| 166 | 188 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
| 167 | 189 | } |
| 168 | 190 | print '</div>'; |
@@ -186,8 +208,9 @@ discard block |
||
| 186 | 208 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
| 187 | 209 | <?php |
| 188 | 210 | $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
| 189 | - if (count($pilot_array) == 0) print _("No data available"); |
|
| 190 | - else { |
|
| 211 | + if (count($pilot_array) == 0) { |
|
| 212 | + print _("No data available"); |
|
| 213 | + } else { |
|
| 191 | 214 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
| 192 | 215 | $pilot_data = ''; |
| 193 | 216 | foreach($pilot_array as $pilot_item) |
@@ -206,7 +229,9 @@ discard block |
||
| 206 | 229 | } |
| 207 | 230 | print '<div class="more">'; |
| 208 | 231 | print '<a href="'.$globalURL.'/statistics/pilot'; |
| 209 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
| 232 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 233 | + echo '/'.$airline_icao; |
|
| 234 | + } |
|
| 210 | 235 | print'" class="btn btn-default btn" role="button">'._("See full statistic").'»</a>'; |
| 211 | 236 | print '</div>'; |
| 212 | 237 | ?> |
@@ -220,8 +245,9 @@ discard block |
||
| 220 | 245 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
| 221 | 246 | <?php |
| 222 | 247 | $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
| 223 | - if (count($owner_array) == 0) print _("No data available"); |
|
| 224 | - else { |
|
| 248 | + if (count($owner_array) == 0) { |
|
| 249 | + print _("No data available"); |
|
| 250 | + } else { |
|
| 225 | 251 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
| 226 | 252 | $owner_data = ''; |
| 227 | 253 | foreach($owner_array as $owner_item) |
@@ -240,7 +266,10 @@ discard block |
||
| 240 | 266 | } |
| 241 | 267 | ?> |
| 242 | 268 | <div class="more"> |
| 243 | - <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 269 | + <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 270 | + echo '/'.$airline_icao; |
|
| 271 | +} |
|
| 272 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 244 | 273 | </div> |
| 245 | 274 | </div> |
| 246 | 275 | |
@@ -253,8 +282,9 @@ discard block |
||
| 253 | 282 | <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2> |
| 254 | 283 | <?php |
| 255 | 284 | //$flightover_array = $Stats->countAllFlightOverCountries(); |
| 256 | - if (count($flightover_array) == 0) print _("No data available"); |
|
| 257 | - else { |
|
| 285 | + if (count($flightover_array) == 0) { |
|
| 286 | + print _("No data available"); |
|
| 287 | + } else { |
|
| 258 | 288 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
| 259 | 289 | print 'var series = ['; |
| 260 | 290 | $flightover_data = ''; |
@@ -297,7 +327,10 @@ discard block |
||
| 297 | 327 | } |
| 298 | 328 | ?> |
| 299 | 329 | <div class="more"> |
| 300 | - <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 330 | + <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 331 | + echo '/'.$airline_icao; |
|
| 332 | +} |
|
| 333 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 301 | 334 | </div> |
| 302 | 335 | </div> |
| 303 | 336 | <?php |
@@ -364,7 +397,9 @@ discard block |
||
| 364 | 397 | print '</script>'; |
| 365 | 398 | |
| 366 | 399 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure'; |
| 367 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
| 400 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 401 | + echo '/'.$airline_icao; |
|
| 402 | + } |
|
| 368 | 403 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
| 369 | 404 | } |
| 370 | 405 | ?> |
@@ -427,7 +462,9 @@ discard block |
||
| 427 | 462 | |
| 428 | 463 | |
| 429 | 464 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival'; |
| 430 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
| 465 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 466 | + echo '/'.$airline_icao; |
|
| 467 | + } |
|
| 431 | 468 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
| 432 | 469 | } |
| 433 | 470 | ?> |
@@ -442,8 +479,9 @@ discard block |
||
| 442 | 479 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
| 443 | 480 | <?php |
| 444 | 481 | $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
| 445 | - if (count($year_array) == 0) print _("No data available"); |
|
| 446 | - else { |
|
| 482 | + if (count($year_array) == 0) { |
|
| 483 | + print _("No data available"); |
|
| 484 | + } else { |
|
| 447 | 485 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
| 448 | 486 | $year_data = ''; |
| 449 | 487 | $year_cnt = ''; |
@@ -463,7 +501,10 @@ discard block |
||
| 463 | 501 | } |
| 464 | 502 | ?> |
| 465 | 503 | <div class="more"> |
| 466 | - <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 504 | + <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 505 | + echo '/'.$airline_icao; |
|
| 506 | +} |
|
| 507 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 467 | 508 | </div> |
| 468 | 509 | </div> |
| 469 | 510 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -471,8 +512,9 @@ discard block |
||
| 471 | 512 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
| 472 | 513 | <?php |
| 473 | 514 | $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
| 474 | - if (count($month_array) == 0) print _("No data available"); |
|
| 475 | - else { |
|
| 515 | + if (count($month_array) == 0) { |
|
| 516 | + print _("No data available"); |
|
| 517 | + } else { |
|
| 476 | 518 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
| 477 | 519 | $month_data = ''; |
| 478 | 520 | $month_cnt = ''; |
@@ -493,7 +535,10 @@ discard block |
||
| 493 | 535 | } |
| 494 | 536 | ?> |
| 495 | 537 | <div class="more"> |
| 496 | - <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 538 | + <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 539 | + echo '/'.$airline_icao; |
|
| 540 | +} |
|
| 541 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 497 | 542 | </div> |
| 498 | 543 | </div> |
| 499 | 544 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -502,8 +547,9 @@ discard block |
||
| 502 | 547 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
| 503 | 548 | <?php |
| 504 | 549 | $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
| 505 | - if (empty($date_array)) print _("No data available"); |
|
| 506 | - else { |
|
| 550 | + if (empty($date_array)) { |
|
| 551 | + print _("No data available"); |
|
| 552 | + } else { |
|
| 507 | 553 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
| 508 | 554 | $date_data = ''; |
| 509 | 555 | $date_cnt = ''; |
@@ -524,7 +570,10 @@ discard block |
||
| 524 | 570 | } |
| 525 | 571 | ?> |
| 526 | 572 | <div class="more"> |
| 527 | - <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 573 | + <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 574 | + echo '/'.$airline_icao; |
|
| 575 | +} |
|
| 576 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 528 | 577 | </div> |
| 529 | 578 | </div> |
| 530 | 579 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -532,8 +581,9 @@ discard block |
||
| 532 | 581 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
| 533 | 582 | <?php |
| 534 | 583 | $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
| 535 | - if (empty($hour_array)) print _("No data available"); |
|
| 536 | - else { |
|
| 584 | + if (empty($hour_array)) { |
|
| 585 | + print _("No data available"); |
|
| 586 | + } else { |
|
| 537 | 587 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
| 538 | 588 | $hour_data = ''; |
| 539 | 589 | $hour_cnt = ''; |
@@ -554,7 +604,10 @@ discard block |
||
| 554 | 604 | } |
| 555 | 605 | ?> |
| 556 | 606 | <div class="more"> |
| 557 | - <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 607 | + <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 608 | + echo '/'.$airline_icao; |
|
| 609 | +} |
|
| 610 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 558 | 611 | </div> |
| 559 | 612 | </div> |
| 560 | 613 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -571,8 +624,9 @@ discard block |
||
| 571 | 624 | <h2><?php echo _("Fatalities by Years"); ?></h2> |
| 572 | 625 | <?php |
| 573 | 626 | $year_array = $Stats->countFatalitiesByYear(); |
| 574 | - if (count($year_array) == 0) print _("No data available"); |
|
| 575 | - else { |
|
| 627 | + if (count($year_array) == 0) { |
|
| 628 | + print _("No data available"); |
|
| 629 | + } else { |
|
| 576 | 630 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
| 577 | 631 | $year_data = ''; |
| 578 | 632 | $year_cnt = ''; |
@@ -603,8 +657,9 @@ discard block |
||
| 603 | 657 | <h2><?php echo _("Fatalities last 12 Months"); ?></h2> |
| 604 | 658 | <?php |
| 605 | 659 | $year_array = $Stats->countFatalitiesLast12Months(); |
| 606 | - if (count($year_array) == 0) print _("No data available"); |
|
| 607 | - else { |
|
| 660 | + if (count($year_array) == 0) { |
|
| 661 | + print _("No data available"); |
|
| 662 | + } else { |
|
| 608 | 663 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
| 609 | 664 | $year_data = ''; |
| 610 | 665 | $year_cnt = ''; |
@@ -664,8 +719,11 @@ discard block |
||
| 664 | 719 | $distance = $distance; |
| 665 | 720 | $unit = 'km'; |
| 666 | 721 | } |
| 667 | - if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 668 | - else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 722 | + if (!isset($polar_data)) { |
|
| 723 | + $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 724 | + } else { |
|
| 725 | + $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 726 | + } |
|
| 669 | 727 | } |
| 670 | 728 | ?> |
| 671 | 729 | <div class="col-md-6"> |
@@ -717,8 +775,11 @@ discard block |
||
| 717 | 775 | foreach ($msg as $eachmsg) { |
| 718 | 776 | //$eachmsg = $msg[0]; |
| 719 | 777 | $data = $eachmsg['source_data']; |
| 720 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
| 721 | - else $max = 500; |
|
| 778 | + if ($data > 500) { |
|
| 779 | + $max = (round(($data+100)/100))*100; |
|
| 780 | + } else { |
|
| 781 | + $max = 500; |
|
| 782 | + } |
|
| 722 | 783 | ?> |
| 723 | 784 | <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
| 724 | 785 | <script> |
@@ -8,7 +8,9 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
| 10 | 10 | global $globalDBdriver, $globalNoDB; |
| 11 | - if (isset($globalNoDB) && $globalNoDB === TRUE) return true; |
|
| 11 | + if (isset($globalNoDB) && $globalNoDB === TRUE) { |
|
| 12 | + return true; |
|
| 13 | + } |
|
| 12 | 14 | if ($dbc === null) { |
| 13 | 15 | if ($this->db === null && $dbname === null) { |
| 14 | 16 | if ($user === null && $pass === null) { |
@@ -65,8 +67,11 @@ discard block |
||
| 65 | 67 | $globalDBSname = $globalDBname; |
| 66 | 68 | $globalDBSuser = $globalDBuser; |
| 67 | 69 | $globalDBSpass = $globalDBpass; |
| 68 | - if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306; |
|
| 69 | - else $globalDBSport = $globalDBport; |
|
| 70 | + if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') { |
|
| 71 | + $globalDBSport = 3306; |
|
| 72 | + } else { |
|
| 73 | + $globalDBSport = $globalDBport; |
|
| 74 | + } |
|
| 70 | 75 | } else { |
| 71 | 76 | $DBname = 'default'; |
| 72 | 77 | $globalDBSdriver = $globalDBdriver; |
@@ -74,8 +79,11 @@ discard block |
||
| 74 | 79 | $globalDBSname = $globalDBname; |
| 75 | 80 | $globalDBSuser = $user; |
| 76 | 81 | $globalDBSpass = $pass; |
| 77 | - if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306; |
|
| 78 | - else $globalDBSport = $globalDBport; |
|
| 82 | + if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') { |
|
| 83 | + $globalDBSport = 3306; |
|
| 84 | + } else { |
|
| 85 | + $globalDBSport = $globalDBport; |
|
| 86 | + } |
|
| 79 | 87 | } |
| 80 | 88 | } else { |
| 81 | 89 | $globalDBSdriver = $globalDB[$DBname]['driver']; |
@@ -83,11 +91,16 @@ discard block |
||
| 83 | 91 | $globalDBSname = $globalDB[$DBname]['name']; |
| 84 | 92 | $globalDBSuser = $globalDB[$DBname]['user']; |
| 85 | 93 | $globalDBSpass = $globalDB[$DBname]['pass']; |
| 86 | - if (isset($globalDB[$DBname]['port'])) $globalDBSport = $globalDB[$DBname]['port']; |
|
| 87 | - else $globalDBSport = 3306; |
|
| 94 | + if (isset($globalDB[$DBname]['port'])) { |
|
| 95 | + $globalDBSport = $globalDB[$DBname]['port']; |
|
| 96 | + } else { |
|
| 97 | + $globalDBSport = 3306; |
|
| 98 | + } |
|
| 88 | 99 | } |
| 89 | 100 | // Set number of try to connect to DB |
| 90 | - if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) $globalDBretry = 5; |
|
| 101 | + if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) { |
|
| 102 | + $globalDBretry = 5; |
|
| 103 | + } |
|
| 91 | 104 | $i = 0; |
| 92 | 105 | while (true) { |
| 93 | 106 | try { |
@@ -96,10 +109,16 @@ discard block |
||
| 96 | 109 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
| 97 | 110 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 98 | 111 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
| 99 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500); |
|
| 100 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 101 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 102 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 112 | + if (!isset($globalDBTimeOut)) { |
|
| 113 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500); |
|
| 114 | + } else { |
|
| 115 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 116 | + } |
|
| 117 | + if (!isset($globalDBPersistent)) { |
|
| 118 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 119 | + } else { |
|
| 120 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 121 | + } |
|
| 103 | 122 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
| 104 | 123 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); |
| 105 | 124 | // Workaround against "ONLY_FULL_GROUP_BY" mode |
@@ -113,23 +132,35 @@ discard block |
||
| 113 | 132 | //$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
| 114 | 133 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 115 | 134 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
| 116 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
| 117 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 118 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 119 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 135 | + if (!isset($globalDBTimeOut)) { |
|
| 136 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
| 137 | + } else { |
|
| 138 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 139 | + } |
|
| 140 | + if (!isset($globalDBPersistent)) { |
|
| 141 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 142 | + } else { |
|
| 143 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 144 | + } |
|
| 120 | 145 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
| 121 | 146 | $this->dbs[$DBname]->exec('SET timezone="UTC"'); |
| 122 | 147 | } |
| 123 | 148 | break; |
| 124 | 149 | } catch(PDOException $e) { |
| 125 | 150 | $i++; |
| 126 | - if (isset($globalDebug) && $globalDebug) echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n"; |
|
| 151 | + if (isset($globalDebug) && $globalDebug) { |
|
| 152 | + echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n"; |
|
| 153 | + } |
|
| 127 | 154 | //exit; |
| 128 | - if ($i > $globalDBretry) return false; |
|
| 155 | + if ($i > $globalDBretry) { |
|
| 156 | + return false; |
|
| 157 | + } |
|
| 129 | 158 | //return false; |
| 130 | 159 | } |
| 131 | 160 | } |
| 132 | - if ($DBname === 'default') $this->db = $this->dbs['default']; |
|
| 161 | + if ($DBname === 'default') { |
|
| 162 | + $this->db = $this->dbs['default']; |
|
| 163 | + } |
|
| 133 | 164 | return true; |
| 134 | 165 | } |
| 135 | 166 | |
@@ -141,7 +172,9 @@ discard block |
||
| 141 | 172 | } else { |
| 142 | 173 | $query = "SELECT * FROM pg_catalog.pg_tables WHERE tablename = '".$table."'"; |
| 143 | 174 | } |
| 144 | - if ($this->db == NULL) return false; |
|
| 175 | + if ($this->db == NULL) { |
|
| 176 | + return false; |
|
| 177 | + } |
|
| 145 | 178 | try { |
| 146 | 179 | //$Connection = new Connection(); |
| 147 | 180 | $results = $this->db->query($query); |
@@ -150,21 +183,28 @@ discard block |
||
| 150 | 183 | } |
| 151 | 184 | if($results->rowCount()>0) { |
| 152 | 185 | return true; |
| 186 | + } else { |
|
| 187 | + return false; |
|
| 153 | 188 | } |
| 154 | - else return false; |
|
| 155 | 189 | } |
| 156 | 190 | |
| 157 | 191 | public function connectionExists() |
| 158 | 192 | { |
| 159 | 193 | global $globalDBdriver, $globalDBCheckConnection; |
| 160 | - if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) return true; |
|
| 194 | + if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) { |
|
| 195 | + return true; |
|
| 196 | + } |
|
| 161 | 197 | $query = "SELECT 1 + 1"; |
| 162 | - if ($this->db === null) return false; |
|
| 198 | + if ($this->db === null) { |
|
| 199 | + return false; |
|
| 200 | + } |
|
| 163 | 201 | try { |
| 164 | 202 | $sum = @$this->db->query($query); |
| 165 | 203 | if ($sum instanceof \PDOStatement) { |
| 166 | 204 | $sum = $sum->fetchColumn(0); |
| 167 | - } else $sum = 0; |
|
| 205 | + } else { |
|
| 206 | + $sum = 0; |
|
| 207 | + } |
|
| 168 | 208 | if (intval($sum) !== 2) { |
| 169 | 209 | return false; |
| 170 | 210 | } |
@@ -199,8 +239,9 @@ discard block |
||
| 199 | 239 | $nb = $results->fetchAll(PDO::FETCH_ASSOC); |
| 200 | 240 | if($nb[0]['nb'] > 0) { |
| 201 | 241 | return true; |
| 242 | + } else { |
|
| 243 | + return false; |
|
| 202 | 244 | } |
| 203 | - else return false; |
|
| 204 | 245 | } |
| 205 | 246 | |
| 206 | 247 | /* |
@@ -250,9 +291,12 @@ discard block |
||
| 250 | 291 | } |
| 251 | 292 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 252 | 293 | $sth->closeCursor(); |
| 253 | - if ($result['nb'] > 0) return true; |
|
| 254 | - else return false; |
|
| 255 | -/* } else { |
|
| 294 | + if ($result['nb'] > 0) { |
|
| 295 | + return true; |
|
| 296 | + } else { |
|
| 297 | + return false; |
|
| 298 | + } |
|
| 299 | + /* } else { |
|
| 256 | 300 | $query = "SELECT * FROM ".$table." LIMIT 0"; |
| 257 | 301 | try { |
| 258 | 302 | $results = $this->db->query($query); |
@@ -291,7 +335,9 @@ discard block |
||
| 291 | 335 | $sth->closeCursor(); |
| 292 | 336 | return $result['value']; |
| 293 | 337 | } |
| 294 | - } else return $version; |
|
| 338 | + } else { |
|
| 339 | + return $version; |
|
| 340 | + } |
|
| 295 | 341 | } |
| 296 | 342 | |
| 297 | 343 | /* |
@@ -300,9 +346,14 @@ discard block |
||
| 300 | 346 | */ |
| 301 | 347 | public function latest() { |
| 302 | 348 | global $globalNoDB; |
| 303 | - if (isset($globalNoDB) && $globalNoDB === TRUE) return true; |
|
| 304 | - if ($this->check_schema_version() == $this->latest_schema) return true; |
|
| 305 | - else return false; |
|
| 349 | + if (isset($globalNoDB) && $globalNoDB === TRUE) { |
|
| 350 | + return true; |
|
| 351 | + } |
|
| 352 | + if ($this->check_schema_version() == $this->latest_schema) { |
|
| 353 | + return true; |
|
| 354 | + } else { |
|
| 355 | + return false; |
|
| 356 | + } |
|
| 306 | 357 | } |
| 307 | 358 | |
| 308 | 359 | } |
@@ -13,7 +13,9 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | public function __construct($dbc = null) { |
| 15 | 15 | global $globalFilterName; |
| 16 | - if (isset($globalFilterName)) $this->filter_name = $globalFilterName; |
|
| 16 | + if (isset($globalFilterName)) { |
|
| 17 | + $this->filter_name = $globalFilterName; |
|
| 18 | + } |
|
| 17 | 19 | $Connection = new Connection($dbc); |
| 18 | 20 | $this->db = $Connection->db(); |
| 19 | 21 | } |
@@ -81,7 +83,9 @@ discard block |
||
| 81 | 83 | } |
| 82 | 84 | } |
| 83 | 85 | public function getAllAirlineNames($filter_name = '') { |
| 84 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 86 | + if ($filter_name == '') { |
|
| 87 | + $filter_name = $this->filter_name; |
|
| 88 | + } |
|
| 85 | 89 | $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
| 86 | 90 | try { |
| 87 | 91 | $sth = $this->db->prepare($query); |
@@ -93,7 +97,9 @@ discard block |
||
| 93 | 97 | return $all; |
| 94 | 98 | } |
| 95 | 99 | public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
| 96 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 100 | + if ($filter_name == '') { |
|
| 101 | + $filter_name = $this->filter_name; |
|
| 102 | + } |
|
| 97 | 103 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
| 98 | 104 | try { |
| 99 | 105 | $sth = $this->db->prepare($query); |
@@ -105,7 +111,9 @@ discard block |
||
| 105 | 111 | return $all; |
| 106 | 112 | } |
| 107 | 113 | public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
| 108 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 114 | + if ($filter_name == '') { |
|
| 115 | + $filter_name = $this->filter_name; |
|
| 116 | + } |
|
| 109 | 117 | $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC"; |
| 110 | 118 | try { |
| 111 | 119 | $sth = $this->db->prepare($query); |
@@ -117,7 +125,9 @@ discard block |
||
| 117 | 125 | return $all; |
| 118 | 126 | } |
| 119 | 127 | public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
| 120 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 128 | + if ($filter_name == '') { |
|
| 129 | + $filter_name = $this->filter_name; |
|
| 130 | + } |
|
| 121 | 131 | $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
| 122 | 132 | try { |
| 123 | 133 | $sth = $this->db->prepare($query); |
@@ -130,7 +140,9 @@ discard block |
||
| 130 | 140 | } |
| 131 | 141 | |
| 132 | 142 | public function getAllOwnerNames($stats_airline = '',$filter_name = '') { |
| 133 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 143 | + if ($filter_name == '') { |
|
| 144 | + $filter_name = $this->filter_name; |
|
| 145 | + } |
|
| 134 | 146 | $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC"; |
| 135 | 147 | try { |
| 136 | 148 | $sth = $this->db->prepare($query); |
@@ -143,7 +155,9 @@ discard block |
||
| 143 | 155 | } |
| 144 | 156 | |
| 145 | 157 | public function getAllPilotNames($stats_airline = '',$filter_name = '') { |
| 146 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 158 | + if ($filter_name == '') { |
|
| 159 | + $filter_name = $this->filter_name; |
|
| 160 | + } |
|
| 147 | 161 | $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC"; |
| 148 | 162 | try { |
| 149 | 163 | $sth = $this->db->prepare($query); |
@@ -158,10 +172,15 @@ discard block |
||
| 158 | 172 | |
| 159 | 173 | public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 160 | 174 | global $globalStatsFilters; |
| 161 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 175 | + if ($filter_name == '') { |
|
| 176 | + $filter_name = $this->filter_name; |
|
| 177 | + } |
|
| 162 | 178 | if ($year == '' && $month == '') { |
| 163 | - if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 164 | - else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 179 | + if ($limit) { |
|
| 180 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 181 | + } else { |
|
| 182 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 183 | + } |
|
| 165 | 184 | try { |
| 166 | 185 | $sth = $this->db->prepare($query); |
| 167 | 186 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -169,7 +188,9 @@ discard block |
||
| 169 | 188 | echo "error : ".$e->getMessage(); |
| 170 | 189 | } |
| 171 | 190 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 172 | - } else $all = array(); |
|
| 191 | + } else { |
|
| 192 | + $all = array(); |
|
| 193 | + } |
|
| 173 | 194 | if (empty($all)) { |
| 174 | 195 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 175 | 196 | if ($filter_name != '') { |
@@ -183,10 +204,15 @@ discard block |
||
| 183 | 204 | } |
| 184 | 205 | public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
| 185 | 206 | global $globalStatsFilters; |
| 186 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 207 | + if ($filter_name == '') { |
|
| 208 | + $filter_name = $this->filter_name; |
|
| 209 | + } |
|
| 187 | 210 | if ($year == '' && $month == '') { |
| 188 | - if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 189 | - else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC"; |
|
| 211 | + if ($limit) { |
|
| 212 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 213 | + } else { |
|
| 214 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC"; |
|
| 215 | + } |
|
| 190 | 216 | try { |
| 191 | 217 | $sth = $this->db->prepare($query); |
| 192 | 218 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -194,7 +220,9 @@ discard block |
||
| 194 | 220 | echo "error : ".$e->getMessage(); |
| 195 | 221 | } |
| 196 | 222 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 197 | - } else $all = array(); |
|
| 223 | + } else { |
|
| 224 | + $all = array(); |
|
| 225 | + } |
|
| 198 | 226 | if (empty($all)) { |
| 199 | 227 | $Spotter = new Spotter($this->db); |
| 200 | 228 | $filters = array(); |
@@ -209,10 +237,15 @@ discard block |
||
| 209 | 237 | } |
| 210 | 238 | public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 211 | 239 | global $globalStatsFilters; |
| 212 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 240 | + if ($filter_name == '') { |
|
| 241 | + $filter_name = $this->filter_name; |
|
| 242 | + } |
|
| 213 | 243 | if ($year == '' && $month == '') { |
| 214 | - 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"; |
|
| 215 | - 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"; |
|
| 244 | + if ($limit) { |
|
| 245 | + $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"; |
|
| 246 | + } else { |
|
| 247 | + $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"; |
|
| 248 | + } |
|
| 216 | 249 | try { |
| 217 | 250 | $sth = $this->db->prepare($query); |
| 218 | 251 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -220,7 +253,9 @@ discard block |
||
| 220 | 253 | echo "error : ".$e->getMessage(); |
| 221 | 254 | } |
| 222 | 255 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 223 | - } else $all = array(); |
|
| 256 | + } else { |
|
| 257 | + $all = array(); |
|
| 258 | + } |
|
| 224 | 259 | if (empty($all)) { |
| 225 | 260 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 226 | 261 | if ($filter_name != '') { |
@@ -235,10 +270,15 @@ discard block |
||
| 235 | 270 | |
| 236 | 271 | public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 237 | 272 | global $globalStatsFilters; |
| 238 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 273 | + if ($filter_name == '') { |
|
| 274 | + $filter_name = $this->filter_name; |
|
| 275 | + } |
|
| 239 | 276 | if ($year == '' && $month == '') { |
| 240 | - if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 241 | - else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
| 277 | + if ($limit) { |
|
| 278 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 279 | + } else { |
|
| 280 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
| 281 | + } |
|
| 242 | 282 | try { |
| 243 | 283 | $sth = $this->db->prepare($query); |
| 244 | 284 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -246,7 +286,9 @@ discard block |
||
| 246 | 286 | echo "error : ".$e->getMessage(); |
| 247 | 287 | } |
| 248 | 288 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 249 | - } else $all = array(); |
|
| 289 | + } else { |
|
| 290 | + $all = array(); |
|
| 291 | + } |
|
| 250 | 292 | if (empty($all)) { |
| 251 | 293 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 252 | 294 | if ($filter_name != '') { |
@@ -260,9 +302,14 @@ discard block |
||
| 260 | 302 | } |
| 261 | 303 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
| 262 | 304 | global $globalStatsFilters; |
| 263 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 264 | - if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 265 | - else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
| 305 | + if ($filter_name == '') { |
|
| 306 | + $filter_name = $this->filter_name; |
|
| 307 | + } |
|
| 308 | + if ($limit) { |
|
| 309 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 310 | + } else { |
|
| 311 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
| 312 | + } |
|
| 266 | 313 | try { |
| 267 | 314 | $sth = $this->db->prepare($query); |
| 268 | 315 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -284,17 +331,29 @@ discard block |
||
| 284 | 331 | |
| 285 | 332 | public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
| 286 | 333 | global $globalStatsFilters, $globalVATSIM, $globalIVAO; |
| 287 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 334 | + if ($filter_name == '') { |
|
| 335 | + $filter_name = $this->filter_name; |
|
| 336 | + } |
|
| 288 | 337 | if ($year == '' && $month == '') { |
| 289 | - if ($globalVATSIM) $forsource = 'vatsim'; |
|
| 290 | - if ($globalIVAO) $forsource = 'ivao'; |
|
| 338 | + if ($globalVATSIM) { |
|
| 339 | + $forsource = 'vatsim'; |
|
| 340 | + } |
|
| 341 | + if ($globalIVAO) { |
|
| 342 | + $forsource = 'ivao'; |
|
| 343 | + } |
|
| 291 | 344 | if (isset($forsource)) { |
| 292 | - 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 AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 293 | - 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 AND airlines.forsource = :forsource ORDER BY airline_count DESC"; |
|
| 345 | + if ($limit) { |
|
| 346 | + $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 AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 347 | + } else { |
|
| 348 | + $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 AND airlines.forsource = :forsource ORDER BY airline_count DESC"; |
|
| 349 | + } |
|
| 294 | 350 | $query_values = array(':filter_name' => $filter_name,':forsource' => $forsource); |
| 295 | 351 | } else { |
| 296 | - 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 AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 297 | - 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 AND airlines.forsource IS NULL ORDER BY airline_count DESC"; |
|
| 352 | + if ($limit) { |
|
| 353 | + $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 AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 354 | + } else { |
|
| 355 | + $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 AND airlines.forsource IS NULL ORDER BY airline_count DESC"; |
|
| 356 | + } |
|
| 298 | 357 | $query_values = array(':filter_name' => $filter_name); |
| 299 | 358 | } |
| 300 | 359 | try { |
@@ -304,7 +363,9 @@ discard block |
||
| 304 | 363 | echo "error : ".$e->getMessage(); |
| 305 | 364 | } |
| 306 | 365 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 307 | - } else $all = array(); |
|
| 366 | + } else { |
|
| 367 | + $all = array(); |
|
| 368 | + } |
|
| 308 | 369 | if (empty($all)) { |
| 309 | 370 | $Spotter = new Spotter($this->db); |
| 310 | 371 | $filters = array(); |
@@ -319,10 +380,15 @@ discard block |
||
| 319 | 380 | } |
| 320 | 381 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 321 | 382 | global $globalStatsFilters; |
| 322 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 383 | + if ($filter_name == '') { |
|
| 384 | + $filter_name = $this->filter_name; |
|
| 385 | + } |
|
| 323 | 386 | if ($year == '' && $month == '') { |
| 324 | - 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"; |
|
| 325 | - 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"; |
|
| 387 | + if ($limit) { |
|
| 388 | + $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"; |
|
| 389 | + } else { |
|
| 390 | + $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"; |
|
| 391 | + } |
|
| 326 | 392 | try { |
| 327 | 393 | $sth = $this->db->prepare($query); |
| 328 | 394 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -330,7 +396,9 @@ discard block |
||
| 330 | 396 | echo "error : ".$e->getMessage(); |
| 331 | 397 | } |
| 332 | 398 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 333 | - } else $all = array(); |
|
| 399 | + } else { |
|
| 400 | + $all = array(); |
|
| 401 | + } |
|
| 334 | 402 | if (empty($all)) { |
| 335 | 403 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 336 | 404 | if ($filter_name != '') { |
@@ -344,10 +412,15 @@ discard block |
||
| 344 | 412 | } |
| 345 | 413 | public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 346 | 414 | global $globalStatsFilters; |
| 347 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 415 | + if ($filter_name == '') { |
|
| 416 | + $filter_name = $this->filter_name; |
|
| 417 | + } |
|
| 348 | 418 | if ($year == '' && $month == '') { |
| 349 | - 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"; |
|
| 350 | - 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"; |
|
| 419 | + if ($limit) { |
|
| 420 | + $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"; |
|
| 421 | + } else { |
|
| 422 | + $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"; |
|
| 423 | + } |
|
| 351 | 424 | try { |
| 352 | 425 | $sth = $this->db->prepare($query); |
| 353 | 426 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -355,7 +428,9 @@ discard block |
||
| 355 | 428 | echo "error : ".$e->getMessage(); |
| 356 | 429 | } |
| 357 | 430 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 358 | - } else $all = array(); |
|
| 431 | + } else { |
|
| 432 | + $all = array(); |
|
| 433 | + } |
|
| 359 | 434 | if (empty($all)) { |
| 360 | 435 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 361 | 436 | if ($filter_name != '') { |
@@ -369,11 +444,16 @@ discard block |
||
| 369 | 444 | } |
| 370 | 445 | public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 371 | 446 | $Connection = new Connection(); |
| 372 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 447 | + if ($filter_name == '') { |
|
| 448 | + $filter_name = $this->filter_name; |
|
| 449 | + } |
|
| 373 | 450 | if ($Connection->tableExists('countries')) { |
| 374 | 451 | if ($year == '' && $month == '') { |
| 375 | - 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"; |
|
| 376 | - 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"; |
|
| 452 | + if ($limit) { |
|
| 453 | + $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"; |
|
| 454 | + } else { |
|
| 455 | + $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"; |
|
| 456 | + } |
|
| 377 | 457 | try { |
| 378 | 458 | $sth = $this->db->prepare($query); |
| 379 | 459 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -388,17 +468,24 @@ discard block |
||
| 388 | 468 | } |
| 389 | 469 | */ |
| 390 | 470 | return $all; |
| 391 | - } else return array(); |
|
| 471 | + } else { |
|
| 472 | + return array(); |
|
| 473 | + } |
|
| 392 | 474 | } else { |
| 393 | 475 | return array(); |
| 394 | 476 | } |
| 395 | 477 | } |
| 396 | 478 | public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
| 397 | 479 | global $globalStatsFilters; |
| 398 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 480 | + if ($filter_name == '') { |
|
| 481 | + $filter_name = $this->filter_name; |
|
| 482 | + } |
|
| 399 | 483 | if ($year == '' && $month == '') { |
| 400 | - if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
|
| 401 | - else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
|
| 484 | + if ($limit) { |
|
| 485 | + $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
|
| 486 | + } else { |
|
| 487 | + $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
|
| 488 | + } |
|
| 402 | 489 | try { |
| 403 | 490 | $sth = $this->db->prepare($query); |
| 404 | 491 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -406,7 +493,9 @@ discard block |
||
| 406 | 493 | echo "error : ".$e->getMessage(); |
| 407 | 494 | } |
| 408 | 495 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 409 | - } else $all = array(); |
|
| 496 | + } else { |
|
| 497 | + $all = array(); |
|
| 498 | + } |
|
| 410 | 499 | if (empty($all)) { |
| 411 | 500 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 412 | 501 | if ($filter_name != '') { |
@@ -421,10 +510,15 @@ discard block |
||
| 421 | 510 | |
| 422 | 511 | public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
| 423 | 512 | global $globalStatsFilters; |
| 424 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 513 | + if ($filter_name == '') { |
|
| 514 | + $filter_name = $this->filter_name; |
|
| 515 | + } |
|
| 425 | 516 | if ($year == '' && $month == '') { |
| 426 | - 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"; |
|
| 427 | - 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"; |
|
| 517 | + if ($limit) { |
|
| 518 | + $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"; |
|
| 519 | + } else { |
|
| 520 | + $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"; |
|
| 521 | + } |
|
| 428 | 522 | try { |
| 429 | 523 | $sth = $this->db->prepare($query); |
| 430 | 524 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -432,7 +526,9 @@ discard block |
||
| 432 | 526 | echo "error : ".$e->getMessage(); |
| 433 | 527 | } |
| 434 | 528 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 435 | - } else $all = array(); |
|
| 529 | + } else { |
|
| 530 | + $all = array(); |
|
| 531 | + } |
|
| 436 | 532 | if (empty($all)) { |
| 437 | 533 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 438 | 534 | if ($filter_name != '') { |
@@ -446,10 +542,15 @@ discard block |
||
| 446 | 542 | } |
| 447 | 543 | public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 448 | 544 | global $globalStatsFilters; |
| 449 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 545 | + if ($filter_name == '') { |
|
| 546 | + $filter_name = $this->filter_name; |
|
| 547 | + } |
|
| 450 | 548 | if ($year == '' && $month == '') { |
| 451 | - 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, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND 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"; |
|
| 452 | - 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, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
| 549 | + if ($limit) { |
|
| 550 | + $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, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND 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"; |
|
| 551 | + } else { |
|
| 552 | + $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, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
| 553 | + } |
|
| 453 | 554 | try { |
| 454 | 555 | $sth = $this->db->prepare($query); |
| 455 | 556 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -457,7 +558,9 @@ discard block |
||
| 457 | 558 | echo "error : ".$e->getMessage(); |
| 458 | 559 | } |
| 459 | 560 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 460 | - } else $all = array(); |
|
| 561 | + } else { |
|
| 562 | + $all = array(); |
|
| 563 | + } |
|
| 461 | 564 | if (empty($all)) { |
| 462 | 565 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 463 | 566 | if ($filter_name != '') { |
@@ -478,7 +581,9 @@ discard block |
||
| 478 | 581 | $icao = $value['airport_departure_icao']; |
| 479 | 582 | if (isset($all[$icao])) { |
| 480 | 583 | $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 481 | - } else $all[$icao] = $value; |
|
| 584 | + } else { |
|
| 585 | + $all[$icao] = $value; |
|
| 586 | + } |
|
| 482 | 587 | } |
| 483 | 588 | $count = array(); |
| 484 | 589 | foreach ($all as $key => $row) { |
@@ -490,10 +595,15 @@ discard block |
||
| 490 | 595 | } |
| 491 | 596 | public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 492 | 597 | global $globalStatsFilters; |
| 493 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 598 | + if ($filter_name == '') { |
|
| 599 | + $filter_name = $this->filter_name; |
|
| 600 | + } |
|
| 494 | 601 | if ($year == '' && $month == '') { |
| 495 | - 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, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND 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"; |
|
| 496 | - 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, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
| 602 | + if ($limit) { |
|
| 603 | + $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, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND 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"; |
|
| 604 | + } else { |
|
| 605 | + $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, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
| 606 | + } |
|
| 497 | 607 | try { |
| 498 | 608 | $sth = $this->db->prepare($query); |
| 499 | 609 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -501,7 +611,9 @@ discard block |
||
| 501 | 611 | echo "error : ".$e->getMessage(); |
| 502 | 612 | } |
| 503 | 613 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 504 | - } else $all = array(); |
|
| 614 | + } else { |
|
| 615 | + $all = array(); |
|
| 616 | + } |
|
| 505 | 617 | if (empty($all)) { |
| 506 | 618 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 507 | 619 | if ($filter_name != '') { |
@@ -522,7 +634,9 @@ discard block |
||
| 522 | 634 | $icao = $value['airport_arrival_icao']; |
| 523 | 635 | if (isset($all[$icao])) { |
| 524 | 636 | $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 525 | - } else $all[$icao] = $value; |
|
| 637 | + } else { |
|
| 638 | + $all[$icao] = $value; |
|
| 639 | + } |
|
| 526 | 640 | } |
| 527 | 641 | $count = array(); |
| 528 | 642 | foreach ($all as $key => $row) { |
@@ -535,13 +649,21 @@ discard block |
||
| 535 | 649 | } |
| 536 | 650 | public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
| 537 | 651 | global $globalDBdriver, $globalStatsFilters; |
| 538 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 652 | + if ($filter_name == '') { |
|
| 653 | + $filter_name = $this->filter_name; |
|
| 654 | + } |
|
| 539 | 655 | if ($globalDBdriver == 'mysql') { |
| 540 | - 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"; |
|
| 541 | - 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"; |
|
| 656 | + if ($limit) { |
|
| 657 | + $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"; |
|
| 658 | + } else { |
|
| 659 | + $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"; |
|
| 660 | + } |
|
| 542 | 661 | } else { |
| 543 | - 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"; |
|
| 544 | - 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"; |
|
| 662 | + if ($limit) { |
|
| 663 | + $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"; |
|
| 664 | + } else { |
|
| 665 | + $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"; |
|
| 666 | + } |
|
| 545 | 667 | } |
| 546 | 668 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 547 | 669 | try { |
@@ -565,7 +687,9 @@ discard block |
||
| 565 | 687 | |
| 566 | 688 | public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
| 567 | 689 | global $globalStatsFilters; |
| 568 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 690 | + if ($filter_name == '') { |
|
| 691 | + $filter_name = $this->filter_name; |
|
| 692 | + } |
|
| 569 | 693 | $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"; |
| 570 | 694 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 571 | 695 | try { |
@@ -587,7 +711,9 @@ discard block |
||
| 587 | 711 | } |
| 588 | 712 | public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
| 589 | 713 | global $globalDBdriver, $globalStatsFilters; |
| 590 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 714 | + if ($filter_name == '') { |
|
| 715 | + $filter_name = $this->filter_name; |
|
| 716 | + } |
|
| 591 | 717 | if ($globalDBdriver == 'mysql') { |
| 592 | 718 | $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"; |
| 593 | 719 | } else { |
@@ -613,7 +739,9 @@ discard block |
||
| 613 | 739 | } |
| 614 | 740 | public function countAllDates($stats_airline = '',$filter_name = '') { |
| 615 | 741 | global $globalStatsFilters; |
| 616 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 742 | + if ($filter_name == '') { |
|
| 743 | + $filter_name = $this->filter_name; |
|
| 744 | + } |
|
| 617 | 745 | $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"; |
| 618 | 746 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 619 | 747 | try { |
@@ -635,7 +763,9 @@ discard block |
||
| 635 | 763 | } |
| 636 | 764 | public function countAllDatesByAirlines($filter_name = '') { |
| 637 | 765 | global $globalStatsFilters; |
| 638 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 766 | + if ($filter_name == '') { |
|
| 767 | + $filter_name = $this->filter_name; |
|
| 768 | + } |
|
| 639 | 769 | $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"; |
| 640 | 770 | $query_data = array('filter_name' => $filter_name); |
| 641 | 771 | try { |
@@ -657,7 +787,9 @@ discard block |
||
| 657 | 787 | } |
| 658 | 788 | public function countAllMonths($stats_airline = '',$filter_name = '') { |
| 659 | 789 | global $globalStatsFilters, $globalDBdriver; |
| 660 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 790 | + if ($filter_name == '') { |
|
| 791 | + $filter_name = $this->filter_name; |
|
| 792 | + } |
|
| 661 | 793 | if ($globalDBdriver == 'mysql') { |
| 662 | 794 | $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"; |
| 663 | 795 | } else { |
@@ -726,7 +858,9 @@ discard block |
||
| 726 | 858 | } |
| 727 | 859 | public function countAllMilitaryMonths($filter_name = '') { |
| 728 | 860 | global $globalStatsFilters; |
| 729 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 861 | + if ($filter_name == '') { |
|
| 862 | + $filter_name = $this->filter_name; |
|
| 863 | + } |
|
| 730 | 864 | $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"; |
| 731 | 865 | try { |
| 732 | 866 | $sth = $this->db->prepare($query); |
@@ -747,9 +881,14 @@ discard block |
||
| 747 | 881 | } |
| 748 | 882 | public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
| 749 | 883 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
| 750 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 751 | - 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"; |
|
| 752 | - 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"; |
|
| 884 | + if ($filter_name == '') { |
|
| 885 | + $filter_name = $this->filter_name; |
|
| 886 | + } |
|
| 887 | + if ($limit) { |
|
| 888 | + $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"; |
|
| 889 | + } else { |
|
| 890 | + $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"; |
|
| 891 | + } |
|
| 753 | 892 | if ($orderby == 'hour') { |
| 754 | 893 | if ($globalDBdriver == 'mysql') { |
| 755 | 894 | //$query .= " ORDER BY flight_date ASC"; |
@@ -758,7 +897,9 @@ discard block |
||
| 758 | 897 | $query .= " ORDER BY CAST(flight_date AS integer) ASC"; |
| 759 | 898 | } |
| 760 | 899 | } |
| 761 | - if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
|
| 900 | + if ($orderby == 'count') { |
|
| 901 | + $query .= " ORDER BY hour_count DESC"; |
|
| 902 | + } |
|
| 762 | 903 | try { |
| 763 | 904 | $sth = $this->db->prepare($query); |
| 764 | 905 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
@@ -779,8 +920,12 @@ discard block |
||
| 779 | 920 | |
| 780 | 921 | public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
| 781 | 922 | global $globalStatsFilters; |
| 782 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 783 | - if ($year == '') $year = date('Y'); |
|
| 923 | + if ($filter_name == '') { |
|
| 924 | + $filter_name = $this->filter_name; |
|
| 925 | + } |
|
| 926 | + if ($year == '') { |
|
| 927 | + $year = date('Y'); |
|
| 928 | + } |
|
| 784 | 929 | $all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
| 785 | 930 | if (empty($all)) { |
| 786 | 931 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
@@ -795,8 +940,12 @@ discard block |
||
| 795 | 940 | } |
| 796 | 941 | public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
| 797 | 942 | global $globalStatsFilters; |
| 798 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 799 | - if ($year == '') $year = date('Y'); |
|
| 943 | + if ($filter_name == '') { |
|
| 944 | + $filter_name = $this->filter_name; |
|
| 945 | + } |
|
| 946 | + if ($year == '') { |
|
| 947 | + $year = date('Y'); |
|
| 948 | + } |
|
| 800 | 949 | $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
| 801 | 950 | if (empty($all)) { |
| 802 | 951 | $filters = array(); |
@@ -812,8 +961,12 @@ discard block |
||
| 812 | 961 | } |
| 813 | 962 | public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
| 814 | 963 | global $globalStatsFilters; |
| 815 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 816 | - if ($year == '') $year = date('Y'); |
|
| 964 | + if ($filter_name == '') { |
|
| 965 | + $filter_name = $this->filter_name; |
|
| 966 | + } |
|
| 967 | + if ($year == '') { |
|
| 968 | + $year = date('Y'); |
|
| 969 | + } |
|
| 817 | 970 | $all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
| 818 | 971 | if (empty($all)) { |
| 819 | 972 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
@@ -828,7 +981,9 @@ discard block |
||
| 828 | 981 | } |
| 829 | 982 | public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
| 830 | 983 | global $globalStatsFilters; |
| 831 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 984 | + if ($filter_name == '') { |
|
| 985 | + $filter_name = $this->filter_name; |
|
| 986 | + } |
|
| 832 | 987 | if ($year == '' && $month == '') { |
| 833 | 988 | $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 834 | 989 | try { |
@@ -839,7 +994,9 @@ discard block |
||
| 839 | 994 | } |
| 840 | 995 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 841 | 996 | $all = $result[0]['nb']; |
| 842 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 997 | + } else { |
|
| 998 | + $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 999 | + } |
|
| 843 | 1000 | if (empty($all)) { |
| 844 | 1001 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 845 | 1002 | if ($filter_name != '') { |
@@ -853,7 +1010,9 @@ discard block |
||
| 853 | 1010 | } |
| 854 | 1011 | public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
| 855 | 1012 | global $globalStatsFilters; |
| 856 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1013 | + if ($filter_name == '') { |
|
| 1014 | + $filter_name = $this->filter_name; |
|
| 1015 | + } |
|
| 857 | 1016 | if ($year == '' && $month == '') { |
| 858 | 1017 | $query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name"; |
| 859 | 1018 | try { |
@@ -864,7 +1023,9 @@ discard block |
||
| 864 | 1023 | } |
| 865 | 1024 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 866 | 1025 | $all = $result[0]['nb_airline']; |
| 867 | - } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
| 1026 | + } else { |
|
| 1027 | + $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
| 1028 | + } |
|
| 868 | 1029 | if (empty($all)) { |
| 869 | 1030 | $filters = array(); |
| 870 | 1031 | $filters = array('year' => $year,'month' => $month); |
@@ -879,7 +1040,9 @@ discard block |
||
| 879 | 1040 | } |
| 880 | 1041 | public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
| 881 | 1042 | global $globalStatsFilters; |
| 882 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1043 | + if ($filter_name == '') { |
|
| 1044 | + $filter_name = $this->filter_name; |
|
| 1045 | + } |
|
| 883 | 1046 | if ($year == '' && $month == '') { |
| 884 | 1047 | $query = "SELECT count(*) as nb FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 885 | 1048 | $query_values = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
@@ -907,7 +1070,9 @@ discard block |
||
| 907 | 1070 | } |
| 908 | 1071 | public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 909 | 1072 | global $globalStatsFilters; |
| 910 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1073 | + if ($filter_name == '') { |
|
| 1074 | + $filter_name = $this->filter_name; |
|
| 1075 | + } |
|
| 911 | 1076 | //if ($year == '') $year = date('Y'); |
| 912 | 1077 | if ($year == '' && $month == '') { |
| 913 | 1078 | $query = "SELECT count(*) as nb FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -936,7 +1101,9 @@ discard block |
||
| 936 | 1101 | } |
| 937 | 1102 | |
| 938 | 1103 | public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
| 939 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1104 | + if ($filter_name == '') { |
|
| 1105 | + $filter_name = $this->filter_name; |
|
| 1106 | + } |
|
| 940 | 1107 | $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"; |
| 941 | 1108 | $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
| 942 | 1109 | try { |
@@ -949,7 +1116,9 @@ discard block |
||
| 949 | 1116 | return $all; |
| 950 | 1117 | } |
| 951 | 1118 | public function getStats($type,$stats_airline = '', $filter_name = '') { |
| 952 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1119 | + if ($filter_name == '') { |
|
| 1120 | + $filter_name = $this->filter_name; |
|
| 1121 | + } |
|
| 953 | 1122 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
| 954 | 1123 | $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 955 | 1124 | try { |
@@ -962,7 +1131,9 @@ discard block |
||
| 962 | 1131 | return $all; |
| 963 | 1132 | } |
| 964 | 1133 | public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') { |
| 965 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1134 | + if ($filter_name == '') { |
|
| 1135 | + $filter_name = $this->filter_name; |
|
| 1136 | + } |
|
| 966 | 1137 | $query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 967 | 1138 | $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 968 | 1139 | try { |
@@ -973,7 +1144,9 @@ discard block |
||
| 973 | 1144 | } |
| 974 | 1145 | } |
| 975 | 1146 | public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
| 976 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1147 | + if ($filter_name == '') { |
|
| 1148 | + $filter_name = $this->filter_name; |
|
| 1149 | + } |
|
| 977 | 1150 | global $globalArchiveMonths, $globalDBdriver; |
| 978 | 1151 | if ($globalDBdriver == 'mysql') { |
| 979 | 1152 | if ($month == '') { |
@@ -1003,7 +1176,9 @@ discard block |
||
| 1003 | 1176 | } |
| 1004 | 1177 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
| 1005 | 1178 | global $globalArchiveMonths, $globalDBdriver; |
| 1006 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1179 | + if ($filter_name == '') { |
|
| 1180 | + $filter_name = $this->filter_name; |
|
| 1181 | + } |
|
| 1007 | 1182 | if ($globalDBdriver == 'mysql') { |
| 1008 | 1183 | $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"; |
| 1009 | 1184 | } else { |
@@ -1021,7 +1196,9 @@ discard block |
||
| 1021 | 1196 | } |
| 1022 | 1197 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
| 1023 | 1198 | global $globalArchiveMonths, $globalDBdriver; |
| 1024 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1199 | + if ($filter_name == '') { |
|
| 1200 | + $filter_name = $this->filter_name; |
|
| 1201 | + } |
|
| 1025 | 1202 | if ($globalDBdriver == 'mysql') { |
| 1026 | 1203 | $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 1027 | 1204 | } else { |
@@ -1038,7 +1215,9 @@ discard block |
||
| 1038 | 1215 | } |
| 1039 | 1216 | public function getStatsAirlineTotal($filter_name = '') { |
| 1040 | 1217 | global $globalArchiveMonths, $globalDBdriver; |
| 1041 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1218 | + if ($filter_name == '') { |
|
| 1219 | + $filter_name = $this->filter_name; |
|
| 1220 | + } |
|
| 1042 | 1221 | if ($globalDBdriver == 'mysql') { |
| 1043 | 1222 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
| 1044 | 1223 | } else { |
@@ -1055,7 +1234,9 @@ discard block |
||
| 1055 | 1234 | } |
| 1056 | 1235 | public function getStatsOwnerTotal($filter_name = '') { |
| 1057 | 1236 | global $globalArchiveMonths, $globalDBdriver; |
| 1058 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1237 | + if ($filter_name == '') { |
|
| 1238 | + $filter_name = $this->filter_name; |
|
| 1239 | + } |
|
| 1059 | 1240 | if ($globalDBdriver == 'mysql') { |
| 1060 | 1241 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
| 1061 | 1242 | } else { |
@@ -1072,7 +1253,9 @@ discard block |
||
| 1072 | 1253 | } |
| 1073 | 1254 | public function getStatsOwner($owner_name,$filter_name = '') { |
| 1074 | 1255 | global $globalArchiveMonths, $globalDBdriver; |
| 1075 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1256 | + if ($filter_name == '') { |
|
| 1257 | + $filter_name = $this->filter_name; |
|
| 1258 | + } |
|
| 1076 | 1259 | $query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name"; |
| 1077 | 1260 | try { |
| 1078 | 1261 | $sth = $this->db->prepare($query); |
@@ -1081,12 +1264,17 @@ discard block |
||
| 1081 | 1264 | echo "error : ".$e->getMessage(); |
| 1082 | 1265 | } |
| 1083 | 1266 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1084 | - if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
| 1085 | - else return 0; |
|
| 1267 | + if (isset($all[0]['cnt'])) { |
|
| 1268 | + return $all[0]['cnt']; |
|
| 1269 | + } else { |
|
| 1270 | + return 0; |
|
| 1271 | + } |
|
| 1086 | 1272 | } |
| 1087 | 1273 | public function getStatsPilotTotal($filter_name = '') { |
| 1088 | 1274 | global $globalArchiveMonths, $globalDBdriver; |
| 1089 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1275 | + if ($filter_name == '') { |
|
| 1276 | + $filter_name = $this->filter_name; |
|
| 1277 | + } |
|
| 1090 | 1278 | if ($globalDBdriver == 'mysql') { |
| 1091 | 1279 | $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
| 1092 | 1280 | } else { |
@@ -1103,7 +1291,9 @@ discard block |
||
| 1103 | 1291 | } |
| 1104 | 1292 | public function getStatsPilot($pilot,$filter_name = '') { |
| 1105 | 1293 | global $globalArchiveMonths, $globalDBdriver; |
| 1106 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1294 | + if ($filter_name == '') { |
|
| 1295 | + $filter_name = $this->filter_name; |
|
| 1296 | + } |
|
| 1107 | 1297 | $query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)"; |
| 1108 | 1298 | try { |
| 1109 | 1299 | $sth = $this->db->prepare($query); |
@@ -1112,13 +1302,18 @@ discard block |
||
| 1112 | 1302 | echo "error : ".$e->getMessage(); |
| 1113 | 1303 | } |
| 1114 | 1304 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1115 | - if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
| 1116 | - else return 0; |
|
| 1305 | + if (isset($all[0]['cnt'])) { |
|
| 1306 | + return $all[0]['cnt']; |
|
| 1307 | + } else { |
|
| 1308 | + return 0; |
|
| 1309 | + } |
|
| 1117 | 1310 | } |
| 1118 | 1311 | |
| 1119 | 1312 | public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 1120 | 1313 | global $globalDBdriver; |
| 1121 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1314 | + if ($filter_name == '') { |
|
| 1315 | + $filter_name = $this->filter_name; |
|
| 1316 | + } |
|
| 1122 | 1317 | if ($globalDBdriver == 'mysql') { |
| 1123 | 1318 | $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"; |
| 1124 | 1319 | } else { |
@@ -1134,7 +1329,9 @@ discard block |
||
| 1134 | 1329 | } |
| 1135 | 1330 | public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 1136 | 1331 | global $globalDBdriver; |
| 1137 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1332 | + if ($filter_name == '') { |
|
| 1333 | + $filter_name = $this->filter_name; |
|
| 1334 | + } |
|
| 1138 | 1335 | if ($globalDBdriver == 'mysql') { |
| 1139 | 1336 | $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"; |
| 1140 | 1337 | } else { |
@@ -1520,10 +1717,14 @@ discard block |
||
| 1520 | 1717 | $Connection = new Connection(); |
| 1521 | 1718 | date_default_timezone_set('UTC'); |
| 1522 | 1719 | $last_update = $this->getLastStatsUpdate('last_update_stats'); |
| 1523 | - if ($globalDebug) echo 'Update stats !'."\n"; |
|
| 1720 | + if ($globalDebug) { |
|
| 1721 | + echo 'Update stats !'."\n"; |
|
| 1722 | + } |
|
| 1524 | 1723 | if (isset($last_update[0]['value'])) { |
| 1525 | 1724 | $last_update_day = $last_update[0]['value']; |
| 1526 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
| 1725 | + } else { |
|
| 1726 | + $last_update_day = '2012-12-12 12:12:12'; |
|
| 1727 | + } |
|
| 1527 | 1728 | $reset = false; |
| 1528 | 1729 | //if ($globalStatsResetYear && date('Y',strtotime($last_update_day)) != date('Y')) { |
| 1529 | 1730 | if ($globalStatsResetYear) { |
@@ -1532,42 +1733,60 @@ discard block |
||
| 1532 | 1733 | } |
| 1533 | 1734 | $Spotter = new Spotter($this->db); |
| 1534 | 1735 | |
| 1535 | - if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
|
| 1736 | + if ($globalDebug) { |
|
| 1737 | + echo 'Count all aircraft types...'."\n"; |
|
| 1738 | + } |
|
| 1536 | 1739 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
| 1537 | 1740 | foreach ($alldata as $number) { |
| 1538 | 1741 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
| 1539 | 1742 | } |
| 1540 | - if ($globalDebug) echo 'Count all airlines...'."\n"; |
|
| 1743 | + if ($globalDebug) { |
|
| 1744 | + echo 'Count all airlines...'."\n"; |
|
| 1745 | + } |
|
| 1541 | 1746 | $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
| 1542 | 1747 | foreach ($alldata as $number) { |
| 1543 | 1748 | $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
| 1544 | 1749 | } |
| 1545 | - if ($globalDebug) echo 'Count all registrations...'."\n"; |
|
| 1750 | + if ($globalDebug) { |
|
| 1751 | + echo 'Count all registrations...'."\n"; |
|
| 1752 | + } |
|
| 1546 | 1753 | $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
| 1547 | 1754 | foreach ($alldata as $number) { |
| 1548 | 1755 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
| 1549 | 1756 | } |
| 1550 | - if ($globalDebug) echo 'Count all callsigns...'."\n"; |
|
| 1757 | + if ($globalDebug) { |
|
| 1758 | + echo 'Count all callsigns...'."\n"; |
|
| 1759 | + } |
|
| 1551 | 1760 | $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
| 1552 | 1761 | foreach ($alldata as $number) { |
| 1553 | 1762 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
| 1554 | 1763 | } |
| 1555 | - if ($globalDebug) echo 'Count all owners...'."\n"; |
|
| 1764 | + if ($globalDebug) { |
|
| 1765 | + echo 'Count all owners...'."\n"; |
|
| 1766 | + } |
|
| 1556 | 1767 | $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
| 1557 | 1768 | foreach ($alldata as $number) { |
| 1558 | 1769 | $this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
| 1559 | 1770 | } |
| 1560 | - if ($globalDebug) echo 'Count all pilots...'."\n"; |
|
| 1771 | + if ($globalDebug) { |
|
| 1772 | + echo 'Count all pilots...'."\n"; |
|
| 1773 | + } |
|
| 1561 | 1774 | $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
| 1562 | 1775 | foreach ($alldata as $number) { |
| 1563 | 1776 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
| 1564 | 1777 | } |
| 1565 | 1778 | |
| 1566 | - if ($globalDebug) echo 'Count all departure airports...'."\n"; |
|
| 1779 | + if ($globalDebug) { |
|
| 1780 | + echo 'Count all departure airports...'."\n"; |
|
| 1781 | + } |
|
| 1567 | 1782 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
| 1568 | - if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
|
| 1783 | + if ($globalDebug) { |
|
| 1784 | + echo 'Count all detected departure airports...'."\n"; |
|
| 1785 | + } |
|
| 1569 | 1786 | $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
| 1570 | - if ($globalDebug) echo 'Order departure airports...'."\n"; |
|
| 1787 | + if ($globalDebug) { |
|
| 1788 | + echo 'Order departure airports...'."\n"; |
|
| 1789 | + } |
|
| 1571 | 1790 | $alldata = array(); |
| 1572 | 1791 | |
| 1573 | 1792 | foreach ($pall as $value) { |
@@ -1578,7 +1797,9 @@ discard block |
||
| 1578 | 1797 | $icao = $value['airport_departure_icao']; |
| 1579 | 1798 | if (isset($alldata[$icao])) { |
| 1580 | 1799 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 1581 | - } else $alldata[$icao] = $value; |
|
| 1800 | + } else { |
|
| 1801 | + $alldata[$icao] = $value; |
|
| 1802 | + } |
|
| 1582 | 1803 | } |
| 1583 | 1804 | $count = array(); |
| 1584 | 1805 | foreach ($alldata as $key => $row) { |
@@ -1588,11 +1809,17 @@ discard block |
||
| 1588 | 1809 | foreach ($alldata as $number) { |
| 1589 | 1810 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset); |
| 1590 | 1811 | } |
| 1591 | - if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
|
| 1812 | + if ($globalDebug) { |
|
| 1813 | + echo 'Count all arrival airports...'."\n"; |
|
| 1814 | + } |
|
| 1592 | 1815 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
| 1593 | - if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
|
| 1816 | + if ($globalDebug) { |
|
| 1817 | + echo 'Count all detected arrival airports...'."\n"; |
|
| 1818 | + } |
|
| 1594 | 1819 | $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
| 1595 | - if ($globalDebug) echo 'Order arrival airports...'."\n"; |
|
| 1820 | + if ($globalDebug) { |
|
| 1821 | + echo 'Order arrival airports...'."\n"; |
|
| 1822 | + } |
|
| 1596 | 1823 | $alldata = array(); |
| 1597 | 1824 | foreach ($pall as $value) { |
| 1598 | 1825 | $icao = $value['airport_arrival_icao']; |
@@ -1602,7 +1829,9 @@ discard block |
||
| 1602 | 1829 | $icao = $value['airport_arrival_icao']; |
| 1603 | 1830 | if (isset($alldata[$icao])) { |
| 1604 | 1831 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 1605 | - } else $alldata[$icao] = $value; |
|
| 1832 | + } else { |
|
| 1833 | + $alldata[$icao] = $value; |
|
| 1834 | + } |
|
| 1606 | 1835 | } |
| 1607 | 1836 | $count = array(); |
| 1608 | 1837 | foreach ($alldata as $key => $row) { |
@@ -1613,7 +1842,9 @@ discard block |
||
| 1613 | 1842 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset); |
| 1614 | 1843 | } |
| 1615 | 1844 | if ($Connection->tableExists('countries')) { |
| 1616 | - if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
|
| 1845 | + if ($globalDebug) { |
|
| 1846 | + echo 'Count all flights by countries...'."\n"; |
|
| 1847 | + } |
|
| 1617 | 1848 | $SpotterArchive = new SpotterArchive(); |
| 1618 | 1849 | $alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
| 1619 | 1850 | foreach ($alldata as $number) { |
@@ -1621,7 +1852,9 @@ discard block |
||
| 1621 | 1852 | } |
| 1622 | 1853 | } |
| 1623 | 1854 | |
| 1624 | - if ($globalDebug) echo 'Count fatalities stats...'."\n"; |
|
| 1855 | + if ($globalDebug) { |
|
| 1856 | + echo 'Count fatalities stats...'."\n"; |
|
| 1857 | + } |
|
| 1625 | 1858 | $Accident = new Accident(); |
| 1626 | 1859 | $this->deleteStatsByType('fatalities_byyear'); |
| 1627 | 1860 | $alldata = $Accident->countFatalitiesByYear(); |
@@ -1638,46 +1871,66 @@ discard block |
||
| 1638 | 1871 | // Add by month using getstat if month finish... |
| 1639 | 1872 | |
| 1640 | 1873 | //if (date('m',strtotime($last_update_day)) != date('m')) { |
| 1641 | - if ($globalDebug) echo 'Count all flights by months...'."\n"; |
|
| 1874 | + if ($globalDebug) { |
|
| 1875 | + echo 'Count all flights by months...'."\n"; |
|
| 1876 | + } |
|
| 1642 | 1877 | $Spotter = new Spotter($this->db); |
| 1643 | 1878 | $alldata = $Spotter->countAllMonths(); |
| 1644 | 1879 | $lastyear = false; |
| 1645 | 1880 | foreach ($alldata as $number) { |
| 1646 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 1881 | + if ($number['year_name'] != date('Y')) { |
|
| 1882 | + $lastyear = true; |
|
| 1883 | + } |
|
| 1647 | 1884 | $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']))); |
| 1648 | 1885 | } |
| 1649 | - if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
|
| 1886 | + if ($globalDebug) { |
|
| 1887 | + echo 'Count all military flights by months...'."\n"; |
|
| 1888 | + } |
|
| 1650 | 1889 | $alldata = $Spotter->countAllMilitaryMonths(); |
| 1651 | 1890 | foreach ($alldata as $number) { |
| 1652 | 1891 | $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']))); |
| 1653 | 1892 | } |
| 1654 | - if ($globalDebug) echo 'Count all owners by months...'."\n"; |
|
| 1893 | + if ($globalDebug) { |
|
| 1894 | + echo 'Count all owners by months...'."\n"; |
|
| 1895 | + } |
|
| 1655 | 1896 | $alldata = $Spotter->countAllMonthsOwners(); |
| 1656 | 1897 | foreach ($alldata as $number) { |
| 1657 | 1898 | $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']))); |
| 1658 | 1899 | } |
| 1659 | - if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
|
| 1900 | + if ($globalDebug) { |
|
| 1901 | + echo 'Count all pilots by months...'."\n"; |
|
| 1902 | + } |
|
| 1660 | 1903 | $alldata = $Spotter->countAllMonthsPilots(); |
| 1661 | 1904 | foreach ($alldata as $number) { |
| 1662 | 1905 | $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']))); |
| 1663 | 1906 | } |
| 1664 | - if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
|
| 1907 | + if ($globalDebug) { |
|
| 1908 | + echo 'Count all airlines by months...'."\n"; |
|
| 1909 | + } |
|
| 1665 | 1910 | $alldata = $Spotter->countAllMonthsAirlines(); |
| 1666 | 1911 | foreach ($alldata as $number) { |
| 1667 | 1912 | $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']))); |
| 1668 | 1913 | } |
| 1669 | - if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
|
| 1914 | + if ($globalDebug) { |
|
| 1915 | + echo 'Count all aircrafts by months...'."\n"; |
|
| 1916 | + } |
|
| 1670 | 1917 | $alldata = $Spotter->countAllMonthsAircrafts(); |
| 1671 | 1918 | foreach ($alldata as $number) { |
| 1672 | 1919 | $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']))); |
| 1673 | 1920 | } |
| 1674 | - if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
|
| 1921 | + if ($globalDebug) { |
|
| 1922 | + echo 'Count all real arrivals by months...'."\n"; |
|
| 1923 | + } |
|
| 1675 | 1924 | $alldata = $Spotter->countAllMonthsRealArrivals(); |
| 1676 | 1925 | foreach ($alldata as $number) { |
| 1677 | 1926 | $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']))); |
| 1678 | 1927 | } |
| 1679 | - if ($globalDebug) echo 'Airports data...'."\n"; |
|
| 1680 | - if ($globalDebug) echo '...Departure'."\n"; |
|
| 1928 | + if ($globalDebug) { |
|
| 1929 | + echo 'Airports data...'."\n"; |
|
| 1930 | + } |
|
| 1931 | + if ($globalDebug) { |
|
| 1932 | + echo '...Departure'."\n"; |
|
| 1933 | + } |
|
| 1681 | 1934 | $this->deleteStatAirport('daily'); |
| 1682 | 1935 | // $pall = $Spotter->getLast7DaysAirportsDeparture(); |
| 1683 | 1936 | // $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
@@ -1798,44 +2051,62 @@ discard block |
||
| 1798 | 2051 | // Count by airlines |
| 1799 | 2052 | echo '--- Stats by airlines ---'."\n"; |
| 1800 | 2053 | if ($Connection->tableExists('countries')) { |
| 1801 | - if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n"; |
|
| 2054 | + if ($globalDebug) { |
|
| 2055 | + echo 'Count all flights by countries by airlines...'."\n"; |
|
| 2056 | + } |
|
| 1802 | 2057 | $SpotterArchive = new SpotterArchive(); |
| 1803 | 2058 | $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
| 1804 | 2059 | foreach ($alldata as $number) { |
| 1805 | 2060 | $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset); |
| 1806 | 2061 | } |
| 1807 | 2062 | } |
| 1808 | - if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
|
| 2063 | + if ($globalDebug) { |
|
| 2064 | + echo 'Count all aircraft types by airlines...'."\n"; |
|
| 2065 | + } |
|
| 1809 | 2066 | $Spotter = new Spotter($this->db); |
| 1810 | 2067 | $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
| 1811 | 2068 | foreach ($alldata as $number) { |
| 1812 | 2069 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
| 1813 | 2070 | } |
| 1814 | - if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
|
| 2071 | + if ($globalDebug) { |
|
| 2072 | + echo 'Count all aircraft registrations by airlines...'."\n"; |
|
| 2073 | + } |
|
| 1815 | 2074 | $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
| 1816 | 2075 | foreach ($alldata as $number) { |
| 1817 | 2076 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
| 1818 | 2077 | } |
| 1819 | - if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
|
| 2078 | + if ($globalDebug) { |
|
| 2079 | + echo 'Count all callsigns by airlines...'."\n"; |
|
| 2080 | + } |
|
| 1820 | 2081 | $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
| 1821 | 2082 | foreach ($alldata as $number) { |
| 1822 | 2083 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
| 1823 | 2084 | } |
| 1824 | - if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
|
| 2085 | + if ($globalDebug) { |
|
| 2086 | + echo 'Count all owners by airlines...'."\n"; |
|
| 2087 | + } |
|
| 1825 | 2088 | $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
| 1826 | 2089 | foreach ($alldata as $number) { |
| 1827 | 2090 | $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
| 1828 | 2091 | } |
| 1829 | - if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
|
| 2092 | + if ($globalDebug) { |
|
| 2093 | + echo 'Count all pilots by airlines...'."\n"; |
|
| 2094 | + } |
|
| 1830 | 2095 | $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
| 1831 | 2096 | foreach ($alldata as $number) { |
| 1832 | 2097 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
| 1833 | 2098 | } |
| 1834 | - if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
|
| 2099 | + if ($globalDebug) { |
|
| 2100 | + echo 'Count all departure airports by airlines...'."\n"; |
|
| 2101 | + } |
|
| 1835 | 2102 | $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
| 1836 | - if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
|
| 2103 | + if ($globalDebug) { |
|
| 2104 | + echo 'Count all detected departure airports by airlines...'."\n"; |
|
| 2105 | + } |
|
| 1837 | 2106 | $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
| 1838 | - if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
|
| 2107 | + if ($globalDebug) { |
|
| 2108 | + echo 'Order detected departure airports by airlines...'."\n"; |
|
| 2109 | + } |
|
| 1839 | 2110 | //$alldata = array(); |
| 1840 | 2111 | foreach ($dall as $value) { |
| 1841 | 2112 | $icao = $value['airport_departure_icao']; |
@@ -1856,11 +2127,17 @@ discard block |
||
| 1856 | 2127 | foreach ($alldata as $number) { |
| 1857 | 2128 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset); |
| 1858 | 2129 | } |
| 1859 | - if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
|
| 2130 | + if ($globalDebug) { |
|
| 2131 | + echo 'Count all arrival airports by airlines...'."\n"; |
|
| 2132 | + } |
|
| 1860 | 2133 | $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
| 1861 | - if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
|
| 2134 | + if ($globalDebug) { |
|
| 2135 | + echo 'Count all detected arrival airports by airlines...'."\n"; |
|
| 2136 | + } |
|
| 1862 | 2137 | $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
| 1863 | - if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
|
| 2138 | + if ($globalDebug) { |
|
| 2139 | + echo 'Order arrival airports by airlines...'."\n"; |
|
| 2140 | + } |
|
| 1864 | 2141 | //$alldata = array(); |
| 1865 | 2142 | foreach ($dall as $value) { |
| 1866 | 2143 | $icao = $value['airport_arrival_icao']; |
@@ -1879,37 +2156,53 @@ discard block |
||
| 1879 | 2156 | } |
| 1880 | 2157 | $alldata = $pall; |
| 1881 | 2158 | foreach ($alldata as $number) { |
| 1882 | - if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
| 2159 | + if ($number['airline_icao'] != '') { |
|
| 2160 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
| 2161 | + } |
|
| 2162 | + } |
|
| 2163 | + if ($globalDebug) { |
|
| 2164 | + echo 'Count all flights by months by airlines...'."\n"; |
|
| 1883 | 2165 | } |
| 1884 | - if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
|
| 1885 | 2166 | $Spotter = new Spotter($this->db); |
| 1886 | 2167 | $alldata = $Spotter->countAllMonthsByAirlines(); |
| 1887 | 2168 | $lastyear = false; |
| 1888 | 2169 | foreach ($alldata as $number) { |
| 1889 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 2170 | + if ($number['year_name'] != date('Y')) { |
|
| 2171 | + $lastyear = true; |
|
| 2172 | + } |
|
| 1890 | 2173 | $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']); |
| 1891 | 2174 | } |
| 1892 | - if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
|
| 2175 | + if ($globalDebug) { |
|
| 2176 | + echo 'Count all owners by months by airlines...'."\n"; |
|
| 2177 | + } |
|
| 1893 | 2178 | $alldata = $Spotter->countAllMonthsOwnersByAirlines(); |
| 1894 | 2179 | foreach ($alldata as $number) { |
| 1895 | 2180 | $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']); |
| 1896 | 2181 | } |
| 1897 | - if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
|
| 2182 | + if ($globalDebug) { |
|
| 2183 | + echo 'Count all pilots by months by airlines...'."\n"; |
|
| 2184 | + } |
|
| 1898 | 2185 | $alldata = $Spotter->countAllMonthsPilotsByAirlines(); |
| 1899 | 2186 | foreach ($alldata as $number) { |
| 1900 | 2187 | $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']); |
| 1901 | 2188 | } |
| 1902 | - if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
|
| 2189 | + if ($globalDebug) { |
|
| 2190 | + echo 'Count all aircrafts by months by airlines...'."\n"; |
|
| 2191 | + } |
|
| 1903 | 2192 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines(); |
| 1904 | 2193 | foreach ($alldata as $number) { |
| 1905 | 2194 | $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']); |
| 1906 | 2195 | } |
| 1907 | - if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
|
| 2196 | + if ($globalDebug) { |
|
| 2197 | + echo 'Count all real arrivals by months by airlines...'."\n"; |
|
| 2198 | + } |
|
| 1908 | 2199 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines(); |
| 1909 | 2200 | foreach ($alldata as $number) { |
| 1910 | 2201 | $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']); |
| 1911 | 2202 | } |
| 1912 | - if ($globalDebug) echo '...Departure'."\n"; |
|
| 2203 | + if ($globalDebug) { |
|
| 2204 | + echo '...Departure'."\n"; |
|
| 2205 | + } |
|
| 1913 | 2206 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
| 1914 | 2207 | $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
| 1915 | 2208 | foreach ($dall as $value) { |
@@ -1932,7 +2225,9 @@ discard block |
||
| 1932 | 2225 | foreach ($alldata as $number) { |
| 1933 | 2226 | $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']); |
| 1934 | 2227 | } |
| 1935 | - if ($globalDebug) echo '...Arrival'."\n"; |
|
| 2228 | + if ($globalDebug) { |
|
| 2229 | + echo '...Arrival'."\n"; |
|
| 2230 | + } |
|
| 1936 | 2231 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
| 1937 | 2232 | $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
| 1938 | 2233 | foreach ($dall as $value) { |
@@ -1956,13 +2251,19 @@ discard block |
||
| 1956 | 2251 | $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']); |
| 1957 | 2252 | } |
| 1958 | 2253 | |
| 1959 | - if ($globalDebug) echo 'Flights data...'."\n"; |
|
| 1960 | - if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
|
| 2254 | + if ($globalDebug) { |
|
| 2255 | + echo 'Flights data...'."\n"; |
|
| 2256 | + } |
|
| 2257 | + if ($globalDebug) { |
|
| 2258 | + echo '-> countAllDatesLastMonth...'."\n"; |
|
| 2259 | + } |
|
| 1961 | 2260 | $alldata = $Spotter->countAllDatesLastMonthByAirlines(); |
| 1962 | 2261 | foreach ($alldata as $number) { |
| 1963 | 2262 | $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
| 1964 | 2263 | } |
| 1965 | - if ($globalDebug) echo '-> countAllDates...'."\n"; |
|
| 2264 | + if ($globalDebug) { |
|
| 2265 | + echo '-> countAllDates...'."\n"; |
|
| 2266 | + } |
|
| 1966 | 2267 | //$previousdata = $this->countAllDatesByAirlines(); |
| 1967 | 2268 | $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines()); |
| 1968 | 2269 | $values = array(); |
@@ -1975,7 +2276,9 @@ discard block |
||
| 1975 | 2276 | $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
| 1976 | 2277 | } |
| 1977 | 2278 | |
| 1978 | - if ($globalDebug) echo '-> countAllHours...'."\n"; |
|
| 2279 | + if ($globalDebug) { |
|
| 2280 | + echo '-> countAllHours...'."\n"; |
|
| 2281 | + } |
|
| 1979 | 2282 | $alldata = $Spotter->countAllHoursByAirlines('hour'); |
| 1980 | 2283 | foreach ($alldata as $number) { |
| 1981 | 2284 | $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
@@ -1983,14 +2286,18 @@ discard block |
||
| 1983 | 2286 | |
| 1984 | 2287 | |
| 1985 | 2288 | // Stats by filters |
| 1986 | - if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array(); |
|
| 2289 | + if (!isset($globalStatsFilters) || $globalStatsFilters == '') { |
|
| 2290 | + $globalStatsFilters = array(); |
|
| 2291 | + } |
|
| 1987 | 2292 | foreach ($globalStatsFilters as $name => $filter) { |
| 1988 | 2293 | //$filter_name = $filter['name']; |
| 1989 | 2294 | $filter_name = $name; |
| 1990 | 2295 | $reset = false; |
| 1991 | 2296 | $last_update = $this->getLastStatsUpdate('last_update_stats_'.$filter_name); |
| 1992 | 2297 | if (isset($filter['resetall']) && isset($last_update[0]['value']) && strtotime($filter['resetall']) > strtotime($last_update[0]['value'])) { |
| 1993 | - if ($globalDebug) echo '!!! Delete stats for filter '.$filter_name.' !!!'."\n"; |
|
| 2298 | + if ($globalDebug) { |
|
| 2299 | + echo '!!! Delete stats for filter '.$filter_name.' !!!'."\n"; |
|
| 2300 | + } |
|
| 1994 | 2301 | $this->deleteOldStats($filter_name); |
| 1995 | 2302 | unset($last_update); |
| 1996 | 2303 | } |
@@ -2009,7 +2316,9 @@ discard block |
||
| 2009 | 2316 | |
| 2010 | 2317 | |
| 2011 | 2318 | // Count by filter |
| 2012 | - if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
| 2319 | + if ($globalDebug) { |
|
| 2320 | + echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
| 2321 | + } |
|
| 2013 | 2322 | $Spotter = new Spotter($this->db); |
| 2014 | 2323 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
| 2015 | 2324 | foreach ($alldata as $number) { |
@@ -2046,7 +2355,9 @@ discard block |
||
| 2046 | 2355 | $icao = $value['airport_departure_icao']; |
| 2047 | 2356 | if (isset($alldata[$icao])) { |
| 2048 | 2357 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 2049 | - } else $alldata[$icao] = $value; |
|
| 2358 | + } else { |
|
| 2359 | + $alldata[$icao] = $value; |
|
| 2360 | + } |
|
| 2050 | 2361 | } |
| 2051 | 2362 | $count = array(); |
| 2052 | 2363 | foreach ($alldata as $key => $row) { |
@@ -2067,7 +2378,9 @@ discard block |
||
| 2067 | 2378 | $icao = $value['airport_arrival_icao']; |
| 2068 | 2379 | if (isset($alldata[$icao])) { |
| 2069 | 2380 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 2070 | - } else $alldata[$icao] = $value; |
|
| 2381 | + } else { |
|
| 2382 | + $alldata[$icao] = $value; |
|
| 2383 | + } |
|
| 2071 | 2384 | } |
| 2072 | 2385 | $count = array(); |
| 2073 | 2386 | foreach ($alldata as $key => $row) { |
@@ -2081,7 +2394,9 @@ discard block |
||
| 2081 | 2394 | $alldata = $Spotter->countAllMonths($filter); |
| 2082 | 2395 | $lastyear = false; |
| 2083 | 2396 | foreach ($alldata as $number) { |
| 2084 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 2397 | + if ($number['year_name'] != date('Y')) { |
|
| 2398 | + $lastyear = true; |
|
| 2399 | + } |
|
| 2085 | 2400 | $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); |
| 2086 | 2401 | } |
| 2087 | 2402 | $alldata = $Spotter->countAllMonthsOwners($filter); |
@@ -72,7 +72,9 @@ discard block |
||
| 72 | 72 | if (isset($filter[0]['source'])) { |
| 73 | 73 | $filters = array_merge($filters,$filter); |
| 74 | 74 | } |
| 75 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 75 | + if (is_array($globalFilter)) { |
|
| 76 | + $filter = array_merge($filter,$globalFilter); |
|
| 77 | + } |
|
| 76 | 78 | $filter_query_join = ''; |
| 77 | 79 | $filter_query_where = ''; |
| 78 | 80 | foreach($filters as $flt) { |
@@ -156,8 +158,11 @@ discard block |
||
| 156 | 158 | $filter_query_where .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'"; |
| 157 | 159 | } |
| 158 | 160 | } |
| 159 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 160 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 161 | + if ($filter_query_where == '' && $where) { |
|
| 162 | + $filter_query_where = ' WHERE'; |
|
| 163 | + } elseif ($filter_query_where != '' && $and) { |
|
| 164 | + $filter_query_where .= ' AND'; |
|
| 165 | + } |
|
| 161 | 166 | if ($filter_query_where != '') { |
| 162 | 167 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 163 | 168 | } |
@@ -180,10 +185,18 @@ discard block |
||
| 180 | 185 | $Image = new Image($this->db); |
| 181 | 186 | $Schedule = new Schedule($this->db); |
| 182 | 187 | $ACARS = new ACARS($this->db); |
| 183 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 184 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 185 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 186 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 188 | + if (!isset($globalIVAO)) { |
|
| 189 | + $globalIVAO = FALSE; |
|
| 190 | + } |
|
| 191 | + if (!isset($globalVATSIM)) { |
|
| 192 | + $globalVATSIM = FALSE; |
|
| 193 | + } |
|
| 194 | + if (!isset($globalphpVMS)) { |
|
| 195 | + $globalphpVMS = FALSE; |
|
| 196 | + } |
|
| 197 | + if (!isset($globalVAM)) { |
|
| 198 | + $globalVAM = FALSE; |
|
| 199 | + } |
|
| 187 | 200 | date_default_timezone_set('UTC'); |
| 188 | 201 | |
| 189 | 202 | if (!is_string($query)) |
@@ -230,21 +243,35 @@ discard block |
||
| 230 | 243 | } else { |
| 231 | 244 | $temp_array['spotter_id'] = ''; |
| 232 | 245 | } |
| 233 | - if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 234 | - if (isset($row['modes'])) $temp_array['modes'] = $row['modes']; |
|
| 246 | + if (isset($row['flightaware_id'])) { |
|
| 247 | + $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 248 | + } |
|
| 249 | + if (isset($row['modes'])) { |
|
| 250 | + $temp_array['modes'] = $row['modes']; |
|
| 251 | + } |
|
| 235 | 252 | $temp_array['ident'] = $row['ident']; |
| 236 | 253 | if (isset($row['registration']) && $row['registration'] != '') { |
| 237 | 254 | $temp_array['registration'] = $row['registration']; |
| 238 | 255 | } elseif (isset($temp_array['modes'])) { |
| 239 | 256 | $temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']); |
| 240 | - } else $temp_array['registration'] = ''; |
|
| 241 | - if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 257 | + } else { |
|
| 258 | + $temp_array['registration'] = ''; |
|
| 259 | + } |
|
| 260 | + if (isset($row['aircraft_icao'])) { |
|
| 261 | + $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 262 | + } |
|
| 242 | 263 | |
| 243 | 264 | $temp_array['departure_airport'] = $row['departure_airport_icao']; |
| 244 | 265 | $temp_array['arrival_airport'] = $row['arrival_airport_icao']; |
| 245 | - if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 246 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
| 247 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
| 266 | + if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) { |
|
| 267 | + $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 268 | + } |
|
| 269 | + if (isset($row['latitude'])) { |
|
| 270 | + $temp_array['latitude'] = $row['latitude']; |
|
| 271 | + } |
|
| 272 | + if (isset($row['longitude'])) { |
|
| 273 | + $temp_array['longitude'] = $row['longitude']; |
|
| 274 | + } |
|
| 248 | 275 | /* |
| 249 | 276 | if (Connection->tableExists('countries')) { |
| 250 | 277 | $country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']); |
@@ -254,8 +281,12 @@ discard block |
||
| 254 | 281 | } |
| 255 | 282 | } |
| 256 | 283 | */ |
| 257 | - if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints']; |
|
| 258 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
| 284 | + if (isset($row['waypoints'])) { |
|
| 285 | + $temp_array['waypoints'] = $row['waypoints']; |
|
| 286 | + } |
|
| 287 | + if (isset($row['format_source'])) { |
|
| 288 | + $temp_array['format_source'] = $row['format_source']; |
|
| 289 | + } |
|
| 259 | 290 | if (isset($row['route_stop']) && $row['route_stop'] != '') { |
| 260 | 291 | $temp_array['route_stop'] = $row['route_stop']; |
| 261 | 292 | $allroute = explode(' ',$row['route_stop']); |
@@ -271,13 +302,19 @@ discard block |
||
| 271 | 302 | } |
| 272 | 303 | } |
| 273 | 304 | } |
| 274 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
| 305 | + if (isset($row['altitude'])) { |
|
| 306 | + $temp_array['altitude'] = $row['altitude']; |
|
| 307 | + } |
|
| 275 | 308 | if (isset($row['heading'])) { |
| 276 | 309 | $temp_array['heading'] = $row['heading']; |
| 277 | 310 | $heading_direction = $this->parseDirection($row['heading']); |
| 278 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 311 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
| 312 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 313 | + } |
|
| 314 | + } |
|
| 315 | + if (isset($row['ground_speed'])) { |
|
| 316 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 279 | 317 | } |
| 280 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 281 | 318 | $temp_array['image'] = ""; |
| 282 | 319 | $temp_array['image_thumbnail'] = ""; |
| 283 | 320 | $temp_array['image_source'] = ""; |
@@ -285,7 +322,9 @@ discard block |
||
| 285 | 322 | |
| 286 | 323 | if (isset($row['highlight'])) { |
| 287 | 324 | $temp_array['highlight'] = $row['highlight']; |
| 288 | - } else $temp_array['highlight'] = ''; |
|
| 325 | + } else { |
|
| 326 | + $temp_array['highlight'] = ''; |
|
| 327 | + } |
|
| 289 | 328 | |
| 290 | 329 | if (isset($row['date'])) { |
| 291 | 330 | $dateArray = $this->parseDateString($row['date']); |
@@ -341,7 +380,9 @@ discard block |
||
| 341 | 380 | |
| 342 | 381 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
| 343 | 382 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
| 344 | - } else $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 383 | + } else { |
|
| 384 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 385 | + } |
|
| 345 | 386 | } else { |
| 346 | 387 | $temp_array['aircraft_shadow'] = 'default.png'; |
| 347 | 388 | $temp_array['aircraft_name'] = 'N/A'; |
@@ -349,11 +390,17 @@ discard block |
||
| 349 | 390 | } |
| 350 | 391 | } |
| 351 | 392 | $fromsource = NULL; |
| 352 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 353 | - elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 354 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 355 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 356 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 393 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 394 | + $fromsource = $globalAirlinesSource; |
|
| 395 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 396 | + $fromsource = 'vatsim'; |
|
| 397 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 398 | + $fromsource = 'ivao'; |
|
| 399 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 400 | + $fromsource = 'vatsim'; |
|
| 401 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 402 | + $fromsource = 'ivao'; |
|
| 403 | + } |
|
| 357 | 404 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
| 358 | 405 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
| 359 | 406 | if (is_numeric(substr($row['ident'], 2, 1))) { |
@@ -376,12 +423,18 @@ discard block |
||
| 376 | 423 | } |
| 377 | 424 | } else { |
| 378 | 425 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 379 | - if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 380 | - else $temp_array['airline_iata'] = 'N/A'; |
|
| 426 | + if (isset($row['airline_iata'])) { |
|
| 427 | + $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 428 | + } else { |
|
| 429 | + $temp_array['airline_iata'] = 'N/A'; |
|
| 430 | + } |
|
| 381 | 431 | $temp_array['airline_name'] = $row['airline_name']; |
| 382 | 432 | $temp_array['airline_country'] = $row['airline_country']; |
| 383 | - if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 384 | - else $temp_array['airline_callsign'] = 'N/A'; |
|
| 433 | + if (isset($row['airline_callsign'])) { |
|
| 434 | + $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 435 | + } else { |
|
| 436 | + $temp_array['airline_callsign'] = 'N/A'; |
|
| 437 | + } |
|
| 385 | 438 | $temp_array['airline_type'] = $row['airline_type']; |
| 386 | 439 | if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') { |
| 387 | 440 | $airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']); |
@@ -408,7 +461,9 @@ discard block |
||
| 408 | 461 | } |
| 409 | 462 | if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) { |
| 410 | 463 | $owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']); |
| 411 | - if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 464 | + if ($owner_info['owner'] != '') { |
|
| 465 | + $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 466 | + } |
|
| 412 | 467 | $temp_array['aircraft_base'] = $owner_info['base']; |
| 413 | 468 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
| 414 | 469 | } |
@@ -416,9 +471,14 @@ discard block |
||
| 416 | 471 | if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
| 417 | 472 | { |
| 418 | 473 | if ($globalIVAO) { |
| 419 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 420 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 421 | - } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 474 | + if (isset($temp_array['airline_icao'])) { |
|
| 475 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 476 | + } else { |
|
| 477 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 478 | + } |
|
| 479 | + } else { |
|
| 480 | + $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 481 | + } |
|
| 422 | 482 | if (count($image_array) > 0) { |
| 423 | 483 | $temp_array['image'] = $image_array[0]['image']; |
| 424 | 484 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -470,7 +530,9 @@ discard block |
||
| 470 | 530 | //if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') { |
| 471 | 531 | if ($row['departure_airport_icao'] != '') { |
| 472 | 532 | $departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']); |
| 473 | - if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 533 | + if (!isset($departure_airport_array[0]['name'])) { |
|
| 534 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 535 | + } |
|
| 474 | 536 | /* |
| 475 | 537 | } elseif ($row['departure_airport_name'] != '') { |
| 476 | 538 | $temp_array['departure_airport_name'] = $row['departure_airport_name']; |
@@ -478,7 +540,9 @@ discard block |
||
| 478 | 540 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 479 | 541 | $temp_array['departure_airport_icao'] = $row['departure_airport_icao']; |
| 480 | 542 | */ |
| 481 | - } else $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 543 | + } else { |
|
| 544 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 545 | + } |
|
| 482 | 546 | if (isset($departure_airport_array[0]['name'])) { |
| 483 | 547 | $temp_array['departure_airport_name'] = $departure_airport_array[0]['name']; |
| 484 | 548 | $temp_array['departure_airport_city'] = $departure_airport_array[0]['city']; |
@@ -498,8 +562,12 @@ discard block |
||
| 498 | 562 | |
| 499 | 563 | if ($row['arrival_airport_icao'] != '') { |
| 500 | 564 | $arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']); |
| 501 | - if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 502 | - } else $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 565 | + if (count($arrival_airport_array) == 0) { |
|
| 566 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 567 | + } |
|
| 568 | + } else { |
|
| 569 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 570 | + } |
|
| 503 | 571 | if (isset($arrival_airport_array[0]['name'])) { |
| 504 | 572 | $temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name']; |
| 505 | 573 | $temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city']; |
@@ -515,27 +583,45 @@ discard block |
||
| 515 | 583 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
| 516 | 584 | } |
| 517 | 585 | */ |
| 518 | - if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 519 | - if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 520 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
| 521 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
| 522 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
| 586 | + if (isset($row['pilot_id']) && $row['pilot_id'] != '') { |
|
| 587 | + $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 588 | + } |
|
| 589 | + if (isset($row['pilot_name']) && $row['pilot_name'] != '') { |
|
| 590 | + $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 591 | + } |
|
| 592 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
| 593 | + $temp_array['source_name'] = $row['source_name']; |
|
| 594 | + } |
|
| 595 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
| 596 | + $temp_array['over_country'] = $row['over_country']; |
|
| 597 | + } |
|
| 598 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
| 599 | + $temp_array['distance'] = $row['distance']; |
|
| 600 | + } |
|
| 523 | 601 | if (isset($row['squawk'])) { |
| 524 | 602 | $temp_array['squawk'] = $row['squawk']; |
| 525 | 603 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
| 526 | 604 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
| 527 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 605 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 606 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 607 | + } |
|
| 528 | 608 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
| 529 | 609 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
| 530 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 531 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 610 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 611 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 612 | + } |
|
| 613 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) { |
|
| 614 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 615 | + } |
|
| 532 | 616 | } |
| 533 | 617 | |
| 534 | 618 | $temp_array['query_number_rows'] = $num_rows; |
| 535 | 619 | |
| 536 | 620 | $spotter_array[] = $temp_array; |
| 537 | 621 | } |
| 538 | - if ($num_rows == 0) return array(); |
|
| 622 | + if ($num_rows == 0) { |
|
| 623 | + return array(); |
|
| 624 | + } |
|
| 539 | 625 | $spotter_array[0]['query_number_rows'] = $num_rows; |
| 540 | 626 | return $spotter_array; |
| 541 | 627 | } |
@@ -568,7 +654,9 @@ discard block |
||
| 568 | 654 | foreach ($q_array as $q_item){ |
| 569 | 655 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
| 570 | 656 | $additional_query .= " AND ("; |
| 571 | - if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 657 | + if (is_int($q_item)) { |
|
| 658 | + $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 659 | + } |
|
| 572 | 660 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
| 573 | 661 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
| 574 | 662 | $additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
@@ -589,7 +677,9 @@ discard block |
||
| 589 | 677 | $additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR "; |
| 590 | 678 | $additional_query .= "(spotter_output.ident like '%".$q_item."%') OR "; |
| 591 | 679 | $translate = $Translation->ident2icao($q_item); |
| 592 | - if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 680 | + if ($translate != $q_item) { |
|
| 681 | + $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 682 | + } |
|
| 593 | 683 | $additional_query .= "(spotter_output.highlight like '%".$q_item."%')"; |
| 594 | 684 | $additional_query .= ")"; |
| 595 | 685 | } |
@@ -816,7 +906,9 @@ discard block |
||
| 816 | 906 | date_default_timezone_set($globalTimezone); |
| 817 | 907 | $datetime = new DateTime(); |
| 818 | 908 | $offset = $datetime->format('P'); |
| 819 | - } else $offset = '+00:00'; |
|
| 909 | + } else { |
|
| 910 | + $offset = '+00:00'; |
|
| 911 | + } |
|
| 820 | 912 | |
| 821 | 913 | if ($date_array[1] != "") |
| 822 | 914 | { |
@@ -848,8 +940,12 @@ discard block |
||
| 848 | 940 | { |
| 849 | 941 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 850 | 942 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 851 | - } else $limit_query = ""; |
|
| 852 | - } else $limit_query = ""; |
|
| 943 | + } else { |
|
| 944 | + $limit_query = ""; |
|
| 945 | + } |
|
| 946 | + } else { |
|
| 947 | + $limit_query = ""; |
|
| 948 | + } |
|
| 853 | 949 | |
| 854 | 950 | |
| 855 | 951 | if ($sort != "") |
@@ -917,8 +1013,12 @@ discard block |
||
| 917 | 1013 | { |
| 918 | 1014 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 919 | 1015 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 920 | - } else $limit_query = ""; |
|
| 921 | - } else $limit_query = ""; |
|
| 1016 | + } else { |
|
| 1017 | + $limit_query = ""; |
|
| 1018 | + } |
|
| 1019 | + } else { |
|
| 1020 | + $limit_query = ""; |
|
| 1021 | + } |
|
| 922 | 1022 | |
| 923 | 1023 | if ($sort != "") |
| 924 | 1024 | { |
@@ -1242,7 +1342,9 @@ discard block |
||
| 1242 | 1342 | global $global_query; |
| 1243 | 1343 | |
| 1244 | 1344 | date_default_timezone_set('UTC'); |
| 1245 | - if ($id == '') return array(); |
|
| 1345 | + if ($id == '') { |
|
| 1346 | + return array(); |
|
| 1347 | + } |
|
| 1246 | 1348 | $additional_query = "spotter_output.spotter_id = :id"; |
| 1247 | 1349 | $query_values = array(':id' => $id); |
| 1248 | 1350 | |
@@ -1357,8 +1459,11 @@ discard block |
||
| 1357 | 1459 | if ($sort != "") |
| 1358 | 1460 | { |
| 1359 | 1461 | $search_orderby_array = $this->getOrderBy(); |
| 1360 | - if (isset($search_orderby_array[$sort]['sql'])) $orderby_query = $search_orderby_array[$sort]['sql']; |
|
| 1361 | - else $orderby_query = " ORDER BY spotter_output.date DESC"; |
|
| 1462 | + if (isset($search_orderby_array[$sort]['sql'])) { |
|
| 1463 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
| 1464 | + } else { |
|
| 1465 | + $orderby_query = " ORDER BY spotter_output.date DESC"; |
|
| 1466 | + } |
|
| 1362 | 1467 | } else { |
| 1363 | 1468 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 1364 | 1469 | } |
@@ -1983,7 +2088,9 @@ discard block |
||
| 1983 | 2088 | { |
| 1984 | 2089 | $highlight = $row['highlight']; |
| 1985 | 2090 | } |
| 1986 | - if (isset($highlight)) return $highlight; |
|
| 2091 | + if (isset($highlight)) { |
|
| 2092 | + return $highlight; |
|
| 2093 | + } |
|
| 1987 | 2094 | } |
| 1988 | 2095 | |
| 1989 | 2096 | |
@@ -2011,7 +2118,9 @@ discard block |
||
| 2011 | 2118 | $sth->closeCursor(); |
| 2012 | 2119 | if (count($row) > 0) { |
| 2013 | 2120 | return $row['usage']; |
| 2014 | - } else return ''; |
|
| 2121 | + } else { |
|
| 2122 | + return ''; |
|
| 2123 | + } |
|
| 2015 | 2124 | } |
| 2016 | 2125 | |
| 2017 | 2126 | /** |
@@ -2036,7 +2145,9 @@ discard block |
||
| 2036 | 2145 | $sth->closeCursor(); |
| 2037 | 2146 | if (count($row) > 0) { |
| 2038 | 2147 | return $row['icao']; |
| 2039 | - } else return ''; |
|
| 2148 | + } else { |
|
| 2149 | + return ''; |
|
| 2150 | + } |
|
| 2040 | 2151 | } |
| 2041 | 2152 | |
| 2042 | 2153 | /** |
@@ -2064,7 +2175,9 @@ discard block |
||
| 2064 | 2175 | $airport_longitude = $row['longitude']; |
| 2065 | 2176 | $Common = new Common(); |
| 2066 | 2177 | return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
| 2067 | - } else return ''; |
|
| 2178 | + } else { |
|
| 2179 | + return ''; |
|
| 2180 | + } |
|
| 2068 | 2181 | } |
| 2069 | 2182 | |
| 2070 | 2183 | /** |
@@ -2176,7 +2289,9 @@ discard block |
||
| 2176 | 2289 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2177 | 2290 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2178 | 2291 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2179 | - } else return array(); |
|
| 2292 | + } else { |
|
| 2293 | + return array(); |
|
| 2294 | + } |
|
| 2180 | 2295 | if ($globalDBdriver == 'mysql') { |
| 2181 | 2296 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
| 2182 | 2297 | } else { |
@@ -2211,7 +2326,9 @@ discard block |
||
| 2211 | 2326 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2212 | 2327 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2213 | 2328 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2214 | - } else return array(); |
|
| 2329 | + } else { |
|
| 2330 | + return array(); |
|
| 2331 | + } |
|
| 2215 | 2332 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
| 2216 | 2333 | $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.")"; |
| 2217 | 2334 | //$query = "SELECT waypoints.* FROM waypoints"; |
@@ -2246,7 +2363,9 @@ discard block |
||
| 2246 | 2363 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
| 2247 | 2364 | { |
| 2248 | 2365 | global $globalUseRealAirlines; |
| 2249 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2366 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2367 | + $fromsource = NULL; |
|
| 2368 | + } |
|
| 2250 | 2369 | $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
| 2251 | 2370 | if ($airline_icao == 'NA') { |
| 2252 | 2371 | $airline_array = array(); |
@@ -2315,7 +2434,9 @@ discard block |
||
| 2315 | 2434 | public function getAllAirlineInfoByName($airline_name, $fromsource = NULL) |
| 2316 | 2435 | { |
| 2317 | 2436 | global $globalUseRealAirlines; |
| 2318 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2437 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2438 | + $fromsource = NULL; |
|
| 2439 | + } |
|
| 2319 | 2440 | $airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING)); |
| 2320 | 2441 | $query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1"; |
| 2321 | 2442 | $sth = $this->db->prepare($query); |
@@ -2331,7 +2452,9 @@ discard block |
||
| 2331 | 2452 | $sth->execute(array(':fromsource' => $fromsource)); |
| 2332 | 2453 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2333 | 2454 | $sth->closeCursor(); |
| 2334 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name); |
|
| 2455 | + if ($row['nb'] == 0) { |
|
| 2456 | + $result = $this->getAllAirlineInfoByName($airline_name); |
|
| 2457 | + } |
|
| 2335 | 2458 | } |
| 2336 | 2459 | return $result; |
| 2337 | 2460 | } |
@@ -2394,15 +2517,20 @@ discard block |
||
| 2394 | 2517 | 'A320-211' => 'A320', |
| 2395 | 2518 | '747-8i' => 'B748', |
| 2396 | 2519 | 'A380' => 'A388'); |
| 2397 | - if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
|
| 2520 | + if (isset($all_aircraft[$aircraft_type])) { |
|
| 2521 | + return $all_aircraft[$aircraft_type]; |
|
| 2522 | + } |
|
| 2398 | 2523 | |
| 2399 | 2524 | $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
| 2400 | 2525 | $aircraft_type = strtoupper($aircraft_type); |
| 2401 | 2526 | $sth = $this->db->prepare($query); |
| 2402 | 2527 | $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
| 2403 | 2528 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2404 | - if (isset($result[0]['icao'])) return $result[0]['icao']; |
|
| 2405 | - else return ''; |
|
| 2529 | + if (isset($result[0]['icao'])) { |
|
| 2530 | + return $result[0]['icao']; |
|
| 2531 | + } else { |
|
| 2532 | + return ''; |
|
| 2533 | + } |
|
| 2406 | 2534 | } |
| 2407 | 2535 | |
| 2408 | 2536 | /** |
@@ -2430,11 +2558,15 @@ discard block |
||
| 2430 | 2558 | $sth->closeCursor(); |
| 2431 | 2559 | if (isset($row['icaotypecode'])) { |
| 2432 | 2560 | $icao = $row['icaotypecode']; |
| 2433 | - if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao]; |
|
| 2561 | + if (isset($this->aircraft_correct_icaotype[$icao])) { |
|
| 2562 | + $icao = $this->aircraft_correct_icaotype[$icao]; |
|
| 2563 | + } |
|
| 2434 | 2564 | return $icao; |
| 2435 | 2565 | } elseif ($source_type == 'flarm') { |
| 2436 | 2566 | return $this->getAllAircraftType($aircraft_modes); |
| 2437 | - } else return ''; |
|
| 2567 | + } else { |
|
| 2568 | + return ''; |
|
| 2569 | + } |
|
| 2438 | 2570 | } |
| 2439 | 2571 | |
| 2440 | 2572 | /** |
@@ -2457,7 +2589,9 @@ discard block |
||
| 2457 | 2589 | $sth->closeCursor(); |
| 2458 | 2590 | if (isset($row['icaotypecode'])) { |
| 2459 | 2591 | return $row['icaotypecode']; |
| 2460 | - } else return ''; |
|
| 2592 | + } else { |
|
| 2593 | + return ''; |
|
| 2594 | + } |
|
| 2461 | 2595 | } |
| 2462 | 2596 | |
| 2463 | 2597 | /** |
@@ -2503,7 +2637,9 @@ discard block |
||
| 2503 | 2637 | $sth->closeCursor(); |
| 2504 | 2638 | if (isset($row['operator_correct'])) { |
| 2505 | 2639 | return $row['operator_correct']; |
| 2506 | - } else return $operator; |
|
| 2640 | + } else { |
|
| 2641 | + return $operator; |
|
| 2642 | + } |
|
| 2507 | 2643 | } |
| 2508 | 2644 | |
| 2509 | 2645 | /** |
@@ -2516,7 +2652,9 @@ discard block |
||
| 2516 | 2652 | public function getRouteInfo($callsign) |
| 2517 | 2653 | { |
| 2518 | 2654 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
| 2519 | - if ($callsign == '') return array(); |
|
| 2655 | + if ($callsign == '') { |
|
| 2656 | + return array(); |
|
| 2657 | + } |
|
| 2520 | 2658 | $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"; |
| 2521 | 2659 | |
| 2522 | 2660 | $sth = $this->db->prepare($query); |
@@ -2526,7 +2664,9 @@ discard block |
||
| 2526 | 2664 | $sth->closeCursor(); |
| 2527 | 2665 | if (count($row) > 0) { |
| 2528 | 2666 | return $row; |
| 2529 | - } else return array(); |
|
| 2667 | + } else { |
|
| 2668 | + return array(); |
|
| 2669 | + } |
|
| 2530 | 2670 | } |
| 2531 | 2671 | |
| 2532 | 2672 | /** |
@@ -2579,7 +2719,9 @@ discard block |
||
| 2579 | 2719 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 2580 | 2720 | $sth->closeCursor(); |
| 2581 | 2721 | return $result; |
| 2582 | - } else return array(); |
|
| 2722 | + } else { |
|
| 2723 | + return array(); |
|
| 2724 | + } |
|
| 2583 | 2725 | } |
| 2584 | 2726 | |
| 2585 | 2727 | |
@@ -2738,8 +2880,11 @@ discard block |
||
| 2738 | 2880 | $query .= " ORDER BY spotter_output.source_name ASC"; |
| 2739 | 2881 | |
| 2740 | 2882 | $sth = $this->db->prepare($query); |
| 2741 | - if (!empty($query_values)) $sth->execute($query_values); |
|
| 2742 | - else $sth->execute(); |
|
| 2883 | + if (!empty($query_values)) { |
|
| 2884 | + $sth->execute($query_values); |
|
| 2885 | + } else { |
|
| 2886 | + $sth->execute(); |
|
| 2887 | + } |
|
| 2743 | 2888 | |
| 2744 | 2889 | $source_array = array(); |
| 2745 | 2890 | $temp_array = array(); |
@@ -2772,9 +2917,13 @@ discard block |
||
| 2772 | 2917 | WHERE spotter_output.airline_icao <> '' |
| 2773 | 2918 | ORDER BY spotter_output.airline_name ASC"; |
| 2774 | 2919 | */ |
| 2775 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2776 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2777 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2920 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2921 | + $forsource = $globalAirlinesSource; |
|
| 2922 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2923 | + $forsource = 'vatsim'; |
|
| 2924 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2925 | + $forsource = 'ivao'; |
|
| 2926 | + } |
|
| 2778 | 2927 | if ($forsource === NULL) { |
| 2779 | 2928 | $query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC"; |
| 2780 | 2929 | $query_data = array(); |
@@ -2817,9 +2966,13 @@ discard block |
||
| 2817 | 2966 | { |
| 2818 | 2967 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
| 2819 | 2968 | $filter_query = $this->getFilter($filters,true,true); |
| 2820 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2821 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2822 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2969 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2970 | + $forsource = $globalAirlinesSource; |
|
| 2971 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2972 | + $forsource = 'vatsim'; |
|
| 2973 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2974 | + $forsource = 'ivao'; |
|
| 2975 | + } |
|
| 2823 | 2976 | if ($forsource === NULL) { |
| 2824 | 2977 | $query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC"; |
| 2825 | 2978 | $query_data = array(); |
@@ -3130,7 +3283,9 @@ discard block |
||
| 3130 | 3283 | date_default_timezone_set($globalTimezone); |
| 3131 | 3284 | $datetime = new DateTime(); |
| 3132 | 3285 | $offset = $datetime->format('P'); |
| 3133 | - } else $offset = '+00:00'; |
|
| 3286 | + } else { |
|
| 3287 | + $offset = '+00:00'; |
|
| 3288 | + } |
|
| 3134 | 3289 | if ($airport_icao == '') { |
| 3135 | 3290 | if ($globalDBdriver == 'mysql') { |
| 3136 | 3291 | $query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -3162,7 +3317,9 @@ discard block |
||
| 3162 | 3317 | date_default_timezone_set($globalTimezone); |
| 3163 | 3318 | $datetime = new DateTime(); |
| 3164 | 3319 | $offset = $datetime->format('P'); |
| 3165 | - } else $offset = '+00:00'; |
|
| 3320 | + } else { |
|
| 3321 | + $offset = '+00:00'; |
|
| 3322 | + } |
|
| 3166 | 3323 | if ($airport_icao == '') { |
| 3167 | 3324 | if ($globalDBdriver == 'mysql') { |
| 3168 | 3325 | $query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -3195,7 +3352,9 @@ discard block |
||
| 3195 | 3352 | date_default_timezone_set($globalTimezone); |
| 3196 | 3353 | $datetime = new DateTime(); |
| 3197 | 3354 | $offset = $datetime->format('P'); |
| 3198 | - } else $offset = '+00:00'; |
|
| 3355 | + } else { |
|
| 3356 | + $offset = '+00:00'; |
|
| 3357 | + } |
|
| 3199 | 3358 | if ($airport_icao == '') { |
| 3200 | 3359 | if ($globalDBdriver == 'mysql') { |
| 3201 | 3360 | $query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3234,7 +3393,9 @@ discard block |
||
| 3234 | 3393 | date_default_timezone_set($globalTimezone); |
| 3235 | 3394 | $datetime = new DateTime(); |
| 3236 | 3395 | $offset = $datetime->format('P'); |
| 3237 | - } else $offset = '+00:00'; |
|
| 3396 | + } else { |
|
| 3397 | + $offset = '+00:00'; |
|
| 3398 | + } |
|
| 3238 | 3399 | if ($airport_icao == '') { |
| 3239 | 3400 | if ($globalDBdriver == 'mysql') { |
| 3240 | 3401 | $query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3279,7 +3440,9 @@ discard block |
||
| 3279 | 3440 | date_default_timezone_set($globalTimezone); |
| 3280 | 3441 | $datetime = new DateTime(); |
| 3281 | 3442 | $offset = $datetime->format('P'); |
| 3282 | - } else $offset = '+00:00'; |
|
| 3443 | + } else { |
|
| 3444 | + $offset = '+00:00'; |
|
| 3445 | + } |
|
| 3283 | 3446 | if ($airport_icao == '') { |
| 3284 | 3447 | if ($globalDBdriver == 'mysql') { |
| 3285 | 3448 | $query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -3314,7 +3477,9 @@ discard block |
||
| 3314 | 3477 | date_default_timezone_set($globalTimezone); |
| 3315 | 3478 | $datetime = new DateTime(); |
| 3316 | 3479 | $offset = $datetime->format('P'); |
| 3317 | - } else $offset = '+00:00'; |
|
| 3480 | + } else { |
|
| 3481 | + $offset = '+00:00'; |
|
| 3482 | + } |
|
| 3318 | 3483 | if ($airport_icao == '') { |
| 3319 | 3484 | if ($globalDBdriver == 'mysql') { |
| 3320 | 3485 | $query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3356,7 +3521,9 @@ discard block |
||
| 3356 | 3521 | date_default_timezone_set($globalTimezone); |
| 3357 | 3522 | $datetime = new DateTime(); |
| 3358 | 3523 | $offset = $datetime->format('P'); |
| 3359 | - } else $offset = '+00:00'; |
|
| 3524 | + } else { |
|
| 3525 | + $offset = '+00:00'; |
|
| 3526 | + } |
|
| 3360 | 3527 | if ($airport_icao == '') { |
| 3361 | 3528 | if ($globalDBdriver == 'mysql') { |
| 3362 | 3529 | $query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -3390,7 +3557,9 @@ discard block |
||
| 3390 | 3557 | date_default_timezone_set($globalTimezone); |
| 3391 | 3558 | $datetime = new DateTime(); |
| 3392 | 3559 | $offset = $datetime->format('P'); |
| 3393 | - } else $offset = '+00:00'; |
|
| 3560 | + } else { |
|
| 3561 | + $offset = '+00:00'; |
|
| 3562 | + } |
|
| 3394 | 3563 | if ($airport_icao == '') { |
| 3395 | 3564 | if ($globalDBdriver == 'mysql') { |
| 3396 | 3565 | $query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3438,7 +3607,9 @@ discard block |
||
| 3438 | 3607 | date_default_timezone_set($globalTimezone); |
| 3439 | 3608 | $datetime = new DateTime(); |
| 3440 | 3609 | $offset = $datetime->format('P'); |
| 3441 | - } else $offset = '+00:00'; |
|
| 3610 | + } else { |
|
| 3611 | + $offset = '+00:00'; |
|
| 3612 | + } |
|
| 3442 | 3613 | |
| 3443 | 3614 | if ($globalDBdriver == 'mysql') { |
| 3444 | 3615 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
@@ -3558,7 +3729,9 @@ discard block |
||
| 3558 | 3729 | */ |
| 3559 | 3730 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
| 3560 | 3731 | { |
| 3561 | - if ($groundspeed == '') $groundspeed = NULL; |
|
| 3732 | + if ($groundspeed == '') { |
|
| 3733 | + $groundspeed = NULL; |
|
| 3734 | + } |
|
| 3562 | 3735 | $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'; |
| 3563 | 3736 | $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); |
| 3564 | 3737 | |
@@ -3608,10 +3781,18 @@ discard block |
||
| 3608 | 3781 | $Image = new Image($this->db); |
| 3609 | 3782 | $Common = new Common(); |
| 3610 | 3783 | |
| 3611 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 3612 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 3613 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 3614 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 3784 | + if (!isset($globalIVAO)) { |
|
| 3785 | + $globalIVAO = FALSE; |
|
| 3786 | + } |
|
| 3787 | + if (!isset($globalVATSIM)) { |
|
| 3788 | + $globalVATSIM = FALSE; |
|
| 3789 | + } |
|
| 3790 | + if (!isset($globalphpVMS)) { |
|
| 3791 | + $globalphpVMS = FALSE; |
|
| 3792 | + } |
|
| 3793 | + if (!isset($globalVAM)) { |
|
| 3794 | + $globalVAM = FALSE; |
|
| 3795 | + } |
|
| 3615 | 3796 | date_default_timezone_set('UTC'); |
| 3616 | 3797 | |
| 3617 | 3798 | //getting the registration |
@@ -3624,23 +3805,33 @@ discard block |
||
| 3624 | 3805 | if ($ModeS != '') { |
| 3625 | 3806 | $timeelapsed = microtime(true); |
| 3626 | 3807 | $registration = $this->getAircraftRegistrationBymodeS($ModeS,$source_type); |
| 3627 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3808 | + if ($globalDebugTimeElapsed) { |
|
| 3809 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3810 | + } |
|
| 3628 | 3811 | } else { |
| 3629 | 3812 | $myhex = explode('-',$flightaware_id); |
| 3630 | 3813 | if (count($myhex) > 0) { |
| 3631 | 3814 | $timeelapsed = microtime(true); |
| 3632 | 3815 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0],$source_type); |
| 3633 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3816 | + if ($globalDebugTimeElapsed) { |
|
| 3817 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3818 | + } |
|
| 3634 | 3819 | } |
| 3635 | 3820 | } |
| 3636 | 3821 | } |
| 3637 | 3822 | } |
| 3638 | 3823 | $fromsource = NULL; |
| 3639 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 3640 | - elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 3641 | - elseif ($format_source == 'whazzup') $fromsource = 'ivao'; |
|
| 3642 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 3643 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 3824 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 3825 | + $fromsource = $globalAirlinesSource; |
|
| 3826 | + } elseif ($format_source == 'vatsimtxt') { |
|
| 3827 | + $fromsource = 'vatsim'; |
|
| 3828 | + } elseif ($format_source == 'whazzup') { |
|
| 3829 | + $fromsource = 'ivao'; |
|
| 3830 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 3831 | + $fromsource = 'vatsim'; |
|
| 3832 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 3833 | + $fromsource = 'ivao'; |
|
| 3834 | + } |
|
| 3644 | 3835 | //getting the airline information |
| 3645 | 3836 | if ($ident != "") |
| 3646 | 3837 | { |
@@ -3664,15 +3855,21 @@ discard block |
||
| 3664 | 3855 | if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
| 3665 | 3856 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3666 | 3857 | } |
| 3667 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3858 | + if ($globalDebugTimeElapsed) { |
|
| 3859 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3860 | + } |
|
| 3668 | 3861 | |
| 3669 | 3862 | } else { |
| 3670 | 3863 | $timeelapsed = microtime(true); |
| 3671 | 3864 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3672 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3865 | + if ($globalDebugTimeElapsed) { |
|
| 3866 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3867 | + } |
|
| 3673 | 3868 | } |
| 3674 | 3869 | } |
| 3675 | - } else $airline_array = array(); |
|
| 3870 | + } else { |
|
| 3871 | + $airline_array = array(); |
|
| 3872 | + } |
|
| 3676 | 3873 | |
| 3677 | 3874 | //getting the aircraft information |
| 3678 | 3875 | $aircraft_array = array(); |
@@ -3686,27 +3883,37 @@ discard block |
||
| 3686 | 3883 | { |
| 3687 | 3884 | $timeelapsed = microtime(true); |
| 3688 | 3885 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3689 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3886 | + if ($globalDebugTimeElapsed) { |
|
| 3887 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3888 | + } |
|
| 3690 | 3889 | } else { |
| 3691 | 3890 | $timeelapsed = microtime(true); |
| 3692 | 3891 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3693 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3892 | + if ($globalDebugTimeElapsed) { |
|
| 3893 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3894 | + } |
|
| 3694 | 3895 | } |
| 3695 | 3896 | } |
| 3696 | 3897 | } else { |
| 3697 | 3898 | if ($ModeS != '') { |
| 3698 | 3899 | $timeelapsed = microtime(true); |
| 3699 | 3900 | $aircraft_icao = $this->getAllAircraftType($ModeS,$source_type); |
| 3700 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3901 | + if ($globalDebugTimeElapsed) { |
|
| 3902 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3903 | + } |
|
| 3701 | 3904 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
| 3702 | 3905 | { |
| 3703 | 3906 | $timeelapsed = microtime(true); |
| 3704 | 3907 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3705 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3908 | + if ($globalDebugTimeElapsed) { |
|
| 3909 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3910 | + } |
|
| 3706 | 3911 | } else { |
| 3707 | 3912 | $timeelapsed = microtime(true); |
| 3708 | 3913 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3709 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3914 | + if ($globalDebugTimeElapsed) { |
|
| 3915 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3916 | + } |
|
| 3710 | 3917 | } |
| 3711 | 3918 | } |
| 3712 | 3919 | } |
@@ -3722,7 +3929,9 @@ discard block |
||
| 3722 | 3929 | } else { |
| 3723 | 3930 | $timeelapsed = microtime(true); |
| 3724 | 3931 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
| 3725 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3932 | + if ($globalDebugTimeElapsed) { |
|
| 3933 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3934 | + } |
|
| 3726 | 3935 | } |
| 3727 | 3936 | } |
| 3728 | 3937 | |
@@ -3737,7 +3946,9 @@ discard block |
||
| 3737 | 3946 | } else { |
| 3738 | 3947 | $timeelapsed = microtime(true); |
| 3739 | 3948 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
| 3740 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3949 | + if ($globalDebugTimeElapsed) { |
|
| 3950 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3951 | + } |
|
| 3741 | 3952 | } |
| 3742 | 3953 | } |
| 3743 | 3954 | |
@@ -3771,7 +3982,9 @@ discard block |
||
| 3771 | 3982 | { |
| 3772 | 3983 | return false; |
| 3773 | 3984 | } |
| 3774 | - } else $altitude = 0; |
|
| 3985 | + } else { |
|
| 3986 | + $altitude = 0; |
|
| 3987 | + } |
|
| 3775 | 3988 | |
| 3776 | 3989 | if ($heading != "") |
| 3777 | 3990 | { |
@@ -3800,7 +4013,9 @@ discard block |
||
| 3800 | 4013 | { |
| 3801 | 4014 | $timeelapsed = microtime(true); |
| 3802 | 4015 | $image_array = $Image->getSpotterImage($registration); |
| 3803 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4016 | + if ($globalDebugTimeElapsed) { |
|
| 4017 | + echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4018 | + } |
|
| 3804 | 4019 | if (!isset($image_array[0]['registration'])) |
| 3805 | 4020 | { |
| 3806 | 4021 | //echo "Add image !!!! \n"; |
@@ -3808,14 +4023,21 @@ discard block |
||
| 3808 | 4023 | } |
| 3809 | 4024 | $timeelapsed = microtime(true); |
| 3810 | 4025 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
| 3811 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3812 | - if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 4026 | + if ($globalDebugTimeElapsed) { |
|
| 4027 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4028 | + } |
|
| 4029 | + if ($owner_info['owner'] != '') { |
|
| 4030 | + $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 4031 | + } |
|
| 3813 | 4032 | } |
| 3814 | 4033 | |
| 3815 | 4034 | if ($globalIVAO && $aircraft_icao != '') |
| 3816 | 4035 | { |
| 3817 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3818 | - else $airline_icao = ''; |
|
| 4036 | + if (isset($airline_array[0]['icao'])) { |
|
| 4037 | + $airline_icao = $airline_array[0]['icao']; |
|
| 4038 | + } else { |
|
| 4039 | + $airline_icao = ''; |
|
| 4040 | + } |
|
| 3819 | 4041 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
| 3820 | 4042 | if (!isset($image_array[0]['registration'])) |
| 3821 | 4043 | { |
@@ -3860,16 +4082,28 @@ discard block |
||
| 3860 | 4082 | { |
| 3861 | 4083 | $arrival_airport_array = $this->getAllAirportInfo('NA'); |
| 3862 | 4084 | } |
| 3863 | - if ($registration == '') $registration = 'NA'; |
|
| 4085 | + if ($registration == '') { |
|
| 4086 | + $registration = 'NA'; |
|
| 4087 | + } |
|
| 3864 | 4088 | if ($latitude == '' && $longitude == '') { |
| 3865 | 4089 | $latitude = 0; |
| 3866 | 4090 | $longitude = 0; |
| 3867 | 4091 | } |
| 3868 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3869 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3870 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3871 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3872 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 4092 | + if ($squawk == '' || $Common->isInteger($squawk) === false) { |
|
| 4093 | + $squawk = NULL; |
|
| 4094 | + } |
|
| 4095 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) { |
|
| 4096 | + $verticalrate = NULL; |
|
| 4097 | + } |
|
| 4098 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
| 4099 | + $heading = 0; |
|
| 4100 | + } |
|
| 4101 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
| 4102 | + $groundspeed = 0; |
|
| 4103 | + } |
|
| 4104 | + if (!isset($aircraft_owner)) { |
|
| 4105 | + $aircraft_owner = NULL; |
|
| 4106 | + } |
|
| 3873 | 4107 | $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) |
| 3874 | 4108 | 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)"; |
| 3875 | 4109 | |
@@ -3880,9 +4114,13 @@ discard block |
||
| 3880 | 4114 | if ($airline_type == '') { |
| 3881 | 4115 | $timeelapsed = microtime(true); |
| 3882 | 4116 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3883 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4117 | + if ($globalDebugTimeElapsed) { |
|
| 4118 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4119 | + } |
|
| 4120 | + } |
|
| 4121 | + if ($airline_type == null) { |
|
| 4122 | + $airline_type = ''; |
|
| 3884 | 4123 | } |
| 3885 | - if ($airline_type == null) $airline_type = ''; |
|
| 3886 | 4124 | $aircraft_type = $aircraft_array[0]['type']; |
| 3887 | 4125 | $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
| 3888 | 4126 | $departure_airport_name = $departure_airport_array[0]['name']; |
@@ -4046,7 +4284,9 @@ discard block |
||
| 4046 | 4284 | } |
| 4047 | 4285 | } |
| 4048 | 4286 | $query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC"; |
| 4049 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4287 | + if ($limit) { |
|
| 4288 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4289 | + } |
|
| 4050 | 4290 | |
| 4051 | 4291 | $sth = $this->db->prepare($query); |
| 4052 | 4292 | $sth->execute($query_values); |
@@ -4119,7 +4359,9 @@ discard block |
||
| 4119 | 4359 | } |
| 4120 | 4360 | |
| 4121 | 4361 | $query .= " GROUP BY spotter_output.pilot_id,s.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 4122 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4362 | + if ($limit) { |
|
| 4363 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4364 | + } |
|
| 4123 | 4365 | |
| 4124 | 4366 | |
| 4125 | 4367 | $sth = $this->db->prepare($query); |
@@ -4163,7 +4405,9 @@ discard block |
||
| 4163 | 4405 | } |
| 4164 | 4406 | } |
| 4165 | 4407 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 4166 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4408 | + if ($limit) { |
|
| 4409 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4410 | + } |
|
| 4167 | 4411 | |
| 4168 | 4412 | |
| 4169 | 4413 | $sth = $this->db->prepare($query); |
@@ -4239,7 +4483,9 @@ discard block |
||
| 4239 | 4483 | } |
| 4240 | 4484 | } |
| 4241 | 4485 | $query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC"; |
| 4242 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4486 | + if ($limit) { |
|
| 4487 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4488 | + } |
|
| 4243 | 4489 | |
| 4244 | 4490 | $sth = $this->db->prepare($query); |
| 4245 | 4491 | $sth->execute($query_values); |
@@ -4281,7 +4527,9 @@ discard block |
||
| 4281 | 4527 | } |
| 4282 | 4528 | } |
| 4283 | 4529 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC"; |
| 4284 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4530 | + if ($limit) { |
|
| 4531 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4532 | + } |
|
| 4285 | 4533 | |
| 4286 | 4534 | |
| 4287 | 4535 | $sth = $this->db->prepare($query); |
@@ -4524,7 +4772,9 @@ discard block |
||
| 4524 | 4772 | date_default_timezone_set($globalTimezone); |
| 4525 | 4773 | $datetime = new DateTime($date); |
| 4526 | 4774 | $offset = $datetime->format('P'); |
| 4527 | - } else $offset = '+00:00'; |
|
| 4775 | + } else { |
|
| 4776 | + $offset = '+00:00'; |
|
| 4777 | + } |
|
| 4528 | 4778 | |
| 4529 | 4779 | if ($globalDBdriver == 'mysql') { |
| 4530 | 4780 | $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
@@ -4572,7 +4822,9 @@ discard block |
||
| 4572 | 4822 | date_default_timezone_set($globalTimezone); |
| 4573 | 4823 | $datetime = new DateTime($date); |
| 4574 | 4824 | $offset = $datetime->format('P'); |
| 4575 | - } else $offset = '+00:00'; |
|
| 4825 | + } else { |
|
| 4826 | + $offset = '+00:00'; |
|
| 4827 | + } |
|
| 4576 | 4828 | |
| 4577 | 4829 | if ($globalDBdriver == 'mysql') { |
| 4578 | 4830 | $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
@@ -4692,9 +4944,13 @@ discard block |
||
| 4692 | 4944 | $sth = $this->db->prepare($query); |
| 4693 | 4945 | $sth->execute($query_values); |
| 4694 | 4946 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 4695 | - if (is_numeric($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
| 4696 | - elseif ($result[0]['duration'] == '') return 0; |
|
| 4697 | - else return $result[0]['duration']; |
|
| 4947 | + if (is_numeric($result[0]['duration'])) { |
|
| 4948 | + return gmdate('H:i:s',$result[0]['duration']); |
|
| 4949 | + } elseif ($result[0]['duration'] == '') { |
|
| 4950 | + return 0; |
|
| 4951 | + } else { |
|
| 4952 | + return $result[0]['duration']; |
|
| 4953 | + } |
|
| 4698 | 4954 | } |
| 4699 | 4955 | |
| 4700 | 4956 | /** |
@@ -4783,8 +5039,11 @@ discard block |
||
| 4783 | 5039 | $sth = $this->db->prepare($query); |
| 4784 | 5040 | $sth->execute($query_values); |
| 4785 | 5041 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 4786 | - if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
| 4787 | - else return $result[0]['duration']; |
|
| 5042 | + if (is_int($result[0]['duration'])) { |
|
| 5043 | + return gmdate('H:i:s',$result[0]['duration']); |
|
| 5044 | + } else { |
|
| 5045 | + return $result[0]['duration']; |
|
| 5046 | + } |
|
| 4788 | 5047 | } |
| 4789 | 5048 | |
| 4790 | 5049 | /** |
@@ -4989,7 +5248,9 @@ discard block |
||
| 4989 | 5248 | } |
| 4990 | 5249 | $query .= " GROUP BY spotter_output.airline_country, countries.iso3 |
| 4991 | 5250 | ORDER BY airline_country_count DESC"; |
| 4992 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5251 | + if ($limit) { |
|
| 5252 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5253 | + } |
|
| 4993 | 5254 | |
| 4994 | 5255 | $sth = $this->db->prepare($query); |
| 4995 | 5256 | $sth->execute($query_values); |
@@ -5018,7 +5279,9 @@ discard block |
||
| 5018 | 5279 | global $globalDBdriver; |
| 5019 | 5280 | //$filter_query = $this->getFilter($filters,true,true); |
| 5020 | 5281 | $Connection= new Connection($this->db); |
| 5021 | - if (!$Connection->tableExists('countries')) return array(); |
|
| 5282 | + if (!$Connection->tableExists('countries')) { |
|
| 5283 | + return array(); |
|
| 5284 | + } |
|
| 5022 | 5285 | /* |
| 5023 | 5286 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
| 5024 | 5287 | FROM countries c, spotter_output s |
@@ -5050,7 +5313,9 @@ discard block |
||
| 5050 | 5313 | } |
| 5051 | 5314 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT flightaware_id,over_country FROM spotter_live".$filter_query.") l ON c.iso2 = l.over_country "; |
| 5052 | 5315 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
| 5053 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5316 | + if ($limit) { |
|
| 5317 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5318 | + } |
|
| 5054 | 5319 | |
| 5055 | 5320 | |
| 5056 | 5321 | $sth = $this->db->prepare($query); |
@@ -5127,7 +5392,9 @@ discard block |
||
| 5127 | 5392 | } |
| 5128 | 5393 | |
| 5129 | 5394 | $query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 5130 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5395 | + if ($limit) { |
|
| 5396 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5397 | + } |
|
| 5131 | 5398 | |
| 5132 | 5399 | $sth = $this->db->prepare($query); |
| 5133 | 5400 | $sth->execute($query_values); |
@@ -5201,7 +5468,9 @@ discard block |
||
| 5201 | 5468 | } |
| 5202 | 5469 | |
| 5203 | 5470 | $query .= " GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 5204 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5471 | + if ($limit) { |
|
| 5472 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5473 | + } |
|
| 5205 | 5474 | |
| 5206 | 5475 | $sth = $this->db->prepare($query); |
| 5207 | 5476 | $sth->execute($query_values); |
@@ -5248,7 +5517,9 @@ discard block |
||
| 5248 | 5517 | } |
| 5249 | 5518 | |
| 5250 | 5519 | $query .= "GROUP BY EXTRACT(month from spotter_output.date), EXTRACT(year from spotter_output.date), spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 5251 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5520 | + if ($limit) { |
|
| 5521 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5522 | + } |
|
| 5252 | 5523 | |
| 5253 | 5524 | $sth = $this->db->prepare($query); |
| 5254 | 5525 | $sth->execute(); |
@@ -5301,7 +5572,9 @@ discard block |
||
| 5301 | 5572 | if($row['registration'] != "") |
| 5302 | 5573 | { |
| 5303 | 5574 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5304 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5575 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5576 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5577 | + } |
|
| 5305 | 5578 | } |
| 5306 | 5579 | $temp_array['registration_count'] = $row['registration_count']; |
| 5307 | 5580 | |
@@ -5376,7 +5649,9 @@ discard block |
||
| 5376 | 5649 | if($row['registration'] != "") |
| 5377 | 5650 | { |
| 5378 | 5651 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5379 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5652 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5653 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5654 | + } |
|
| 5380 | 5655 | } |
| 5381 | 5656 | $temp_array['registration_count'] = $row['registration_count']; |
| 5382 | 5657 | |
@@ -5483,7 +5758,9 @@ discard block |
||
| 5483 | 5758 | if($row['registration'] != "") |
| 5484 | 5759 | { |
| 5485 | 5760 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5486 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5761 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5762 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5763 | + } |
|
| 5487 | 5764 | } |
| 5488 | 5765 | $temp_array['registration_count'] = $row['registration_count']; |
| 5489 | 5766 | $aircraft_array[] = $temp_array; |
@@ -5608,7 +5885,9 @@ discard block |
||
| 5608 | 5885 | date_default_timezone_set($globalTimezone); |
| 5609 | 5886 | $datetime = new DateTime($date); |
| 5610 | 5887 | $offset = $datetime->format('P'); |
| 5611 | - } else $offset = '+00:00'; |
|
| 5888 | + } else { |
|
| 5889 | + $offset = '+00:00'; |
|
| 5890 | + } |
|
| 5612 | 5891 | |
| 5613 | 5892 | if ($globalDBdriver == 'mysql') { |
| 5614 | 5893 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
@@ -5655,7 +5934,9 @@ discard block |
||
| 5655 | 5934 | date_default_timezone_set($globalTimezone); |
| 5656 | 5935 | $datetime = new DateTime($date); |
| 5657 | 5936 | $offset = $datetime->format('P'); |
| 5658 | - } else $offset = '+00:00'; |
|
| 5937 | + } else { |
|
| 5938 | + $offset = '+00:00'; |
|
| 5939 | + } |
|
| 5659 | 5940 | |
| 5660 | 5941 | if ($globalDBdriver == 'mysql') { |
| 5661 | 5942 | $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 |
@@ -5684,7 +5965,9 @@ discard block |
||
| 5684 | 5965 | if($row['registration'] != "") |
| 5685 | 5966 | { |
| 5686 | 5967 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5687 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5968 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5969 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5970 | + } |
|
| 5688 | 5971 | } |
| 5689 | 5972 | $temp_array['registration_count'] = $row['registration_count']; |
| 5690 | 5973 | |
@@ -5709,7 +5992,9 @@ discard block |
||
| 5709 | 5992 | date_default_timezone_set($globalTimezone); |
| 5710 | 5993 | $datetime = new DateTime($date); |
| 5711 | 5994 | $offset = $datetime->format('P'); |
| 5712 | - } else $offset = '+00:00'; |
|
| 5995 | + } else { |
|
| 5996 | + $offset = '+00:00'; |
|
| 5997 | + } |
|
| 5713 | 5998 | |
| 5714 | 5999 | if ($globalDBdriver == 'mysql') { |
| 5715 | 6000 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
@@ -5905,8 +6190,11 @@ discard block |
||
| 5905 | 6190 | if($row['registration'] != "") |
| 5906 | 6191 | { |
| 5907 | 6192 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5908 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5909 | - else $temp_array['image_thumbnail'] = ''; |
|
| 6193 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6194 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6195 | + } else { |
|
| 6196 | + $temp_array['image_thumbnail'] = ''; |
|
| 6197 | + } |
|
| 5910 | 6198 | } |
| 5911 | 6199 | $temp_array['registration_count'] = $row['registration_count']; |
| 5912 | 6200 | $aircraft_array[] = $temp_array; |
@@ -5980,8 +6268,11 @@ discard block |
||
| 5980 | 6268 | if($row['registration'] != "") |
| 5981 | 6269 | { |
| 5982 | 6270 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5983 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5984 | - else $temp_array['image_thumbnail'] = ''; |
|
| 6271 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6272 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6273 | + } else { |
|
| 6274 | + $temp_array['image_thumbnail'] = ''; |
|
| 6275 | + } |
|
| 5985 | 6276 | } |
| 5986 | 6277 | $temp_array['registration_count'] = $row['registration_count']; |
| 5987 | 6278 | $aircraft_array[] = $temp_array; |
@@ -6055,8 +6346,11 @@ discard block |
||
| 6055 | 6346 | if($row['registration'] != "") |
| 6056 | 6347 | { |
| 6057 | 6348 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6058 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6059 | - else $temp_array['image_thumbnail'] = ''; |
|
| 6349 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6350 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6351 | + } else { |
|
| 6352 | + $temp_array['image_thumbnail'] = ''; |
|
| 6353 | + } |
|
| 6060 | 6354 | } |
| 6061 | 6355 | $temp_array['registration_count'] = $row['registration_count']; |
| 6062 | 6356 | $aircraft_array[] = $temp_array; |
@@ -6267,7 +6561,9 @@ discard block |
||
| 6267 | 6561 | if($row['registration'] != "") |
| 6268 | 6562 | { |
| 6269 | 6563 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6270 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6564 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6565 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6566 | + } |
|
| 6271 | 6567 | } |
| 6272 | 6568 | $temp_array['registration_count'] = $row['registration_count']; |
| 6273 | 6569 | |
@@ -6384,7 +6680,9 @@ discard block |
||
| 6384 | 6680 | if($row['registration'] != "") |
| 6385 | 6681 | { |
| 6386 | 6682 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6387 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6683 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6684 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6685 | + } |
|
| 6388 | 6686 | } |
| 6389 | 6687 | $temp_array['registration_count'] = $row['registration_count']; |
| 6390 | 6688 | |
@@ -6550,7 +6848,9 @@ discard block |
||
| 6550 | 6848 | } |
| 6551 | 6849 | } |
| 6552 | 6850 | $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
| 6553 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6851 | + if ($limit) { |
|
| 6852 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6853 | + } |
|
| 6554 | 6854 | |
| 6555 | 6855 | $sth = $this->db->prepare($query); |
| 6556 | 6856 | $sth->execute($query_values); |
@@ -6569,7 +6869,9 @@ discard block |
||
| 6569 | 6869 | if($row['registration'] != "") |
| 6570 | 6870 | { |
| 6571 | 6871 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6572 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6872 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6873 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6874 | + } |
|
| 6573 | 6875 | } |
| 6574 | 6876 | |
| 6575 | 6877 | $aircraft_array[] = $temp_array; |
@@ -6610,7 +6912,9 @@ discard block |
||
| 6610 | 6912 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6611 | 6913 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6612 | 6914 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
| 6613 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6915 | + if ($limit) { |
|
| 6916 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6917 | + } |
|
| 6614 | 6918 | |
| 6615 | 6919 | $sth = $this->db->prepare($query); |
| 6616 | 6920 | $sth->execute(); |
@@ -6630,7 +6934,9 @@ discard block |
||
| 6630 | 6934 | if($row['registration'] != "") |
| 6631 | 6935 | { |
| 6632 | 6936 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6633 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6937 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6938 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6939 | + } |
|
| 6634 | 6940 | } |
| 6635 | 6941 | |
| 6636 | 6942 | $aircraft_array[] = $temp_array; |
@@ -6696,7 +7002,9 @@ discard block |
||
| 6696 | 7002 | } |
| 6697 | 7003 | $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, airport.latitude, airport.longitude |
| 6698 | 7004 | ORDER BY airport_departure_icao_count DESC"; |
| 6699 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7005 | + if ($limit) { |
|
| 7006 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7007 | + } |
|
| 6700 | 7008 | |
| 6701 | 7009 | $sth = $this->db->prepare($query); |
| 6702 | 7010 | $sth->execute($query_values); |
@@ -6748,7 +7056,9 @@ discard block |
||
| 6748 | 7056 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6749 | 7057 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6750 | 7058 | ORDER BY airport_departure_icao_count DESC"; |
| 6751 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7059 | + if ($limit) { |
|
| 7060 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7061 | + } |
|
| 6752 | 7062 | |
| 6753 | 7063 | $sth = $this->db->prepare($query); |
| 6754 | 7064 | $sth->execute(); |
@@ -6826,7 +7136,9 @@ discard block |
||
| 6826 | 7136 | } |
| 6827 | 7137 | $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude |
| 6828 | 7138 | ORDER BY airport_departure_icao_count DESC"; |
| 6829 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7139 | + if ($limit) { |
|
| 7140 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7141 | + } |
|
| 6830 | 7142 | //echo $query; |
| 6831 | 7143 | $sth = $this->db->prepare($query); |
| 6832 | 7144 | $sth->execute($query_values); |
@@ -6880,7 +7192,9 @@ discard block |
||
| 6880 | 7192 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6881 | 7193 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
| 6882 | 7194 | ORDER BY airport_departure_icao_count DESC"; |
| 6883 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7195 | + if ($limit) { |
|
| 7196 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7197 | + } |
|
| 6884 | 7198 | |
| 6885 | 7199 | $sth = $this->db->prepare($query); |
| 6886 | 7200 | $sth->execute(); |
@@ -7275,7 +7589,9 @@ discard block |
||
| 7275 | 7589 | date_default_timezone_set($globalTimezone); |
| 7276 | 7590 | $datetime = new DateTime($date); |
| 7277 | 7591 | $offset = $datetime->format('P'); |
| 7278 | - } else $offset = '+00:00'; |
|
| 7592 | + } else { |
|
| 7593 | + $offset = '+00:00'; |
|
| 7594 | + } |
|
| 7279 | 7595 | |
| 7280 | 7596 | if ($globalDBdriver == 'mysql') { |
| 7281 | 7597 | $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 |
@@ -7325,7 +7641,9 @@ discard block |
||
| 7325 | 7641 | date_default_timezone_set($globalTimezone); |
| 7326 | 7642 | $datetime = new DateTime($date); |
| 7327 | 7643 | $offset = $datetime->format('P'); |
| 7328 | - } else $offset = '+00:00'; |
|
| 7644 | + } else { |
|
| 7645 | + $offset = '+00:00'; |
|
| 7646 | + } |
|
| 7329 | 7647 | |
| 7330 | 7648 | if ($globalDBdriver == 'mysql') { |
| 7331 | 7649 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
@@ -7674,7 +7992,9 @@ discard block |
||
| 7674 | 7992 | } |
| 7675 | 7993 | $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, airport.latitude, airport.longitude |
| 7676 | 7994 | ORDER BY airport_arrival_icao_count DESC"; |
| 7677 | - if ($limit) $query .= " LIMIT 10"; |
|
| 7995 | + if ($limit) { |
|
| 7996 | + $query .= " LIMIT 10"; |
|
| 7997 | + } |
|
| 7678 | 7998 | |
| 7679 | 7999 | |
| 7680 | 8000 | $sth = $this->db->prepare($query); |
@@ -7696,7 +8016,9 @@ discard block |
||
| 7696 | 8016 | if ($icaoaskey) { |
| 7697 | 8017 | $icao = $row['arrival_airport_icao']; |
| 7698 | 8018 | $airport_array[$icao] = $temp_array; |
| 7699 | - } else $airport_array[] = $temp_array; |
|
| 8019 | + } else { |
|
| 8020 | + $airport_array[] = $temp_array; |
|
| 8021 | + } |
|
| 7700 | 8022 | } |
| 7701 | 8023 | |
| 7702 | 8024 | return $airport_array; |
@@ -7733,7 +8055,9 @@ discard block |
||
| 7733 | 8055 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 7734 | 8056 | $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7735 | 8057 | ORDER BY airport_arrival_icao_count DESC"; |
| 7736 | - if ($limit) $query .= " LIMIT 10"; |
|
| 8058 | + if ($limit) { |
|
| 8059 | + $query .= " LIMIT 10"; |
|
| 8060 | + } |
|
| 7737 | 8061 | |
| 7738 | 8062 | |
| 7739 | 8063 | $sth = $this->db->prepare($query); |
@@ -7754,7 +8078,9 @@ discard block |
||
| 7754 | 8078 | if ($icaoaskey) { |
| 7755 | 8079 | $icao = $row['arrival_airport_icao']; |
| 7756 | 8080 | $airport_array[$icao] = $temp_array; |
| 7757 | - } else $airport_array[] = $temp_array; |
|
| 8081 | + } else { |
|
| 8082 | + $airport_array[] = $temp_array; |
|
| 8083 | + } |
|
| 7758 | 8084 | } |
| 7759 | 8085 | |
| 7760 | 8086 | return $airport_array; |
@@ -7817,7 +8143,9 @@ discard block |
||
| 7817 | 8143 | } |
| 7818 | 8144 | $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude |
| 7819 | 8145 | ORDER BY airport_arrival_icao_count DESC"; |
| 7820 | - if ($limit) $query .= " LIMIT 10"; |
|
| 8146 | + if ($limit) { |
|
| 8147 | + $query .= " LIMIT 10"; |
|
| 8148 | + } |
|
| 7821 | 8149 | |
| 7822 | 8150 | |
| 7823 | 8151 | $sth = $this->db->prepare($query); |
@@ -7836,7 +8164,9 @@ discard block |
||
| 7836 | 8164 | if ($icaoaskey) { |
| 7837 | 8165 | $icao = $row['arrival_airport_icao']; |
| 7838 | 8166 | $airport_array[$icao] = $temp_array; |
| 7839 | - } else $airport_array[] = $temp_array; |
|
| 8167 | + } else { |
|
| 8168 | + $airport_array[] = $temp_array; |
|
| 8169 | + } |
|
| 7840 | 8170 | } |
| 7841 | 8171 | |
| 7842 | 8172 | return $airport_array; |
@@ -7873,7 +8203,9 @@ discard block |
||
| 7873 | 8203 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 7874 | 8204 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
| 7875 | 8205 | ORDER BY airport_arrival_icao_count DESC"; |
| 7876 | - if ($limit) $query .= " LIMIT 10"; |
|
| 8206 | + if ($limit) { |
|
| 8207 | + $query .= " LIMIT 10"; |
|
| 8208 | + } |
|
| 7877 | 8209 | |
| 7878 | 8210 | |
| 7879 | 8211 | $sth = $this->db->prepare($query); |
@@ -7894,7 +8226,9 @@ discard block |
||
| 7894 | 8226 | if ($icaoaskey) { |
| 7895 | 8227 | $icao = $row['arrival_airport_icao']; |
| 7896 | 8228 | $airport_array[$icao] = $temp_array; |
| 7897 | - } else $airport_array[] = $temp_array; |
|
| 8229 | + } else { |
|
| 8230 | + $airport_array[] = $temp_array; |
|
| 8231 | + } |
|
| 7898 | 8232 | } |
| 7899 | 8233 | |
| 7900 | 8234 | return $airport_array; |
@@ -8275,7 +8609,9 @@ discard block |
||
| 8275 | 8609 | date_default_timezone_set($globalTimezone); |
| 8276 | 8610 | $datetime = new DateTime($date); |
| 8277 | 8611 | $offset = $datetime->format('P'); |
| 8278 | - } else $offset = '+00:00'; |
|
| 8612 | + } else { |
|
| 8613 | + $offset = '+00:00'; |
|
| 8614 | + } |
|
| 8279 | 8615 | |
| 8280 | 8616 | if ($globalDBdriver == 'mysql') { |
| 8281 | 8617 | $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 |
@@ -8325,7 +8661,9 @@ discard block |
||
| 8325 | 8661 | date_default_timezone_set($globalTimezone); |
| 8326 | 8662 | $datetime = new DateTime($date); |
| 8327 | 8663 | $offset = $datetime->format('P'); |
| 8328 | - } else $offset = '+00:00'; |
|
| 8664 | + } else { |
|
| 8665 | + $offset = '+00:00'; |
|
| 8666 | + } |
|
| 8329 | 8667 | |
| 8330 | 8668 | if ($globalDBdriver == 'mysql') { |
| 8331 | 8669 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
@@ -8716,7 +9054,9 @@ discard block |
||
| 8716 | 9054 | } |
| 8717 | 9055 | $query .= " GROUP BY spotter_output.arrival_airport_country, countries.iso3 |
| 8718 | 9056 | ORDER BY airport_arrival_country_count DESC"; |
| 8719 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 9057 | + if ($limit) { |
|
| 9058 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 9059 | + } |
|
| 8720 | 9060 | |
| 8721 | 9061 | |
| 8722 | 9062 | $sth = $this->db->prepare($query); |
@@ -9004,7 +9344,9 @@ discard block |
||
| 9004 | 9344 | date_default_timezone_set($globalTimezone); |
| 9005 | 9345 | $datetime = new DateTime($date); |
| 9006 | 9346 | $offset = $datetime->format('P'); |
| 9007 | - } else $offset = '+00:00'; |
|
| 9347 | + } else { |
|
| 9348 | + $offset = '+00:00'; |
|
| 9349 | + } |
|
| 9008 | 9350 | |
| 9009 | 9351 | if ($globalDBdriver == 'mysql') { |
| 9010 | 9352 | $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 |
@@ -9260,12 +9602,18 @@ discard block |
||
| 9260 | 9602 | $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
| 9261 | 9603 | FROM spotter_output".$filter_query." spotter_output.ident <> ''"; |
| 9262 | 9604 | if ($olderthanmonths > 0) { |
| 9263 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 9264 | - else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 9605 | + if ($globalDBdriver == 'mysql') { |
|
| 9606 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 9607 | + } else { |
|
| 9608 | + $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 9609 | + } |
|
| 9265 | 9610 | } |
| 9266 | 9611 | if ($sincedate != '') { |
| 9267 | - if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 9268 | - else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 9612 | + if ($globalDBdriver == 'mysql') { |
|
| 9613 | + $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 9614 | + } else { |
|
| 9615 | + $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 9616 | + } |
|
| 9269 | 9617 | } |
| 9270 | 9618 | $query_values = array(); |
| 9271 | 9619 | if ($year != '') { |
@@ -9296,7 +9644,9 @@ discard block |
||
| 9296 | 9644 | } |
| 9297 | 9645 | } |
| 9298 | 9646 | $query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 9299 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 9647 | + if ($limit) { |
|
| 9648 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 9649 | + } |
|
| 9300 | 9650 | |
| 9301 | 9651 | $sth = $this->db->prepare($query); |
| 9302 | 9652 | $sth->execute($query_values); |
@@ -9330,15 +9680,23 @@ discard block |
||
| 9330 | 9680 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
| 9331 | 9681 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
| 9332 | 9682 | if ($olderthanmonths > 0) { |
| 9333 | - if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 9334 | - else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 9683 | + if ($globalDBdriver == 'mysql') { |
|
| 9684 | + $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 9685 | + } else { |
|
| 9686 | + $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 9687 | + } |
|
| 9335 | 9688 | } |
| 9336 | 9689 | if ($sincedate != '') { |
| 9337 | - if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 9338 | - else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 9690 | + if ($globalDBdriver == 'mysql') { |
|
| 9691 | + $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 9692 | + } else { |
|
| 9693 | + $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 9694 | + } |
|
| 9339 | 9695 | } |
| 9340 | 9696 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 9341 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 9697 | + if ($limit) { |
|
| 9698 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 9699 | + } |
|
| 9342 | 9700 | |
| 9343 | 9701 | $sth = $this->db->prepare($query); |
| 9344 | 9702 | $sth->execute(); |
@@ -9375,7 +9733,9 @@ discard block |
||
| 9375 | 9733 | date_default_timezone_set($globalTimezone); |
| 9376 | 9734 | $datetime = new DateTime(); |
| 9377 | 9735 | $offset = $datetime->format('P'); |
| 9378 | - } else $offset = '+00:00'; |
|
| 9736 | + } else { |
|
| 9737 | + $offset = '+00:00'; |
|
| 9738 | + } |
|
| 9379 | 9739 | |
| 9380 | 9740 | if ($globalDBdriver == 'mysql') { |
| 9381 | 9741 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9424,7 +9784,9 @@ discard block |
||
| 9424 | 9784 | date_default_timezone_set($globalTimezone); |
| 9425 | 9785 | $datetime = new DateTime(); |
| 9426 | 9786 | $offset = $datetime->format('P'); |
| 9427 | - } else $offset = '+00:00'; |
|
| 9787 | + } else { |
|
| 9788 | + $offset = '+00:00'; |
|
| 9789 | + } |
|
| 9428 | 9790 | $filter_query = $this->getFilter($filters,true,true); |
| 9429 | 9791 | if ($globalDBdriver == 'mysql') { |
| 9430 | 9792 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9473,7 +9835,9 @@ discard block |
||
| 9473 | 9835 | date_default_timezone_set($globalTimezone); |
| 9474 | 9836 | $datetime = new DateTime(); |
| 9475 | 9837 | $offset = $datetime->format('P'); |
| 9476 | - } else $offset = '+00:00'; |
|
| 9838 | + } else { |
|
| 9839 | + $offset = '+00:00'; |
|
| 9840 | + } |
|
| 9477 | 9841 | $filter_query = $this->getFilter($filters,true,true); |
| 9478 | 9842 | if ($globalDBdriver == 'mysql') { |
| 9479 | 9843 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9519,7 +9883,9 @@ discard block |
||
| 9519 | 9883 | date_default_timezone_set($globalTimezone); |
| 9520 | 9884 | $datetime = new DateTime(); |
| 9521 | 9885 | $offset = $datetime->format('P'); |
| 9522 | - } else $offset = '+00:00'; |
|
| 9886 | + } else { |
|
| 9887 | + $offset = '+00:00'; |
|
| 9888 | + } |
|
| 9523 | 9889 | $filter_query = $this->getFilter($filters,true,true); |
| 9524 | 9890 | if ($globalDBdriver == 'mysql') { |
| 9525 | 9891 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9567,7 +9933,9 @@ discard block |
||
| 9567 | 9933 | date_default_timezone_set($globalTimezone); |
| 9568 | 9934 | $datetime = new DateTime(); |
| 9569 | 9935 | $offset = $datetime->format('P'); |
| 9570 | - } else $offset = '+00:00'; |
|
| 9936 | + } else { |
|
| 9937 | + $offset = '+00:00'; |
|
| 9938 | + } |
|
| 9571 | 9939 | |
| 9572 | 9940 | if ($globalDBdriver == 'mysql') { |
| 9573 | 9941 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9615,7 +9983,9 @@ discard block |
||
| 9615 | 9983 | date_default_timezone_set($globalTimezone); |
| 9616 | 9984 | $datetime = new DateTime(); |
| 9617 | 9985 | $offset = $datetime->format('P'); |
| 9618 | - } else $offset = '+00:00'; |
|
| 9986 | + } else { |
|
| 9987 | + $offset = '+00:00'; |
|
| 9988 | + } |
|
| 9619 | 9989 | |
| 9620 | 9990 | if ($globalDBdriver == 'mysql') { |
| 9621 | 9991 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -9662,7 +10032,9 @@ discard block |
||
| 9662 | 10032 | date_default_timezone_set($globalTimezone); |
| 9663 | 10033 | $datetime = new DateTime(); |
| 9664 | 10034 | $offset = $datetime->format('P'); |
| 9665 | - } else $offset = '+00:00'; |
|
| 10035 | + } else { |
|
| 10036 | + $offset = '+00:00'; |
|
| 10037 | + } |
|
| 9666 | 10038 | |
| 9667 | 10039 | if ($globalDBdriver == 'mysql') { |
| 9668 | 10040 | $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 |
@@ -9710,7 +10082,9 @@ discard block |
||
| 9710 | 10082 | date_default_timezone_set($globalTimezone); |
| 9711 | 10083 | $datetime = new DateTime(); |
| 9712 | 10084 | $offset = $datetime->format('P'); |
| 9713 | - } else $offset = '+00:00'; |
|
| 10085 | + } else { |
|
| 10086 | + $offset = '+00:00'; |
|
| 10087 | + } |
|
| 9714 | 10088 | $filter_query = $this->getFilter($filters,true,true); |
| 9715 | 10089 | if ($globalDBdriver == 'mysql') { |
| 9716 | 10090 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -9755,7 +10129,9 @@ discard block |
||
| 9755 | 10129 | date_default_timezone_set($globalTimezone); |
| 9756 | 10130 | $datetime = new DateTime(); |
| 9757 | 10131 | $offset = $datetime->format('P'); |
| 9758 | - } else $offset = '+00:00'; |
|
| 10132 | + } else { |
|
| 10133 | + $offset = '+00:00'; |
|
| 10134 | + } |
|
| 9759 | 10135 | $filter_query = $this->getFilter($filters,true,true); |
| 9760 | 10136 | |
| 9761 | 10137 | if ($globalDBdriver == 'mysql') { |
@@ -9802,7 +10178,9 @@ discard block |
||
| 9802 | 10178 | date_default_timezone_set($globalTimezone); |
| 9803 | 10179 | $datetime = new DateTime(); |
| 9804 | 10180 | $offset = $datetime->format('P'); |
| 9805 | - } else $offset = '+00:00'; |
|
| 10181 | + } else { |
|
| 10182 | + $offset = '+00:00'; |
|
| 10183 | + } |
|
| 9806 | 10184 | |
| 9807 | 10185 | if ($globalDBdriver == 'mysql') { |
| 9808 | 10186 | $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 |
@@ -9848,7 +10226,9 @@ discard block |
||
| 9848 | 10226 | date_default_timezone_set($globalTimezone); |
| 9849 | 10227 | $datetime = new DateTime(); |
| 9850 | 10228 | $offset = $datetime->format('P'); |
| 9851 | - } else $offset = '+00:00'; |
|
| 10229 | + } else { |
|
| 10230 | + $offset = '+00:00'; |
|
| 10231 | + } |
|
| 9852 | 10232 | $filter_query = $this->getFilter($filters,true,true); |
| 9853 | 10233 | |
| 9854 | 10234 | if ($globalDBdriver == 'mysql') { |
@@ -9895,7 +10275,9 @@ discard block |
||
| 9895 | 10275 | date_default_timezone_set($globalTimezone); |
| 9896 | 10276 | $datetime = new DateTime(); |
| 9897 | 10277 | $offset = $datetime->format('P'); |
| 9898 | - } else $offset = '+00:00'; |
|
| 10278 | + } else { |
|
| 10279 | + $offset = '+00:00'; |
|
| 10280 | + } |
|
| 9899 | 10281 | |
| 9900 | 10282 | if ($globalDBdriver == 'mysql') { |
| 9901 | 10283 | $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 |
@@ -9942,7 +10324,9 @@ discard block |
||
| 9942 | 10324 | date_default_timezone_set($globalTimezone); |
| 9943 | 10325 | $datetime = new DateTime(); |
| 9944 | 10326 | $offset = $datetime->format('P'); |
| 9945 | - } else $offset = '+00:00'; |
|
| 10327 | + } else { |
|
| 10328 | + $offset = '+00:00'; |
|
| 10329 | + } |
|
| 9946 | 10330 | |
| 9947 | 10331 | if ($globalDBdriver == 'mysql') { |
| 9948 | 10332 | $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 |
@@ -9987,7 +10371,9 @@ discard block |
||
| 9987 | 10371 | date_default_timezone_set($globalTimezone); |
| 9988 | 10372 | $datetime = new DateTime(); |
| 9989 | 10373 | $offset = $datetime->format('P'); |
| 9990 | - } else $offset = '+00:00'; |
|
| 10374 | + } else { |
|
| 10375 | + $offset = '+00:00'; |
|
| 10376 | + } |
|
| 9991 | 10377 | $filter_query = $this->getFilter($filters,true,true); |
| 9992 | 10378 | |
| 9993 | 10379 | if ($globalDBdriver == 'mysql') { |
@@ -10035,7 +10421,9 @@ discard block |
||
| 10035 | 10421 | date_default_timezone_set($globalTimezone); |
| 10036 | 10422 | $datetime = new DateTime(); |
| 10037 | 10423 | $offset = $datetime->format('P'); |
| 10038 | - } else $offset = '+00:00'; |
|
| 10424 | + } else { |
|
| 10425 | + $offset = '+00:00'; |
|
| 10426 | + } |
|
| 10039 | 10427 | |
| 10040 | 10428 | if ($globalDBdriver == 'mysql') { |
| 10041 | 10429 | $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 |
@@ -10081,7 +10469,9 @@ discard block |
||
| 10081 | 10469 | date_default_timezone_set($globalTimezone); |
| 10082 | 10470 | $datetime = new DateTime(); |
| 10083 | 10471 | $offset = $datetime->format('P'); |
| 10084 | - } else $offset = '+00:00'; |
|
| 10472 | + } else { |
|
| 10473 | + $offset = '+00:00'; |
|
| 10474 | + } |
|
| 10085 | 10475 | $filter_query = $this->getFilter($filters,true,true); |
| 10086 | 10476 | |
| 10087 | 10477 | if ($globalDBdriver == 'mysql') { |
@@ -10129,7 +10519,9 @@ discard block |
||
| 10129 | 10519 | date_default_timezone_set($globalTimezone); |
| 10130 | 10520 | $datetime = new DateTime(); |
| 10131 | 10521 | $offset = $datetime->format('P'); |
| 10132 | - } else $offset = '+00:00'; |
|
| 10522 | + } else { |
|
| 10523 | + $offset = '+00:00'; |
|
| 10524 | + } |
|
| 10133 | 10525 | |
| 10134 | 10526 | if ($globalDBdriver == 'mysql') { |
| 10135 | 10527 | $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 |
@@ -10176,7 +10568,9 @@ discard block |
||
| 10176 | 10568 | date_default_timezone_set($globalTimezone); |
| 10177 | 10569 | $datetime = new DateTime(); |
| 10178 | 10570 | $offset = $datetime->format('P'); |
| 10179 | - } else $offset = '+00:00'; |
|
| 10571 | + } else { |
|
| 10572 | + $offset = '+00:00'; |
|
| 10573 | + } |
|
| 10180 | 10574 | $filter_query = $this->getFilter($filters,true,true); |
| 10181 | 10575 | if ($globalDBdriver == 'mysql') { |
| 10182 | 10576 | $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 |
@@ -10225,7 +10619,9 @@ discard block |
||
| 10225 | 10619 | date_default_timezone_set($globalTimezone); |
| 10226 | 10620 | $datetime = new DateTime(); |
| 10227 | 10621 | $offset = $datetime->format('P'); |
| 10228 | - } else $offset = '+00:00'; |
|
| 10622 | + } else { |
|
| 10623 | + $offset = '+00:00'; |
|
| 10624 | + } |
|
| 10229 | 10625 | |
| 10230 | 10626 | $orderby_sql = ''; |
| 10231 | 10627 | if ($orderby == "hour") |
@@ -10291,7 +10687,9 @@ discard block |
||
| 10291 | 10687 | date_default_timezone_set($globalTimezone); |
| 10292 | 10688 | $datetime = new DateTime(); |
| 10293 | 10689 | $offset = $datetime->format('P'); |
| 10294 | - } else $offset = '+00:00'; |
|
| 10690 | + } else { |
|
| 10691 | + $offset = '+00:00'; |
|
| 10692 | + } |
|
| 10295 | 10693 | |
| 10296 | 10694 | $orderby_sql = ''; |
| 10297 | 10695 | if ($orderby == "hour") |
@@ -10358,7 +10756,9 @@ discard block |
||
| 10358 | 10756 | date_default_timezone_set($globalTimezone); |
| 10359 | 10757 | $datetime = new DateTime(); |
| 10360 | 10758 | $offset = $datetime->format('P'); |
| 10361 | - } else $offset = '+00:00'; |
|
| 10759 | + } else { |
|
| 10760 | + $offset = '+00:00'; |
|
| 10761 | + } |
|
| 10362 | 10762 | |
| 10363 | 10763 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
| 10364 | 10764 | |
@@ -10409,7 +10809,9 @@ discard block |
||
| 10409 | 10809 | date_default_timezone_set($globalTimezone); |
| 10410 | 10810 | $datetime = new DateTime(); |
| 10411 | 10811 | $offset = $datetime->format('P'); |
| 10412 | - } else $offset = '+00:00'; |
|
| 10812 | + } else { |
|
| 10813 | + $offset = '+00:00'; |
|
| 10814 | + } |
|
| 10413 | 10815 | |
| 10414 | 10816 | if ($globalDBdriver == 'mysql') { |
| 10415 | 10817 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10456,7 +10858,9 @@ discard block |
||
| 10456 | 10858 | date_default_timezone_set($globalTimezone); |
| 10457 | 10859 | $datetime = new DateTime(); |
| 10458 | 10860 | $offset = $datetime->format('P'); |
| 10459 | - } else $offset = '+00:00'; |
|
| 10861 | + } else { |
|
| 10862 | + $offset = '+00:00'; |
|
| 10863 | + } |
|
| 10460 | 10864 | |
| 10461 | 10865 | if ($globalDBdriver == 'mysql') { |
| 10462 | 10866 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10503,7 +10907,9 @@ discard block |
||
| 10503 | 10907 | date_default_timezone_set($globalTimezone); |
| 10504 | 10908 | $datetime = new DateTime(); |
| 10505 | 10909 | $offset = $datetime->format('P'); |
| 10506 | - } else $offset = '+00:00'; |
|
| 10910 | + } else { |
|
| 10911 | + $offset = '+00:00'; |
|
| 10912 | + } |
|
| 10507 | 10913 | |
| 10508 | 10914 | if ($globalDBdriver == 'mysql') { |
| 10509 | 10915 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10551,7 +10957,9 @@ discard block |
||
| 10551 | 10957 | date_default_timezone_set($globalTimezone); |
| 10552 | 10958 | $datetime = new DateTime(); |
| 10553 | 10959 | $offset = $datetime->format('P'); |
| 10554 | - } else $offset = '+00:00'; |
|
| 10960 | + } else { |
|
| 10961 | + $offset = '+00:00'; |
|
| 10962 | + } |
|
| 10555 | 10963 | |
| 10556 | 10964 | if ($globalDBdriver == 'mysql') { |
| 10557 | 10965 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10599,7 +11007,9 @@ discard block |
||
| 10599 | 11007 | date_default_timezone_set($globalTimezone); |
| 10600 | 11008 | $datetime = new DateTime($date); |
| 10601 | 11009 | $offset = $datetime->format('P'); |
| 10602 | - } else $offset = '+00:00'; |
|
| 11010 | + } else { |
|
| 11011 | + $offset = '+00:00'; |
|
| 11012 | + } |
|
| 10603 | 11013 | |
| 10604 | 11014 | if ($globalDBdriver == 'mysql') { |
| 10605 | 11015 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10647,7 +11057,9 @@ discard block |
||
| 10647 | 11057 | date_default_timezone_set($globalTimezone); |
| 10648 | 11058 | $datetime = new DateTime(); |
| 10649 | 11059 | $offset = $datetime->format('P'); |
| 10650 | - } else $offset = '+00:00'; |
|
| 11060 | + } else { |
|
| 11061 | + $offset = '+00:00'; |
|
| 11062 | + } |
|
| 10651 | 11063 | |
| 10652 | 11064 | if ($globalDBdriver == 'mysql') { |
| 10653 | 11065 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10694,7 +11106,9 @@ discard block |
||
| 10694 | 11106 | date_default_timezone_set($globalTimezone); |
| 10695 | 11107 | $datetime = new DateTime(); |
| 10696 | 11108 | $offset = $datetime->format('P'); |
| 10697 | - } else $offset = '+00:00'; |
|
| 11109 | + } else { |
|
| 11110 | + $offset = '+00:00'; |
|
| 11111 | + } |
|
| 10698 | 11112 | |
| 10699 | 11113 | if ($globalDBdriver == 'mysql') { |
| 10700 | 11114 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10741,7 +11155,9 @@ discard block |
||
| 10741 | 11155 | date_default_timezone_set($globalTimezone); |
| 10742 | 11156 | $datetime = new DateTime(); |
| 10743 | 11157 | $offset = $datetime->format('P'); |
| 10744 | - } else $offset = '+00:00'; |
|
| 11158 | + } else { |
|
| 11159 | + $offset = '+00:00'; |
|
| 11160 | + } |
|
| 10745 | 11161 | |
| 10746 | 11162 | if ($globalDBdriver == 'mysql') { |
| 10747 | 11163 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10791,7 +11207,9 @@ discard block |
||
| 10791 | 11207 | date_default_timezone_set($globalTimezone); |
| 10792 | 11208 | $datetime = new DateTime(); |
| 10793 | 11209 | $offset = $datetime->format('P'); |
| 10794 | - } else $offset = '+00:00'; |
|
| 11210 | + } else { |
|
| 11211 | + $offset = '+00:00'; |
|
| 11212 | + } |
|
| 10795 | 11213 | |
| 10796 | 11214 | if ($globalDBdriver == 'mysql') { |
| 10797 | 11215 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10838,7 +11256,9 @@ discard block |
||
| 10838 | 11256 | date_default_timezone_set($globalTimezone); |
| 10839 | 11257 | $datetime = new DateTime(); |
| 10840 | 11258 | $offset = $datetime->format('P'); |
| 10841 | - } else $offset = '+00:00'; |
|
| 11259 | + } else { |
|
| 11260 | + $offset = '+00:00'; |
|
| 11261 | + } |
|
| 10842 | 11262 | |
| 10843 | 11263 | if ($globalDBdriver == 'mysql') { |
| 10844 | 11264 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -11049,8 +11469,11 @@ discard block |
||
| 11049 | 11469 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 11050 | 11470 | } |
| 11051 | 11471 | } |
| 11052 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
| 11053 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11472 | + if (empty($query_values)) { |
|
| 11473 | + $queryi .= $this->getFilter($filters); |
|
| 11474 | + } else { |
|
| 11475 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11476 | + } |
|
| 11054 | 11477 | |
| 11055 | 11478 | $sth = $this->db->prepare($queryi); |
| 11056 | 11479 | $sth->execute($query_values); |
@@ -11128,8 +11551,11 @@ discard block |
||
| 11128 | 11551 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 11129 | 11552 | } |
| 11130 | 11553 | } |
| 11131 | - if ($query == '') $queryi .= $this->getFilter($filters); |
|
| 11132 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11554 | + if ($query == '') { |
|
| 11555 | + $queryi .= $this->getFilter($filters); |
|
| 11556 | + } else { |
|
| 11557 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11558 | + } |
|
| 11133 | 11559 | |
| 11134 | 11560 | |
| 11135 | 11561 | $sth = $this->db->prepare($queryi); |
@@ -11152,7 +11578,9 @@ discard block |
||
| 11152 | 11578 | date_default_timezone_set($globalTimezone); |
| 11153 | 11579 | $datetime = new DateTime(); |
| 11154 | 11580 | $offset = $datetime->format('P'); |
| 11155 | - } else $offset = '+00:00'; |
|
| 11581 | + } else { |
|
| 11582 | + $offset = '+00:00'; |
|
| 11583 | + } |
|
| 11156 | 11584 | |
| 11157 | 11585 | if ($globalDBdriver == 'mysql') { |
| 11158 | 11586 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -11338,7 +11766,9 @@ discard block |
||
| 11338 | 11766 | */ |
| 11339 | 11767 | public function parseDirection($direction = 0) |
| 11340 | 11768 | { |
| 11341 | - if ($direction == '') $direction = 0; |
|
| 11769 | + if ($direction == '') { |
|
| 11770 | + $direction = 0; |
|
| 11771 | + } |
|
| 11342 | 11772 | $direction_array = array(); |
| 11343 | 11773 | $temp_array = array(); |
| 11344 | 11774 | |
@@ -11439,7 +11869,9 @@ discard block |
||
| 11439 | 11869 | if (isset($result->AirlineFlightInfoResult)) |
| 11440 | 11870 | { |
| 11441 | 11871 | $registration = $result->AirlineFlightInfoResult->tailnumber; |
| 11442 | - } else return ''; |
|
| 11872 | + } else { |
|
| 11873 | + return ''; |
|
| 11874 | + } |
|
| 11443 | 11875 | |
| 11444 | 11876 | $registration = $this->convertAircraftRegistration($registration); |
| 11445 | 11877 | |
@@ -11473,7 +11905,9 @@ discard block |
||
| 11473 | 11905 | return $row['registration']; |
| 11474 | 11906 | } elseif ($source_type == 'flarm') { |
| 11475 | 11907 | return $this->getAircraftRegistrationBymodeS($aircraft_modes); |
| 11476 | - } else return ''; |
|
| 11908 | + } else { |
|
| 11909 | + return ''; |
|
| 11910 | + } |
|
| 11477 | 11911 | |
| 11478 | 11912 | } |
| 11479 | 11913 | |
@@ -11500,11 +11934,16 @@ discard block |
||
| 11500 | 11934 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 11501 | 11935 | $sth->closeCursor(); |
| 11502 | 11936 | if (count($row) > 0) { |
| 11503 | - if ($row['type_flight'] == null) return ''; |
|
| 11504 | - else return $row['type_flight']; |
|
| 11937 | + if ($row['type_flight'] == null) { |
|
| 11938 | + return ''; |
|
| 11939 | + } else { |
|
| 11940 | + return $row['type_flight']; |
|
| 11941 | + } |
|
| 11505 | 11942 | } elseif ($source_type == 'flarm') { |
| 11506 | 11943 | return $this->getAircraftTypeBymodeS($aircraft_modes); |
| 11507 | - } else return ''; |
|
| 11944 | + } else { |
|
| 11945 | + return ''; |
|
| 11946 | + } |
|
| 11508 | 11947 | |
| 11509 | 11948 | } |
| 11510 | 11949 | |
@@ -11522,7 +11961,9 @@ discard block |
||
| 11522 | 11961 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 11523 | 11962 | |
| 11524 | 11963 | $Connection = new Connection($this->db); |
| 11525 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 11964 | + if (!$Connection->tableExists('countries')) { |
|
| 11965 | + return ''; |
|
| 11966 | + } |
|
| 11526 | 11967 | |
| 11527 | 11968 | try { |
| 11528 | 11969 | /* |
@@ -11542,9 +11983,13 @@ discard block |
||
| 11542 | 11983 | $sth->closeCursor(); |
| 11543 | 11984 | if (count($row) > 0) { |
| 11544 | 11985 | return $row; |
| 11545 | - } else return ''; |
|
| 11986 | + } else { |
|
| 11987 | + return ''; |
|
| 11988 | + } |
|
| 11546 | 11989 | } catch (PDOException $e) { |
| 11547 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 11990 | + if (isset($globalDebug) && $globalDebug) { |
|
| 11991 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 11992 | + } |
|
| 11548 | 11993 | return ''; |
| 11549 | 11994 | } |
| 11550 | 11995 | |
@@ -11562,7 +12007,9 @@ discard block |
||
| 11562 | 12007 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
| 11563 | 12008 | |
| 11564 | 12009 | $Connection = new Connection($this->db); |
| 11565 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 12010 | + if (!$Connection->tableExists('countries')) { |
|
| 12011 | + return ''; |
|
| 12012 | + } |
|
| 11566 | 12013 | |
| 11567 | 12014 | try { |
| 11568 | 12015 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -11574,9 +12021,13 @@ discard block |
||
| 11574 | 12021 | $sth->closeCursor(); |
| 11575 | 12022 | if (count($row) > 0) { |
| 11576 | 12023 | return $row; |
| 11577 | - } else return ''; |
|
| 12024 | + } else { |
|
| 12025 | + return ''; |
|
| 12026 | + } |
|
| 11578 | 12027 | } catch (PDOException $e) { |
| 11579 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 12028 | + if (isset($globalDebug) && $globalDebug) { |
|
| 12029 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 12030 | + } |
|
| 11580 | 12031 | return ''; |
| 11581 | 12032 | } |
| 11582 | 12033 | |
@@ -11826,7 +12277,9 @@ discard block |
||
| 11826 | 12277 | { |
| 11827 | 12278 | global $globalBitlyAccessToken; |
| 11828 | 12279 | |
| 11829 | - if ($globalBitlyAccessToken == '') return $url; |
|
| 12280 | + if ($globalBitlyAccessToken == '') { |
|
| 12281 | + return $url; |
|
| 12282 | + } |
|
| 11830 | 12283 | |
| 11831 | 12284 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
| 11832 | 12285 | |
@@ -11975,7 +12428,9 @@ discard block |
||
| 11975 | 12428 | |
| 11976 | 12429 | |
| 11977 | 12430 | // routes |
| 11978 | - if ($globalDebug) print "Routes...\n"; |
|
| 12431 | + if ($globalDebug) { |
|
| 12432 | + print "Routes...\n"; |
|
| 12433 | + } |
|
| 11979 | 12434 | if ($globalDBdriver == 'mysql') { |
| 11980 | 12435 | $query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)"; |
| 11981 | 12436 | } else { |
@@ -11994,7 +12449,9 @@ discard block |
||
| 11994 | 12449 | } |
| 11995 | 12450 | } |
| 11996 | 12451 | |
| 11997 | - if ($globalDebug) print "Airlines...\n"; |
|
| 12452 | + if ($globalDebug) { |
|
| 12453 | + print "Airlines...\n"; |
|
| 12454 | + } |
|
| 11998 | 12455 | //airlines |
| 11999 | 12456 | if ($globalDBdriver == 'mysql') { |
| 12000 | 12457 | $query = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)"; |
@@ -12008,10 +12465,15 @@ discard block |
||
| 12008 | 12465 | if (is_numeric(substr($row['ident'], -1, 1))) |
| 12009 | 12466 | { |
| 12010 | 12467 | $fromsource = NULL; |
| 12011 | - if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 12012 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 12013 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 12014 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 12468 | + if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 12469 | + $fromsource = 'vatsim'; |
|
| 12470 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 12471 | + $fromsource = 'ivao'; |
|
| 12472 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 12473 | + $fromsource = 'vatsim'; |
|
| 12474 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 12475 | + $fromsource = 'ivao'; |
|
| 12476 | + } |
|
| 12015 | 12477 | $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
| 12016 | 12478 | if (isset($airline_array[0]['name'])) { |
| 12017 | 12479 | $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"; |
@@ -12021,13 +12483,17 @@ discard block |
||
| 12021 | 12483 | } |
| 12022 | 12484 | } |
| 12023 | 12485 | |
| 12024 | - if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n"; |
|
| 12486 | + if ($globalDebug) { |
|
| 12487 | + print "Remove Duplicate in aircraft_modes...\n"; |
|
| 12488 | + } |
|
| 12025 | 12489 | //duplicate modes |
| 12026 | 12490 | $query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL"; |
| 12027 | 12491 | $sth = $this->db->prepare($query); |
| 12028 | 12492 | $sth->execute(); |
| 12029 | 12493 | |
| 12030 | - if ($globalDebug) print "Aircraft...\n"; |
|
| 12494 | + if ($globalDebug) { |
|
| 12495 | + print "Aircraft...\n"; |
|
| 12496 | + } |
|
| 12031 | 12497 | //aircraft |
| 12032 | 12498 | if ($globalDBdriver == 'mysql') { |
| 12033 | 12499 | $query = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -12070,26 +12536,38 @@ discard block |
||
| 12070 | 12536 | if (isset($closestAirports[0])) { |
| 12071 | 12537 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
| 12072 | 12538 | $airport_icao = $closestAirports[0]['icao']; |
| 12073 | - if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12539 | + if ($globalDebug) { |
|
| 12540 | + echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12541 | + } |
|
| 12074 | 12542 | } elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') { |
| 12075 | 12543 | foreach ($closestAirports as $airport) { |
| 12076 | 12544 | if ($row['arrival_airport_icao'] == $airport['icao']) { |
| 12077 | 12545 | $airport_icao = $airport['icao']; |
| 12078 | - if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12546 | + if ($globalDebug) { |
|
| 12547 | + echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12548 | + } |
|
| 12079 | 12549 | break; |
| 12080 | 12550 | } |
| 12081 | 12551 | } |
| 12082 | 12552 | } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
| 12083 | 12553 | $airport_icao = $closestAirports[0]['icao']; |
| 12084 | - 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"; |
|
| 12554 | + if ($globalDebug) { |
|
| 12555 | + 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"; |
|
| 12556 | + } |
|
| 12085 | 12557 | } else { |
| 12086 | - if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 12558 | + if ($globalDebug) { |
|
| 12559 | + echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 12560 | + } |
|
| 12087 | 12561 | } |
| 12088 | 12562 | } else { |
| 12089 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 12563 | + if ($globalDebug) { |
|
| 12564 | + echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 12565 | + } |
|
| 12090 | 12566 | } |
| 12091 | 12567 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
| 12092 | - if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
|
| 12568 | + if ($globalDebug) { |
|
| 12569 | + echo "Updating airport to ".$airport_icao."...\n"; |
|
| 12570 | + } |
|
| 12093 | 12571 | $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
| 12094 | 12572 | $sthu = $this->db->prepare($update_query); |
| 12095 | 12573 | $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |