Skip to content

Commit

Permalink
Remove not need queries
Browse files Browse the repository at this point in the history
  • Loading branch information
Ysurac committed Nov 27, 2017
1 parent 389f09c commit 466cc81
Show file tree
Hide file tree
Showing 14 changed files with 19 additions and 18 deletions.
10 changes: 5 additions & 5 deletions airport-detailed.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
$page_url = $globalURL.'/airport/'.$airport_icao;

$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
if ($sort != '') {
$spotter_array = $Spotter->getSpotterDataByAirport($airport_icao,$limit_start.",".$absolute_difference, $sort);
} else {
$spotter_array = $Spotter->getSpotterDataByAirport($airport_icao,$limit_start.",".$absolute_difference, '');
}
$airport_array = $Spotter->getAllAirportInfo($airport_icao);

if (!empty($airport_array))
{
if ($sort != '') {
$spotter_array = $Spotter->getSpotterDataByAirport($airport_icao,$limit_start.",".$absolute_difference, $sort);
} else {
$spotter_array = $Spotter->getSpotterDataByAirport($airport_icao,$limit_start.",".$absolute_difference, '');
}

if (isset($globalMETAR) && $globalMETAR) {
$METAR = new METAR();
Expand Down
2 changes: 1 addition & 1 deletion airport-statistics-aircraft.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
$Spotter = new Spotter();

$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
$airport_array = $Spotter->getAllAirportInfo($airport);

if (!empty($airport_array))
{
//$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
$title = sprintf(_("Most Common Aircraft to/from %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']);
require_once('header.php');
print '<div class="select-item">';
Expand Down
2 changes: 1 addition & 1 deletion airport-statistics-airline-country.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
}
$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
$Spotter = new Spotter();
$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
$airport_array = $Spotter->getAllAirportInfo($airport);

if (!empty($airport_array))
{
//$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
$title = sprintf(_("Most Common Airlines by Country to/from %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']);
require_once('header.php');
print '<div class="select-item">';
Expand Down
2 changes: 1 addition & 1 deletion airport-statistics-airline.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
}
$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
$Spotter = new Spotter();
$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
$airport_array = $Spotter->getAllAirportInfo($airport);

if (!empty($airport_array))
{
//$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
$title = sprintf(_("Most Common Airlines to/from %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']);
require_once('header.php');
print '<div class="select-item">';
Expand Down
2 changes: 1 addition & 1 deletion airport-statistics-arrival-airport-country.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
}
$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
$Spotter = new Spotter();
$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
$airport_array = $Spotter->getAllAirportInfo($airport);

if (!empty($airport_array))
{
//$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
$title = sprintf(_("Most Common Arrival Airports by Country from %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']);
require_once('header.php');
print '<div class="select-item">';
Expand Down
2 changes: 1 addition & 1 deletion airport-statistics-arrival-airport.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
}
$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
$Spotter = new Spotter();
$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
$airport_array = $Spotter->getAllAirportInfo($airport);

if (!empty($airport_array))
{
//$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
$title = sprintf(_("Most Common Arrival Airports from %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']);
require_once('header.php');
print '<div class="select-item">';
Expand Down
2 changes: 1 addition & 1 deletion airport-statistics-departure-airport-country.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
}
$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
$Spotter = new Spotter();
$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
$airport_array = $Spotter->getAllAirportInfo($airport);

if (!empty($airport_array))
{
//$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
$title = sprintf(_("Most Common Departure Airports by Country to %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']);
require_once('header.php');
print '<div class="select-item">';
Expand Down
2 changes: 1 addition & 1 deletion airport-statistics-departure-airport.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
}
$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
$Spotter = new Spotter();
$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
$airport_array = $Spotter->getAllAirportInfo($airport);

if (!empty($airport_array))
{
//$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
$title = sprintf(_("Most Common Departure Airports to %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']);
require_once('header.php');
print '<div class="select-item">';
Expand Down
2 changes: 1 addition & 1 deletion airport-statistics-manufacturer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
}
$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
$Spotter = new Spotter();
$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
$airport_array = $Spotter->getAllAirportInfo($airport);

if (!empty($airport_array))
{
//$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
$title = sprintf(_("Most Common Aircraft Manufacturer to/from %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']);

require_once('header.php');
Expand Down
2 changes: 1 addition & 1 deletion airport-statistics-registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
}
$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
$Spotter = new Spotter();
$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
$airport_array = $Spotter->getAllAirportInfo($airport);

if (!empty($airport_array))
{
//$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
$title = sprintf(_("Most Common Aircraft by Registration to/from %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']);

require_once('header.php');
Expand Down
2 changes: 1 addition & 1 deletion airport-statistics-route.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
$Spotter = new Spotter();
$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
//$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
$airport_array = $Spotter->getAllAirportInfo($airport);

if (!empty($airport_array))
Expand Down
2 changes: 1 addition & 1 deletion airport-statistics-time.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
$Spotter = new Spotter();
$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
//$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
$airport_array = $Spotter->getAllAirportInfo($airport);

if (!empty($airport_array))
Expand Down
2 changes: 1 addition & 1 deletion airport.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
$page_url = $globalURL.'/airport/'.$airport;
$spotter_array = $Spotter->getSpotterDataByAirport($airport,$limit_start.",".$absolute_difference, $sort);
$airport_array = $Spotter->getAllAirportInfo($airport);

if (!empty($airport_array))
{
$spotter_array = $Spotter->getSpotterDataByAirport($airport,$limit_start.",".$absolute_difference, $sort);
$title = $airport_array[0]['city'].', '.$airport_array[0]['name'].' ('.$airport_array[0]['icao'].')';

require_once('header.php');
Expand Down
3 changes: 2 additions & 1 deletion require/class.Spotter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1731,7 +1731,8 @@ public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$
$orderby_query = " ORDER BY spotter_output.date DESC";
}

$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." AND (spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> 'NA') ".$orderby_query;
//$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." AND (spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> 'NA') ".$orderby_query;
$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query;
$spotter_array = $this->getDataFromDB($query, $query_values, $limit_query);

return $spotter_array;
Expand Down

0 comments on commit 466cc81

Please sign in to comment.