@@ -6,8 +6,8 @@ discard block |
||
| 6 | 6 | $title = _("Statistics").' - '._("Most common Airline by Country"); |
| 7 | 7 | if (!isset($filter_name)) $filter_name = ''; |
| 8 | 8 | require_once('header.php'); |
| 9 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
| 10 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
| 9 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
| 10 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
| 11 | 11 | include('statistics-sub-menu.php'); |
| 12 | 12 | |
| 13 | 13 | print '<script type="text/javascript" src="https://www.google.com/jsapi"></script> |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | </div> |
| 17 | 17 | <p>'._("Below are the <strong>Top 10</strong> countries that an airline belongs to.").'</p>'; |
| 18 | 18 | |
| 19 | -$airline_array = $Stats->countAllAirlineCountries(true,$filter_name,$year,$month); |
|
| 19 | +$airline_array = $Stats->countAllAirlineCountries(true, $filter_name, $year, $month); |
|
| 20 | 20 | if (count($airline_array) > 0) { |
| 21 | 21 | print '<div id="chartCountry" class="chart" width="100%"></div> |
| 22 | 22 | <script> |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | var data = google.visualization.arrayToDataTable([ |
| 27 | 27 | ["'._("Country").'", "'._("# of times").'"], '; |
| 28 | 28 | $country_data = ''; |
| 29 | -foreach($airline_array as $airline_item) |
|
| 29 | +foreach ($airline_array as $airline_item) |
|
| 30 | 30 | { |
| 31 | 31 | $country_data .= '[ "'.$airline_item['airline_country'].'",'.$airline_item['airline_country_count'].'],'; |
| 32 | 32 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | print '</thead>'; |
| 61 | 61 | print '<tbody>'; |
| 62 | 62 | $i = 1; |
| 63 | - foreach($airline_array as $airline_item) |
|
| 63 | + foreach ($airline_array as $airline_item) |
|
| 64 | 64 | { |
| 65 | 65 | print '<tr>'; |
| 66 | 66 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -4,7 +4,9 @@ |
||
| 4 | 4 | require_once('require/class.Language.php'); |
| 5 | 5 | $Stats = new Stats(); |
| 6 | 6 | $title = _("Statistics").' - '._("Most common Airline by Country"); |
| 7 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 7 | +if (!isset($filter_name)) { |
|
| 8 | + $filter_name = ''; |
|
| 9 | +} |
|
| 8 | 10 | require_once('header.php'); |
| 9 | 11 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 10 | 12 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -6,19 +6,19 @@ discard block |
||
| 6 | 6 | $title = _("Statistics").' - '._("Most common owners"); |
| 7 | 7 | |
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 10 | 10 | if ($airline_icao == 'all') { |
| 11 | 11 | unset($_COOKIE['stats_airline_icao']); |
| 12 | - setcookie('stats_airline_icao', '', time()-3600); |
|
| 12 | + setcookie('stats_airline_icao', '', time() - 3600); |
|
| 13 | 13 | $airline_icao = ''; |
| 14 | 14 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | 15 | $airline_icao = $_COOKIE['stats_airline_icao']; |
| 16 | 16 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | 17 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
| 18 | 18 | } |
| 19 | -setcookie('stats_airline_icao',$airline_icao); |
|
| 20 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
| 21 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
| 19 | +setcookie('stats_airline_icao', $airline_icao); |
|
| 20 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
| 21 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
| 22 | 22 | require_once('header.php'); |
| 23 | 23 | include('statistics-sub-menu.php'); |
| 24 | 24 | print '<script type="text/javascript" src="https://www.google.com/jsapi"></script> |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | </div> |
| 28 | 28 | <p>'._("Below are the <strong>Top 10</strong> most common owner.").'</p>'; |
| 29 | 29 | |
| 30 | - $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
|
| 30 | + $owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month); |
|
| 31 | 31 | print '<div id="chart" class="chart" width="100%"></div> |
| 32 | 32 | <script> |
| 33 | 33 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | var data = google.visualization.arrayToDataTable([ |
| 37 | 37 | ["'._("Owner").'", "'._("# of times").'"], '; |
| 38 | 38 | $owner_data = ''; |
| 39 | - foreach($owner_array as $owner_item) |
|
| 39 | + foreach ($owner_array as $owner_item) |
|
| 40 | 40 | { |
| 41 | 41 | $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
| 42 | 42 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | print '</thead>'; |
| 70 | 70 | print '<tbody>'; |
| 71 | 71 | $i = 1; |
| 72 | - foreach($owner_array as $owner_item) |
|
| 72 | + foreach ($owner_array as $owner_item) |
|
| 73 | 73 | { |
| 74 | 74 | print '<tr>'; |
| 75 | 75 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -5,7 +5,9 @@ discard block |
||
| 5 | 5 | $Stats = new Stats(); |
| 6 | 6 | $title = _("Statistics").' - '._("Most common owners"); |
| 7 | 7 | |
| 8 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 8 | +if (!isset($filter_name)) { |
|
| 9 | + $filter_name = ''; |
|
| 10 | +} |
|
| 9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 12 | if ($airline_icao == 'all') { |
| 11 | 13 | unset($_COOKIE['stats_airline_icao']); |
@@ -14,8 +16,10 @@ discard block |
||
| 14 | 16 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | 17 | $airline_icao = $_COOKIE['stats_airline_icao']; |
| 16 | 18 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 18 | -} |
|
| 19 | + if (isset($globalFilter['airline'])) { |
|
| 20 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 21 | + } |
|
| 22 | + } |
|
| 19 | 23 | setcookie('stats_airline_icao',$airline_icao); |
| 20 | 24 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 21 | 25 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -6,19 +6,19 @@ discard block |
||
| 6 | 6 | $title = _("Statistics").' - '._("Most common Pilots"); |
| 7 | 7 | |
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 10 | 10 | if ($airline_icao == 'all') { |
| 11 | 11 | unset($_COOKIE['stats_airline_icao']); |
| 12 | - setcookie('stats_airline_icao', '', time()-3600); |
|
| 12 | + setcookie('stats_airline_icao', '', time() - 3600); |
|
| 13 | 13 | $airline_icao = ''; |
| 14 | 14 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | 15 | $airline_icao = $_COOKIE['stats_airline_icao']; |
| 16 | 16 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | 17 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
| 18 | 18 | } |
| 19 | -setcookie('stats_airline_icao',$airline_icao); |
|
| 20 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
| 21 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
| 19 | +setcookie('stats_airline_icao', $airline_icao); |
|
| 20 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
| 21 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
| 22 | 22 | require_once('header.php'); |
| 23 | 23 | include('statistics-sub-menu.php'); |
| 24 | 24 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | </div> |
| 29 | 29 | <p>'._("Below are the <strong>Top 10</strong> most common pilot.").'</p>'; |
| 30 | 30 | |
| 31 | - $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
|
| 31 | + $pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month); |
|
| 32 | 32 | print '<div id="chart" class="chart" width="100%"></div> |
| 33 | 33 | <script> |
| 34 | 34 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | var data = google.visualization.arrayToDataTable([ |
| 38 | 38 | ["'._("Pilot").'", "'._("# of times").'"], '; |
| 39 | 39 | $pilot_data = ''; |
| 40 | - foreach($pilot_array as $pilot_item) |
|
| 40 | + foreach ($pilot_array as $pilot_item) |
|
| 41 | 41 | { |
| 42 | 42 | $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
| 43 | 43 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | print '</thead>'; |
| 71 | 71 | print '<tbody>'; |
| 72 | 72 | $i = 1; |
| 73 | - foreach($pilot_array as $pilot_item) |
|
| 73 | + foreach ($pilot_array as $pilot_item) |
|
| 74 | 74 | { |
| 75 | 75 | print '<tr>'; |
| 76 | 76 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -5,7 +5,9 @@ discard block |
||
| 5 | 5 | $Stats = new Stats(); |
| 6 | 6 | $title = _("Statistics").' - '._("Most common Pilots"); |
| 7 | 7 | |
| 8 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 8 | +if (!isset($filter_name)) { |
|
| 9 | + $filter_name = ''; |
|
| 10 | +} |
|
| 9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 12 | if ($airline_icao == 'all') { |
| 11 | 13 | unset($_COOKIE['stats_airline_icao']); |
@@ -14,8 +16,10 @@ discard block |
||
| 14 | 16 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | 17 | $airline_icao = $_COOKIE['stats_airline_icao']; |
| 16 | 18 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 18 | -} |
|
| 19 | + if (isset($globalFilter['airline'])) { |
|
| 20 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 21 | + } |
|
| 22 | + } |
|
| 19 | 23 | setcookie('stats_airline_icao',$airline_icao); |
| 20 | 24 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 21 | 25 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -17,14 +17,14 @@ discard block |
||
| 17 | 17 | $this->db = $Connection->db(); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - public function addLastStatsUpdate($type,$stats_date) { |
|
| 20 | + public function addLastStatsUpdate($type, $stats_date) { |
|
| 21 | 21 | $query = "DELETE FROM config WHERE name = :type; |
| 22 | 22 | INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
| 23 | - $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
| 23 | + $query_values = array('type' => $type, ':stats_date' => $stats_date); |
|
| 24 | 24 | try { |
| 25 | 25 | $sth = $this->db->prepare($query); |
| 26 | 26 | $sth->execute($query_values); |
| 27 | - } catch(PDOException $e) { |
|
| 27 | + } catch (PDOException $e) { |
|
| 28 | 28 | return "error : ".$e->getMessage(); |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | try { |
| 35 | 35 | $sth = $this->db->prepare($query); |
| 36 | 36 | $sth->execute(array(':type' => $type)); |
| 37 | - } catch(PDOException $e) { |
|
| 37 | + } catch (PDOException $e) { |
|
| 38 | 38 | echo "error : ".$e->getMessage(); |
| 39 | 39 | } |
| 40 | 40 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | try { |
| 55 | 55 | $sth = $this->db->prepare($query); |
| 56 | 56 | $sth->execute(array(':filter_name' => $filter_name)); |
| 57 | - } catch(PDOException $e) { |
|
| 57 | + } catch (PDOException $e) { |
|
| 58 | 58 | return "error : ".$e->getMessage(); |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | try { |
| 65 | 65 | $sth = $this->db->prepare($query); |
| 66 | 66 | $sth->execute(); |
| 67 | - } catch(PDOException $e) { |
|
| 67 | + } catch (PDOException $e) { |
|
| 68 | 68 | return "error : ".$e->getMessage(); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | try { |
| 73 | 73 | $sth = $this->db->prepare($query); |
| 74 | 74 | $sth->execute(array(':filter_name' => $filter_name)); |
| 75 | - } catch(PDOException $e) { |
|
| 75 | + } catch (PDOException $e) { |
|
| 76 | 76 | return "error : ".$e->getMessage(); |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -82,43 +82,43 @@ discard block |
||
| 82 | 82 | try { |
| 83 | 83 | $sth = $this->db->prepare($query); |
| 84 | 84 | $sth->execute(array(':filter_name' => $filter_name)); |
| 85 | - } catch(PDOException $e) { |
|
| 85 | + } catch (PDOException $e) { |
|
| 86 | 86 | echo "error : ".$e->getMessage(); |
| 87 | 87 | } |
| 88 | 88 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 89 | 89 | return $all; |
| 90 | 90 | } |
| 91 | - public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
|
| 91 | + public function getAllAircraftTypes($stats_airline = '', $filter_name = '') { |
|
| 92 | 92 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 93 | 93 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
| 94 | 94 | try { |
| 95 | 95 | $sth = $this->db->prepare($query); |
| 96 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 97 | - } catch(PDOException $e) { |
|
| 96 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 97 | + } catch (PDOException $e) { |
|
| 98 | 98 | echo "error : ".$e->getMessage(); |
| 99 | 99 | } |
| 100 | 100 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 101 | 101 | return $all; |
| 102 | 102 | } |
| 103 | - public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
|
| 103 | + public function getAllManufacturers($stats_airline = '', $filter_name = '') { |
|
| 104 | 104 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 105 | 105 | $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"; |
| 106 | 106 | try { |
| 107 | 107 | $sth = $this->db->prepare($query); |
| 108 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 109 | - } catch(PDOException $e) { |
|
| 108 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 109 | + } catch (PDOException $e) { |
|
| 110 | 110 | echo "error : ".$e->getMessage(); |
| 111 | 111 | } |
| 112 | 112 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 113 | 113 | return $all; |
| 114 | 114 | } |
| 115 | - public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
|
| 115 | + public function getAllAirportNames($stats_airline = '', $filter_name = '') { |
|
| 116 | 116 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 117 | 117 | $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"; |
| 118 | 118 | try { |
| 119 | 119 | $sth = $this->db->prepare($query); |
| 120 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 121 | - } catch(PDOException $e) { |
|
| 120 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 121 | + } catch (PDOException $e) { |
|
| 122 | 122 | echo "error : ".$e->getMessage(); |
| 123 | 123 | } |
| 124 | 124 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
| 129 | - public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
| 129 | + public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 130 | 130 | global $globalStatsFilters; |
| 131 | 131 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 132 | 132 | if ($year == '' && $month == '') { |
@@ -134,8 +134,8 @@ discard block |
||
| 134 | 134 | 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"; |
| 135 | 135 | try { |
| 136 | 136 | $sth = $this->db->prepare($query); |
| 137 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 138 | - } catch(PDOException $e) { |
|
| 137 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 138 | + } catch (PDOException $e) { |
|
| 139 | 139 | echo "error : ".$e->getMessage(); |
| 140 | 140 | } |
| 141 | 141 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -143,14 +143,14 @@ discard block |
||
| 143 | 143 | if (empty($all)) { |
| 144 | 144 | $filters = array('airlines' => array($stats_airline)); |
| 145 | 145 | if ($filter_name != '') { |
| 146 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 146 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 147 | 147 | } |
| 148 | 148 | $Spotter = new Spotter($this->db); |
| 149 | - $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month); |
|
| 149 | + $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters, $year, $month); |
|
| 150 | 150 | } |
| 151 | 151 | return $all; |
| 152 | 152 | } |
| 153 | - public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
|
| 153 | + public function countAllAirlineCountries($limit = true, $filter_name = '', $year = '', $month = '') { |
|
| 154 | 154 | global $globalStatsFilters; |
| 155 | 155 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 156 | 156 | if ($year == '' && $month == '') { |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | try { |
| 160 | 160 | $sth = $this->db->prepare($query); |
| 161 | 161 | $sth->execute(array(':filter_name' => $filter_name)); |
| 162 | - } catch(PDOException $e) { |
|
| 162 | + } catch (PDOException $e) { |
|
| 163 | 163 | echo "error : ".$e->getMessage(); |
| 164 | 164 | } |
| 165 | 165 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -168,13 +168,13 @@ discard block |
||
| 168 | 168 | $Spotter = new Spotter($this->db); |
| 169 | 169 | $filters = array(); |
| 170 | 170 | if ($filter_name != '') { |
| 171 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 171 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 172 | 172 | } |
| 173 | - $all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month); |
|
| 173 | + $all = $Spotter->countAllAirlineCountries($limit, $filters, $year, $month); |
|
| 174 | 174 | } |
| 175 | 175 | return $all; |
| 176 | 176 | } |
| 177 | - public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
| 177 | + public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 178 | 178 | global $globalStatsFilters; |
| 179 | 179 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 180 | 180 | if ($year == '' && $month == '') { |
@@ -182,8 +182,8 @@ discard block |
||
| 182 | 182 | 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"; |
| 183 | 183 | try { |
| 184 | 184 | $sth = $this->db->prepare($query); |
| 185 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 186 | - } catch(PDOException $e) { |
|
| 185 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 186 | + } catch (PDOException $e) { |
|
| 187 | 187 | echo "error : ".$e->getMessage(); |
| 188 | 188 | } |
| 189 | 189 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -191,15 +191,15 @@ discard block |
||
| 191 | 191 | if (empty($all)) { |
| 192 | 192 | $filters = array('airlines' => array($stats_airline)); |
| 193 | 193 | if ($filter_name != '') { |
| 194 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 194 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 195 | 195 | } |
| 196 | 196 | $Spotter = new Spotter($this->db); |
| 197 | - $all = $Spotter->countAllAircraftManufacturers($filters,$year,$month); |
|
| 197 | + $all = $Spotter->countAllAircraftManufacturers($filters, $year, $month); |
|
| 198 | 198 | } |
| 199 | 199 | return $all; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
| 202 | + public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 203 | 203 | global $globalStatsFilters; |
| 204 | 204 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 205 | 205 | if ($year == '' && $month == '') { |
@@ -207,8 +207,8 @@ discard block |
||
| 207 | 207 | else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
| 208 | 208 | try { |
| 209 | 209 | $sth = $this->db->prepare($query); |
| 210 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 211 | - } catch(PDOException $e) { |
|
| 210 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 211 | + } catch (PDOException $e) { |
|
| 212 | 212 | echo "error : ".$e->getMessage(); |
| 213 | 213 | } |
| 214 | 214 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -216,10 +216,10 @@ discard block |
||
| 216 | 216 | if (empty($all)) { |
| 217 | 217 | $filters = array('airlines' => array($stats_airline)); |
| 218 | 218 | if ($filter_name != '') { |
| 219 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 219 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 220 | 220 | } |
| 221 | 221 | $Spotter = new Spotter($this->db); |
| 222 | - $all = $Spotter->countAllArrivalCountries($limit,$filters,$year,$month); |
|
| 222 | + $all = $Spotter->countAllArrivalCountries($limit, $filters, $year, $month); |
|
| 223 | 223 | } |
| 224 | 224 | return $all; |
| 225 | 225 | } |
@@ -230,23 +230,23 @@ discard block |
||
| 230 | 230 | else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
| 231 | 231 | try { |
| 232 | 232 | $sth = $this->db->prepare($query); |
| 233 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 234 | - } catch(PDOException $e) { |
|
| 233 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 234 | + } catch (PDOException $e) { |
|
| 235 | 235 | echo "error : ".$e->getMessage(); |
| 236 | 236 | } |
| 237 | 237 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 238 | 238 | if (empty($all)) { |
| 239 | 239 | $filters = array('airlines' => array($stats_airline)); |
| 240 | 240 | if ($filter_name != '') { |
| 241 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 241 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 242 | 242 | } |
| 243 | 243 | $Spotter = new Spotter($this->db); |
| 244 | - $all = $Spotter->countAllDepartureCountries($filters,$year,$month); |
|
| 244 | + $all = $Spotter->countAllDepartureCountries($filters, $year, $month); |
|
| 245 | 245 | } |
| 246 | 246 | return $all; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
|
| 249 | + public function countAllAirlines($limit = true, $filter_name = '', $year = '', $month = '') { |
|
| 250 | 250 | global $globalStatsFilters; |
| 251 | 251 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 252 | 252 | if ($year == '' && $month == '') { |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | try { |
| 256 | 256 | $sth = $this->db->prepare($query); |
| 257 | 257 | $sth->execute(array(':filter_name' => $filter_name)); |
| 258 | - } catch(PDOException $e) { |
|
| 258 | + } catch (PDOException $e) { |
|
| 259 | 259 | echo "error : ".$e->getMessage(); |
| 260 | 260 | } |
| 261 | 261 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -264,14 +264,14 @@ discard block |
||
| 264 | 264 | $Spotter = new Spotter($this->db); |
| 265 | 265 | $filters = array(); |
| 266 | 266 | if ($filter_name != '') { |
| 267 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 267 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - $all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month); |
|
| 270 | + $all = $Spotter->countAllAirlines($limit, 0, '', $filters, $year, $month); |
|
| 271 | 271 | } |
| 272 | 272 | return $all; |
| 273 | 273 | } |
| 274 | - public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
| 274 | + public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 275 | 275 | global $globalStatsFilters; |
| 276 | 276 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 277 | 277 | if ($year == '' && $month == '') { |
@@ -279,8 +279,8 @@ discard block |
||
| 279 | 279 | 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"; |
| 280 | 280 | try { |
| 281 | 281 | $sth = $this->db->prepare($query); |
| 282 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 283 | - } catch(PDOException $e) { |
|
| 282 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 283 | + } catch (PDOException $e) { |
|
| 284 | 284 | echo "error : ".$e->getMessage(); |
| 285 | 285 | } |
| 286 | 286 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -288,14 +288,14 @@ discard block |
||
| 288 | 288 | if (empty($all)) { |
| 289 | 289 | $filters = array('airlines' => array($stats_airline)); |
| 290 | 290 | if ($filter_name != '') { |
| 291 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 291 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 292 | 292 | } |
| 293 | 293 | $Spotter = new Spotter($this->db); |
| 294 | - $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters,$year,$month); |
|
| 294 | + $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters, $year, $month); |
|
| 295 | 295 | } |
| 296 | 296 | return $all; |
| 297 | 297 | } |
| 298 | - public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
| 298 | + public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 299 | 299 | global $globalStatsFilters; |
| 300 | 300 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 301 | 301 | if ($year == '' && $month == '') { |
@@ -303,8 +303,8 @@ discard block |
||
| 303 | 303 | 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"; |
| 304 | 304 | try { |
| 305 | 305 | $sth = $this->db->prepare($query); |
| 306 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 307 | - } catch(PDOException $e) { |
|
| 306 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 307 | + } catch (PDOException $e) { |
|
| 308 | 308 | echo "error : ".$e->getMessage(); |
| 309 | 309 | } |
| 310 | 310 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -312,14 +312,14 @@ discard block |
||
| 312 | 312 | if (empty($all)) { |
| 313 | 313 | $filters = array('airlines' => array($stats_airline)); |
| 314 | 314 | if ($filter_name != '') { |
| 315 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 315 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 316 | 316 | } |
| 317 | 317 | $Spotter = new Spotter($this->db); |
| 318 | - $all = $Spotter->countAllCallsigns($limit,0,'',$filters,$year,$month); |
|
| 318 | + $all = $Spotter->countAllCallsigns($limit, 0, '', $filters, $year, $month); |
|
| 319 | 319 | } |
| 320 | 320 | return $all; |
| 321 | 321 | } |
| 322 | - public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
| 322 | + public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 323 | 323 | $Connection = new Connection(); |
| 324 | 324 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 325 | 325 | if ($Connection->tableExists('countries')) { |
@@ -328,8 +328,8 @@ discard block |
||
| 328 | 328 | 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"; |
| 329 | 329 | try { |
| 330 | 330 | $sth = $this->db->prepare($query); |
| 331 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 332 | - } catch(PDOException $e) { |
|
| 331 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 332 | + } catch (PDOException $e) { |
|
| 333 | 333 | echo "error : ".$e->getMessage(); |
| 334 | 334 | } |
| 335 | 335 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | return array(); |
| 346 | 346 | } |
| 347 | 347 | } |
| 348 | - public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
|
| 348 | + public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 349 | 349 | global $globalStatsFilters; |
| 350 | 350 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 351 | 351 | if ($year == '' && $month == '') { |
@@ -353,8 +353,8 @@ discard block |
||
| 353 | 353 | 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"; |
| 354 | 354 | try { |
| 355 | 355 | $sth = $this->db->prepare($query); |
| 356 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 357 | - } catch(PDOException $e) { |
|
| 356 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 357 | + } catch (PDOException $e) { |
|
| 358 | 358 | echo "error : ".$e->getMessage(); |
| 359 | 359 | } |
| 360 | 360 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -362,15 +362,15 @@ discard block |
||
| 362 | 362 | if (empty($all)) { |
| 363 | 363 | $filters = array('airlines' => array($stats_airline)); |
| 364 | 364 | if ($filter_name != '') { |
| 365 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 365 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 366 | 366 | } |
| 367 | 367 | $Spotter = new Spotter($this->db); |
| 368 | - $all = $Spotter->countAllPilots($limit,0,'',$filters,$year,$month); |
|
| 368 | + $all = $Spotter->countAllPilots($limit, 0, '', $filters, $year, $month); |
|
| 369 | 369 | } |
| 370 | 370 | return $all; |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
| 373 | + public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 374 | 374 | global $globalStatsFilters; |
| 375 | 375 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 376 | 376 | if ($year == '' && $month == '') { |
@@ -378,8 +378,8 @@ discard block |
||
| 378 | 378 | 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"; |
| 379 | 379 | try { |
| 380 | 380 | $sth = $this->db->prepare($query); |
| 381 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 382 | - } catch(PDOException $e) { |
|
| 381 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 382 | + } catch (PDOException $e) { |
|
| 383 | 383 | echo "error : ".$e->getMessage(); |
| 384 | 384 | } |
| 385 | 385 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -387,14 +387,14 @@ discard block |
||
| 387 | 387 | if (empty($all)) { |
| 388 | 388 | $filters = array('airlines' => array($stats_airline)); |
| 389 | 389 | if ($filter_name != '') { |
| 390 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 390 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 391 | 391 | } |
| 392 | 392 | $Spotter = new Spotter($this->db); |
| 393 | - $all = $Spotter->countAllOwners($limit,0,'',$filters,$year,$month); |
|
| 393 | + $all = $Spotter->countAllOwners($limit, 0, '', $filters, $year, $month); |
|
| 394 | 394 | } |
| 395 | 395 | return $all; |
| 396 | 396 | } |
| 397 | - public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
| 397 | + public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 398 | 398 | global $globalStatsFilters; |
| 399 | 399 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 400 | 400 | if ($year == '' && $month == '') { |
@@ -402,8 +402,8 @@ discard block |
||
| 402 | 402 | else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
| 403 | 403 | try { |
| 404 | 404 | $sth = $this->db->prepare($query); |
| 405 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 406 | - } catch(PDOException $e) { |
|
| 405 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 406 | + } catch (PDOException $e) { |
|
| 407 | 407 | echo "error : ".$e->getMessage(); |
| 408 | 408 | } |
| 409 | 409 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -411,11 +411,11 @@ discard block |
||
| 411 | 411 | if (empty($all)) { |
| 412 | 412 | $filters = array('airlines' => array($stats_airline)); |
| 413 | 413 | if ($filter_name != '') { |
| 414 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 414 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 415 | 415 | } |
| 416 | 416 | $Spotter = new Spotter($this->db); |
| 417 | - $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters,$year,$month); |
|
| 418 | - $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters,$year,$month); |
|
| 417 | + $pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters, $year, $month); |
|
| 418 | + $dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters, $year, $month); |
|
| 419 | 419 | $all = array(); |
| 420 | 420 | foreach ($pall as $value) { |
| 421 | 421 | $icao = $value['airport_departure_icao']; |
@@ -432,11 +432,11 @@ discard block |
||
| 432 | 432 | foreach ($all as $key => $row) { |
| 433 | 433 | $count[$key] = $row['airport_departure_icao_count']; |
| 434 | 434 | } |
| 435 | - array_multisort($count,SORT_DESC,$all); |
|
| 435 | + array_multisort($count, SORT_DESC, $all); |
|
| 436 | 436 | } |
| 437 | 437 | return $all; |
| 438 | 438 | } |
| 439 | - public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
| 439 | + public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 440 | 440 | global $globalStatsFilters; |
| 441 | 441 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 442 | 442 | if ($year == '' && $month == '') { |
@@ -444,8 +444,8 @@ discard block |
||
| 444 | 444 | else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
| 445 | 445 | try { |
| 446 | 446 | $sth = $this->db->prepare($query); |
| 447 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 448 | - } catch(PDOException $e) { |
|
| 447 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 448 | + } catch (PDOException $e) { |
|
| 449 | 449 | echo "error : ".$e->getMessage(); |
| 450 | 450 | } |
| 451 | 451 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -453,11 +453,11 @@ discard block |
||
| 453 | 453 | if (empty($all)) { |
| 454 | 454 | $filters = array('airlines' => array($stats_airline)); |
| 455 | 455 | if ($filter_name != '') { |
| 456 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 456 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 457 | 457 | } |
| 458 | 458 | $Spotter = new Spotter($this->db); |
| 459 | - $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters,$year,$month); |
|
| 460 | - $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters,$year,$month); |
|
| 459 | + $pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters, $year, $month); |
|
| 460 | + $dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters, $year, $month); |
|
| 461 | 461 | $all = array(); |
| 462 | 462 | foreach ($pall as $value) { |
| 463 | 463 | $icao = $value['airport_arrival_icao']; |
@@ -474,12 +474,12 @@ discard block |
||
| 474 | 474 | foreach ($all as $key => $row) { |
| 475 | 475 | $count[$key] = $row['airport_arrival_icao_count']; |
| 476 | 476 | } |
| 477 | - array_multisort($count,SORT_DESC,$all); |
|
| 477 | + array_multisort($count, SORT_DESC, $all); |
|
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | return $all; |
| 481 | 481 | } |
| 482 | - public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
|
| 482 | + public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') { |
|
| 483 | 483 | global $globalDBdriver, $globalStatsFilters; |
| 484 | 484 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 485 | 485 | if ($globalDBdriver == 'mysql') { |
@@ -489,18 +489,18 @@ discard block |
||
| 489 | 489 | 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"; |
| 490 | 490 | 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"; |
| 491 | 491 | } |
| 492 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 492 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 493 | 493 | try { |
| 494 | 494 | $sth = $this->db->prepare($query); |
| 495 | 495 | $sth->execute($query_data); |
| 496 | - } catch(PDOException $e) { |
|
| 496 | + } catch (PDOException $e) { |
|
| 497 | 497 | echo "error : ".$e->getMessage(); |
| 498 | 498 | } |
| 499 | 499 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 500 | 500 | if (empty($all)) { |
| 501 | 501 | $filters = array('airlines' => array($stats_airline)); |
| 502 | 502 | if ($filter_name != '') { |
| 503 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 503 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 504 | 504 | } |
| 505 | 505 | $Spotter = new Spotter($this->db); |
| 506 | 506 | $all = $Spotter->countAllMonthsLastYear($filters); |
@@ -509,29 +509,29 @@ discard block |
||
| 509 | 509 | return $all; |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | - public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
|
| 512 | + public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') { |
|
| 513 | 513 | global $globalStatsFilters; |
| 514 | 514 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 515 | 515 | $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"; |
| 516 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 516 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 517 | 517 | try { |
| 518 | 518 | $sth = $this->db->prepare($query); |
| 519 | 519 | $sth->execute($query_data); |
| 520 | - } catch(PDOException $e) { |
|
| 520 | + } catch (PDOException $e) { |
|
| 521 | 521 | echo "error : ".$e->getMessage(); |
| 522 | 522 | } |
| 523 | 523 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 524 | 524 | if (empty($all)) { |
| 525 | 525 | $filters = array('airlines' => array($stats_airline)); |
| 526 | 526 | if ($filter_name != '') { |
| 527 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 527 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 528 | 528 | } |
| 529 | 529 | $Spotter = new Spotter($this->db); |
| 530 | 530 | $all = $Spotter->countAllDatesLastMonth($filters); |
| 531 | 531 | } |
| 532 | 532 | return $all; |
| 533 | 533 | } |
| 534 | - public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
|
| 534 | + public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') { |
|
| 535 | 535 | global $globalDBdriver, $globalStatsFilters; |
| 536 | 536 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 537 | 537 | if ($globalDBdriver == 'mysql') { |
@@ -539,40 +539,40 @@ discard block |
||
| 539 | 539 | } else { |
| 540 | 540 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 541 | 541 | } |
| 542 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 542 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 543 | 543 | try { |
| 544 | 544 | $sth = $this->db->prepare($query); |
| 545 | 545 | $sth->execute($query_data); |
| 546 | - } catch(PDOException $e) { |
|
| 546 | + } catch (PDOException $e) { |
|
| 547 | 547 | echo "error : ".$e->getMessage(); |
| 548 | 548 | } |
| 549 | 549 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 550 | 550 | if (empty($all)) { |
| 551 | 551 | $filters = array('airlines' => array($stats_airline)); |
| 552 | 552 | if ($filter_name != '') { |
| 553 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 553 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 554 | 554 | } |
| 555 | 555 | $Spotter = new Spotter($this->db); |
| 556 | 556 | $all = $Spotter->countAllDatesLast7Days($filters); |
| 557 | 557 | } |
| 558 | 558 | return $all; |
| 559 | 559 | } |
| 560 | - public function countAllDates($stats_airline = '',$filter_name = '') { |
|
| 560 | + public function countAllDates($stats_airline = '', $filter_name = '') { |
|
| 561 | 561 | global $globalStatsFilters; |
| 562 | 562 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 563 | 563 | $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"; |
| 564 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 564 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 565 | 565 | try { |
| 566 | 566 | $sth = $this->db->prepare($query); |
| 567 | 567 | $sth->execute($query_data); |
| 568 | - } catch(PDOException $e) { |
|
| 568 | + } catch (PDOException $e) { |
|
| 569 | 569 | echo "error : ".$e->getMessage(); |
| 570 | 570 | } |
| 571 | 571 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 572 | 572 | if (empty($all)) { |
| 573 | 573 | $filters = array('airlines' => array($stats_airline)); |
| 574 | 574 | if ($filter_name != '') { |
| 575 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 575 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 576 | 576 | } |
| 577 | 577 | $Spotter = new Spotter($this->db); |
| 578 | 578 | $all = $Spotter->countAllDates($filters); |
@@ -587,35 +587,35 @@ discard block |
||
| 587 | 587 | try { |
| 588 | 588 | $sth = $this->db->prepare($query); |
| 589 | 589 | $sth->execute($query_data); |
| 590 | - } catch(PDOException $e) { |
|
| 590 | + } catch (PDOException $e) { |
|
| 591 | 591 | echo "error : ".$e->getMessage(); |
| 592 | 592 | } |
| 593 | 593 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 594 | 594 | if (empty($all)) { |
| 595 | 595 | $filters = array(); |
| 596 | 596 | if ($filter_name != '') { |
| 597 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 597 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 598 | 598 | } |
| 599 | 599 | $Spotter = new Spotter($this->db); |
| 600 | 600 | $all = $Spotter->countAllDatesByAirlines($filters); |
| 601 | 601 | } |
| 602 | 602 | return $all; |
| 603 | 603 | } |
| 604 | - public function countAllMonths($stats_airline = '',$filter_name = '') { |
|
| 604 | + public function countAllMonths($stats_airline = '', $filter_name = '') { |
|
| 605 | 605 | global $globalStatsFilters; |
| 606 | 606 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 607 | 607 | $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"; |
| 608 | 608 | try { |
| 609 | 609 | $sth = $this->db->prepare($query); |
| 610 | 610 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
| 611 | - } catch(PDOException $e) { |
|
| 611 | + } catch (PDOException $e) { |
|
| 612 | 612 | echo "error : ".$e->getMessage(); |
| 613 | 613 | } |
| 614 | 614 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 615 | 615 | if (empty($all)) { |
| 616 | 616 | $filters = array('airlines' => array($stats_airline)); |
| 617 | 617 | if ($filter_name != '') { |
| 618 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 618 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 619 | 619 | } |
| 620 | 620 | $Spotter = new Spotter($this->db); |
| 621 | 621 | $all = $Spotter->countAllMonths($filters); |
@@ -629,21 +629,21 @@ discard block |
||
| 629 | 629 | try { |
| 630 | 630 | $sth = $this->db->prepare($query); |
| 631 | 631 | $sth->execute(array(':filter_name' => $filter_name)); |
| 632 | - } catch(PDOException $e) { |
|
| 632 | + } catch (PDOException $e) { |
|
| 633 | 633 | echo "error : ".$e->getMessage(); |
| 634 | 634 | } |
| 635 | 635 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 636 | 636 | if (empty($all)) { |
| 637 | 637 | $filters = array(); |
| 638 | 638 | if ($filter_name != '') { |
| 639 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 639 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 640 | 640 | } |
| 641 | 641 | $Spotter = new Spotter($this->db); |
| 642 | 642 | $all = $Spotter->countAllMilitaryMonths($filters); |
| 643 | 643 | } |
| 644 | 644 | return $all; |
| 645 | 645 | } |
| 646 | - public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
|
| 646 | + public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') { |
|
| 647 | 647 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
| 648 | 648 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 649 | 649 | 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"; |
@@ -660,82 +660,82 @@ discard block |
||
| 660 | 660 | try { |
| 661 | 661 | $sth = $this->db->prepare($query); |
| 662 | 662 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
| 663 | - } catch(PDOException $e) { |
|
| 663 | + } catch (PDOException $e) { |
|
| 664 | 664 | echo "error : ".$e->getMessage(); |
| 665 | 665 | } |
| 666 | 666 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 667 | 667 | if (empty($all)) { |
| 668 | 668 | $filters = array('airlines' => array($stats_airline)); |
| 669 | 669 | if ($filter_name != '') { |
| 670 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 670 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 671 | 671 | } |
| 672 | 672 | $Spotter = new Spotter($this->db); |
| 673 | - $all = $Spotter->countAllHours($orderby,$filters); |
|
| 673 | + $all = $Spotter->countAllHours($orderby, $filters); |
|
| 674 | 674 | } |
| 675 | 675 | return $all; |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | - public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
| 678 | + public function countOverallFlights($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 679 | 679 | global $globalStatsFilters; |
| 680 | 680 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 681 | 681 | if ($year == '') $year = date('Y'); |
| 682 | - $all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 682 | + $all = $this->getSumStats('flights_bymonth', $year, $stats_airline, $filter_name, $month); |
|
| 683 | 683 | if (empty($all)) { |
| 684 | 684 | $filters = array('airlines' => array($stats_airline)); |
| 685 | 685 | if ($filter_name != '') { |
| 686 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 686 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 687 | 687 | } |
| 688 | 688 | $Spotter = new Spotter($this->db); |
| 689 | - $all = $Spotter->countOverallFlights($filters,$year,$month); |
|
| 689 | + $all = $Spotter->countOverallFlights($filters, $year, $month); |
|
| 690 | 690 | } |
| 691 | 691 | return $all; |
| 692 | 692 | } |
| 693 | - public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
|
| 693 | + public function countOverallMilitaryFlights($filter_name = '', $year = '', $month = '') { |
|
| 694 | 694 | global $globalStatsFilters; |
| 695 | 695 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 696 | 696 | if ($year == '') $year = date('Y'); |
| 697 | - $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
|
| 697 | + $all = $this->getSumStats('military_flights_bymonth', $year, '', $filter_name, $month); |
|
| 698 | 698 | if (empty($all)) { |
| 699 | 699 | $filters = array(); |
| 700 | 700 | if ($filter_name != '') { |
| 701 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 701 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 702 | 702 | } |
| 703 | 703 | $Spotter = new Spotter($this->db); |
| 704 | - $all = $Spotter->countOverallMilitaryFlights($filters,$year,$month); |
|
| 704 | + $all = $Spotter->countOverallMilitaryFlights($filters, $year, $month); |
|
| 705 | 705 | } |
| 706 | 706 | return $all; |
| 707 | 707 | } |
| 708 | - public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
|
| 708 | + public function countOverallArrival($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 709 | 709 | global $globalStatsFilters; |
| 710 | 710 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 711 | 711 | if ($year == '') $year = date('Y'); |
| 712 | - $all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 712 | + $all = $this->getSumStats('realarrivals_bymonth', $year, $stats_airline, $filter_name, $month); |
|
| 713 | 713 | if (empty($all)) { |
| 714 | 714 | $filters = array('airlines' => array($stats_airline)); |
| 715 | 715 | if ($filter_name != '') { |
| 716 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 716 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 717 | 717 | } |
| 718 | 718 | $Spotter = new Spotter($this->db); |
| 719 | - $all = $Spotter->countOverallArrival($filters,$year,$month); |
|
| 719 | + $all = $Spotter->countOverallArrival($filters, $year, $month); |
|
| 720 | 720 | } |
| 721 | 721 | return $all; |
| 722 | 722 | } |
| 723 | - public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
| 723 | + public function countOverallAircrafts($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 724 | 724 | global $globalStatsFilters; |
| 725 | 725 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 726 | 726 | if ($year == '') $year = date('Y'); |
| 727 | - $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 727 | + $all = $this->getSumStats('aircrafts_bymonth', $year, $stats_airline, $filter_name, $month); |
|
| 728 | 728 | if (empty($all)) { |
| 729 | 729 | $filters = array('airlines' => array($stats_airline)); |
| 730 | 730 | if ($filter_name != '') { |
| 731 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 731 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 732 | 732 | } |
| 733 | 733 | $Spotter = new Spotter($this->db); |
| 734 | - $all = $Spotter->countOverallAircrafts($filters,$year,$month); |
|
| 734 | + $all = $Spotter->countOverallAircrafts($filters, $year, $month); |
|
| 735 | 735 | } |
| 736 | 736 | return $all; |
| 737 | 737 | } |
| 738 | - public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
|
| 738 | + public function countOverallAirlines($filter_name = '', $year = '', $month = '') { |
|
| 739 | 739 | global $globalStatsFilters; |
| 740 | 740 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 741 | 741 | if ($year == '' && $month == '') { |
@@ -743,23 +743,23 @@ discard block |
||
| 743 | 743 | try { |
| 744 | 744 | $sth = $this->db->prepare($query); |
| 745 | 745 | $sth->execute(array(':filter_name' => $filter_name)); |
| 746 | - } catch(PDOException $e) { |
|
| 746 | + } catch (PDOException $e) { |
|
| 747 | 747 | echo "error : ".$e->getMessage(); |
| 748 | 748 | } |
| 749 | 749 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 750 | 750 | $all = $result[0]['nb_airline']; |
| 751 | - } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
| 751 | + } else $all = $this->getSumStats('airlines_bymonth', $year, '', $filter_name, $month); |
|
| 752 | 752 | if (empty($all)) { |
| 753 | 753 | $filters = array(); |
| 754 | 754 | if ($filter_name != '') { |
| 755 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 755 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 756 | 756 | } |
| 757 | 757 | $Spotter = new Spotter($this->db); |
| 758 | - $all = $Spotter->countOverallAirlines($filters,$year,$month); |
|
| 758 | + $all = $Spotter->countOverallAirlines($filters, $year, $month); |
|
| 759 | 759 | } |
| 760 | 760 | return $all; |
| 761 | 761 | } |
| 762 | - public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
| 762 | + public function countOverallOwners($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 763 | 763 | global $globalStatsFilters; |
| 764 | 764 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 765 | 765 | if ($year == '') $year = date('Y'); |
@@ -774,83 +774,83 @@ discard block |
||
| 774 | 774 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 775 | 775 | $all = $result[0]['nb_owner']; |
| 776 | 776 | */ |
| 777 | - $all = $this->getSumStats('owners_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 777 | + $all = $this->getSumStats('owners_bymonth', $year, $stats_airline, $filter_name, $month); |
|
| 778 | 778 | if (empty($all)) { |
| 779 | 779 | $filters = array('airlines' => array($stats_airline)); |
| 780 | 780 | if ($filter_name != '') { |
| 781 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 781 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 782 | 782 | } |
| 783 | 783 | $Spotter = new Spotter($this->db); |
| 784 | - $all = $Spotter->countOverallOwners($filters,$year,$month); |
|
| 784 | + $all = $Spotter->countOverallOwners($filters, $year, $month); |
|
| 785 | 785 | } |
| 786 | 786 | return $all; |
| 787 | 787 | } |
| 788 | - public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
| 788 | + public function countOverallPilots($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 789 | 789 | global $globalStatsFilters; |
| 790 | 790 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 791 | 791 | if ($year == '') $year = date('Y'); |
| 792 | - $all = $this->getSumStats('pilots_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 792 | + $all = $this->getSumStats('pilots_bymonth', $year, $stats_airline, $filter_name, $month); |
|
| 793 | 793 | if (empty($all)) { |
| 794 | 794 | $filters = array('airlines' => array($stats_airline)); |
| 795 | 795 | if ($filter_name != '') { |
| 796 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 796 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 797 | 797 | } |
| 798 | 798 | $Spotter = new Spotter($this->db); |
| 799 | - $all = $Spotter->countOverallPilots($filters,$year,$month); |
|
| 799 | + $all = $Spotter->countOverallPilots($filters, $year, $month); |
|
| 800 | 800 | } |
| 801 | 801 | return $all; |
| 802 | 802 | } |
| 803 | 803 | |
| 804 | - public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
|
| 804 | + public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') { |
|
| 805 | 805 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 806 | 806 | $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"; |
| 807 | - $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 807 | + $query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 808 | 808 | try { |
| 809 | 809 | $sth = $this->db->prepare($query); |
| 810 | 810 | $sth->execute($query_values); |
| 811 | - } catch(PDOException $e) { |
|
| 811 | + } catch (PDOException $e) { |
|
| 812 | 812 | echo "error : ".$e->getMessage(); |
| 813 | 813 | } |
| 814 | 814 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 815 | 815 | return $all; |
| 816 | 816 | } |
| 817 | - public function getStats($type,$stats_airline = '', $filter_name = '') { |
|
| 817 | + public function getStats($type, $stats_airline = '', $filter_name = '') { |
|
| 818 | 818 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 819 | 819 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
| 820 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 820 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 821 | 821 | try { |
| 822 | 822 | $sth = $this->db->prepare($query); |
| 823 | 823 | $sth->execute($query_values); |
| 824 | - } catch(PDOException $e) { |
|
| 824 | + } catch (PDOException $e) { |
|
| 825 | 825 | echo "error : ".$e->getMessage(); |
| 826 | 826 | } |
| 827 | 827 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 828 | 828 | return $all; |
| 829 | 829 | } |
| 830 | - public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
|
| 830 | + public function getSumStats($type, $year, $stats_airline = '', $filter_name = '', $month = '') { |
|
| 831 | 831 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 832 | 832 | global $globalArchiveMonths, $globalDBdriver; |
| 833 | 833 | if ($globalDBdriver == 'mysql') { |
| 834 | 834 | if ($month == '') { |
| 835 | 835 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 836 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 836 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 837 | 837 | } else { |
| 838 | 838 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 839 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
|
| 839 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month); |
|
| 840 | 840 | } |
| 841 | 841 | } else { |
| 842 | 842 | if ($month == '') { |
| 843 | 843 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 844 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 844 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 845 | 845 | } else { |
| 846 | 846 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 847 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
|
| 847 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month); |
|
| 848 | 848 | } |
| 849 | 849 | } |
| 850 | 850 | try { |
| 851 | 851 | $sth = $this->db->prepare($query); |
| 852 | 852 | $sth->execute($query_values); |
| 853 | - } catch(PDOException $e) { |
|
| 853 | + } catch (PDOException $e) { |
|
| 854 | 854 | echo "error : ".$e->getMessage(); |
| 855 | 855 | } |
| 856 | 856 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -868,7 +868,7 @@ discard block |
||
| 868 | 868 | try { |
| 869 | 869 | $sth = $this->db->prepare($query); |
| 870 | 870 | $sth->execute($query_values); |
| 871 | - } catch(PDOException $e) { |
|
| 871 | + } catch (PDOException $e) { |
|
| 872 | 872 | echo "error : ".$e->getMessage(); |
| 873 | 873 | } |
| 874 | 874 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -885,7 +885,7 @@ discard block |
||
| 885 | 885 | try { |
| 886 | 886 | $sth = $this->db->prepare($query); |
| 887 | 887 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
| 888 | - } catch(PDOException $e) { |
|
| 888 | + } catch (PDOException $e) { |
|
| 889 | 889 | echo "error : ".$e->getMessage(); |
| 890 | 890 | } |
| 891 | 891 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -902,7 +902,7 @@ discard block |
||
| 902 | 902 | try { |
| 903 | 903 | $sth = $this->db->prepare($query); |
| 904 | 904 | $sth->execute(array(':filter_name' => $filter_name)); |
| 905 | - } catch(PDOException $e) { |
|
| 905 | + } catch (PDOException $e) { |
|
| 906 | 906 | echo "error : ".$e->getMessage(); |
| 907 | 907 | } |
| 908 | 908 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | try { |
| 920 | 920 | $sth = $this->db->prepare($query); |
| 921 | 921 | $sth->execute(array(':filter_name' => $filter_name)); |
| 922 | - } catch(PDOException $e) { |
|
| 922 | + } catch (PDOException $e) { |
|
| 923 | 923 | echo "error : ".$e->getMessage(); |
| 924 | 924 | } |
| 925 | 925 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -936,14 +936,14 @@ discard block |
||
| 936 | 936 | try { |
| 937 | 937 | $sth = $this->db->prepare($query); |
| 938 | 938 | $sth->execute(array(':filter_name' => $filter_name)); |
| 939 | - } catch(PDOException $e) { |
|
| 939 | + } catch (PDOException $e) { |
|
| 940 | 940 | echo "error : ".$e->getMessage(); |
| 941 | 941 | } |
| 942 | 942 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 943 | 943 | return $all[0]['total']; |
| 944 | 944 | } |
| 945 | 945 | |
| 946 | - public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
| 946 | + public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
| 947 | 947 | global $globalDBdriver; |
| 948 | 948 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 949 | 949 | if ($globalDBdriver == 'mysql') { |
@@ -951,15 +951,15 @@ discard block |
||
| 951 | 951 | } else { |
| 952 | 952 | $query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 953 | 953 | } |
| 954 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 954 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 955 | 955 | try { |
| 956 | 956 | $sth = $this->db->prepare($query); |
| 957 | 957 | $sth->execute($query_values); |
| 958 | - } catch(PDOException $e) { |
|
| 958 | + } catch (PDOException $e) { |
|
| 959 | 959 | return "error : ".$e->getMessage(); |
| 960 | 960 | } |
| 961 | 961 | } |
| 962 | - public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
| 962 | + public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
| 963 | 963 | global $globalDBdriver; |
| 964 | 964 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 965 | 965 | if ($globalDBdriver == 'mysql') { |
@@ -968,11 +968,11 @@ discard block |
||
| 968 | 968 | //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
| 969 | 969 | $query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 970 | 970 | } |
| 971 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 971 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 972 | 972 | try { |
| 973 | 973 | $sth = $this->db->prepare($query); |
| 974 | 974 | $sth->execute($query_values); |
| 975 | - } catch(PDOException $e) { |
|
| 975 | + } catch (PDOException $e) { |
|
| 976 | 976 | return "error : ".$e->getMessage(); |
| 977 | 977 | } |
| 978 | 978 | } |
@@ -996,75 +996,75 @@ discard block |
||
| 996 | 996 | } |
| 997 | 997 | */ |
| 998 | 998 | |
| 999 | - public function getStatsSource($stats_type,$year = '',$month = '',$day = '') { |
|
| 999 | + public function getStatsSource($stats_type, $year = '', $month = '', $day = '') { |
|
| 1000 | 1000 | global $globalDBdriver; |
| 1001 | 1001 | $query = "SELECT * FROM stats_source WHERE stats_type = :stats_type"; |
| 1002 | 1002 | $query_values = array(); |
| 1003 | 1003 | if ($globalDBdriver == 'mysql') { |
| 1004 | 1004 | if ($year != '') { |
| 1005 | 1005 | $query .= ' AND YEAR(stats_date) = :year'; |
| 1006 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1006 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1007 | 1007 | } |
| 1008 | 1008 | if ($month != '') { |
| 1009 | 1009 | $query .= ' AND MONTH(stats_date) = :month'; |
| 1010 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1010 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1011 | 1011 | } |
| 1012 | 1012 | if ($day != '') { |
| 1013 | 1013 | $query .= ' AND DAY(stats_date) = :day'; |
| 1014 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 1014 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 1015 | 1015 | } |
| 1016 | 1016 | } else { |
| 1017 | 1017 | if ($year != '') { |
| 1018 | 1018 | $query .= ' AND EXTRACT(YEAR FROM stats_date) = :year'; |
| 1019 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1019 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1020 | 1020 | } |
| 1021 | 1021 | if ($month != '') { |
| 1022 | 1022 | $query .= ' AND EXTRACT(MONTH FROM stats_date) = :month'; |
| 1023 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1023 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1024 | 1024 | } |
| 1025 | 1025 | if ($day != '') { |
| 1026 | 1026 | $query .= ' AND EXTRACT(DAY FROM stats_date) = :day'; |
| 1027 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 1027 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 1028 | 1028 | } |
| 1029 | 1029 | } |
| 1030 | 1030 | $query .= " ORDER BY source_name"; |
| 1031 | - $query_values = array_merge($query_values,array(':stats_type' => $stats_type)); |
|
| 1031 | + $query_values = array_merge($query_values, array(':stats_type' => $stats_type)); |
|
| 1032 | 1032 | try { |
| 1033 | 1033 | $sth = $this->db->prepare($query); |
| 1034 | 1034 | $sth->execute($query_values); |
| 1035 | - } catch(PDOException $e) { |
|
| 1035 | + } catch (PDOException $e) { |
|
| 1036 | 1036 | echo "error : ".$e->getMessage(); |
| 1037 | 1037 | } |
| 1038 | 1038 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1039 | 1039 | return $all; |
| 1040 | 1040 | } |
| 1041 | 1041 | |
| 1042 | - public function addStatSource($data,$source_name,$stats_type,$date) { |
|
| 1042 | + public function addStatSource($data, $source_name, $stats_type, $date) { |
|
| 1043 | 1043 | global $globalDBdriver; |
| 1044 | 1044 | if ($globalDBdriver == 'mysql') { |
| 1045 | 1045 | $query = "INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) VALUES (:data,:source_name,:stats_type,:stats_date) ON DUPLICATE KEY UPDATE source_data = :data"; |
| 1046 | 1046 | } else { |
| 1047 | 1047 | $query = "UPDATE stats_source SET source_data = :data WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type; INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) SELECT :data,:source_name,:stats_type,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats_source WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type);"; |
| 1048 | 1048 | } |
| 1049 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
| 1049 | + $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type); |
|
| 1050 | 1050 | try { |
| 1051 | 1051 | $sth = $this->db->prepare($query); |
| 1052 | 1052 | $sth->execute($query_values); |
| 1053 | - } catch(PDOException $e) { |
|
| 1053 | + } catch (PDOException $e) { |
|
| 1054 | 1054 | return "error : ".$e->getMessage(); |
| 1055 | 1055 | } |
| 1056 | 1056 | } |
| 1057 | - public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
|
| 1057 | + public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') { |
|
| 1058 | 1058 | $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
| 1059 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1059 | + $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 1060 | 1060 | try { |
| 1061 | 1061 | $sth = $this->db->prepare($query); |
| 1062 | 1062 | $sth->execute($query_values); |
| 1063 | - } catch(PDOException $e) { |
|
| 1063 | + } catch (PDOException $e) { |
|
| 1064 | 1064 | return "error : ".$e->getMessage(); |
| 1065 | 1065 | } |
| 1066 | 1066 | } |
| 1067 | - public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '',$reset = false) { |
|
| 1067 | + public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
| 1068 | 1068 | global $globalDBdriver; |
| 1069 | 1069 | if ($globalDBdriver == 'mysql') { |
| 1070 | 1070 | if ($reset) { |
@@ -1079,15 +1079,15 @@ discard block |
||
| 1079 | 1079 | $query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:registration,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 1080 | 1080 | } |
| 1081 | 1081 | } |
| 1082 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 1082 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 1083 | 1083 | try { |
| 1084 | 1084 | $sth = $this->db->prepare($query); |
| 1085 | 1085 | $sth->execute($query_values); |
| 1086 | - } catch(PDOException $e) { |
|
| 1086 | + } catch (PDOException $e) { |
|
| 1087 | 1087 | return "error : ".$e->getMessage(); |
| 1088 | 1088 | } |
| 1089 | 1089 | } |
| 1090 | - public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '', $reset = false) { |
|
| 1090 | + public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '', $reset = false) { |
|
| 1091 | 1091 | global $globalDBdriver; |
| 1092 | 1092 | if ($globalDBdriver == 'mysql') { |
| 1093 | 1093 | if ($reset) { |
@@ -1102,15 +1102,15 @@ discard block |
||
| 1102 | 1102 | $query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) SELECT :callsign_icao,:airline_icao,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name);"; |
| 1103 | 1103 | } |
| 1104 | 1104 | } |
| 1105 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 1105 | + $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 1106 | 1106 | try { |
| 1107 | 1107 | $sth = $this->db->prepare($query); |
| 1108 | 1108 | $sth->execute($query_values); |
| 1109 | - } catch(PDOException $e) { |
|
| 1109 | + } catch (PDOException $e) { |
|
| 1110 | 1110 | return "error : ".$e->getMessage(); |
| 1111 | 1111 | } |
| 1112 | 1112 | } |
| 1113 | - public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '',$reset = false) { |
|
| 1113 | + public function addStatCountry($iso2, $iso3, $name, $cnt, $filter_name = '', $reset = false) { |
|
| 1114 | 1114 | global $globalDBdriver; |
| 1115 | 1115 | if ($globalDBdriver == 'mysql') { |
| 1116 | 1116 | if ($reset) { |
@@ -1125,15 +1125,15 @@ discard block |
||
| 1125 | 1125 | $query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name; INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) SELECT :iso2,:iso3,:name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name);"; |
| 1126 | 1126 | } |
| 1127 | 1127 | } |
| 1128 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
| 1128 | + $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 1129 | 1129 | try { |
| 1130 | 1130 | $sth = $this->db->prepare($query); |
| 1131 | 1131 | $sth->execute($query_values); |
| 1132 | - } catch(PDOException $e) { |
|
| 1132 | + } catch (PDOException $e) { |
|
| 1133 | 1133 | return "error : ".$e->getMessage(); |
| 1134 | 1134 | } |
| 1135 | 1135 | } |
| 1136 | - public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
| 1136 | + public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
| 1137 | 1137 | global $globalDBdriver; |
| 1138 | 1138 | if ($globalDBdriver == 'mysql') { |
| 1139 | 1139 | if ($reset) { |
@@ -1148,15 +1148,15 @@ discard block |
||
| 1148 | 1148 | $query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, filter_name = :filter_name WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 1149 | 1149 | } |
| 1150 | 1150 | } |
| 1151 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 1151 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':aircraft_name' => $aircraft_name, ':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 1152 | 1152 | try { |
| 1153 | 1153 | $sth = $this->db->prepare($query); |
| 1154 | 1154 | $sth->execute($query_values); |
| 1155 | - } catch(PDOException $e) { |
|
| 1155 | + } catch (PDOException $e) { |
|
| 1156 | 1156 | return "error : ".$e->getMessage(); |
| 1157 | 1157 | } |
| 1158 | 1158 | } |
| 1159 | - public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '', $reset = false) { |
|
| 1159 | + public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '', $reset = false) { |
|
| 1160 | 1160 | global $globalDBdriver; |
| 1161 | 1161 | if ($globalDBdriver == 'mysql') { |
| 1162 | 1162 | if ($reset) { |
@@ -1171,15 +1171,15 @@ discard block |
||
| 1171 | 1171 | $query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao AND filter_name = :filter_name; INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) SELECT :airline_icao,:airline_name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao AND filter_name = :filter_name);"; |
| 1172 | 1172 | } |
| 1173 | 1173 | } |
| 1174 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
| 1174 | + $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 1175 | 1175 | try { |
| 1176 | 1176 | $sth = $this->db->prepare($query); |
| 1177 | 1177 | $sth->execute($query_values); |
| 1178 | - } catch(PDOException $e) { |
|
| 1178 | + } catch (PDOException $e) { |
|
| 1179 | 1179 | return "error : ".$e->getMessage(); |
| 1180 | 1180 | } |
| 1181 | 1181 | } |
| 1182 | - public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '', $reset = false) { |
|
| 1182 | + public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '', $reset = false) { |
|
| 1183 | 1183 | global $globalDBdriver; |
| 1184 | 1184 | if ($globalDBdriver == 'mysql') { |
| 1185 | 1185 | if ($reset) { |
@@ -1194,15 +1194,15 @@ discard block |
||
| 1194 | 1194 | $query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) SELECT :owner_name,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 1195 | 1195 | } |
| 1196 | 1196 | } |
| 1197 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1197 | + $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 1198 | 1198 | try { |
| 1199 | 1199 | $sth = $this->db->prepare($query); |
| 1200 | 1200 | $sth->execute($query_values); |
| 1201 | - } catch(PDOException $e) { |
|
| 1201 | + } catch (PDOException $e) { |
|
| 1202 | 1202 | return "error : ".$e->getMessage(); |
| 1203 | 1203 | } |
| 1204 | 1204 | } |
| 1205 | - public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '',$reset = false) { |
|
| 1205 | + public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '', $format_source = '', $reset = false) { |
|
| 1206 | 1206 | global $globalDBdriver; |
| 1207 | 1207 | if ($globalDBdriver == 'mysql') { |
| 1208 | 1208 | if ($reset) { |
@@ -1217,15 +1217,15 @@ discard block |
||
| 1217 | 1217 | $query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source);"; |
| 1218 | 1218 | } |
| 1219 | 1219 | } |
| 1220 | - $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name,':format_source' => $format_source); |
|
| 1220 | + $query_values = array(':pilot_id' => $pilot_id, ':cnt' => $cnt, ':pilot_name' => $pilot_name, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':format_source' => $format_source); |
|
| 1221 | 1221 | try { |
| 1222 | 1222 | $sth = $this->db->prepare($query); |
| 1223 | 1223 | $sth->execute($query_values); |
| 1224 | - } catch(PDOException $e) { |
|
| 1224 | + } catch (PDOException $e) { |
|
| 1225 | 1225 | return "error : ".$e->getMessage(); |
| 1226 | 1226 | } |
| 1227 | 1227 | } |
| 1228 | - public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '',$reset = false) { |
|
| 1228 | + public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '', $reset = false) { |
|
| 1229 | 1229 | global $globalDBdriver; |
| 1230 | 1230 | if ($airport_icao != '') { |
| 1231 | 1231 | if ($globalDBdriver == 'mysql') { |
@@ -1241,16 +1241,16 @@ discard block |
||
| 1241 | 1241 | $query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; |
| 1242 | 1242 | } |
| 1243 | 1243 | } |
| 1244 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
| 1244 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 1245 | 1245 | try { |
| 1246 | 1246 | $sth = $this->db->prepare($query); |
| 1247 | 1247 | $sth->execute($query_values); |
| 1248 | - } catch(PDOException $e) { |
|
| 1248 | + } catch (PDOException $e) { |
|
| 1249 | 1249 | return "error : ".$e->getMessage(); |
| 1250 | 1250 | } |
| 1251 | 1251 | } |
| 1252 | 1252 | } |
| 1253 | - public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
| 1253 | + public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
|
| 1254 | 1254 | global $globalDBdriver; |
| 1255 | 1255 | if ($airport_icao != '') { |
| 1256 | 1256 | if ($globalDBdriver == 'mysql') { |
@@ -1258,16 +1258,16 @@ discard block |
||
| 1258 | 1258 | } else { |
| 1259 | 1259 | $query = "UPDATE stats_airport SET departure = :departure WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 1260 | 1260 | } |
| 1261 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
| 1261 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 1262 | 1262 | try { |
| 1263 | 1263 | $sth = $this->db->prepare($query); |
| 1264 | 1264 | $sth->execute($query_values); |
| 1265 | - } catch(PDOException $e) { |
|
| 1265 | + } catch (PDOException $e) { |
|
| 1266 | 1266 | return "error : ".$e->getMessage(); |
| 1267 | 1267 | } |
| 1268 | 1268 | } |
| 1269 | 1269 | } |
| 1270 | - public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '',$reset = false) { |
|
| 1270 | + public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '', $reset = false) { |
|
| 1271 | 1271 | global $globalDBdriver; |
| 1272 | 1272 | if ($airport_icao != '') { |
| 1273 | 1273 | if ($globalDBdriver == 'mysql') { |
@@ -1283,16 +1283,16 @@ discard block |
||
| 1283 | 1283 | $query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; |
| 1284 | 1284 | } |
| 1285 | 1285 | } |
| 1286 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
| 1286 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 1287 | 1287 | try { |
| 1288 | 1288 | $sth = $this->db->prepare($query); |
| 1289 | 1289 | $sth->execute($query_values); |
| 1290 | - } catch(PDOException $e) { |
|
| 1290 | + } catch (PDOException $e) { |
|
| 1291 | 1291 | return "error : ".$e->getMessage(); |
| 1292 | 1292 | } |
| 1293 | 1293 | } |
| 1294 | 1294 | } |
| 1295 | - public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
| 1295 | + public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
|
| 1296 | 1296 | global $globalDBdriver; |
| 1297 | 1297 | if ($airport_icao != '') { |
| 1298 | 1298 | if ($globalDBdriver == 'mysql') { |
@@ -1300,11 +1300,11 @@ discard block |
||
| 1300 | 1300 | } else { |
| 1301 | 1301 | $query = "UPDATE stats_airport SET arrival = :arrival WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 1302 | 1302 | } |
| 1303 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival, ':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
| 1303 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 1304 | 1304 | try { |
| 1305 | 1305 | $sth = $this->db->prepare($query); |
| 1306 | 1306 | $sth->execute($query_values); |
| 1307 | - } catch(PDOException $e) { |
|
| 1307 | + } catch (PDOException $e) { |
|
| 1308 | 1308 | return "error : ".$e->getMessage(); |
| 1309 | 1309 | } |
| 1310 | 1310 | } |
@@ -1316,7 +1316,7 @@ discard block |
||
| 1316 | 1316 | try { |
| 1317 | 1317 | $sth = $this->db->prepare($query); |
| 1318 | 1318 | $sth->execute($query_values); |
| 1319 | - } catch(PDOException $e) { |
|
| 1319 | + } catch (PDOException $e) { |
|
| 1320 | 1320 | return "error : ".$e->getMessage(); |
| 1321 | 1321 | } |
| 1322 | 1322 | } |
@@ -1326,7 +1326,7 @@ discard block |
||
| 1326 | 1326 | try { |
| 1327 | 1327 | $sth = $this->db->prepare($query); |
| 1328 | 1328 | $sth->execute($query_values); |
| 1329 | - } catch(PDOException $e) { |
|
| 1329 | + } catch (PDOException $e) { |
|
| 1330 | 1330 | return "error : ".$e->getMessage(); |
| 1331 | 1331 | } |
| 1332 | 1332 | } |
@@ -1336,13 +1336,13 @@ discard block |
||
| 1336 | 1336 | try { |
| 1337 | 1337 | $sth = $this->db->prepare($query); |
| 1338 | 1338 | $sth->execute($query_values); |
| 1339 | - } catch(PDOException $e) { |
|
| 1339 | + } catch (PDOException $e) { |
|
| 1340 | 1340 | return "error : ".$e->getMessage(); |
| 1341 | 1341 | } |
| 1342 | 1342 | } |
| 1343 | 1343 | |
| 1344 | 1344 | public function addOldStats() { |
| 1345 | - global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear; |
|
| 1345 | + global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters, $globalDeleteLastYearStats, $globalStatsReset, $globalStatsResetYear; |
|
| 1346 | 1346 | $Common = new Common(); |
| 1347 | 1347 | $Connection = new Connection(); |
| 1348 | 1348 | date_default_timezone_set('UTC'); |
@@ -1359,40 +1359,40 @@ discard block |
||
| 1359 | 1359 | $Spotter = new Spotter($this->db); |
| 1360 | 1360 | |
| 1361 | 1361 | if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
| 1362 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
|
| 1362 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day); |
|
| 1363 | 1363 | foreach ($alldata as $number) { |
| 1364 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
|
| 1364 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', '', $reset); |
|
| 1365 | 1365 | } |
| 1366 | 1366 | if ($globalDebug) echo 'Count all airlines...'."\n"; |
| 1367 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
|
| 1367 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day); |
|
| 1368 | 1368 | foreach ($alldata as $number) { |
| 1369 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
|
| 1369 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], '', $reset); |
|
| 1370 | 1370 | } |
| 1371 | 1371 | if ($globalDebug) echo 'Count all registrations...'."\n"; |
| 1372 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
|
| 1372 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day); |
|
| 1373 | 1373 | foreach ($alldata as $number) { |
| 1374 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
|
| 1374 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', '', $reset); |
|
| 1375 | 1375 | } |
| 1376 | 1376 | if ($globalDebug) echo 'Count all callsigns...'."\n"; |
| 1377 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
|
| 1377 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day); |
|
| 1378 | 1378 | foreach ($alldata as $number) { |
| 1379 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
| 1379 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset); |
|
| 1380 | 1380 | } |
| 1381 | 1381 | if ($globalDebug) echo 'Count all owners...'."\n"; |
| 1382 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
|
| 1382 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day); |
|
| 1383 | 1383 | foreach ($alldata as $number) { |
| 1384 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
|
| 1384 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', '', $reset); |
|
| 1385 | 1385 | } |
| 1386 | 1386 | if ($globalDebug) echo 'Count all pilots...'."\n"; |
| 1387 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
|
| 1387 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day); |
|
| 1388 | 1388 | foreach ($alldata as $number) { |
| 1389 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
|
| 1389 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', '', $number['format_source'], $reset); |
|
| 1390 | 1390 | } |
| 1391 | 1391 | |
| 1392 | 1392 | if ($globalDebug) echo 'Count all departure airports...'."\n"; |
| 1393 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
|
| 1393 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day); |
|
| 1394 | 1394 | if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
| 1395 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
| 1395 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day); |
|
| 1396 | 1396 | if ($globalDebug) echo 'Order departure airports...'."\n"; |
| 1397 | 1397 | $alldata = array(); |
| 1398 | 1398 | |
@@ -1410,14 +1410,14 @@ discard block |
||
| 1410 | 1410 | foreach ($alldata as $key => $row) { |
| 1411 | 1411 | $count[$key] = $row['airport_departure_icao_count']; |
| 1412 | 1412 | } |
| 1413 | - array_multisort($count,SORT_DESC,$alldata); |
|
| 1413 | + array_multisort($count, SORT_DESC, $alldata); |
|
| 1414 | 1414 | foreach ($alldata as $number) { |
| 1415 | - 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); |
|
| 1415 | + 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); |
|
| 1416 | 1416 | } |
| 1417 | 1417 | if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
| 1418 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
|
| 1418 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day); |
|
| 1419 | 1419 | if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
| 1420 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
| 1420 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day); |
|
| 1421 | 1421 | if ($globalDebug) echo 'Order arrival airports...'."\n"; |
| 1422 | 1422 | $alldata = array(); |
| 1423 | 1423 | foreach ($pall as $value) { |
@@ -1434,16 +1434,16 @@ discard block |
||
| 1434 | 1434 | foreach ($alldata as $key => $row) { |
| 1435 | 1435 | $count[$key] = $row['airport_arrival_icao_count']; |
| 1436 | 1436 | } |
| 1437 | - array_multisort($count,SORT_DESC,$alldata); |
|
| 1437 | + array_multisort($count, SORT_DESC, $alldata); |
|
| 1438 | 1438 | foreach ($alldata as $number) { |
| 1439 | - 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); |
|
| 1439 | + 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); |
|
| 1440 | 1440 | } |
| 1441 | 1441 | if ($Connection->tableExists('countries')) { |
| 1442 | 1442 | if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
| 1443 | 1443 | $SpotterArchive = new SpotterArchive(); |
| 1444 | - $alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
|
| 1444 | + $alldata = $SpotterArchive->countAllFlightOverCountries(false, 0, $last_update_day); |
|
| 1445 | 1445 | foreach ($alldata as $number) { |
| 1446 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],'',$reset); |
|
| 1446 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], '', $reset); |
|
| 1447 | 1447 | } |
| 1448 | 1448 | } |
| 1449 | 1449 | |
@@ -1457,37 +1457,37 @@ discard block |
||
| 1457 | 1457 | $lastyear = false; |
| 1458 | 1458 | foreach ($alldata as $number) { |
| 1459 | 1459 | if ($number['year_name'] != date('Y')) $lastyear = true; |
| 1460 | - $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']))); |
|
| 1460 | + $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']))); |
|
| 1461 | 1461 | } |
| 1462 | 1462 | if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
| 1463 | 1463 | $alldata = $Spotter->countAllMilitaryMonths(); |
| 1464 | 1464 | foreach ($alldata as $number) { |
| 1465 | - $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']))); |
|
| 1465 | + $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']))); |
|
| 1466 | 1466 | } |
| 1467 | 1467 | if ($globalDebug) echo 'Count all owners by months...'."\n"; |
| 1468 | 1468 | $alldata = $Spotter->countAllMonthsOwners(); |
| 1469 | 1469 | foreach ($alldata as $number) { |
| 1470 | - $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']))); |
|
| 1470 | + $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']))); |
|
| 1471 | 1471 | } |
| 1472 | 1472 | if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
| 1473 | 1473 | $alldata = $Spotter->countAllMonthsPilots(); |
| 1474 | 1474 | foreach ($alldata as $number) { |
| 1475 | - $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']))); |
|
| 1475 | + $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']))); |
|
| 1476 | 1476 | } |
| 1477 | 1477 | if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
| 1478 | 1478 | $alldata = $Spotter->countAllMonthsAirlines(); |
| 1479 | 1479 | foreach ($alldata as $number) { |
| 1480 | - $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']))); |
|
| 1480 | + $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']))); |
|
| 1481 | 1481 | } |
| 1482 | 1482 | if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
| 1483 | 1483 | $alldata = $Spotter->countAllMonthsAircrafts(); |
| 1484 | 1484 | foreach ($alldata as $number) { |
| 1485 | - $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']))); |
|
| 1485 | + $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']))); |
|
| 1486 | 1486 | } |
| 1487 | 1487 | if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
| 1488 | 1488 | $alldata = $Spotter->countAllMonthsRealArrivals(); |
| 1489 | 1489 | foreach ($alldata as $number) { |
| 1490 | - $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']))); |
|
| 1490 | + $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']))); |
|
| 1491 | 1491 | } |
| 1492 | 1492 | if ($globalDebug) echo 'Airports data...'."\n"; |
| 1493 | 1493 | if ($globalDebug) echo '...Departure'."\n"; |
@@ -1532,7 +1532,7 @@ discard block |
||
| 1532 | 1532 | } |
| 1533 | 1533 | $alldata = $pall; |
| 1534 | 1534 | foreach ($alldata as $number) { |
| 1535 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
|
| 1535 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']); |
|
| 1536 | 1536 | } |
| 1537 | 1537 | echo '...Arrival'."\n"; |
| 1538 | 1538 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
@@ -1574,7 +1574,7 @@ discard block |
||
| 1574 | 1574 | } |
| 1575 | 1575 | $alldata = $pall; |
| 1576 | 1576 | foreach ($alldata as $number) { |
| 1577 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
|
| 1577 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']); |
|
| 1578 | 1578 | } |
| 1579 | 1579 | |
| 1580 | 1580 | echo 'Flights data...'."\n"; |
@@ -1582,28 +1582,28 @@ discard block |
||
| 1582 | 1582 | echo '-> countAllDatesLastMonth...'."\n"; |
| 1583 | 1583 | $alldata = $Spotter->countAllDatesLastMonth(); |
| 1584 | 1584 | foreach ($alldata as $number) { |
| 1585 | - $this->addStatFlight('month',$number['date_name'],$number['date_count']); |
|
| 1585 | + $this->addStatFlight('month', $number['date_name'], $number['date_count']); |
|
| 1586 | 1586 | } |
| 1587 | 1587 | echo '-> countAllDates...'."\n"; |
| 1588 | 1588 | $previousdata = $this->countAllDates(); |
| 1589 | 1589 | $previousdatabyairlines = $this->countAllDatesByAirlines(); |
| 1590 | 1590 | $this->deleteStatFlight('date'); |
| 1591 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates()); |
|
| 1591 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates()); |
|
| 1592 | 1592 | $values = array(); |
| 1593 | 1593 | foreach ($alldata as $cnt) { |
| 1594 | 1594 | $values[] = $cnt['date_count']; |
| 1595 | 1595 | } |
| 1596 | - array_multisort($values,SORT_DESC,$alldata); |
|
| 1597 | - array_splice($alldata,11); |
|
| 1596 | + array_multisort($values, SORT_DESC, $alldata); |
|
| 1597 | + array_splice($alldata, 11); |
|
| 1598 | 1598 | foreach ($alldata as $number) { |
| 1599 | - $this->addStatFlight('date',$number['date_name'],$number['date_count']); |
|
| 1599 | + $this->addStatFlight('date', $number['date_name'], $number['date_count']); |
|
| 1600 | 1600 | } |
| 1601 | 1601 | |
| 1602 | 1602 | $this->deleteStatFlight('hour'); |
| 1603 | 1603 | echo '-> countAllHours...'."\n"; |
| 1604 | 1604 | $alldata = $Spotter->countAllHours('hour'); |
| 1605 | 1605 | foreach ($alldata as $number) { |
| 1606 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count']); |
|
| 1606 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count']); |
|
| 1607 | 1607 | } |
| 1608 | 1608 | |
| 1609 | 1609 | |
@@ -1612,34 +1612,34 @@ discard block |
||
| 1612 | 1612 | echo '--- Stats by airlines ---'."\n"; |
| 1613 | 1613 | if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
| 1614 | 1614 | $Spotter = new Spotter($this->db); |
| 1615 | - $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
|
| 1615 | + $alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day); |
|
| 1616 | 1616 | foreach ($alldata as $number) { |
| 1617 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
|
| 1617 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao'], '', $reset); |
|
| 1618 | 1618 | } |
| 1619 | 1619 | if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
| 1620 | - $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
|
| 1620 | + $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day); |
|
| 1621 | 1621 | foreach ($alldata as $number) { |
| 1622 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
|
| 1622 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao'], '', $reset); |
|
| 1623 | 1623 | } |
| 1624 | 1624 | if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
| 1625 | - $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
|
| 1625 | + $alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day); |
|
| 1626 | 1626 | foreach ($alldata as $number) { |
| 1627 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
| 1627 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset); |
|
| 1628 | 1628 | } |
| 1629 | 1629 | if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
| 1630 | - $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
|
| 1630 | + $alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day); |
|
| 1631 | 1631 | foreach ($alldata as $number) { |
| 1632 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
|
| 1632 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao'], '', $reset); |
|
| 1633 | 1633 | } |
| 1634 | 1634 | if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
| 1635 | - $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
|
| 1635 | + $alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day); |
|
| 1636 | 1636 | foreach ($alldata as $number) { |
| 1637 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
|
| 1637 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao'], '', $number['format_source'], $reset); |
|
| 1638 | 1638 | } |
| 1639 | 1639 | if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
| 1640 | - $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
|
| 1640 | + $pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
| 1641 | 1641 | if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
| 1642 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
| 1642 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
| 1643 | 1643 | if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
| 1644 | 1644 | //$alldata = array(); |
| 1645 | 1645 | foreach ($dall as $value) { |
@@ -1659,12 +1659,12 @@ discard block |
||
| 1659 | 1659 | } |
| 1660 | 1660 | $alldata = $pall; |
| 1661 | 1661 | foreach ($alldata as $number) { |
| 1662 | - 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); |
|
| 1662 | + 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); |
|
| 1663 | 1663 | } |
| 1664 | 1664 | if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
| 1665 | - $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
|
| 1665 | + $pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
| 1666 | 1666 | if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
| 1667 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
| 1667 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
| 1668 | 1668 | if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
| 1669 | 1669 | //$alldata = array(); |
| 1670 | 1670 | foreach ($dall as $value) { |
@@ -1684,7 +1684,7 @@ discard block |
||
| 1684 | 1684 | } |
| 1685 | 1685 | $alldata = $pall; |
| 1686 | 1686 | foreach ($alldata as $number) { |
| 1687 | - 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); |
|
| 1687 | + 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); |
|
| 1688 | 1688 | } |
| 1689 | 1689 | if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
| 1690 | 1690 | $Spotter = new Spotter($this->db); |
@@ -1692,27 +1692,27 @@ discard block |
||
| 1692 | 1692 | $lastyear = false; |
| 1693 | 1693 | foreach ($alldata as $number) { |
| 1694 | 1694 | if ($number['year_name'] != date('Y')) $lastyear = true; |
| 1695 | - $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']); |
|
| 1695 | + $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']); |
|
| 1696 | 1696 | } |
| 1697 | 1697 | if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
| 1698 | 1698 | $alldata = $Spotter->countAllMonthsOwnersByAirlines(); |
| 1699 | 1699 | foreach ($alldata as $number) { |
| 1700 | - $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']); |
|
| 1700 | + $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']); |
|
| 1701 | 1701 | } |
| 1702 | 1702 | if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
| 1703 | 1703 | $alldata = $Spotter->countAllMonthsPilotsByAirlines(); |
| 1704 | 1704 | foreach ($alldata as $number) { |
| 1705 | - $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']); |
|
| 1705 | + $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']); |
|
| 1706 | 1706 | } |
| 1707 | 1707 | if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
| 1708 | 1708 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines(); |
| 1709 | 1709 | foreach ($alldata as $number) { |
| 1710 | - $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']); |
|
| 1710 | + $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']); |
|
| 1711 | 1711 | } |
| 1712 | 1712 | if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
| 1713 | 1713 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines(); |
| 1714 | 1714 | foreach ($alldata as $number) { |
| 1715 | - $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']); |
|
| 1715 | + $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']); |
|
| 1716 | 1716 | } |
| 1717 | 1717 | if ($globalDebug) echo '...Departure'."\n"; |
| 1718 | 1718 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
@@ -1735,7 +1735,7 @@ discard block |
||
| 1735 | 1735 | } |
| 1736 | 1736 | $alldata = $pall; |
| 1737 | 1737 | foreach ($alldata as $number) { |
| 1738 | - $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']); |
|
| 1738 | + $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']); |
|
| 1739 | 1739 | } |
| 1740 | 1740 | if ($globalDebug) echo '...Arrival'."\n"; |
| 1741 | 1741 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
@@ -1758,32 +1758,32 @@ discard block |
||
| 1758 | 1758 | } |
| 1759 | 1759 | $alldata = $pall; |
| 1760 | 1760 | foreach ($alldata as $number) { |
| 1761 | - $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']); |
|
| 1761 | + $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']); |
|
| 1762 | 1762 | } |
| 1763 | 1763 | |
| 1764 | 1764 | if ($globalDebug) echo 'Flights data...'."\n"; |
| 1765 | 1765 | if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
| 1766 | 1766 | $alldata = $Spotter->countAllDatesLastMonthByAirlines(); |
| 1767 | 1767 | foreach ($alldata as $number) { |
| 1768 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
|
| 1768 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
| 1769 | 1769 | } |
| 1770 | 1770 | if ($globalDebug) echo '-> countAllDates...'."\n"; |
| 1771 | 1771 | //$previousdata = $this->countAllDatesByAirlines(); |
| 1772 | - $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines()); |
|
| 1772 | + $alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines()); |
|
| 1773 | 1773 | $values = array(); |
| 1774 | 1774 | foreach ($alldata as $cnt) { |
| 1775 | 1775 | $values[] = $cnt['date_count']; |
| 1776 | 1776 | } |
| 1777 | - array_multisort($values,SORT_DESC,$alldata); |
|
| 1778 | - array_splice($alldata,11); |
|
| 1777 | + array_multisort($values, SORT_DESC, $alldata); |
|
| 1778 | + array_splice($alldata, 11); |
|
| 1779 | 1779 | foreach ($alldata as $number) { |
| 1780 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
|
| 1780 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
| 1781 | 1781 | } |
| 1782 | 1782 | |
| 1783 | 1783 | if ($globalDebug) echo '-> countAllHours...'."\n"; |
| 1784 | 1784 | $alldata = $Spotter->countAllHoursByAirlines('hour'); |
| 1785 | 1785 | foreach ($alldata as $number) { |
| 1786 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
|
| 1786 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']); |
|
| 1787 | 1787 | } |
| 1788 | 1788 | |
| 1789 | 1789 | |
@@ -1802,32 +1802,32 @@ discard block |
||
| 1802 | 1802 | // Count by filter |
| 1803 | 1803 | if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
| 1804 | 1804 | $Spotter = new Spotter($this->db); |
| 1805 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
|
| 1805 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter); |
|
| 1806 | 1806 | foreach ($alldata as $number) { |
| 1807 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name,$reset); |
|
| 1807 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name, $reset); |
|
| 1808 | 1808 | } |
| 1809 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter); |
|
| 1809 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter); |
|
| 1810 | 1810 | foreach ($alldata as $number) { |
| 1811 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name,$reset); |
|
| 1811 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name, $reset); |
|
| 1812 | 1812 | } |
| 1813 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter); |
|
| 1813 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter); |
|
| 1814 | 1814 | foreach ($alldata as $number) { |
| 1815 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name,$reset); |
|
| 1815 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name, $reset); |
|
| 1816 | 1816 | } |
| 1817 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter); |
|
| 1817 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter); |
|
| 1818 | 1818 | foreach ($alldata as $number) { |
| 1819 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name,$reset); |
|
| 1819 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name, $reset); |
|
| 1820 | 1820 | } |
| 1821 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter); |
|
| 1821 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter); |
|
| 1822 | 1822 | foreach ($alldata as $number) { |
| 1823 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name,$reset); |
|
| 1823 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name, $reset); |
|
| 1824 | 1824 | } |
| 1825 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter); |
|
| 1825 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter); |
|
| 1826 | 1826 | foreach ($alldata as $number) { |
| 1827 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset); |
|
| 1827 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name, $number['format_source'], $reset); |
|
| 1828 | 1828 | } |
| 1829 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
|
| 1830 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
| 1829 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter); |
|
| 1830 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter); |
|
| 1831 | 1831 | $alldata = array(); |
| 1832 | 1832 | foreach ($pall as $value) { |
| 1833 | 1833 | $icao = $value['airport_departure_icao']; |
@@ -1843,12 +1843,12 @@ discard block |
||
| 1843 | 1843 | foreach ($alldata as $key => $row) { |
| 1844 | 1844 | $count[$key] = $row['airport_departure_icao_count']; |
| 1845 | 1845 | } |
| 1846 | - array_multisort($count,SORT_DESC,$alldata); |
|
| 1846 | + array_multisort($count, SORT_DESC, $alldata); |
|
| 1847 | 1847 | foreach ($alldata as $number) { |
| 1848 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name,$reset); |
|
| 1848 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', $filter_name, $reset); |
|
| 1849 | 1849 | } |
| 1850 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter); |
|
| 1851 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter); |
|
| 1850 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
| 1851 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
| 1852 | 1852 | $alldata = array(); |
| 1853 | 1853 | foreach ($pall as $value) { |
| 1854 | 1854 | $icao = $value['airport_arrival_icao']; |
@@ -1864,40 +1864,40 @@ discard block |
||
| 1864 | 1864 | foreach ($alldata as $key => $row) { |
| 1865 | 1865 | $count[$key] = $row['airport_arrival_icao_count']; |
| 1866 | 1866 | } |
| 1867 | - array_multisort($count,SORT_DESC,$alldata); |
|
| 1867 | + array_multisort($count, SORT_DESC, $alldata); |
|
| 1868 | 1868 | foreach ($alldata as $number) { |
| 1869 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name,$reset); |
|
| 1869 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', $filter_name, $reset); |
|
| 1870 | 1870 | } |
| 1871 | 1871 | $Spotter = new Spotter($this->db); |
| 1872 | 1872 | $alldata = $Spotter->countAllMonths($filter); |
| 1873 | 1873 | $lastyear = false; |
| 1874 | 1874 | foreach ($alldata as $number) { |
| 1875 | 1875 | if ($number['year_name'] != date('Y')) $lastyear = true; |
| 1876 | - $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); |
|
| 1876 | + $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); |
|
| 1877 | 1877 | } |
| 1878 | 1878 | $alldata = $Spotter->countAllMonthsOwners($filter); |
| 1879 | 1879 | foreach ($alldata as $number) { |
| 1880 | - $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
| 1880 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
| 1881 | 1881 | } |
| 1882 | 1882 | $alldata = $Spotter->countAllMonthsPilots($filter); |
| 1883 | 1883 | foreach ($alldata as $number) { |
| 1884 | - $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
| 1884 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
| 1885 | 1885 | } |
| 1886 | 1886 | $alldata = $Spotter->countAllMilitaryMonths($filter); |
| 1887 | 1887 | foreach ($alldata as $number) { |
| 1888 | - $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'])),'',$filter_name); |
|
| 1888 | + $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'])), '', $filter_name); |
|
| 1889 | 1889 | } |
| 1890 | 1890 | $alldata = $Spotter->countAllMonthsAircrafts($filter); |
| 1891 | 1891 | foreach ($alldata as $number) { |
| 1892 | - $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
| 1892 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
| 1893 | 1893 | } |
| 1894 | 1894 | $alldata = $Spotter->countAllMonthsRealArrivals($filter); |
| 1895 | 1895 | foreach ($alldata as $number) { |
| 1896 | - $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
| 1896 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
| 1897 | 1897 | } |
| 1898 | 1898 | echo '...Departure'."\n"; |
| 1899 | - $pall = $Spotter->getLast7DaysAirportsDeparture('',$filter); |
|
| 1900 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
| 1899 | + $pall = $Spotter->getLast7DaysAirportsDeparture('', $filter); |
|
| 1900 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter); |
|
| 1901 | 1901 | foreach ($dall as $value) { |
| 1902 | 1902 | $icao = $value['departure_airport_icao']; |
| 1903 | 1903 | $ddate = $value['date']; |
@@ -1915,11 +1915,11 @@ discard block |
||
| 1915 | 1915 | } |
| 1916 | 1916 | $alldata = $pall; |
| 1917 | 1917 | foreach ($alldata as $number) { |
| 1918 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],'',$filter_name); |
|
| 1918 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], '', $filter_name); |
|
| 1919 | 1919 | } |
| 1920 | 1920 | echo '...Arrival'."\n"; |
| 1921 | - $pall = $Spotter->getLast7DaysAirportsArrival('',$filter); |
|
| 1922 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
| 1921 | + $pall = $Spotter->getLast7DaysAirportsArrival('', $filter); |
|
| 1922 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter); |
|
| 1923 | 1923 | foreach ($dall as $value) { |
| 1924 | 1924 | $icao = $value['arrival_airport_icao']; |
| 1925 | 1925 | $ddate = $value['date']; |
@@ -1937,40 +1937,40 @@ discard block |
||
| 1937 | 1937 | } |
| 1938 | 1938 | $alldata = $pall; |
| 1939 | 1939 | foreach ($alldata as $number) { |
| 1940 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],'',$filter_name); |
|
| 1940 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], '', $filter_name); |
|
| 1941 | 1941 | } |
| 1942 | 1942 | |
| 1943 | 1943 | echo 'Flights data...'."\n"; |
| 1944 | 1944 | echo '-> countAllDatesLastMonth...'."\n"; |
| 1945 | 1945 | $alldata = $Spotter->countAllDatesLastMonth($filter); |
| 1946 | 1946 | foreach ($alldata as $number) { |
| 1947 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name); |
|
| 1947 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name); |
|
| 1948 | 1948 | } |
| 1949 | 1949 | echo '-> countAllDates...'."\n"; |
| 1950 | - $previousdata = $this->countAllDates('',$filter_name); |
|
| 1951 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter)); |
|
| 1950 | + $previousdata = $this->countAllDates('', $filter_name); |
|
| 1951 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter)); |
|
| 1952 | 1952 | $values = array(); |
| 1953 | 1953 | foreach ($alldata as $cnt) { |
| 1954 | 1954 | $values[] = $cnt['date_count']; |
| 1955 | 1955 | } |
| 1956 | - array_multisort($values,SORT_DESC,$alldata); |
|
| 1957 | - array_splice($alldata,11); |
|
| 1956 | + array_multisort($values, SORT_DESC, $alldata); |
|
| 1957 | + array_splice($alldata, 11); |
|
| 1958 | 1958 | foreach ($alldata as $number) { |
| 1959 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name); |
|
| 1959 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name); |
|
| 1960 | 1960 | } |
| 1961 | 1961 | |
| 1962 | 1962 | echo '-> countAllHours...'."\n"; |
| 1963 | - $alldata = $Spotter->countAllHours('hour',$filter); |
|
| 1963 | + $alldata = $Spotter->countAllHours('hour', $filter); |
|
| 1964 | 1964 | foreach ($alldata as $number) { |
| 1965 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name); |
|
| 1965 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name); |
|
| 1966 | 1966 | } |
| 1967 | 1967 | echo 'Insert last stats update date...'."\n"; |
| 1968 | 1968 | date_default_timezone_set('UTC'); |
| 1969 | - $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y-m-d G:i:s')); |
|
| 1969 | + $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y-m-d G:i:s')); |
|
| 1970 | 1970 | if (isset($filter['DeleteLastYearStats']) && $filter['DeleteLastYearStats'] == true) { |
| 1971 | - if (date('Y',strtotime($last_update_day)) != date('Y')) { |
|
| 1971 | + if (date('Y', strtotime($last_update_day)) != date('Y')) { |
|
| 1972 | 1972 | $this->deleteOldStats($filter_name); |
| 1973 | - $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y').'-01-01 00:00:00'); |
|
| 1973 | + $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y').'-01-01 00:00:00'); |
|
| 1974 | 1974 | } |
| 1975 | 1975 | } |
| 1976 | 1976 | |
@@ -1983,16 +1983,16 @@ discard block |
||
| 1983 | 1983 | // SUM all previous month to put as year |
| 1984 | 1984 | $previous_year = date('Y'); |
| 1985 | 1985 | $previous_year--; |
| 1986 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
| 1987 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
| 1988 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
| 1989 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
| 1986 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
| 1987 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
| 1988 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
| 1989 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
| 1990 | 1990 | $allairlines = $this->getAllAirlineNames(); |
| 1991 | 1991 | foreach ($allairlines as $data) { |
| 1992 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
| 1993 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
| 1994 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
| 1995 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
| 1992 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
| 1993 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
| 1994 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
| 1995 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
| 1996 | 1996 | } |
| 1997 | 1997 | |
| 1998 | 1998 | if (isset($globalArchiveYear) && $globalArchiveYear) { |
@@ -2001,7 +2001,7 @@ discard block |
||
| 2001 | 2001 | try { |
| 2002 | 2002 | $sth = $this->db->prepare($query); |
| 2003 | 2003 | $sth->execute(); |
| 2004 | - } catch(PDOException $e) { |
|
| 2004 | + } catch (PDOException $e) { |
|
| 2005 | 2005 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
| 2006 | 2006 | } |
| 2007 | 2007 | } |
@@ -2010,15 +2010,15 @@ discard block |
||
| 2010 | 2010 | try { |
| 2011 | 2011 | $sth = $this->db->prepare($query); |
| 2012 | 2012 | $sth->execute(); |
| 2013 | - } catch(PDOException $e) { |
|
| 2013 | + } catch (PDOException $e) { |
|
| 2014 | 2014 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
| 2015 | 2015 | } |
| 2016 | 2016 | } |
| 2017 | 2017 | if (isset($globalDeleteLastYearStats) && $globalDeleteLastYearStats) { |
| 2018 | 2018 | $last_update = $this->getLastStatsUpdate('last_update_stats'); |
| 2019 | - if (date('Y',strtotime($last_update[0]['value'])) != date('Y')) { |
|
| 2019 | + if (date('Y', strtotime($last_update[0]['value'])) != date('Y')) { |
|
| 2020 | 2020 | $this->deleteOldStats(); |
| 2021 | - $this->addLastStatsUpdate('last_update_stats',date('Y').'-01-01 00:00:00'); |
|
| 2021 | + $this->addLastStatsUpdate('last_update_stats', date('Y').'-01-01 00:00:00'); |
|
| 2022 | 2022 | $lastyearupdate = true; |
| 2023 | 2023 | } |
| 2024 | 2024 | } |
@@ -2040,7 +2040,7 @@ discard block |
||
| 2040 | 2040 | try { |
| 2041 | 2041 | $sth = $this->db->prepare($query); |
| 2042 | 2042 | $sth->execute(); |
| 2043 | - } catch(PDOException $e) { |
|
| 2043 | + } catch (PDOException $e) { |
|
| 2044 | 2044 | return "error : ".$e->getMessage(); |
| 2045 | 2045 | } |
| 2046 | 2046 | } |
@@ -2054,14 +2054,14 @@ discard block |
||
| 2054 | 2054 | try { |
| 2055 | 2055 | $sth = $this->db->prepare($query); |
| 2056 | 2056 | $sth->execute(); |
| 2057 | - } catch(PDOException $e) { |
|
| 2057 | + } catch (PDOException $e) { |
|
| 2058 | 2058 | return "error : ".$e->getMessage(); |
| 2059 | 2059 | } |
| 2060 | 2060 | } |
| 2061 | 2061 | if (!isset($lastyearupdate)) { |
| 2062 | 2062 | echo 'Insert last stats update date...'."\n"; |
| 2063 | 2063 | date_default_timezone_set('UTC'); |
| 2064 | - $this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s')); |
|
| 2064 | + $this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s')); |
|
| 2065 | 2065 | } |
| 2066 | 2066 | if ($globalStatsResetYear) { |
| 2067 | 2067 | require_once(dirname(__FILE__).'/../install/class.settings.php'); |
@@ -12,7 +12,9 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | public function __construct($dbc = null) { |
| 14 | 14 | global $globalFilterName; |
| 15 | - if (isset($globalFilterName)) $this->filter_name = $globalFilterName; |
|
| 15 | + if (isset($globalFilterName)) { |
|
| 16 | + $this->filter_name = $globalFilterName; |
|
| 17 | + } |
|
| 16 | 18 | $Connection = new Connection($dbc); |
| 17 | 19 | $this->db = $Connection->db(); |
| 18 | 20 | } |
@@ -77,7 +79,9 @@ discard block |
||
| 77 | 79 | } |
| 78 | 80 | } |
| 79 | 81 | public function getAllAirlineNames($filter_name = '') { |
| 80 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 82 | + if ($filter_name == '') { |
|
| 83 | + $filter_name = $this->filter_name; |
|
| 84 | + } |
|
| 81 | 85 | $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
| 82 | 86 | try { |
| 83 | 87 | $sth = $this->db->prepare($query); |
@@ -89,7 +93,9 @@ discard block |
||
| 89 | 93 | return $all; |
| 90 | 94 | } |
| 91 | 95 | public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
| 92 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 96 | + if ($filter_name == '') { |
|
| 97 | + $filter_name = $this->filter_name; |
|
| 98 | + } |
|
| 93 | 99 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
| 94 | 100 | try { |
| 95 | 101 | $sth = $this->db->prepare($query); |
@@ -101,7 +107,9 @@ discard block |
||
| 101 | 107 | return $all; |
| 102 | 108 | } |
| 103 | 109 | public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
| 104 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 110 | + if ($filter_name == '') { |
|
| 111 | + $filter_name = $this->filter_name; |
|
| 112 | + } |
|
| 105 | 113 | $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"; |
| 106 | 114 | try { |
| 107 | 115 | $sth = $this->db->prepare($query); |
@@ -113,7 +121,9 @@ discard block |
||
| 113 | 121 | return $all; |
| 114 | 122 | } |
| 115 | 123 | public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
| 116 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 124 | + if ($filter_name == '') { |
|
| 125 | + $filter_name = $this->filter_name; |
|
| 126 | + } |
|
| 117 | 127 | $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"; |
| 118 | 128 | try { |
| 119 | 129 | $sth = $this->db->prepare($query); |
@@ -128,10 +138,15 @@ discard block |
||
| 128 | 138 | |
| 129 | 139 | public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 130 | 140 | global $globalStatsFilters; |
| 131 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 141 | + if ($filter_name == '') { |
|
| 142 | + $filter_name = $this->filter_name; |
|
| 143 | + } |
|
| 132 | 144 | if ($year == '' && $month == '') { |
| 133 | - 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"; |
|
| 134 | - 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"; |
|
| 145 | + if ($limit) { |
|
| 146 | + $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"; |
|
| 147 | + } else { |
|
| 148 | + $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"; |
|
| 149 | + } |
|
| 135 | 150 | try { |
| 136 | 151 | $sth = $this->db->prepare($query); |
| 137 | 152 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -139,7 +154,9 @@ discard block |
||
| 139 | 154 | echo "error : ".$e->getMessage(); |
| 140 | 155 | } |
| 141 | 156 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 142 | - } else $all = array(); |
|
| 157 | + } else { |
|
| 158 | + $all = array(); |
|
| 159 | + } |
|
| 143 | 160 | if (empty($all)) { |
| 144 | 161 | $filters = array('airlines' => array($stats_airline)); |
| 145 | 162 | if ($filter_name != '') { |
@@ -152,10 +169,15 @@ discard block |
||
| 152 | 169 | } |
| 153 | 170 | public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
| 154 | 171 | global $globalStatsFilters; |
| 155 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 172 | + if ($filter_name == '') { |
|
| 173 | + $filter_name = $this->filter_name; |
|
| 174 | + } |
|
| 156 | 175 | if ($year == '' && $month == '') { |
| 157 | - if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 158 | - else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC"; |
|
| 176 | + if ($limit) { |
|
| 177 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 178 | + } else { |
|
| 179 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC"; |
|
| 180 | + } |
|
| 159 | 181 | try { |
| 160 | 182 | $sth = $this->db->prepare($query); |
| 161 | 183 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -163,7 +185,9 @@ discard block |
||
| 163 | 185 | echo "error : ".$e->getMessage(); |
| 164 | 186 | } |
| 165 | 187 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 166 | - } else $all = array(); |
|
| 188 | + } else { |
|
| 189 | + $all = array(); |
|
| 190 | + } |
|
| 167 | 191 | if (empty($all)) { |
| 168 | 192 | $Spotter = new Spotter($this->db); |
| 169 | 193 | $filters = array(); |
@@ -176,10 +200,15 @@ discard block |
||
| 176 | 200 | } |
| 177 | 201 | public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 178 | 202 | global $globalStatsFilters; |
| 179 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 203 | + if ($filter_name == '') { |
|
| 204 | + $filter_name = $this->filter_name; |
|
| 205 | + } |
|
| 180 | 206 | if ($year == '' && $month == '') { |
| 181 | - 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"; |
|
| 182 | - 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"; |
|
| 207 | + if ($limit) { |
|
| 208 | + $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"; |
|
| 209 | + } else { |
|
| 210 | + $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"; |
|
| 211 | + } |
|
| 183 | 212 | try { |
| 184 | 213 | $sth = $this->db->prepare($query); |
| 185 | 214 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -187,7 +216,9 @@ discard block |
||
| 187 | 216 | echo "error : ".$e->getMessage(); |
| 188 | 217 | } |
| 189 | 218 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 190 | - } else $all = array(); |
|
| 219 | + } else { |
|
| 220 | + $all = array(); |
|
| 221 | + } |
|
| 191 | 222 | if (empty($all)) { |
| 192 | 223 | $filters = array('airlines' => array($stats_airline)); |
| 193 | 224 | if ($filter_name != '') { |
@@ -201,10 +232,15 @@ discard block |
||
| 201 | 232 | |
| 202 | 233 | public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 203 | 234 | global $globalStatsFilters; |
| 204 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 235 | + if ($filter_name == '') { |
|
| 236 | + $filter_name = $this->filter_name; |
|
| 237 | + } |
|
| 205 | 238 | if ($year == '' && $month == '') { |
| 206 | - if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 207 | - else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
|
| 239 | + if ($limit) { |
|
| 240 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 241 | + } else { |
|
| 242 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
|
| 243 | + } |
|
| 208 | 244 | try { |
| 209 | 245 | $sth = $this->db->prepare($query); |
| 210 | 246 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -212,7 +248,9 @@ discard block |
||
| 212 | 248 | echo "error : ".$e->getMessage(); |
| 213 | 249 | } |
| 214 | 250 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 215 | - } else $all = array(); |
|
| 251 | + } else { |
|
| 252 | + $all = array(); |
|
| 253 | + } |
|
| 216 | 254 | if (empty($all)) { |
| 217 | 255 | $filters = array('airlines' => array($stats_airline)); |
| 218 | 256 | if ($filter_name != '') { |
@@ -225,9 +263,14 @@ discard block |
||
| 225 | 263 | } |
| 226 | 264 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
| 227 | 265 | global $globalStatsFilters; |
| 228 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 229 | - if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 230 | - else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
|
| 266 | + if ($filter_name == '') { |
|
| 267 | + $filter_name = $this->filter_name; |
|
| 268 | + } |
|
| 269 | + if ($limit) { |
|
| 270 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 271 | + } else { |
|
| 272 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
|
| 273 | + } |
|
| 231 | 274 | try { |
| 232 | 275 | $sth = $this->db->prepare($query); |
| 233 | 276 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -248,10 +291,15 @@ discard block |
||
| 248 | 291 | |
| 249 | 292 | public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
| 250 | 293 | global $globalStatsFilters; |
| 251 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 294 | + if ($filter_name == '') { |
|
| 295 | + $filter_name = $this->filter_name; |
|
| 296 | + } |
|
| 252 | 297 | if ($year == '' && $month == '') { |
| 253 | - if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 254 | - else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC"; |
|
| 298 | + if ($limit) { |
|
| 299 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 300 | + } else { |
|
| 301 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC"; |
|
| 302 | + } |
|
| 255 | 303 | try { |
| 256 | 304 | $sth = $this->db->prepare($query); |
| 257 | 305 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -259,7 +307,9 @@ discard block |
||
| 259 | 307 | echo "error : ".$e->getMessage(); |
| 260 | 308 | } |
| 261 | 309 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 262 | - } else $all = array(); |
|
| 310 | + } else { |
|
| 311 | + $all = array(); |
|
| 312 | + } |
|
| 263 | 313 | if (empty($all)) { |
| 264 | 314 | $Spotter = new Spotter($this->db); |
| 265 | 315 | $filters = array(); |
@@ -273,10 +323,15 @@ discard block |
||
| 273 | 323 | } |
| 274 | 324 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 275 | 325 | global $globalStatsFilters; |
| 276 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 326 | + if ($filter_name == '') { |
|
| 327 | + $filter_name = $this->filter_name; |
|
| 328 | + } |
|
| 277 | 329 | if ($year == '' && $month == '') { |
| 278 | - 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"; |
|
| 279 | - 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"; |
|
| 330 | + if ($limit) { |
|
| 331 | + $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"; |
|
| 332 | + } else { |
|
| 333 | + $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"; |
|
| 334 | + } |
|
| 280 | 335 | try { |
| 281 | 336 | $sth = $this->db->prepare($query); |
| 282 | 337 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -284,7 +339,9 @@ discard block |
||
| 284 | 339 | echo "error : ".$e->getMessage(); |
| 285 | 340 | } |
| 286 | 341 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 287 | - } else $all = array(); |
|
| 342 | + } else { |
|
| 343 | + $all = array(); |
|
| 344 | + } |
|
| 288 | 345 | if (empty($all)) { |
| 289 | 346 | $filters = array('airlines' => array($stats_airline)); |
| 290 | 347 | if ($filter_name != '') { |
@@ -297,10 +354,15 @@ discard block |
||
| 297 | 354 | } |
| 298 | 355 | public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 299 | 356 | global $globalStatsFilters; |
| 300 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 357 | + if ($filter_name == '') { |
|
| 358 | + $filter_name = $this->filter_name; |
|
| 359 | + } |
|
| 301 | 360 | if ($year == '' && $month == '') { |
| 302 | - 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"; |
|
| 303 | - 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"; |
|
| 361 | + if ($limit) { |
|
| 362 | + $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"; |
|
| 363 | + } else { |
|
| 364 | + $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"; |
|
| 365 | + } |
|
| 304 | 366 | try { |
| 305 | 367 | $sth = $this->db->prepare($query); |
| 306 | 368 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -308,7 +370,9 @@ discard block |
||
| 308 | 370 | echo "error : ".$e->getMessage(); |
| 309 | 371 | } |
| 310 | 372 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 311 | - } else $all = array(); |
|
| 373 | + } else { |
|
| 374 | + $all = array(); |
|
| 375 | + } |
|
| 312 | 376 | if (empty($all)) { |
| 313 | 377 | $filters = array('airlines' => array($stats_airline)); |
| 314 | 378 | if ($filter_name != '') { |
@@ -321,11 +385,16 @@ discard block |
||
| 321 | 385 | } |
| 322 | 386 | public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 323 | 387 | $Connection = new Connection(); |
| 324 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 388 | + if ($filter_name == '') { |
|
| 389 | + $filter_name = $this->filter_name; |
|
| 390 | + } |
|
| 325 | 391 | if ($Connection->tableExists('countries')) { |
| 326 | 392 | if ($year == '' && $month == '') { |
| 327 | - 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"; |
|
| 328 | - 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"; |
|
| 393 | + if ($limit) { |
|
| 394 | + $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"; |
|
| 395 | + } else { |
|
| 396 | + $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"; |
|
| 397 | + } |
|
| 329 | 398 | try { |
| 330 | 399 | $sth = $this->db->prepare($query); |
| 331 | 400 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -340,17 +409,24 @@ discard block |
||
| 340 | 409 | } |
| 341 | 410 | */ |
| 342 | 411 | return $all; |
| 343 | - } else return array(); |
|
| 412 | + } else { |
|
| 413 | + return array(); |
|
| 414 | + } |
|
| 344 | 415 | } else { |
| 345 | 416 | return array(); |
| 346 | 417 | } |
| 347 | 418 | } |
| 348 | 419 | public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
| 349 | 420 | global $globalStatsFilters; |
| 350 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 421 | + if ($filter_name == '') { |
|
| 422 | + $filter_name = $this->filter_name; |
|
| 423 | + } |
|
| 351 | 424 | if ($year == '' && $month == '') { |
| 352 | - 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"; |
|
| 353 | - 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"; |
|
| 425 | + if ($limit) { |
|
| 426 | + $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"; |
|
| 427 | + } else { |
|
| 428 | + $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"; |
|
| 429 | + } |
|
| 354 | 430 | try { |
| 355 | 431 | $sth = $this->db->prepare($query); |
| 356 | 432 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -358,7 +434,9 @@ discard block |
||
| 358 | 434 | echo "error : ".$e->getMessage(); |
| 359 | 435 | } |
| 360 | 436 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 361 | - } else $all = array(); |
|
| 437 | + } else { |
|
| 438 | + $all = array(); |
|
| 439 | + } |
|
| 362 | 440 | if (empty($all)) { |
| 363 | 441 | $filters = array('airlines' => array($stats_airline)); |
| 364 | 442 | if ($filter_name != '') { |
@@ -372,10 +450,15 @@ discard block |
||
| 372 | 450 | |
| 373 | 451 | public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
| 374 | 452 | global $globalStatsFilters; |
| 375 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 453 | + if ($filter_name == '') { |
|
| 454 | + $filter_name = $this->filter_name; |
|
| 455 | + } |
|
| 376 | 456 | if ($year == '' && $month == '') { |
| 377 | - 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"; |
|
| 378 | - 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"; |
|
| 457 | + if ($limit) { |
|
| 458 | + $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"; |
|
| 459 | + } else { |
|
| 460 | + $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"; |
|
| 461 | + } |
|
| 379 | 462 | try { |
| 380 | 463 | $sth = $this->db->prepare($query); |
| 381 | 464 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -383,7 +466,9 @@ discard block |
||
| 383 | 466 | echo "error : ".$e->getMessage(); |
| 384 | 467 | } |
| 385 | 468 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 386 | - } else $all = array(); |
|
| 469 | + } else { |
|
| 470 | + $all = array(); |
|
| 471 | + } |
|
| 387 | 472 | if (empty($all)) { |
| 388 | 473 | $filters = array('airlines' => array($stats_airline)); |
| 389 | 474 | if ($filter_name != '') { |
@@ -396,10 +481,15 @@ discard block |
||
| 396 | 481 | } |
| 397 | 482 | public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 398 | 483 | global $globalStatsFilters; |
| 399 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 484 | + if ($filter_name == '') { |
|
| 485 | + $filter_name = $this->filter_name; |
|
| 486 | + } |
|
| 400 | 487 | if ($year == '' && $month == '') { |
| 401 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 402 | - else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
| 488 | + if ($limit) { |
|
| 489 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 490 | + } else { |
|
| 491 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
| 492 | + } |
|
| 403 | 493 | try { |
| 404 | 494 | $sth = $this->db->prepare($query); |
| 405 | 495 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -407,7 +497,9 @@ discard block |
||
| 407 | 497 | echo "error : ".$e->getMessage(); |
| 408 | 498 | } |
| 409 | 499 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 410 | - } else $all = array(); |
|
| 500 | + } else { |
|
| 501 | + $all = array(); |
|
| 502 | + } |
|
| 411 | 503 | if (empty($all)) { |
| 412 | 504 | $filters = array('airlines' => array($stats_airline)); |
| 413 | 505 | if ($filter_name != '') { |
@@ -426,7 +518,9 @@ discard block |
||
| 426 | 518 | $icao = $value['airport_departure_icao']; |
| 427 | 519 | if (isset($all[$icao])) { |
| 428 | 520 | $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 429 | - } else $all[$icao] = $value; |
|
| 521 | + } else { |
|
| 522 | + $all[$icao] = $value; |
|
| 523 | + } |
|
| 430 | 524 | } |
| 431 | 525 | $count = array(); |
| 432 | 526 | foreach ($all as $key => $row) { |
@@ -438,10 +532,15 @@ discard block |
||
| 438 | 532 | } |
| 439 | 533 | public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 440 | 534 | global $globalStatsFilters; |
| 441 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 535 | + if ($filter_name == '') { |
|
| 536 | + $filter_name = $this->filter_name; |
|
| 537 | + } |
|
| 442 | 538 | if ($year == '' && $month == '') { |
| 443 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 444 | - else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
| 539 | + if ($limit) { |
|
| 540 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 541 | + } else { |
|
| 542 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
| 543 | + } |
|
| 445 | 544 | try { |
| 446 | 545 | $sth = $this->db->prepare($query); |
| 447 | 546 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -449,7 +548,9 @@ discard block |
||
| 449 | 548 | echo "error : ".$e->getMessage(); |
| 450 | 549 | } |
| 451 | 550 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 452 | - } else $all = array(); |
|
| 551 | + } else { |
|
| 552 | + $all = array(); |
|
| 553 | + } |
|
| 453 | 554 | if (empty($all)) { |
| 454 | 555 | $filters = array('airlines' => array($stats_airline)); |
| 455 | 556 | if ($filter_name != '') { |
@@ -468,7 +569,9 @@ discard block |
||
| 468 | 569 | $icao = $value['airport_arrival_icao']; |
| 469 | 570 | if (isset($all[$icao])) { |
| 470 | 571 | $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 471 | - } else $all[$icao] = $value; |
|
| 572 | + } else { |
|
| 573 | + $all[$icao] = $value; |
|
| 574 | + } |
|
| 472 | 575 | } |
| 473 | 576 | $count = array(); |
| 474 | 577 | foreach ($all as $key => $row) { |
@@ -481,13 +584,21 @@ discard block |
||
| 481 | 584 | } |
| 482 | 585 | public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
| 483 | 586 | global $globalDBdriver, $globalStatsFilters; |
| 484 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 587 | + if ($filter_name == '') { |
|
| 588 | + $filter_name = $this->filter_name; |
|
| 589 | + } |
|
| 485 | 590 | if ($globalDBdriver == 'mysql') { |
| 486 | - 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"; |
|
| 487 | - 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"; |
|
| 591 | + if ($limit) { |
|
| 592 | + $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"; |
|
| 593 | + } else { |
|
| 594 | + $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"; |
|
| 595 | + } |
|
| 488 | 596 | } else { |
| 489 | - 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"; |
|
| 490 | - 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"; |
|
| 597 | + if ($limit) { |
|
| 598 | + $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"; |
|
| 599 | + } else { |
|
| 600 | + $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"; |
|
| 601 | + } |
|
| 491 | 602 | } |
| 492 | 603 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 493 | 604 | try { |
@@ -511,7 +622,9 @@ discard block |
||
| 511 | 622 | |
| 512 | 623 | public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
| 513 | 624 | global $globalStatsFilters; |
| 514 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 625 | + if ($filter_name == '') { |
|
| 626 | + $filter_name = $this->filter_name; |
|
| 627 | + } |
|
| 515 | 628 | $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"; |
| 516 | 629 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 517 | 630 | try { |
@@ -533,7 +646,9 @@ discard block |
||
| 533 | 646 | } |
| 534 | 647 | public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
| 535 | 648 | global $globalDBdriver, $globalStatsFilters; |
| 536 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 649 | + if ($filter_name == '') { |
|
| 650 | + $filter_name = $this->filter_name; |
|
| 651 | + } |
|
| 537 | 652 | if ($globalDBdriver == 'mysql') { |
| 538 | 653 | $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"; |
| 539 | 654 | } else { |
@@ -559,7 +674,9 @@ discard block |
||
| 559 | 674 | } |
| 560 | 675 | public function countAllDates($stats_airline = '',$filter_name = '') { |
| 561 | 676 | global $globalStatsFilters; |
| 562 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 677 | + if ($filter_name == '') { |
|
| 678 | + $filter_name = $this->filter_name; |
|
| 679 | + } |
|
| 563 | 680 | $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"; |
| 564 | 681 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 565 | 682 | try { |
@@ -581,7 +698,9 @@ discard block |
||
| 581 | 698 | } |
| 582 | 699 | public function countAllDatesByAirlines($filter_name = '') { |
| 583 | 700 | global $globalStatsFilters; |
| 584 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 701 | + if ($filter_name == '') { |
|
| 702 | + $filter_name = $this->filter_name; |
|
| 703 | + } |
|
| 585 | 704 | $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"; |
| 586 | 705 | $query_data = array('filter_name' => $filter_name); |
| 587 | 706 | try { |
@@ -603,7 +722,9 @@ discard block |
||
| 603 | 722 | } |
| 604 | 723 | public function countAllMonths($stats_airline = '',$filter_name = '') { |
| 605 | 724 | global $globalStatsFilters; |
| 606 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 725 | + if ($filter_name == '') { |
|
| 726 | + $filter_name = $this->filter_name; |
|
| 727 | + } |
|
| 607 | 728 | $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"; |
| 608 | 729 | try { |
| 609 | 730 | $sth = $this->db->prepare($query); |
@@ -624,7 +745,9 @@ discard block |
||
| 624 | 745 | } |
| 625 | 746 | public function countAllMilitaryMonths($filter_name = '') { |
| 626 | 747 | global $globalStatsFilters; |
| 627 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 748 | + if ($filter_name == '') { |
|
| 749 | + $filter_name = $this->filter_name; |
|
| 750 | + } |
|
| 628 | 751 | $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"; |
| 629 | 752 | try { |
| 630 | 753 | $sth = $this->db->prepare($query); |
@@ -645,9 +768,14 @@ discard block |
||
| 645 | 768 | } |
| 646 | 769 | public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
| 647 | 770 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
| 648 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 649 | - 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"; |
|
| 650 | - 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"; |
|
| 771 | + if ($filter_name == '') { |
|
| 772 | + $filter_name = $this->filter_name; |
|
| 773 | + } |
|
| 774 | + if ($limit) { |
|
| 775 | + $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"; |
|
| 776 | + } else { |
|
| 777 | + $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"; |
|
| 778 | + } |
|
| 651 | 779 | if ($orderby == 'hour') { |
| 652 | 780 | /* |
| 653 | 781 | if ($globalDBdriver == 'mysql') { |
@@ -656,7 +784,9 @@ discard block |
||
| 656 | 784 | */ |
| 657 | 785 | $query .= " ORDER BY CAST(flight_date AS integer) ASC"; |
| 658 | 786 | } |
| 659 | - if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
|
| 787 | + if ($orderby == 'count') { |
|
| 788 | + $query .= " ORDER BY hour_count DESC"; |
|
| 789 | + } |
|
| 660 | 790 | try { |
| 661 | 791 | $sth = $this->db->prepare($query); |
| 662 | 792 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
@@ -677,8 +807,12 @@ discard block |
||
| 677 | 807 | |
| 678 | 808 | public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
| 679 | 809 | global $globalStatsFilters; |
| 680 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 681 | - if ($year == '') $year = date('Y'); |
|
| 810 | + if ($filter_name == '') { |
|
| 811 | + $filter_name = $this->filter_name; |
|
| 812 | + } |
|
| 813 | + if ($year == '') { |
|
| 814 | + $year = date('Y'); |
|
| 815 | + } |
|
| 682 | 816 | $all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
| 683 | 817 | if (empty($all)) { |
| 684 | 818 | $filters = array('airlines' => array($stats_airline)); |
@@ -692,8 +826,12 @@ discard block |
||
| 692 | 826 | } |
| 693 | 827 | public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
| 694 | 828 | global $globalStatsFilters; |
| 695 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 696 | - if ($year == '') $year = date('Y'); |
|
| 829 | + if ($filter_name == '') { |
|
| 830 | + $filter_name = $this->filter_name; |
|
| 831 | + } |
|
| 832 | + if ($year == '') { |
|
| 833 | + $year = date('Y'); |
|
| 834 | + } |
|
| 697 | 835 | $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
| 698 | 836 | if (empty($all)) { |
| 699 | 837 | $filters = array(); |
@@ -707,8 +845,12 @@ discard block |
||
| 707 | 845 | } |
| 708 | 846 | public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
| 709 | 847 | global $globalStatsFilters; |
| 710 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 711 | - if ($year == '') $year = date('Y'); |
|
| 848 | + if ($filter_name == '') { |
|
| 849 | + $filter_name = $this->filter_name; |
|
| 850 | + } |
|
| 851 | + if ($year == '') { |
|
| 852 | + $year = date('Y'); |
|
| 853 | + } |
|
| 712 | 854 | $all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
| 713 | 855 | if (empty($all)) { |
| 714 | 856 | $filters = array('airlines' => array($stats_airline)); |
@@ -722,8 +864,12 @@ discard block |
||
| 722 | 864 | } |
| 723 | 865 | public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
| 724 | 866 | global $globalStatsFilters; |
| 725 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 726 | - if ($year == '') $year = date('Y'); |
|
| 867 | + if ($filter_name == '') { |
|
| 868 | + $filter_name = $this->filter_name; |
|
| 869 | + } |
|
| 870 | + if ($year == '') { |
|
| 871 | + $year = date('Y'); |
|
| 872 | + } |
|
| 727 | 873 | $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
| 728 | 874 | if (empty($all)) { |
| 729 | 875 | $filters = array('airlines' => array($stats_airline)); |
@@ -737,7 +883,9 @@ discard block |
||
| 737 | 883 | } |
| 738 | 884 | public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
| 739 | 885 | global $globalStatsFilters; |
| 740 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 886 | + if ($filter_name == '') { |
|
| 887 | + $filter_name = $this->filter_name; |
|
| 888 | + } |
|
| 741 | 889 | if ($year == '' && $month == '') { |
| 742 | 890 | $query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name"; |
| 743 | 891 | try { |
@@ -748,7 +896,9 @@ discard block |
||
| 748 | 896 | } |
| 749 | 897 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 750 | 898 | $all = $result[0]['nb_airline']; |
| 751 | - } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
| 899 | + } else { |
|
| 900 | + $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
| 901 | + } |
|
| 752 | 902 | if (empty($all)) { |
| 753 | 903 | $filters = array(); |
| 754 | 904 | if ($filter_name != '') { |
@@ -761,8 +911,12 @@ discard block |
||
| 761 | 911 | } |
| 762 | 912 | public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
| 763 | 913 | global $globalStatsFilters; |
| 764 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 765 | - if ($year == '') $year = date('Y'); |
|
| 914 | + if ($filter_name == '') { |
|
| 915 | + $filter_name = $this->filter_name; |
|
| 916 | + } |
|
| 917 | + if ($year == '') { |
|
| 918 | + $year = date('Y'); |
|
| 919 | + } |
|
| 766 | 920 | /* |
| 767 | 921 | $query = "SELECT COUNT(*) AS nb_owner FROM stats_owner"; |
| 768 | 922 | try { |
@@ -787,8 +941,12 @@ discard block |
||
| 787 | 941 | } |
| 788 | 942 | public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 789 | 943 | global $globalStatsFilters; |
| 790 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 791 | - if ($year == '') $year = date('Y'); |
|
| 944 | + if ($filter_name == '') { |
|
| 945 | + $filter_name = $this->filter_name; |
|
| 946 | + } |
|
| 947 | + if ($year == '') { |
|
| 948 | + $year = date('Y'); |
|
| 949 | + } |
|
| 792 | 950 | $all = $this->getSumStats('pilots_bymonth',$year,$stats_airline,$filter_name,$month); |
| 793 | 951 | if (empty($all)) { |
| 794 | 952 | $filters = array('airlines' => array($stats_airline)); |
@@ -802,7 +960,9 @@ discard block |
||
| 802 | 960 | } |
| 803 | 961 | |
| 804 | 962 | public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
| 805 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 963 | + if ($filter_name == '') { |
|
| 964 | + $filter_name = $this->filter_name; |
|
| 965 | + } |
|
| 806 | 966 | $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"; |
| 807 | 967 | $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
| 808 | 968 | try { |
@@ -815,7 +975,9 @@ discard block |
||
| 815 | 975 | return $all; |
| 816 | 976 | } |
| 817 | 977 | public function getStats($type,$stats_airline = '', $filter_name = '') { |
| 818 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 978 | + if ($filter_name == '') { |
|
| 979 | + $filter_name = $this->filter_name; |
|
| 980 | + } |
|
| 819 | 981 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
| 820 | 982 | $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 821 | 983 | try { |
@@ -828,7 +990,9 @@ discard block |
||
| 828 | 990 | return $all; |
| 829 | 991 | } |
| 830 | 992 | public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
| 831 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 993 | + if ($filter_name == '') { |
|
| 994 | + $filter_name = $this->filter_name; |
|
| 995 | + } |
|
| 832 | 996 | global $globalArchiveMonths, $globalDBdriver; |
| 833 | 997 | if ($globalDBdriver == 'mysql') { |
| 834 | 998 | if ($month == '') { |
@@ -858,7 +1022,9 @@ discard block |
||
| 858 | 1022 | } |
| 859 | 1023 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
| 860 | 1024 | global $globalArchiveMonths, $globalDBdriver; |
| 861 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1025 | + if ($filter_name == '') { |
|
| 1026 | + $filter_name = $this->filter_name; |
|
| 1027 | + } |
|
| 862 | 1028 | if ($globalDBdriver == 'mysql') { |
| 863 | 1029 | $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"; |
| 864 | 1030 | } else { |
@@ -876,7 +1042,9 @@ discard block |
||
| 876 | 1042 | } |
| 877 | 1043 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
| 878 | 1044 | global $globalArchiveMonths, $globalDBdriver; |
| 879 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1045 | + if ($filter_name == '') { |
|
| 1046 | + $filter_name = $this->filter_name; |
|
| 1047 | + } |
|
| 880 | 1048 | if ($globalDBdriver == 'mysql') { |
| 881 | 1049 | $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 882 | 1050 | } else { |
@@ -893,7 +1061,9 @@ discard block |
||
| 893 | 1061 | } |
| 894 | 1062 | public function getStatsAirlineTotal($filter_name = '') { |
| 895 | 1063 | global $globalArchiveMonths, $globalDBdriver; |
| 896 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1064 | + if ($filter_name == '') { |
|
| 1065 | + $filter_name = $this->filter_name; |
|
| 1066 | + } |
|
| 897 | 1067 | if ($globalDBdriver == 'mysql') { |
| 898 | 1068 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
| 899 | 1069 | } else { |
@@ -910,7 +1080,9 @@ discard block |
||
| 910 | 1080 | } |
| 911 | 1081 | public function getStatsOwnerTotal($filter_name = '') { |
| 912 | 1082 | global $globalArchiveMonths, $globalDBdriver; |
| 913 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1083 | + if ($filter_name == '') { |
|
| 1084 | + $filter_name = $this->filter_name; |
|
| 1085 | + } |
|
| 914 | 1086 | if ($globalDBdriver == 'mysql') { |
| 915 | 1087 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
| 916 | 1088 | } else { |
@@ -927,7 +1099,9 @@ discard block |
||
| 927 | 1099 | } |
| 928 | 1100 | public function getStatsPilotTotal($filter_name = '') { |
| 929 | 1101 | global $globalArchiveMonths, $globalDBdriver; |
| 930 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1102 | + if ($filter_name == '') { |
|
| 1103 | + $filter_name = $this->filter_name; |
|
| 1104 | + } |
|
| 931 | 1105 | if ($globalDBdriver == 'mysql') { |
| 932 | 1106 | $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
| 933 | 1107 | } else { |
@@ -945,7 +1119,9 @@ discard block |
||
| 945 | 1119 | |
| 946 | 1120 | public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 947 | 1121 | global $globalDBdriver; |
| 948 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1122 | + if ($filter_name == '') { |
|
| 1123 | + $filter_name = $this->filter_name; |
|
| 1124 | + } |
|
| 949 | 1125 | if ($globalDBdriver == 'mysql') { |
| 950 | 1126 | $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"; |
| 951 | 1127 | } else { |
@@ -961,7 +1137,9 @@ discard block |
||
| 961 | 1137 | } |
| 962 | 1138 | public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 963 | 1139 | global $globalDBdriver; |
| 964 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1140 | + if ($filter_name == '') { |
|
| 1141 | + $filter_name = $this->filter_name; |
|
| 1142 | + } |
|
| 965 | 1143 | if ($globalDBdriver == 'mysql') { |
| 966 | 1144 | $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"; |
| 967 | 1145 | } else { |
@@ -1347,10 +1525,14 @@ discard block |
||
| 1347 | 1525 | $Connection = new Connection(); |
| 1348 | 1526 | date_default_timezone_set('UTC'); |
| 1349 | 1527 | $last_update = $this->getLastStatsUpdate('last_update_stats'); |
| 1350 | - if ($globalDebug) echo 'Update stats !'."\n"; |
|
| 1528 | + if ($globalDebug) { |
|
| 1529 | + echo 'Update stats !'."\n"; |
|
| 1530 | + } |
|
| 1351 | 1531 | if (isset($last_update[0]['value'])) { |
| 1352 | 1532 | $last_update_day = $last_update[0]['value']; |
| 1353 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
| 1533 | + } else { |
|
| 1534 | + $last_update_day = '2012-12-12 12:12:12'; |
|
| 1535 | + } |
|
| 1354 | 1536 | $reset = false; |
| 1355 | 1537 | if ($globalStatsResetYear) { |
| 1356 | 1538 | $reset = true; |
@@ -1358,42 +1540,60 @@ discard block |
||
| 1358 | 1540 | } |
| 1359 | 1541 | $Spotter = new Spotter($this->db); |
| 1360 | 1542 | |
| 1361 | - if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
|
| 1543 | + if ($globalDebug) { |
|
| 1544 | + echo 'Count all aircraft types...'."\n"; |
|
| 1545 | + } |
|
| 1362 | 1546 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
| 1363 | 1547 | foreach ($alldata as $number) { |
| 1364 | 1548 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
| 1365 | 1549 | } |
| 1366 | - if ($globalDebug) echo 'Count all airlines...'."\n"; |
|
| 1550 | + if ($globalDebug) { |
|
| 1551 | + echo 'Count all airlines...'."\n"; |
|
| 1552 | + } |
|
| 1367 | 1553 | $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
| 1368 | 1554 | foreach ($alldata as $number) { |
| 1369 | 1555 | $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
| 1370 | 1556 | } |
| 1371 | - if ($globalDebug) echo 'Count all registrations...'."\n"; |
|
| 1557 | + if ($globalDebug) { |
|
| 1558 | + echo 'Count all registrations...'."\n"; |
|
| 1559 | + } |
|
| 1372 | 1560 | $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
| 1373 | 1561 | foreach ($alldata as $number) { |
| 1374 | 1562 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
| 1375 | 1563 | } |
| 1376 | - if ($globalDebug) echo 'Count all callsigns...'."\n"; |
|
| 1564 | + if ($globalDebug) { |
|
| 1565 | + echo 'Count all callsigns...'."\n"; |
|
| 1566 | + } |
|
| 1377 | 1567 | $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
| 1378 | 1568 | foreach ($alldata as $number) { |
| 1379 | 1569 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
| 1380 | 1570 | } |
| 1381 | - if ($globalDebug) echo 'Count all owners...'."\n"; |
|
| 1571 | + if ($globalDebug) { |
|
| 1572 | + echo 'Count all owners...'."\n"; |
|
| 1573 | + } |
|
| 1382 | 1574 | $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
| 1383 | 1575 | foreach ($alldata as $number) { |
| 1384 | 1576 | $this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
| 1385 | 1577 | } |
| 1386 | - if ($globalDebug) echo 'Count all pilots...'."\n"; |
|
| 1578 | + if ($globalDebug) { |
|
| 1579 | + echo 'Count all pilots...'."\n"; |
|
| 1580 | + } |
|
| 1387 | 1581 | $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
| 1388 | 1582 | foreach ($alldata as $number) { |
| 1389 | 1583 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
| 1390 | 1584 | } |
| 1391 | 1585 | |
| 1392 | - if ($globalDebug) echo 'Count all departure airports...'."\n"; |
|
| 1586 | + if ($globalDebug) { |
|
| 1587 | + echo 'Count all departure airports...'."\n"; |
|
| 1588 | + } |
|
| 1393 | 1589 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
| 1394 | - if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
|
| 1590 | + if ($globalDebug) { |
|
| 1591 | + echo 'Count all detected departure airports...'."\n"; |
|
| 1592 | + } |
|
| 1395 | 1593 | $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
| 1396 | - if ($globalDebug) echo 'Order departure airports...'."\n"; |
|
| 1594 | + if ($globalDebug) { |
|
| 1595 | + echo 'Order departure airports...'."\n"; |
|
| 1596 | + } |
|
| 1397 | 1597 | $alldata = array(); |
| 1398 | 1598 | |
| 1399 | 1599 | foreach ($pall as $value) { |
@@ -1404,7 +1604,9 @@ discard block |
||
| 1404 | 1604 | $icao = $value['airport_departure_icao']; |
| 1405 | 1605 | if (isset($alldata[$icao])) { |
| 1406 | 1606 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 1407 | - } else $alldata[$icao] = $value; |
|
| 1607 | + } else { |
|
| 1608 | + $alldata[$icao] = $value; |
|
| 1609 | + } |
|
| 1408 | 1610 | } |
| 1409 | 1611 | $count = array(); |
| 1410 | 1612 | foreach ($alldata as $key => $row) { |
@@ -1414,11 +1616,17 @@ discard block |
||
| 1414 | 1616 | foreach ($alldata as $number) { |
| 1415 | 1617 | 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); |
| 1416 | 1618 | } |
| 1417 | - if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
|
| 1619 | + if ($globalDebug) { |
|
| 1620 | + echo 'Count all arrival airports...'."\n"; |
|
| 1621 | + } |
|
| 1418 | 1622 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
| 1419 | - if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
|
| 1623 | + if ($globalDebug) { |
|
| 1624 | + echo 'Count all detected arrival airports...'."\n"; |
|
| 1625 | + } |
|
| 1420 | 1626 | $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
| 1421 | - if ($globalDebug) echo 'Order arrival airports...'."\n"; |
|
| 1627 | + if ($globalDebug) { |
|
| 1628 | + echo 'Order arrival airports...'."\n"; |
|
| 1629 | + } |
|
| 1422 | 1630 | $alldata = array(); |
| 1423 | 1631 | foreach ($pall as $value) { |
| 1424 | 1632 | $icao = $value['airport_arrival_icao']; |
@@ -1428,7 +1636,9 @@ discard block |
||
| 1428 | 1636 | $icao = $value['airport_arrival_icao']; |
| 1429 | 1637 | if (isset($alldata[$icao])) { |
| 1430 | 1638 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 1431 | - } else $alldata[$icao] = $value; |
|
| 1639 | + } else { |
|
| 1640 | + $alldata[$icao] = $value; |
|
| 1641 | + } |
|
| 1432 | 1642 | } |
| 1433 | 1643 | $count = array(); |
| 1434 | 1644 | foreach ($alldata as $key => $row) { |
@@ -1439,7 +1649,9 @@ discard block |
||
| 1439 | 1649 | 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); |
| 1440 | 1650 | } |
| 1441 | 1651 | if ($Connection->tableExists('countries')) { |
| 1442 | - if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
|
| 1652 | + if ($globalDebug) { |
|
| 1653 | + echo 'Count all flights by countries...'."\n"; |
|
| 1654 | + } |
|
| 1443 | 1655 | $SpotterArchive = new SpotterArchive(); |
| 1444 | 1656 | $alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
| 1445 | 1657 | foreach ($alldata as $number) { |
@@ -1451,46 +1663,66 @@ discard block |
||
| 1451 | 1663 | // Add by month using getstat if month finish... |
| 1452 | 1664 | |
| 1453 | 1665 | //if (date('m',strtotime($last_update_day)) != date('m')) { |
| 1454 | - if ($globalDebug) echo 'Count all flights by months...'."\n"; |
|
| 1666 | + if ($globalDebug) { |
|
| 1667 | + echo 'Count all flights by months...'."\n"; |
|
| 1668 | + } |
|
| 1455 | 1669 | $Spotter = new Spotter($this->db); |
| 1456 | 1670 | $alldata = $Spotter->countAllMonths(); |
| 1457 | 1671 | $lastyear = false; |
| 1458 | 1672 | foreach ($alldata as $number) { |
| 1459 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 1673 | + if ($number['year_name'] != date('Y')) { |
|
| 1674 | + $lastyear = true; |
|
| 1675 | + } |
|
| 1460 | 1676 | $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']))); |
| 1461 | 1677 | } |
| 1462 | - if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
|
| 1678 | + if ($globalDebug) { |
|
| 1679 | + echo 'Count all military flights by months...'."\n"; |
|
| 1680 | + } |
|
| 1463 | 1681 | $alldata = $Spotter->countAllMilitaryMonths(); |
| 1464 | 1682 | foreach ($alldata as $number) { |
| 1465 | 1683 | $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']))); |
| 1466 | 1684 | } |
| 1467 | - if ($globalDebug) echo 'Count all owners by months...'."\n"; |
|
| 1685 | + if ($globalDebug) { |
|
| 1686 | + echo 'Count all owners by months...'."\n"; |
|
| 1687 | + } |
|
| 1468 | 1688 | $alldata = $Spotter->countAllMonthsOwners(); |
| 1469 | 1689 | foreach ($alldata as $number) { |
| 1470 | 1690 | $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']))); |
| 1471 | 1691 | } |
| 1472 | - if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
|
| 1692 | + if ($globalDebug) { |
|
| 1693 | + echo 'Count all pilots by months...'."\n"; |
|
| 1694 | + } |
|
| 1473 | 1695 | $alldata = $Spotter->countAllMonthsPilots(); |
| 1474 | 1696 | foreach ($alldata as $number) { |
| 1475 | 1697 | $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']))); |
| 1476 | 1698 | } |
| 1477 | - if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
|
| 1699 | + if ($globalDebug) { |
|
| 1700 | + echo 'Count all airlines by months...'."\n"; |
|
| 1701 | + } |
|
| 1478 | 1702 | $alldata = $Spotter->countAllMonthsAirlines(); |
| 1479 | 1703 | foreach ($alldata as $number) { |
| 1480 | 1704 | $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']))); |
| 1481 | 1705 | } |
| 1482 | - if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
|
| 1706 | + if ($globalDebug) { |
|
| 1707 | + echo 'Count all aircrafts by months...'."\n"; |
|
| 1708 | + } |
|
| 1483 | 1709 | $alldata = $Spotter->countAllMonthsAircrafts(); |
| 1484 | 1710 | foreach ($alldata as $number) { |
| 1485 | 1711 | $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']))); |
| 1486 | 1712 | } |
| 1487 | - if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
|
| 1713 | + if ($globalDebug) { |
|
| 1714 | + echo 'Count all real arrivals by months...'."\n"; |
|
| 1715 | + } |
|
| 1488 | 1716 | $alldata = $Spotter->countAllMonthsRealArrivals(); |
| 1489 | 1717 | foreach ($alldata as $number) { |
| 1490 | 1718 | $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']))); |
| 1491 | 1719 | } |
| 1492 | - if ($globalDebug) echo 'Airports data...'."\n"; |
|
| 1493 | - if ($globalDebug) echo '...Departure'."\n"; |
|
| 1720 | + if ($globalDebug) { |
|
| 1721 | + echo 'Airports data...'."\n"; |
|
| 1722 | + } |
|
| 1723 | + if ($globalDebug) { |
|
| 1724 | + echo '...Departure'."\n"; |
|
| 1725 | + } |
|
| 1494 | 1726 | $this->deleteStatAirport('daily'); |
| 1495 | 1727 | // $pall = $Spotter->getLast7DaysAirportsDeparture(); |
| 1496 | 1728 | // $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
@@ -1610,37 +1842,53 @@ discard block |
||
| 1610 | 1842 | |
| 1611 | 1843 | // Count by airlines |
| 1612 | 1844 | echo '--- Stats by airlines ---'."\n"; |
| 1613 | - if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
|
| 1845 | + if ($globalDebug) { |
|
| 1846 | + echo 'Count all aircraft types by airlines...'."\n"; |
|
| 1847 | + } |
|
| 1614 | 1848 | $Spotter = new Spotter($this->db); |
| 1615 | 1849 | $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
| 1616 | 1850 | foreach ($alldata as $number) { |
| 1617 | 1851 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
| 1618 | 1852 | } |
| 1619 | - if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
|
| 1853 | + if ($globalDebug) { |
|
| 1854 | + echo 'Count all aircraft registrations by airlines...'."\n"; |
|
| 1855 | + } |
|
| 1620 | 1856 | $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
| 1621 | 1857 | foreach ($alldata as $number) { |
| 1622 | 1858 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
| 1623 | 1859 | } |
| 1624 | - if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
|
| 1860 | + if ($globalDebug) { |
|
| 1861 | + echo 'Count all callsigns by airlines...'."\n"; |
|
| 1862 | + } |
|
| 1625 | 1863 | $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
| 1626 | 1864 | foreach ($alldata as $number) { |
| 1627 | 1865 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
| 1628 | 1866 | } |
| 1629 | - if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
|
| 1867 | + if ($globalDebug) { |
|
| 1868 | + echo 'Count all owners by airlines...'."\n"; |
|
| 1869 | + } |
|
| 1630 | 1870 | $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
| 1631 | 1871 | foreach ($alldata as $number) { |
| 1632 | 1872 | $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
| 1633 | 1873 | } |
| 1634 | - if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
|
| 1874 | + if ($globalDebug) { |
|
| 1875 | + echo 'Count all pilots by airlines...'."\n"; |
|
| 1876 | + } |
|
| 1635 | 1877 | $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
| 1636 | 1878 | foreach ($alldata as $number) { |
| 1637 | 1879 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
| 1638 | 1880 | } |
| 1639 | - if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
|
| 1881 | + if ($globalDebug) { |
|
| 1882 | + echo 'Count all departure airports by airlines...'."\n"; |
|
| 1883 | + } |
|
| 1640 | 1884 | $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
| 1641 | - if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
|
| 1885 | + if ($globalDebug) { |
|
| 1886 | + echo 'Count all detected departure airports by airlines...'."\n"; |
|
| 1887 | + } |
|
| 1642 | 1888 | $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
| 1643 | - if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
|
| 1889 | + if ($globalDebug) { |
|
| 1890 | + echo 'Order detected departure airports by airlines...'."\n"; |
|
| 1891 | + } |
|
| 1644 | 1892 | //$alldata = array(); |
| 1645 | 1893 | foreach ($dall as $value) { |
| 1646 | 1894 | $icao = $value['airport_departure_icao']; |
@@ -1661,11 +1909,17 @@ discard block |
||
| 1661 | 1909 | foreach ($alldata as $number) { |
| 1662 | 1910 | 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); |
| 1663 | 1911 | } |
| 1664 | - if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
|
| 1912 | + if ($globalDebug) { |
|
| 1913 | + echo 'Count all arrival airports by airlines...'."\n"; |
|
| 1914 | + } |
|
| 1665 | 1915 | $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
| 1666 | - if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
|
| 1916 | + if ($globalDebug) { |
|
| 1917 | + echo 'Count all detected arrival airports by airlines...'."\n"; |
|
| 1918 | + } |
|
| 1667 | 1919 | $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
| 1668 | - if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
|
| 1920 | + if ($globalDebug) { |
|
| 1921 | + echo 'Order arrival airports by airlines...'."\n"; |
|
| 1922 | + } |
|
| 1669 | 1923 | //$alldata = array(); |
| 1670 | 1924 | foreach ($dall as $value) { |
| 1671 | 1925 | $icao = $value['airport_arrival_icao']; |
@@ -1684,37 +1938,53 @@ discard block |
||
| 1684 | 1938 | } |
| 1685 | 1939 | $alldata = $pall; |
| 1686 | 1940 | foreach ($alldata as $number) { |
| 1687 | - 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); |
|
| 1941 | + if ($number['airline_icao'] != '') { |
|
| 1942 | + 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); |
|
| 1943 | + } |
|
| 1944 | + } |
|
| 1945 | + if ($globalDebug) { |
|
| 1946 | + echo 'Count all flights by months by airlines...'."\n"; |
|
| 1688 | 1947 | } |
| 1689 | - if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
|
| 1690 | 1948 | $Spotter = new Spotter($this->db); |
| 1691 | 1949 | $alldata = $Spotter->countAllMonthsByAirlines(); |
| 1692 | 1950 | $lastyear = false; |
| 1693 | 1951 | foreach ($alldata as $number) { |
| 1694 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 1952 | + if ($number['year_name'] != date('Y')) { |
|
| 1953 | + $lastyear = true; |
|
| 1954 | + } |
|
| 1695 | 1955 | $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']); |
| 1696 | 1956 | } |
| 1697 | - if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
|
| 1957 | + if ($globalDebug) { |
|
| 1958 | + echo 'Count all owners by months by airlines...'."\n"; |
|
| 1959 | + } |
|
| 1698 | 1960 | $alldata = $Spotter->countAllMonthsOwnersByAirlines(); |
| 1699 | 1961 | foreach ($alldata as $number) { |
| 1700 | 1962 | $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']); |
| 1701 | 1963 | } |
| 1702 | - if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
|
| 1964 | + if ($globalDebug) { |
|
| 1965 | + echo 'Count all pilots by months by airlines...'."\n"; |
|
| 1966 | + } |
|
| 1703 | 1967 | $alldata = $Spotter->countAllMonthsPilotsByAirlines(); |
| 1704 | 1968 | foreach ($alldata as $number) { |
| 1705 | 1969 | $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']); |
| 1706 | 1970 | } |
| 1707 | - if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
|
| 1971 | + if ($globalDebug) { |
|
| 1972 | + echo 'Count all aircrafts by months by airlines...'."\n"; |
|
| 1973 | + } |
|
| 1708 | 1974 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines(); |
| 1709 | 1975 | foreach ($alldata as $number) { |
| 1710 | 1976 | $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']); |
| 1711 | 1977 | } |
| 1712 | - if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
|
| 1978 | + if ($globalDebug) { |
|
| 1979 | + echo 'Count all real arrivals by months by airlines...'."\n"; |
|
| 1980 | + } |
|
| 1713 | 1981 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines(); |
| 1714 | 1982 | foreach ($alldata as $number) { |
| 1715 | 1983 | $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']); |
| 1716 | 1984 | } |
| 1717 | - if ($globalDebug) echo '...Departure'."\n"; |
|
| 1985 | + if ($globalDebug) { |
|
| 1986 | + echo '...Departure'."\n"; |
|
| 1987 | + } |
|
| 1718 | 1988 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
| 1719 | 1989 | $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
| 1720 | 1990 | foreach ($dall as $value) { |
@@ -1737,7 +2007,9 @@ discard block |
||
| 1737 | 2007 | foreach ($alldata as $number) { |
| 1738 | 2008 | $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']); |
| 1739 | 2009 | } |
| 1740 | - if ($globalDebug) echo '...Arrival'."\n"; |
|
| 2010 | + if ($globalDebug) { |
|
| 2011 | + echo '...Arrival'."\n"; |
|
| 2012 | + } |
|
| 1741 | 2013 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
| 1742 | 2014 | $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
| 1743 | 2015 | foreach ($dall as $value) { |
@@ -1761,13 +2033,19 @@ discard block |
||
| 1761 | 2033 | $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']); |
| 1762 | 2034 | } |
| 1763 | 2035 | |
| 1764 | - if ($globalDebug) echo 'Flights data...'."\n"; |
|
| 1765 | - if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
|
| 2036 | + if ($globalDebug) { |
|
| 2037 | + echo 'Flights data...'."\n"; |
|
| 2038 | + } |
|
| 2039 | + if ($globalDebug) { |
|
| 2040 | + echo '-> countAllDatesLastMonth...'."\n"; |
|
| 2041 | + } |
|
| 1766 | 2042 | $alldata = $Spotter->countAllDatesLastMonthByAirlines(); |
| 1767 | 2043 | foreach ($alldata as $number) { |
| 1768 | 2044 | $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
| 1769 | 2045 | } |
| 1770 | - if ($globalDebug) echo '-> countAllDates...'."\n"; |
|
| 2046 | + if ($globalDebug) { |
|
| 2047 | + echo '-> countAllDates...'."\n"; |
|
| 2048 | + } |
|
| 1771 | 2049 | //$previousdata = $this->countAllDatesByAirlines(); |
| 1772 | 2050 | $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines()); |
| 1773 | 2051 | $values = array(); |
@@ -1780,7 +2058,9 @@ discard block |
||
| 1780 | 2058 | $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
| 1781 | 2059 | } |
| 1782 | 2060 | |
| 1783 | - if ($globalDebug) echo '-> countAllHours...'."\n"; |
|
| 2061 | + if ($globalDebug) { |
|
| 2062 | + echo '-> countAllHours...'."\n"; |
|
| 2063 | + } |
|
| 1784 | 2064 | $alldata = $Spotter->countAllHoursByAirlines('hour'); |
| 1785 | 2065 | foreach ($alldata as $number) { |
| 1786 | 2066 | $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
@@ -1788,7 +2068,9 @@ discard block |
||
| 1788 | 2068 | |
| 1789 | 2069 | |
| 1790 | 2070 | // Stats by filters |
| 1791 | - if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array(); |
|
| 2071 | + if (!isset($globalStatsFilters) || $globalStatsFilters == '') { |
|
| 2072 | + $globalStatsFilters = array(); |
|
| 2073 | + } |
|
| 1792 | 2074 | foreach ($globalStatsFilters as $name => $filter) { |
| 1793 | 2075 | //$filter_name = $filter['name']; |
| 1794 | 2076 | $filter_name = $name; |
@@ -1796,11 +2078,15 @@ discard block |
||
| 1796 | 2078 | $last_update = $this->getLastStatsUpdate('last_update_stats_'.$filter_name); |
| 1797 | 2079 | if (isset($last_update[0]['value'])) { |
| 1798 | 2080 | $last_update_day = $last_update[0]['value']; |
| 1799 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
| 2081 | + } else { |
|
| 2082 | + $last_update_day = '2012-12-12 12:12:12'; |
|
| 2083 | + } |
|
| 1800 | 2084 | $reset = false; |
| 1801 | 2085 | |
| 1802 | 2086 | // Count by filter |
| 1803 | - if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
| 2087 | + if ($globalDebug) { |
|
| 2088 | + echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
| 2089 | + } |
|
| 1804 | 2090 | $Spotter = new Spotter($this->db); |
| 1805 | 2091 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
| 1806 | 2092 | foreach ($alldata as $number) { |
@@ -1837,7 +2123,9 @@ discard block |
||
| 1837 | 2123 | $icao = $value['airport_departure_icao']; |
| 1838 | 2124 | if (isset($alldata[$icao])) { |
| 1839 | 2125 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 1840 | - } else $alldata[$icao] = $value; |
|
| 2126 | + } else { |
|
| 2127 | + $alldata[$icao] = $value; |
|
| 2128 | + } |
|
| 1841 | 2129 | } |
| 1842 | 2130 | $count = array(); |
| 1843 | 2131 | foreach ($alldata as $key => $row) { |
@@ -1858,7 +2146,9 @@ discard block |
||
| 1858 | 2146 | $icao = $value['airport_arrival_icao']; |
| 1859 | 2147 | if (isset($alldata[$icao])) { |
| 1860 | 2148 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 1861 | - } else $alldata[$icao] = $value; |
|
| 2149 | + } else { |
|
| 2150 | + $alldata[$icao] = $value; |
|
| 2151 | + } |
|
| 1862 | 2152 | } |
| 1863 | 2153 | $count = array(); |
| 1864 | 2154 | foreach ($alldata as $key => $row) { |
@@ -1872,7 +2162,9 @@ discard block |
||
| 1872 | 2162 | $alldata = $Spotter->countAllMonths($filter); |
| 1873 | 2163 | $lastyear = false; |
| 1874 | 2164 | foreach ($alldata as $number) { |
| 1875 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 2165 | + if ($number['year_name'] != date('Y')) { |
|
| 2166 | + $lastyear = true; |
|
| 2167 | + } |
|
| 1876 | 2168 | $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); |
| 1877 | 2169 | } |
| 1878 | 2170 | $alldata = $Spotter->countAllMonthsOwners($filter); |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | require_once(dirname(__FILE__).'/class.Image.php'); |
| 5 | 5 | $global_query = "SELECT spotter_output.* FROM spotter_output"; |
| 6 | 6 | |
| 7 | -class Spotter{ |
|
| 7 | +class Spotter { |
|
| 8 | 8 | public $aircraft_correct_icaotype = array('CL64' => 'CL60', |
| 9 | 9 | 'F9LX' => 'F900', |
| 10 | 10 | 'K35T' => 'K35R', |
@@ -59,45 +59,45 @@ discard block |
||
| 59 | 59 | * @param Array $filter the filter |
| 60 | 60 | * @return Array the SQL part |
| 61 | 61 | */ |
| 62 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 62 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 63 | 63 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
| 64 | 64 | $filters = array(); |
| 65 | 65 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 66 | 66 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 67 | 67 | $filters = $globalStatsFilters[$globalFilterName]; |
| 68 | 68 | } else { |
| 69 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 69 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 72 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 73 | 73 | $filter_query_join = ''; |
| 74 | 74 | $filter_query_where = ''; |
| 75 | - foreach($filters as $flt) { |
|
| 75 | + foreach ($filters as $flt) { |
|
| 76 | 76 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
| 77 | 77 | if ($flt['airlines'][0] != '') { |
| 78 | 78 | if (isset($flt['source'])) { |
| 79 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 79 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 80 | 80 | } else { |
| 81 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 81 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
| 86 | 86 | if (isset($flt['source'])) { |
| 87 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 87 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 88 | 88 | } else { |
| 89 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 89 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) { |
| 93 | 93 | if (isset($flt['source'])) { |
| 94 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 94 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 99 | 99 | if ($filter['airlines'][0] != '') { |
| 100 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 100 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
@@ -107,19 +107,19 @@ discard block |
||
| 107 | 107 | $filter_query_join .= " INNER JOIN (SELECT icao FROM airlines WHERE alliance = '".$filter['alliance']."') sal ON sal.icao = spotter_output.airline_icao "; |
| 108 | 108 | } |
| 109 | 109 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
| 110 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 110 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 111 | 111 | } |
| 112 | 112 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 113 | - $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 113 | + $filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 114 | 114 | } |
| 115 | 115 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 116 | 116 | $filter_query_where = " WHERE ident = '".$filter['ident']."'"; |
| 117 | 117 | } |
| 118 | 118 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 119 | 119 | if ($filter_query_where == '') { |
| 120 | - $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 120 | + $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 121 | 121 | } else { |
| 122 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 122 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * @return Array the spotter information |
| 138 | 138 | * |
| 139 | 139 | */ |
| 140 | - public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
|
| 140 | + public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false) |
|
| 141 | 141 | { |
| 142 | 142 | global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM; |
| 143 | 143 | $Image = new Image($this->db); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $sth = $this->db->prepare($query.$limitQuery); |
| 168 | 168 | $sth->execute($params); |
| 169 | 169 | } catch (PDOException $e) { |
| 170 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
| 170 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
| 171 | 171 | exit(); |
| 172 | 172 | } |
| 173 | 173 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $spotter_array = array(); |
| 178 | 178 | |
| 179 | 179 | |
| 180 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 180 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 181 | 181 | { |
| 182 | 182 | $num_rows++; |
| 183 | 183 | $temp_array = array(); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | if (isset($row['route_stop'])) { |
| 223 | 223 | $temp_array['route_stop'] = $row['route_stop']; |
| 224 | 224 | if ($row['route_stop'] != '') { |
| 225 | - $allroute = explode(' ',$row['route_stop']); |
|
| 225 | + $allroute = explode(' ', $row['route_stop']); |
|
| 226 | 226 | |
| 227 | 227 | foreach ($allroute as $route) { |
| 228 | 228 | $route_airport_array = $this->getAllAirportInfo($route); |
@@ -277,11 +277,11 @@ discard block |
||
| 277 | 277 | { |
| 278 | 278 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
| 279 | 279 | } else { |
| 280 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
| 280 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
| 281 | 281 | } |
| 282 | 282 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
| 283 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
| 284 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
| 283 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
| 284 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
| 285 | 285 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
| 286 | 286 | } |
| 287 | 287 | |
@@ -315,9 +315,9 @@ discard block |
||
| 315 | 315 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
| 316 | 316 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
| 317 | 317 | if (is_numeric(substr($row['ident'], 2, 1))) { |
| 318 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource); |
|
| 318 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource); |
|
| 319 | 319 | } elseif (is_numeric(substr($row['ident'], 3, 1))) { |
| 320 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
|
| 320 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource); |
|
| 321 | 321 | } else { |
| 322 | 322 | $airline_array = $this->getAllAirlineInfo('NA'); |
| 323 | 323 | } |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | } |
| 355 | 355 | } |
| 356 | 356 | if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') { |
| 357 | - $acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3)); |
|
| 357 | + $acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3)); |
|
| 358 | 358 | //$acars_array = ACARS->getLiveAcarsData('BA40YL'); |
| 359 | 359 | if (count($acars_array) > 0) { |
| 360 | 360 | $temp_array['acars'] = $acars_array; |
@@ -371,11 +371,11 @@ discard block |
||
| 371 | 371 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
|
| 374 | + if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
|
| 375 | 375 | { |
| 376 | 376 | if ($globalIVAO) { |
| 377 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 378 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 377 | + if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']); |
|
| 378 | + else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']); |
|
| 379 | 379 | } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
| 380 | 380 | if (count($image_array) > 0) { |
| 381 | 381 | $temp_array['image'] = $image_array[0]['image']; |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | - if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
| 402 | + if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
| 403 | 403 | if ($schedules === true) { |
| 404 | 404 | $schedule_array = $Schedule->getSchedule($temp_array['ident']); |
| 405 | 405 | //print_r($schedule_array); |
@@ -481,12 +481,12 @@ discard block |
||
| 481 | 481 | if (isset($row['squawk'])) { |
| 482 | 482 | $temp_array['squawk'] = $row['squawk']; |
| 483 | 483 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
| 484 | - $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
|
| 485 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 484 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']); |
|
| 485 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
| 486 | 486 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
| 487 | - $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
|
| 488 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 489 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 487 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']); |
|
| 488 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
| 489 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | $temp_array['query_number_rows'] = $num_rows; |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | * @return Array the spotter information |
| 506 | 506 | * |
| 507 | 507 | */ |
| 508 | - public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
|
| 508 | + public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
| 509 | 509 | { |
| 510 | 510 | global $globalTimezone, $globalDBdriver; |
| 511 | 511 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | |
| 516 | 516 | $query_values = array(); |
| 517 | 517 | $additional_query = ''; |
| 518 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 518 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 519 | 519 | if ($q != "") |
| 520 | 520 | { |
| 521 | 521 | if (!is_string($q)) |
@@ -523,8 +523,8 @@ discard block |
||
| 523 | 523 | return false; |
| 524 | 524 | } else { |
| 525 | 525 | $q_array = explode(" ", $q); |
| 526 | - foreach ($q_array as $q_item){ |
|
| 527 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 526 | + foreach ($q_array as $q_item) { |
|
| 527 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 528 | 528 | $additional_query .= " AND ("; |
| 529 | 529 | if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
| 530 | 530 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -556,37 +556,37 @@ discard block |
||
| 556 | 556 | |
| 557 | 557 | if ($registration != "") |
| 558 | 558 | { |
| 559 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 559 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 560 | 560 | if (!is_string($registration)) |
| 561 | 561 | { |
| 562 | 562 | return false; |
| 563 | 563 | } else { |
| 564 | 564 | $additional_query .= " AND spotter_output.registration = :registration"; |
| 565 | - $query_values = array_merge($query_values,array(':registration' => $registration)); |
|
| 565 | + $query_values = array_merge($query_values, array(':registration' => $registration)); |
|
| 566 | 566 | } |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | if ($aircraft_icao != "") |
| 570 | 570 | { |
| 571 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 571 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 572 | 572 | if (!is_string($aircraft_icao)) |
| 573 | 573 | { |
| 574 | 574 | return false; |
| 575 | 575 | } else { |
| 576 | 576 | $additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao"; |
| 577 | - $query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao)); |
|
| 577 | + $query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao)); |
|
| 578 | 578 | } |
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | if ($aircraft_manufacturer != "") |
| 582 | 582 | { |
| 583 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 583 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 584 | 584 | if (!is_string($aircraft_manufacturer)) |
| 585 | 585 | { |
| 586 | 586 | return false; |
| 587 | 587 | } else { |
| 588 | 588 | $additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer"; |
| 589 | - $query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
|
| 589 | + $query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
|
| 590 | 590 | } |
| 591 | 591 | } |
| 592 | 592 | |
@@ -602,25 +602,25 @@ discard block |
||
| 602 | 602 | |
| 603 | 603 | if ($airline_icao != "") |
| 604 | 604 | { |
| 605 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 605 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 606 | 606 | if (!is_string($airline_icao)) |
| 607 | 607 | { |
| 608 | 608 | return false; |
| 609 | 609 | } else { |
| 610 | 610 | $additional_query .= " AND spotter_output.airline_icao = :airline_icao"; |
| 611 | - $query_values = array_merge($query_values,array(':airline_icao' => $airline_icao)); |
|
| 611 | + $query_values = array_merge($query_values, array(':airline_icao' => $airline_icao)); |
|
| 612 | 612 | } |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | if ($airline_country != "") |
| 616 | 616 | { |
| 617 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
| 617 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
| 618 | 618 | if (!is_string($airline_country)) |
| 619 | 619 | { |
| 620 | 620 | return false; |
| 621 | 621 | } else { |
| 622 | 622 | $additional_query .= " AND spotter_output.airline_country = :airline_country"; |
| 623 | - $query_values = array_merge($query_values,array(':airline_country' => $airline_country)); |
|
| 623 | + $query_values = array_merge($query_values, array(':airline_country' => $airline_country)); |
|
| 624 | 624 | } |
| 625 | 625 | } |
| 626 | 626 | |
@@ -647,31 +647,31 @@ discard block |
||
| 647 | 647 | |
| 648 | 648 | if ($airport != "") |
| 649 | 649 | { |
| 650 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
| 650 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
| 651 | 651 | if (!is_string($airport)) |
| 652 | 652 | { |
| 653 | 653 | return false; |
| 654 | 654 | } else { |
| 655 | 655 | $additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)"; |
| 656 | - $query_values = array_merge($query_values,array(':airport' => $airport)); |
|
| 656 | + $query_values = array_merge($query_values, array(':airport' => $airport)); |
|
| 657 | 657 | } |
| 658 | 658 | } |
| 659 | 659 | |
| 660 | 660 | if ($airport_country != "") |
| 661 | 661 | { |
| 662 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
| 662 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
| 663 | 663 | if (!is_string($airport_country)) |
| 664 | 664 | { |
| 665 | 665 | return false; |
| 666 | 666 | } else { |
| 667 | 667 | $additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)"; |
| 668 | - $query_values = array_merge($query_values,array(':airport_country' => $airport_country)); |
|
| 668 | + $query_values = array_merge($query_values, array(':airport_country' => $airport_country)); |
|
| 669 | 669 | } |
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | if ($callsign != "") |
| 673 | 673 | { |
| 674 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 674 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 675 | 675 | if (!is_string($callsign)) |
| 676 | 676 | { |
| 677 | 677 | return false; |
@@ -679,79 +679,79 @@ discard block |
||
| 679 | 679 | $translate = $Translation->ident2icao($callsign); |
| 680 | 680 | if ($translate != $callsign) { |
| 681 | 681 | $additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)"; |
| 682 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
| 682 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
| 683 | 683 | } else { |
| 684 | 684 | $additional_query .= " AND spotter_output.ident = :callsign"; |
| 685 | - $query_values = array_merge($query_values,array(':callsign' => $callsign)); |
|
| 685 | + $query_values = array_merge($query_values, array(':callsign' => $callsign)); |
|
| 686 | 686 | } |
| 687 | 687 | } |
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 | if ($owner != "") |
| 691 | 691 | { |
| 692 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 692 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 693 | 693 | if (!is_string($owner)) |
| 694 | 694 | { |
| 695 | 695 | return false; |
| 696 | 696 | } else { |
| 697 | 697 | $additional_query .= " AND spotter_output.owner_name = :owner"; |
| 698 | - $query_values = array_merge($query_values,array(':owner' => $owner)); |
|
| 698 | + $query_values = array_merge($query_values, array(':owner' => $owner)); |
|
| 699 | 699 | } |
| 700 | 700 | } |
| 701 | 701 | |
| 702 | 702 | if ($pilot_name != "") |
| 703 | 703 | { |
| 704 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 704 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 705 | 705 | if (!is_string($pilot_name)) |
| 706 | 706 | { |
| 707 | 707 | return false; |
| 708 | 708 | } else { |
| 709 | 709 | $additional_query .= " AND spotter_output.pilot_name = :pilot_name"; |
| 710 | - $query_values = array_merge($query_values,array(':pilot_name' => $pilot_name)); |
|
| 710 | + $query_values = array_merge($query_values, array(':pilot_name' => $pilot_name)); |
|
| 711 | 711 | } |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | 714 | if ($pilot_id != "") |
| 715 | 715 | { |
| 716 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
| 716 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
| 717 | 717 | if (!is_string($pilot_id)) |
| 718 | 718 | { |
| 719 | 719 | return false; |
| 720 | 720 | } else { |
| 721 | 721 | $additional_query .= " AND spotter_output.pilot_id = :pilot_id"; |
| 722 | - $query_values = array_merge($query_values,array(':pilot_id' => $pilot_id)); |
|
| 722 | + $query_values = array_merge($query_values, array(':pilot_id' => $pilot_id)); |
|
| 723 | 723 | } |
| 724 | 724 | } |
| 725 | 725 | |
| 726 | 726 | if ($departure_airport_route != "") |
| 727 | 727 | { |
| 728 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
| 728 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
| 729 | 729 | if (!is_string($departure_airport_route)) |
| 730 | 730 | { |
| 731 | 731 | return false; |
| 732 | 732 | } else { |
| 733 | 733 | $additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route"; |
| 734 | - $query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route)); |
|
| 734 | + $query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route)); |
|
| 735 | 735 | } |
| 736 | 736 | } |
| 737 | 737 | |
| 738 | 738 | if ($arrival_airport_route != "") |
| 739 | 739 | { |
| 740 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
| 740 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
| 741 | 741 | if (!is_string($arrival_airport_route)) |
| 742 | 742 | { |
| 743 | 743 | return false; |
| 744 | 744 | } else { |
| 745 | 745 | $additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route"; |
| 746 | - $query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route)); |
|
| 746 | + $query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route)); |
|
| 747 | 747 | } |
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | if ($altitude != "") |
| 751 | 751 | { |
| 752 | 752 | $altitude_array = explode(",", $altitude); |
| 753 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 754 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 753 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 754 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 755 | 755 | |
| 756 | 756 | if ($altitude_array[1] != "") |
| 757 | 757 | { |
@@ -767,8 +767,8 @@ discard block |
||
| 767 | 767 | if ($date_posted != "") |
| 768 | 768 | { |
| 769 | 769 | $date_array = explode(",", $date_posted); |
| 770 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
| 771 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
| 770 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
| 771 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
| 772 | 772 | |
| 773 | 773 | if ($globalTimezone != '') { |
| 774 | 774 | date_default_timezone_set($globalTimezone); |
@@ -799,8 +799,8 @@ discard block |
||
| 799 | 799 | { |
| 800 | 800 | $limit_array = explode(",", $limit); |
| 801 | 801 | |
| 802 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 803 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 802 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 803 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 804 | 804 | |
| 805 | 805 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 806 | 806 | { |
@@ -829,23 +829,23 @@ discard block |
||
| 829 | 829 | |
| 830 | 830 | |
| 831 | 831 | if ($origLat != "" && $origLon != "" && $dist != "") { |
| 832 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
| 832 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
| 833 | 833 | |
| 834 | 834 | if ($globalDBdriver == 'mysql') { |
| 835 | - $query="SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance |
|
| 835 | + $query = "SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance |
|
| 836 | 836 | FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND spotter_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and spotter_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 837 | 837 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query; |
| 838 | 838 | } else { |
| 839 | - $query="SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
| 839 | + $query = "SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
| 840 | 840 | FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 841 | 841 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query; |
| 842 | 842 | } |
| 843 | 843 | } else { |
| 844 | - $query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' |
|
| 844 | + $query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' |
|
| 845 | 845 | ".$additional_query." |
| 846 | 846 | ".$orderby_query; |
| 847 | 847 | } |
| 848 | - $spotter_array = $this->getDataFromDB($query, $query_values,$limit_query); |
|
| 848 | + $spotter_array = $this->getDataFromDB($query, $query_values, $limit_query); |
|
| 849 | 849 | return $spotter_array; |
| 850 | 850 | } |
| 851 | 851 | |
@@ -868,8 +868,8 @@ discard block |
||
| 868 | 868 | { |
| 869 | 869 | $limit_array = explode(",", $limit); |
| 870 | 870 | |
| 871 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 872 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 871 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 872 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 873 | 873 | |
| 874 | 874 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 875 | 875 | { |
@@ -886,9 +886,9 @@ discard block |
||
| 886 | 886 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 887 | 887 | } |
| 888 | 888 | |
| 889 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
| 889 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
| 890 | 890 | |
| 891 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
| 891 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
| 892 | 892 | |
| 893 | 893 | return $spotter_array; |
| 894 | 894 | } |
@@ -934,34 +934,34 @@ discard block |
||
| 934 | 934 | { |
| 935 | 935 | return false; |
| 936 | 936 | } else { |
| 937 | - if ($interval == "30m"){ |
|
| 937 | + if ($interval == "30m") { |
|
| 938 | 938 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date '; |
| 939 | - } else if ($interval == "1h"){ |
|
| 939 | + } else if ($interval == "1h") { |
|
| 940 | 940 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date '; |
| 941 | - } else if ($interval == "3h"){ |
|
| 941 | + } else if ($interval == "3h") { |
|
| 942 | 942 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date '; |
| 943 | - } else if ($interval == "6h"){ |
|
| 943 | + } else if ($interval == "6h") { |
|
| 944 | 944 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date '; |
| 945 | - } else if ($interval == "12h"){ |
|
| 945 | + } else if ($interval == "12h") { |
|
| 946 | 946 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date '; |
| 947 | - } else if ($interval == "24h"){ |
|
| 947 | + } else if ($interval == "24h") { |
|
| 948 | 948 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date '; |
| 949 | - } else if ($interval == "7d"){ |
|
| 949 | + } else if ($interval == "7d") { |
|
| 950 | 950 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date '; |
| 951 | - } else if ($interval == "30d"){ |
|
| 951 | + } else if ($interval == "30d") { |
|
| 952 | 952 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date '; |
| 953 | 953 | } |
| 954 | 954 | } |
| 955 | 955 | } |
| 956 | 956 | |
| 957 | - $query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output |
|
| 957 | + $query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output |
|
| 958 | 958 | WHERE spotter_output.latitude <> '' |
| 959 | 959 | AND spotter_output.longitude <> '' |
| 960 | 960 | ".$additional_query." |
| 961 | 961 | HAVING distance < :radius |
| 962 | 962 | ORDER BY distance"; |
| 963 | 963 | |
| 964 | - $spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query); |
|
| 964 | + $spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query); |
|
| 965 | 965 | |
| 966 | 966 | return $spotter_array; |
| 967 | 967 | } |
@@ -973,21 +973,21 @@ discard block |
||
| 973 | 973 | * @return Array the spotter information |
| 974 | 974 | * |
| 975 | 975 | */ |
| 976 | - public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array()) |
|
| 976 | + public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array()) |
|
| 977 | 977 | { |
| 978 | 978 | global $global_query; |
| 979 | 979 | |
| 980 | 980 | date_default_timezone_set('UTC'); |
| 981 | 981 | |
| 982 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 982 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 983 | 983 | |
| 984 | 984 | $limit_query = ''; |
| 985 | 985 | if ($limit != "") |
| 986 | 986 | { |
| 987 | 987 | $limit_array = explode(",", $limit); |
| 988 | 988 | |
| 989 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 990 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 989 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 990 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 991 | 991 | |
| 992 | 992 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 993 | 993 | { |
@@ -1004,7 +1004,7 @@ discard block |
||
| 1004 | 1004 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | - $query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1007 | + $query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1008 | 1008 | |
| 1009 | 1009 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1010 | 1010 | |
@@ -1023,15 +1023,15 @@ discard block |
||
| 1023 | 1023 | global $global_query; |
| 1024 | 1024 | |
| 1025 | 1025 | date_default_timezone_set('UTC'); |
| 1026 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1026 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1027 | 1027 | |
| 1028 | 1028 | $limit_query = ''; |
| 1029 | 1029 | if ($limit != "") |
| 1030 | 1030 | { |
| 1031 | 1031 | $limit_array = explode(",", $limit); |
| 1032 | 1032 | |
| 1033 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1034 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1033 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1034 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1035 | 1035 | |
| 1036 | 1036 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1037 | 1037 | { |
@@ -1048,7 +1048,7 @@ discard block |
||
| 1048 | 1048 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1049 | 1049 | } |
| 1050 | 1050 | |
| 1051 | - $query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1051 | + $query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1052 | 1052 | |
| 1053 | 1053 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1054 | 1054 | |
@@ -1062,20 +1062,20 @@ discard block |
||
| 1062 | 1062 | * @return Array the spotter information |
| 1063 | 1063 | * |
| 1064 | 1064 | */ |
| 1065 | - public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array()) |
|
| 1065 | + public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array()) |
|
| 1066 | 1066 | { |
| 1067 | 1067 | global $global_query; |
| 1068 | 1068 | |
| 1069 | 1069 | date_default_timezone_set('UTC'); |
| 1070 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1070 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1071 | 1071 | |
| 1072 | 1072 | $limit_query = ''; |
| 1073 | 1073 | if ($limit != "") |
| 1074 | 1074 | { |
| 1075 | 1075 | $limit_array = explode(",", $limit); |
| 1076 | 1076 | |
| 1077 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1078 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1077 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1078 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1079 | 1079 | |
| 1080 | 1080 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1081 | 1081 | { |
@@ -1092,7 +1092,7 @@ discard block |
||
| 1092 | 1092 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1093 | 1093 | } |
| 1094 | 1094 | |
| 1095 | - $query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1095 | + $query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1096 | 1096 | |
| 1097 | 1097 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1098 | 1098 | |
@@ -1112,7 +1112,7 @@ discard block |
||
| 1112 | 1112 | |
| 1113 | 1113 | date_default_timezone_set('UTC'); |
| 1114 | 1114 | |
| 1115 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1115 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1116 | 1116 | |
| 1117 | 1117 | $limit_query = ''; |
| 1118 | 1118 | |
@@ -1120,8 +1120,8 @@ discard block |
||
| 1120 | 1120 | { |
| 1121 | 1121 | $limit_array = explode(",", $limit); |
| 1122 | 1122 | |
| 1123 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1124 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1123 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1124 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1125 | 1125 | |
| 1126 | 1126 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1127 | 1127 | { |
@@ -1138,7 +1138,7 @@ discard block |
||
| 1138 | 1138 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1139 | 1139 | } |
| 1140 | 1140 | |
| 1141 | - $query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1141 | + $query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1142 | 1142 | |
| 1143 | 1143 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1144 | 1144 | |
@@ -1157,14 +1157,14 @@ discard block |
||
| 1157 | 1157 | global $global_query; |
| 1158 | 1158 | |
| 1159 | 1159 | date_default_timezone_set('UTC'); |
| 1160 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1160 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1161 | 1161 | $limit_query = ''; |
| 1162 | 1162 | if ($limit != "") |
| 1163 | 1163 | { |
| 1164 | 1164 | $limit_array = explode(",", $limit); |
| 1165 | 1165 | |
| 1166 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1167 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1166 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1167 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1168 | 1168 | |
| 1169 | 1169 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1170 | 1170 | { |
@@ -1181,7 +1181,7 @@ discard block |
||
| 1181 | 1181 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1182 | 1182 | } |
| 1183 | 1183 | |
| 1184 | - $query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1184 | + $query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1185 | 1185 | |
| 1186 | 1186 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1187 | 1187 | |
@@ -1205,9 +1205,9 @@ discard block |
||
| 1205 | 1205 | $query_values = array(':id' => $id); |
| 1206 | 1206 | |
| 1207 | 1207 | //$query = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." "; |
| 1208 | - $query = $global_query." WHERE ".$additional_query." "; |
|
| 1208 | + $query = $global_query." WHERE ".$additional_query." "; |
|
| 1209 | 1209 | |
| 1210 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
| 1210 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
| 1211 | 1211 | |
| 1212 | 1212 | return $spotter_array; |
| 1213 | 1213 | } |
@@ -1245,8 +1245,8 @@ discard block |
||
| 1245 | 1245 | { |
| 1246 | 1246 | $limit_array = explode(",", $limit); |
| 1247 | 1247 | |
| 1248 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1249 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1248 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1249 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1250 | 1250 | |
| 1251 | 1251 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1252 | 1252 | { |
@@ -1287,7 +1287,7 @@ discard block |
||
| 1287 | 1287 | $query_values = array(); |
| 1288 | 1288 | $limit_query = ''; |
| 1289 | 1289 | $additional_query = ''; |
| 1290 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1290 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1291 | 1291 | |
| 1292 | 1292 | if ($aircraft_type != "") |
| 1293 | 1293 | { |
@@ -1304,8 +1304,8 @@ discard block |
||
| 1304 | 1304 | { |
| 1305 | 1305 | $limit_array = explode(",", $limit); |
| 1306 | 1306 | |
| 1307 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1308 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1307 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1308 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1309 | 1309 | |
| 1310 | 1310 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1311 | 1311 | { |
@@ -1361,8 +1361,8 @@ discard block |
||
| 1361 | 1361 | { |
| 1362 | 1362 | $limit_array = explode(",", $limit); |
| 1363 | 1363 | |
| 1364 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1365 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1364 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1365 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1366 | 1366 | |
| 1367 | 1367 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1368 | 1368 | { |
@@ -1378,7 +1378,7 @@ discard block |
||
| 1378 | 1378 | } else { |
| 1379 | 1379 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 1380 | 1380 | } |
| 1381 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1381 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1382 | 1382 | |
| 1383 | 1383 | //$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query; |
| 1384 | 1384 | $query = $global_query.$filter_query." ".$additional_query." ".$orderby_query; |
@@ -1397,7 +1397,7 @@ discard block |
||
| 1397 | 1397 | * @return Array the spotter information |
| 1398 | 1398 | * |
| 1399 | 1399 | */ |
| 1400 | - public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array()) |
|
| 1400 | + public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array()) |
|
| 1401 | 1401 | { |
| 1402 | 1402 | global $global_query; |
| 1403 | 1403 | |
@@ -1406,7 +1406,7 @@ discard block |
||
| 1406 | 1406 | $query_values = array(); |
| 1407 | 1407 | $limit_query = ''; |
| 1408 | 1408 | $additional_query = ''; |
| 1409 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1409 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1410 | 1410 | |
| 1411 | 1411 | if ($airline != "") |
| 1412 | 1412 | { |
@@ -1423,8 +1423,8 @@ discard block |
||
| 1423 | 1423 | { |
| 1424 | 1424 | $limit_array = explode(",", $limit); |
| 1425 | 1425 | |
| 1426 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1427 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1426 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1427 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1428 | 1428 | |
| 1429 | 1429 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1430 | 1430 | { |
@@ -1454,7 +1454,7 @@ discard block |
||
| 1454 | 1454 | * @return Array the spotter information |
| 1455 | 1455 | * |
| 1456 | 1456 | */ |
| 1457 | - public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
| 1457 | + public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
| 1458 | 1458 | { |
| 1459 | 1459 | global $global_query; |
| 1460 | 1460 | |
@@ -1462,7 +1462,7 @@ discard block |
||
| 1462 | 1462 | $query_values = array(); |
| 1463 | 1463 | $limit_query = ''; |
| 1464 | 1464 | $additional_query = ''; |
| 1465 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1465 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1466 | 1466 | |
| 1467 | 1467 | if ($airport != "") |
| 1468 | 1468 | { |
@@ -1479,8 +1479,8 @@ discard block |
||
| 1479 | 1479 | { |
| 1480 | 1480 | $limit_array = explode(",", $limit); |
| 1481 | 1481 | |
| 1482 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1483 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1482 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1483 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1484 | 1484 | |
| 1485 | 1485 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1486 | 1486 | { |
@@ -1512,7 +1512,7 @@ discard block |
||
| 1512 | 1512 | * @return Array the spotter information |
| 1513 | 1513 | * |
| 1514 | 1514 | */ |
| 1515 | - public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
| 1515 | + public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
| 1516 | 1516 | { |
| 1517 | 1517 | global $global_query, $globalTimezone, $globalDBdriver; |
| 1518 | 1518 | |
@@ -1520,7 +1520,7 @@ discard block |
||
| 1520 | 1520 | $limit_query = ''; |
| 1521 | 1521 | $additional_query = ''; |
| 1522 | 1522 | |
| 1523 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1523 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1524 | 1524 | |
| 1525 | 1525 | if ($date != "") |
| 1526 | 1526 | { |
@@ -1549,8 +1549,8 @@ discard block |
||
| 1549 | 1549 | { |
| 1550 | 1550 | $limit_array = explode(",", $limit); |
| 1551 | 1551 | |
| 1552 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1553 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1552 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1553 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1554 | 1554 | |
| 1555 | 1555 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1556 | 1556 | { |
@@ -1580,7 +1580,7 @@ discard block |
||
| 1580 | 1580 | * @return Array the spotter information |
| 1581 | 1581 | * |
| 1582 | 1582 | */ |
| 1583 | - public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array()) |
|
| 1583 | + public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array()) |
|
| 1584 | 1584 | { |
| 1585 | 1585 | global $global_query; |
| 1586 | 1586 | |
@@ -1589,7 +1589,7 @@ discard block |
||
| 1589 | 1589 | $query_values = array(); |
| 1590 | 1590 | $limit_query = ''; |
| 1591 | 1591 | $additional_query = ''; |
| 1592 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1592 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1593 | 1593 | if ($country != "") |
| 1594 | 1594 | { |
| 1595 | 1595 | if (!is_string($country)) |
@@ -1606,8 +1606,8 @@ discard block |
||
| 1606 | 1606 | { |
| 1607 | 1607 | $limit_array = explode(",", $limit); |
| 1608 | 1608 | |
| 1609 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1610 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1609 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1610 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1611 | 1611 | |
| 1612 | 1612 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1613 | 1613 | { |
@@ -1647,7 +1647,7 @@ discard block |
||
| 1647 | 1647 | $query_values = array(); |
| 1648 | 1648 | $additional_query = ''; |
| 1649 | 1649 | $limit_query = ''; |
| 1650 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1650 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1651 | 1651 | |
| 1652 | 1652 | if ($aircraft_manufacturer != "") |
| 1653 | 1653 | { |
@@ -1664,8 +1664,8 @@ discard block |
||
| 1664 | 1664 | { |
| 1665 | 1665 | $limit_array = explode(",", $limit); |
| 1666 | 1666 | |
| 1667 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1668 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1667 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1668 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1669 | 1669 | |
| 1670 | 1670 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1671 | 1671 | { |
@@ -1707,14 +1707,14 @@ discard block |
||
| 1707 | 1707 | $query_values = array(); |
| 1708 | 1708 | $additional_query = ''; |
| 1709 | 1709 | $limit_query = ''; |
| 1710 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1710 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1711 | 1711 | if ($departure_airport_icao != "") |
| 1712 | 1712 | { |
| 1713 | 1713 | if (!is_string($departure_airport_icao)) |
| 1714 | 1714 | { |
| 1715 | 1715 | return false; |
| 1716 | 1716 | } else { |
| 1717 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1717 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1718 | 1718 | $additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)"; |
| 1719 | 1719 | //$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao AND spotter_output.real_departure_airport_icao IS NULL) OR spotter_output.real_departure_airport_icao = :departure_airport_icao"; |
| 1720 | 1720 | $query_values = array(':departure_airport_icao' => $departure_airport_icao); |
@@ -1727,10 +1727,10 @@ discard block |
||
| 1727 | 1727 | { |
| 1728 | 1728 | return false; |
| 1729 | 1729 | } else { |
| 1730 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1730 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1731 | 1731 | $additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)"; |
| 1732 | 1732 | //$additional_query .= " AND ((spotter_output.arrival_airport_icao = :arrival_airport_icao AND spotter_output.real_arrival_airport_icao IS NULL) OR spotter_output.real_arrival_airport_icao = :arrival_airport_icao)"; |
| 1733 | - $query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 1733 | + $query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 1734 | 1734 | } |
| 1735 | 1735 | } |
| 1736 | 1736 | |
@@ -1738,8 +1738,8 @@ discard block |
||
| 1738 | 1738 | { |
| 1739 | 1739 | $limit_array = explode(",", $limit); |
| 1740 | 1740 | |
| 1741 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1742 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1741 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1742 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1743 | 1743 | |
| 1744 | 1744 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1745 | 1745 | { |
@@ -1778,15 +1778,15 @@ discard block |
||
| 1778 | 1778 | global $global_query; |
| 1779 | 1779 | |
| 1780 | 1780 | date_default_timezone_set('UTC'); |
| 1781 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1781 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1782 | 1782 | $limit_query = ''; |
| 1783 | 1783 | |
| 1784 | 1784 | if ($limit != "") |
| 1785 | 1785 | { |
| 1786 | 1786 | $limit_array = explode(",", $limit); |
| 1787 | 1787 | |
| 1788 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1789 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1788 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1789 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1790 | 1790 | |
| 1791 | 1791 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1792 | 1792 | { |
@@ -1803,7 +1803,7 @@ discard block |
||
| 1803 | 1803 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 1804 | 1804 | } |
| 1805 | 1805 | |
| 1806 | - $query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query; |
|
| 1806 | + $query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query; |
|
| 1807 | 1807 | |
| 1808 | 1808 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1809 | 1809 | |
@@ -1816,19 +1816,19 @@ discard block |
||
| 1816 | 1816 | * @return String the highlight text |
| 1817 | 1817 | * |
| 1818 | 1818 | */ |
| 1819 | - public function getHighlightByRegistration($registration,$filter = array()) |
|
| 1819 | + public function getHighlightByRegistration($registration, $filter = array()) |
|
| 1820 | 1820 | { |
| 1821 | 1821 | global $global_query; |
| 1822 | 1822 | |
| 1823 | 1823 | date_default_timezone_set('UTC'); |
| 1824 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1825 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 1824 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1825 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 1826 | 1826 | |
| 1827 | - $query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration"; |
|
| 1827 | + $query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration"; |
|
| 1828 | 1828 | $sth = $this->db->prepare($query); |
| 1829 | 1829 | $sth->execute(array(':registration' => $registration)); |
| 1830 | 1830 | |
| 1831 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1831 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1832 | 1832 | { |
| 1833 | 1833 | $highlight = $row['highlight']; |
| 1834 | 1834 | } |
@@ -1844,14 +1844,14 @@ discard block |
||
| 1844 | 1844 | * @return String usage |
| 1845 | 1845 | * |
| 1846 | 1846 | */ |
| 1847 | - public function getSquawkUsage($squawk = '',$country = 'FR') |
|
| 1847 | + public function getSquawkUsage($squawk = '', $country = 'FR') |
|
| 1848 | 1848 | { |
| 1849 | 1849 | |
| 1850 | - $squawk = filter_var($squawk,FILTER_SANITIZE_STRING); |
|
| 1851 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 1850 | + $squawk = filter_var($squawk, FILTER_SANITIZE_STRING); |
|
| 1851 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 1852 | 1852 | |
| 1853 | 1853 | $query = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1"; |
| 1854 | - $query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country); |
|
| 1854 | + $query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country); |
|
| 1855 | 1855 | |
| 1856 | 1856 | $sth = $this->db->prepare($query); |
| 1857 | 1857 | $sth->execute($query_values); |
@@ -1873,9 +1873,9 @@ discard block |
||
| 1873 | 1873 | public function getAirportIcao($airport_iata = '') |
| 1874 | 1874 | { |
| 1875 | 1875 | |
| 1876 | - $airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING); |
|
| 1876 | + $airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING); |
|
| 1877 | 1877 | |
| 1878 | - $query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1"; |
|
| 1878 | + $query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1"; |
|
| 1879 | 1879 | $query_values = array(':airport' => $airport_iata); |
| 1880 | 1880 | |
| 1881 | 1881 | $sth = $this->db->prepare($query); |
@@ -1897,12 +1897,12 @@ discard block |
||
| 1897 | 1897 | * @return Float distance to the airport |
| 1898 | 1898 | * |
| 1899 | 1899 | */ |
| 1900 | - public function getAirportDistance($airport_icao,$latitude,$longitude) |
|
| 1900 | + public function getAirportDistance($airport_icao, $latitude, $longitude) |
|
| 1901 | 1901 | { |
| 1902 | 1902 | |
| 1903 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 1903 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 1904 | 1904 | |
| 1905 | - $query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1"; |
|
| 1905 | + $query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1"; |
|
| 1906 | 1906 | $query_values = array(':airport' => $airport_icao); |
| 1907 | 1907 | $sth = $this->db->prepare($query); |
| 1908 | 1908 | $sth->execute($query_values); |
@@ -1912,7 +1912,7 @@ discard block |
||
| 1912 | 1912 | $airport_latitude = $row['latitude']; |
| 1913 | 1913 | $airport_longitude = $row['longitude']; |
| 1914 | 1914 | $Common = new Common(); |
| 1915 | - return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
|
| 1915 | + return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude); |
|
| 1916 | 1916 | } else return ''; |
| 1917 | 1917 | } |
| 1918 | 1918 | |
@@ -1926,11 +1926,11 @@ discard block |
||
| 1926 | 1926 | public function getAllAirportInfo($airport = '') |
| 1927 | 1927 | { |
| 1928 | 1928 | |
| 1929 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
| 1929 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
| 1930 | 1930 | |
| 1931 | 1931 | $query_values = array(); |
| 1932 | 1932 | if ($airport == 'NA') { |
| 1933 | - return array(array('name' => 'Not available','city' => 'N/A', 'country' => 'N/A','iata' => 'NA','icao' => 'NA','altitude' => NULL,'latitude' => 0,'longitude' => 0,'type' => 'NA','home_link' => '','wikipedia_link' => '','image_thumb' => '', 'image' => '')); |
|
| 1933 | + return array(array('name' => 'Not available', 'city' => 'N/A', 'country' => 'N/A', 'iata' => 'NA', 'icao' => 'NA', 'altitude' => NULL, 'latitude' => 0, 'longitude' => 0, 'type' => 'NA', 'home_link' => '', 'wikipedia_link' => '', 'image_thumb' => '', 'image' => '')); |
|
| 1934 | 1934 | } elseif ($airport == '') { |
| 1935 | 1935 | $query = "SELECT airport.name, airport.city, airport.country, airport.iata, airport.icao, airport.latitude, airport.longitude, airport.altitude, airport.type, airport.home_link, airport.wikipedia_link, airport.image_thumb, airport.image FROM airport"; |
| 1936 | 1936 | } else { |
@@ -1978,14 +1978,14 @@ discard block |
||
| 1978 | 1978 | { |
| 1979 | 1979 | $lst_countries = ''; |
| 1980 | 1980 | foreach ($countries as $country) { |
| 1981 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 1981 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 1982 | 1982 | if ($lst_countries == '') { |
| 1983 | 1983 | $lst_countries = "'".$country."'"; |
| 1984 | 1984 | } else { |
| 1985 | 1985 | $lst_countries .= ",'".$country."'"; |
| 1986 | 1986 | } |
| 1987 | 1987 | } |
| 1988 | - $query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")"; |
|
| 1988 | + $query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")"; |
|
| 1989 | 1989 | |
| 1990 | 1990 | $sth = $this->db->prepare($query); |
| 1991 | 1991 | $sth->execute(); |
@@ -1993,7 +1993,7 @@ discard block |
||
| 1993 | 1993 | $airport_array = array(); |
| 1994 | 1994 | $temp_array = array(); |
| 1995 | 1995 | |
| 1996 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1996 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1997 | 1997 | { |
| 1998 | 1998 | $temp_array['name'] = $row['name']; |
| 1999 | 1999 | $temp_array['city'] = $row['city']; |
@@ -2021,10 +2021,10 @@ discard block |
||
| 2021 | 2021 | { |
| 2022 | 2022 | global $globalDBdriver; |
| 2023 | 2023 | if (is_array($coord)) { |
| 2024 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2025 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2026 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2027 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2024 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2025 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2026 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2027 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2028 | 2028 | } else return array(); |
| 2029 | 2029 | if ($globalDBdriver == 'mysql') { |
| 2030 | 2030 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
@@ -2036,7 +2036,7 @@ discard block |
||
| 2036 | 2036 | |
| 2037 | 2037 | $airport_array = array(); |
| 2038 | 2038 | |
| 2039 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2039 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2040 | 2040 | { |
| 2041 | 2041 | $temp_array = $row; |
| 2042 | 2042 | |
@@ -2056,13 +2056,13 @@ discard block |
||
| 2056 | 2056 | public function getAllWaypointsInfobyCoord($coord) |
| 2057 | 2057 | { |
| 2058 | 2058 | if (is_array($coord)) { |
| 2059 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2060 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2061 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2062 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2059 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2060 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2061 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2062 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2063 | 2063 | } else return array(); |
| 2064 | 2064 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
| 2065 | - $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.")"; |
|
| 2065 | + $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.")"; |
|
| 2066 | 2066 | //$query = "SELECT waypoints.* FROM waypoints"; |
| 2067 | 2067 | //$query = "SELECT waypoints.* FROM waypoints INNER JOIN (SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") w ON w.name_end = waypoints.name_begin OR w.name_begin = waypoints.name_begin OR w.name_begin = waypoints.name_end OR w.name_end = waypoints.name_end"; |
| 2068 | 2068 | //$query = "SELECT * FROM waypoints LEFT JOIN waypoints w ON waypoints.name_end = w.name_begin WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
@@ -2074,7 +2074,7 @@ discard block |
||
| 2074 | 2074 | |
| 2075 | 2075 | $waypoints_array = array(); |
| 2076 | 2076 | |
| 2077 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2077 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2078 | 2078 | { |
| 2079 | 2079 | $temp_array = $row; |
| 2080 | 2080 | |
@@ -2096,10 +2096,10 @@ discard block |
||
| 2096 | 2096 | { |
| 2097 | 2097 | global $globalUseRealAirlines; |
| 2098 | 2098 | if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
| 2099 | - $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
|
| 2099 | + $airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING)); |
|
| 2100 | 2100 | if ($airline_icao == 'NA') { |
| 2101 | 2101 | $airline_array = array(); |
| 2102 | - $airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>''); |
|
| 2102 | + $airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>''); |
|
| 2103 | 2103 | return $airline_array; |
| 2104 | 2104 | } else { |
| 2105 | 2105 | if (strlen($airline_icao) == 2) { |
@@ -2120,7 +2120,7 @@ discard block |
||
| 2120 | 2120 | if ($fromsource === NULL) { |
| 2121 | 2121 | $sth->execute(array(':airline_icao' => $airline_icao)); |
| 2122 | 2122 | } else { |
| 2123 | - $sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource)); |
|
| 2123 | + $sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource)); |
|
| 2124 | 2124 | } |
| 2125 | 2125 | /* |
| 2126 | 2126 | $airline_array = array(); |
@@ -2162,13 +2162,13 @@ discard block |
||
| 2162 | 2162 | { |
| 2163 | 2163 | global $globalUseRealAirlines; |
| 2164 | 2164 | if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
| 2165 | - $airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING)); |
|
| 2166 | - $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"; |
|
| 2165 | + $airline_name = strtolower(filter_var($airline_name, FILTER_SANITIZE_STRING)); |
|
| 2166 | + $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"; |
|
| 2167 | 2167 | $sth = $this->db->prepare($query); |
| 2168 | 2168 | if ($fromsource === NULL) { |
| 2169 | 2169 | $sth->execute(array(':airline_name' => $airline_name)); |
| 2170 | 2170 | } else { |
| 2171 | - $sth->execute(array(':airline_name' => $airline_name,':fromsource' => $fromsource)); |
|
| 2171 | + $sth->execute(array(':airline_name' => $airline_name, ':fromsource' => $fromsource)); |
|
| 2172 | 2172 | } |
| 2173 | 2173 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2174 | 2174 | if (empty($result) && $fromsource !== NULL) { |
@@ -2193,12 +2193,12 @@ discard block |
||
| 2193 | 2193 | */ |
| 2194 | 2194 | public function getAllAircraftInfo($aircraft_type) |
| 2195 | 2195 | { |
| 2196 | - $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
|
| 2196 | + $aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING); |
|
| 2197 | 2197 | |
| 2198 | 2198 | if ($aircraft_type == 'NA') { |
| 2199 | - return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL)); |
|
| 2199 | + return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL)); |
|
| 2200 | 2200 | } |
| 2201 | - $query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type"; |
|
| 2201 | + $query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type"; |
|
| 2202 | 2202 | |
| 2203 | 2203 | $sth = $this->db->prepare($query); |
| 2204 | 2204 | $sth->execute(array(':aircraft_type' => $aircraft_type)); |
@@ -2230,7 +2230,7 @@ discard block |
||
| 2230 | 2230 | */ |
| 2231 | 2231 | public function getAircraftIcao($aircraft_type) |
| 2232 | 2232 | { |
| 2233 | - $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
|
| 2233 | + $aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING); |
|
| 2234 | 2234 | $all_aircraft = array('737-300' => 'B733', |
| 2235 | 2235 | '777-200' => 'B772', |
| 2236 | 2236 | '777-200ER' => 'B772', |
@@ -2242,10 +2242,10 @@ discard block |
||
| 2242 | 2242 | 'A380' => 'A388'); |
| 2243 | 2243 | if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
| 2244 | 2244 | |
| 2245 | - $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
|
| 2245 | + $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
|
| 2246 | 2246 | $aircraft_type = strtoupper($aircraft_type); |
| 2247 | 2247 | $sth = $this->db->prepare($query); |
| 2248 | - $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
|
| 2248 | + $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,)); |
|
| 2249 | 2249 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2250 | 2250 | if (isset($result[0]['icao'])) return $result[0]['icao']; |
| 2251 | 2251 | else return ''; |
@@ -2260,9 +2260,9 @@ discard block |
||
| 2260 | 2260 | */ |
| 2261 | 2261 | public function getAllAircraftType($aircraft_modes) |
| 2262 | 2262 | { |
| 2263 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
| 2263 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
| 2264 | 2264 | |
| 2265 | - $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 2265 | + $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 2266 | 2266 | |
| 2267 | 2267 | $sth = $this->db->prepare($query); |
| 2268 | 2268 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -2285,9 +2285,9 @@ discard block |
||
| 2285 | 2285 | */ |
| 2286 | 2286 | public function getAllAircraftTypeByRegistration($registration) |
| 2287 | 2287 | { |
| 2288 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2288 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2289 | 2289 | |
| 2290 | - $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 2290 | + $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 2291 | 2291 | |
| 2292 | 2292 | $sth = $this->db->prepare($query); |
| 2293 | 2293 | $sth->execute(array(':registration' => $registration)); |
@@ -2308,9 +2308,9 @@ discard block |
||
| 2308 | 2308 | */ |
| 2309 | 2309 | public function getAllIDByRegistration($registration) |
| 2310 | 2310 | { |
| 2311 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2311 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2312 | 2312 | |
| 2313 | - $query = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
| 2313 | + $query = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
| 2314 | 2314 | |
| 2315 | 2315 | $sth = $this->db->prepare($query); |
| 2316 | 2316 | $sth->execute(array(':registration' => $registration)); |
@@ -2318,7 +2318,7 @@ discard block |
||
| 2318 | 2318 | $idarray = array(); |
| 2319 | 2319 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 2320 | 2320 | $date = $row['date']; |
| 2321 | - $idarray[$date] = array('flightaware_id' => $row['flightaware_id'],'spotter_id' => $row['spotter_id']); |
|
| 2321 | + $idarray[$date] = array('flightaware_id' => $row['flightaware_id'], 'spotter_id' => $row['spotter_id']); |
|
| 2322 | 2322 | } |
| 2323 | 2323 | return $idarray; |
| 2324 | 2324 | } |
@@ -2332,8 +2332,8 @@ discard block |
||
| 2332 | 2332 | */ |
| 2333 | 2333 | public function getOperator($operator) |
| 2334 | 2334 | { |
| 2335 | - $operator = filter_var($operator,FILTER_SANITIZE_STRING); |
|
| 2336 | - $query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1"; |
|
| 2335 | + $operator = filter_var($operator, FILTER_SANITIZE_STRING); |
|
| 2336 | + $query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1"; |
|
| 2337 | 2337 | |
| 2338 | 2338 | $sth = $this->db->prepare($query); |
| 2339 | 2339 | $sth->execute(array(':operator' => $operator)); |
@@ -2354,9 +2354,9 @@ discard block |
||
| 2354 | 2354 | */ |
| 2355 | 2355 | public function getRouteInfo($callsign) |
| 2356 | 2356 | { |
| 2357 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 2357 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 2358 | 2358 | if ($callsign == '') return array(); |
| 2359 | - $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"; |
|
| 2359 | + $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"; |
|
| 2360 | 2360 | |
| 2361 | 2361 | $sth = $this->db->prepare($query); |
| 2362 | 2362 | $sth->execute(array(':callsign' => $callsign)); |
@@ -2377,9 +2377,9 @@ discard block |
||
| 2377 | 2377 | */ |
| 2378 | 2378 | public function getAircraftInfoByRegistration($registration) |
| 2379 | 2379 | { |
| 2380 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2380 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2381 | 2381 | |
| 2382 | - $query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
| 2382 | + $query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
| 2383 | 2383 | |
| 2384 | 2384 | $sth = $this->db->prepare($query); |
| 2385 | 2385 | $sth->execute(array(':registration' => $registration)); |
@@ -2387,7 +2387,7 @@ discard block |
||
| 2387 | 2387 | $aircraft_array = array(); |
| 2388 | 2388 | $temp_array = array(); |
| 2389 | 2389 | |
| 2390 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2390 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2391 | 2391 | { |
| 2392 | 2392 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 2393 | 2393 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -2409,7 +2409,7 @@ discard block |
||
| 2409 | 2409 | */ |
| 2410 | 2410 | public function getAircraftOwnerByRegistration($registration) |
| 2411 | 2411 | { |
| 2412 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2412 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2413 | 2413 | $Connection = new Connection($this->db); |
| 2414 | 2414 | if ($Connection->tableExists('aircraft_owner')) { |
| 2415 | 2415 | $query = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1"; |
@@ -2431,7 +2431,7 @@ discard block |
||
| 2431 | 2431 | public function getAllFlightsforSitemap() |
| 2432 | 2432 | { |
| 2433 | 2433 | //$query = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT "; |
| 2434 | - $query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0"; |
|
| 2434 | + $query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0"; |
|
| 2435 | 2435 | |
| 2436 | 2436 | $sth = $this->db->prepare($query); |
| 2437 | 2437 | $sth->execute(); |
@@ -2478,7 +2478,7 @@ discard block |
||
| 2478 | 2478 | $manufacturer_array = array(); |
| 2479 | 2479 | $temp_array = array(); |
| 2480 | 2480 | |
| 2481 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2481 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2482 | 2482 | { |
| 2483 | 2483 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 2484 | 2484 | |
@@ -2515,7 +2515,7 @@ discard block |
||
| 2515 | 2515 | $aircraft_array = array(); |
| 2516 | 2516 | $temp_array = array(); |
| 2517 | 2517 | |
| 2518 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2518 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2519 | 2519 | { |
| 2520 | 2520 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 2521 | 2521 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
@@ -2536,8 +2536,8 @@ discard block |
||
| 2536 | 2536 | */ |
| 2537 | 2537 | public function getAllAircraftRegistrations($filters = array()) |
| 2538 | 2538 | { |
| 2539 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2540 | - $query = "SELECT DISTINCT spotter_output.registration |
|
| 2539 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2540 | + $query = "SELECT DISTINCT spotter_output.registration |
|
| 2541 | 2541 | FROM spotter_output".$filter_query." spotter_output.registration <> '' |
| 2542 | 2542 | ORDER BY spotter_output.registration ASC"; |
| 2543 | 2543 | |
@@ -2547,7 +2547,7 @@ discard block |
||
| 2547 | 2547 | $aircraft_array = array(); |
| 2548 | 2548 | $temp_array = array(); |
| 2549 | 2549 | |
| 2550 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2550 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2551 | 2551 | { |
| 2552 | 2552 | $temp_array['registration'] = $row['registration']; |
| 2553 | 2553 | |
@@ -2564,11 +2564,11 @@ discard block |
||
| 2564 | 2564 | * @return Array list of source name |
| 2565 | 2565 | * |
| 2566 | 2566 | */ |
| 2567 | - public function getAllSourceName($type = '',$filters = array()) |
|
| 2567 | + public function getAllSourceName($type = '', $filters = array()) |
|
| 2568 | 2568 | { |
| 2569 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2569 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2570 | 2570 | $query_values = array(); |
| 2571 | - $query = "SELECT DISTINCT spotter_output.source_name |
|
| 2571 | + $query = "SELECT DISTINCT spotter_output.source_name |
|
| 2572 | 2572 | FROM spotter_output".$filter_query." spotter_output.source_name <> ''"; |
| 2573 | 2573 | if ($type != '') { |
| 2574 | 2574 | $query_values = array(':type' => $type); |
@@ -2583,7 +2583,7 @@ discard block |
||
| 2583 | 2583 | $source_array = array(); |
| 2584 | 2584 | $temp_array = array(); |
| 2585 | 2585 | |
| 2586 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2586 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2587 | 2587 | { |
| 2588 | 2588 | $temp_array['source_name'] = $row['source_name']; |
| 2589 | 2589 | $source_array[] = $temp_array; |
@@ -2599,11 +2599,11 @@ discard block |
||
| 2599 | 2599 | * @return Array list of airline names |
| 2600 | 2600 | * |
| 2601 | 2601 | */ |
| 2602 | - public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array()) |
|
| 2602 | + public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array()) |
|
| 2603 | 2603 | { |
| 2604 | - global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
|
| 2605 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2606 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
| 2604 | + global $globalAirlinesSource, $globalVATSIM, $globalIVAO; |
|
| 2605 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2606 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
| 2607 | 2607 | if ($airline_type == '' || $airline_type == 'all') { |
| 2608 | 2608 | /* |
| 2609 | 2609 | $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
@@ -2622,7 +2622,7 @@ discard block |
||
| 2622 | 2622 | $query_data = array(':forsource' => $forsource); |
| 2623 | 2623 | } |
| 2624 | 2624 | } else { |
| 2625 | - $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
|
| 2625 | + $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
|
| 2626 | 2626 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 2627 | 2627 | AND spotter_output.airline_type = :airline_type |
| 2628 | 2628 | ORDER BY spotter_output.airline_icao ASC"; |
@@ -2635,7 +2635,7 @@ discard block |
||
| 2635 | 2635 | $airline_array = array(); |
| 2636 | 2636 | $temp_array = array(); |
| 2637 | 2637 | |
| 2638 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2638 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2639 | 2639 | { |
| 2640 | 2640 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 2641 | 2641 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -2652,10 +2652,10 @@ discard block |
||
| 2652 | 2652 | * @return Array list of alliance names |
| 2653 | 2653 | * |
| 2654 | 2654 | */ |
| 2655 | - public function getAllAllianceNames($forsource = NULL,$filters = array()) |
|
| 2655 | + public function getAllAllianceNames($forsource = NULL, $filters = array()) |
|
| 2656 | 2656 | { |
| 2657 | - global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
|
| 2658 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2657 | + global $globalAirlinesSource, $globalVATSIM, $globalIVAO; |
|
| 2658 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2659 | 2659 | if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
| 2660 | 2660 | elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
| 2661 | 2661 | elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
@@ -2683,8 +2683,8 @@ discard block |
||
| 2683 | 2683 | */ |
| 2684 | 2684 | public function getAllAirlineCountries($filters = array()) |
| 2685 | 2685 | { |
| 2686 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2687 | - $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2686 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2687 | + $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2688 | 2688 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' |
| 2689 | 2689 | ORDER BY spotter_output.airline_country ASC"; |
| 2690 | 2690 | |
@@ -2695,7 +2695,7 @@ discard block |
||
| 2695 | 2695 | $airline_array = array(); |
| 2696 | 2696 | $temp_array = array(); |
| 2697 | 2697 | |
| 2698 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2698 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2699 | 2699 | { |
| 2700 | 2700 | $temp_array['airline_country'] = $row['airline_country']; |
| 2701 | 2701 | |
@@ -2715,9 +2715,9 @@ discard block |
||
| 2715 | 2715 | */ |
| 2716 | 2716 | public function getAllAirportNames($filters = array()) |
| 2717 | 2717 | { |
| 2718 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2718 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2719 | 2719 | $airport_array = array(); |
| 2720 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country |
|
| 2720 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country |
|
| 2721 | 2721 | FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' |
| 2722 | 2722 | ORDER BY spotter_output.departure_airport_city ASC"; |
| 2723 | 2723 | |
@@ -2726,7 +2726,7 @@ discard block |
||
| 2726 | 2726 | $sth->execute(); |
| 2727 | 2727 | |
| 2728 | 2728 | $temp_array = array(); |
| 2729 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2729 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2730 | 2730 | { |
| 2731 | 2731 | $temp_array['airport_icao'] = $row['airport_icao']; |
| 2732 | 2732 | $temp_array['airport_name'] = $row['airport_name']; |
@@ -2736,14 +2736,14 @@ discard block |
||
| 2736 | 2736 | $airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array; |
| 2737 | 2737 | } |
| 2738 | 2738 | |
| 2739 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country |
|
| 2739 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country |
|
| 2740 | 2740 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' |
| 2741 | 2741 | ORDER BY spotter_output.arrival_airport_city ASC"; |
| 2742 | 2742 | |
| 2743 | 2743 | $sth = $this->db->prepare($query); |
| 2744 | 2744 | $sth->execute(); |
| 2745 | 2745 | |
| 2746 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2746 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2747 | 2747 | { |
| 2748 | 2748 | // if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao']) |
| 2749 | 2749 | // { |
@@ -2783,21 +2783,21 @@ discard block |
||
| 2783 | 2783 | |
| 2784 | 2784 | $temp_array = array(); |
| 2785 | 2785 | |
| 2786 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2786 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2787 | 2787 | { |
| 2788 | 2788 | $temp_array['airport_country'] = $row['airport_country']; |
| 2789 | 2789 | |
| 2790 | 2790 | $airport_array[$row['airport_country']] = $temp_array; |
| 2791 | 2791 | } |
| 2792 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2793 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2792 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2793 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2794 | 2794 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' |
| 2795 | 2795 | ORDER BY spotter_output.arrival_airport_country ASC"; |
| 2796 | 2796 | |
| 2797 | 2797 | $sth = $this->db->prepare($query); |
| 2798 | 2798 | $sth->execute(); |
| 2799 | 2799 | |
| 2800 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2800 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2801 | 2801 | { |
| 2802 | 2802 | if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country']) |
| 2803 | 2803 | { |
@@ -2820,9 +2820,9 @@ discard block |
||
| 2820 | 2820 | */ |
| 2821 | 2821 | public function getAllCountries($filters = array()) |
| 2822 | 2822 | { |
| 2823 | - $Connection= new Connection($this->db); |
|
| 2823 | + $Connection = new Connection($this->db); |
|
| 2824 | 2824 | if ($Connection->tableExists('countries')) { |
| 2825 | - $query = "SELECT countries.name AS airport_country |
|
| 2825 | + $query = "SELECT countries.name AS airport_country |
|
| 2826 | 2826 | FROM countries |
| 2827 | 2827 | ORDER BY countries.name ASC"; |
| 2828 | 2828 | $sth = $this->db->prepare($query); |
@@ -2831,14 +2831,14 @@ discard block |
||
| 2831 | 2831 | $temp_array = array(); |
| 2832 | 2832 | $country_array = array(); |
| 2833 | 2833 | |
| 2834 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2834 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2835 | 2835 | { |
| 2836 | 2836 | $temp_array['country'] = $row['airport_country']; |
| 2837 | 2837 | $country_array[$row['airport_country']] = $temp_array; |
| 2838 | 2838 | } |
| 2839 | 2839 | } else { |
| 2840 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2841 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country |
|
| 2840 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2841 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country |
|
| 2842 | 2842 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' |
| 2843 | 2843 | ORDER BY spotter_output.departure_airport_country ASC"; |
| 2844 | 2844 | |
@@ -2847,20 +2847,20 @@ discard block |
||
| 2847 | 2847 | |
| 2848 | 2848 | $temp_array = array(); |
| 2849 | 2849 | $country_array = array(); |
| 2850 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2850 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2851 | 2851 | { |
| 2852 | 2852 | $temp_array['country'] = $row['airport_country']; |
| 2853 | 2853 | $country_array[$row['airport_country']] = $temp_array; |
| 2854 | 2854 | } |
| 2855 | 2855 | |
| 2856 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2856 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2857 | 2857 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' |
| 2858 | 2858 | ORDER BY spotter_output.arrival_airport_country ASC"; |
| 2859 | 2859 | |
| 2860 | 2860 | $sth = $this->db->prepare($query); |
| 2861 | 2861 | $sth->execute(); |
| 2862 | 2862 | |
| 2863 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2863 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2864 | 2864 | { |
| 2865 | 2865 | if ($country_array[$row['airport_country']]['country'] != $row['airport_country']) |
| 2866 | 2866 | { |
@@ -2870,14 +2870,14 @@ discard block |
||
| 2870 | 2870 | } |
| 2871 | 2871 | } |
| 2872 | 2872 | |
| 2873 | - $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2873 | + $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2874 | 2874 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' |
| 2875 | 2875 | ORDER BY spotter_output.airline_country ASC"; |
| 2876 | 2876 | |
| 2877 | 2877 | $sth = $this->db->prepare($query); |
| 2878 | 2878 | $sth->execute(); |
| 2879 | 2879 | |
| 2880 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2880 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2881 | 2881 | { |
| 2882 | 2882 | if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country']) |
| 2883 | 2883 | { |
@@ -2901,8 +2901,8 @@ discard block |
||
| 2901 | 2901 | */ |
| 2902 | 2902 | public function getAllIdents($filters = array()) |
| 2903 | 2903 | { |
| 2904 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2905 | - $query = "SELECT DISTINCT spotter_output.ident |
|
| 2904 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2905 | + $query = "SELECT DISTINCT spotter_output.ident |
|
| 2906 | 2906 | FROM spotter_output".$filter_query." spotter_output.ident <> '' |
| 2907 | 2907 | ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0"; |
| 2908 | 2908 | |
@@ -2912,7 +2912,7 @@ discard block |
||
| 2912 | 2912 | $ident_array = array(); |
| 2913 | 2913 | $temp_array = array(); |
| 2914 | 2914 | |
| 2915 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2915 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2916 | 2916 | { |
| 2917 | 2917 | $temp_array['ident'] = $row['ident']; |
| 2918 | 2918 | $ident_array[] = $temp_array; |
@@ -2926,9 +2926,9 @@ discard block |
||
| 2926 | 2926 | * @return Array number, icao, name and city of airports |
| 2927 | 2927 | */ |
| 2928 | 2928 | |
| 2929 | - public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) { |
|
| 2929 | + public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) { |
|
| 2930 | 2930 | global $globalTimezone, $globalDBdriver; |
| 2931 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2931 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2932 | 2932 | if ($globalTimezone != '') { |
| 2933 | 2933 | date_default_timezone_set($globalTimezone); |
| 2934 | 2934 | $datetime = new DateTime(); |
@@ -2993,7 +2993,7 @@ discard block |
||
| 2993 | 2993 | |
| 2994 | 2994 | public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) { |
| 2995 | 2995 | global $globalTimezone, $globalDBdriver; |
| 2996 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2996 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2997 | 2997 | if ($globalTimezone != '') { |
| 2998 | 2998 | date_default_timezone_set($globalTimezone); |
| 2999 | 2999 | $datetime = new DateTime(); |
@@ -3077,7 +3077,7 @@ discard block |
||
| 3077 | 3077 | |
| 3078 | 3078 | public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) { |
| 3079 | 3079 | global $globalTimezone, $globalDBdriver; |
| 3080 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3080 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3081 | 3081 | if ($globalTimezone != '') { |
| 3082 | 3082 | date_default_timezone_set($globalTimezone); |
| 3083 | 3083 | $datetime = new DateTime(); |
@@ -3110,9 +3110,9 @@ discard block |
||
| 3110 | 3110 | * @return Array number, icao, name and city of airports |
| 3111 | 3111 | */ |
| 3112 | 3112 | |
| 3113 | - public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) { |
|
| 3113 | + public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) { |
|
| 3114 | 3114 | global $globalTimezone, $globalDBdriver; |
| 3115 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3115 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3116 | 3116 | if ($globalTimezone != '') { |
| 3117 | 3117 | date_default_timezone_set($globalTimezone); |
| 3118 | 3118 | $datetime = new DateTime(); |
@@ -3244,12 +3244,12 @@ discard block |
||
| 3244 | 3244 | } else $offset = '+00:00'; |
| 3245 | 3245 | |
| 3246 | 3246 | if ($globalDBdriver == 'mysql') { |
| 3247 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
|
| 3247 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
|
| 3248 | 3248 | FROM spotter_output |
| 3249 | 3249 | WHERE spotter_output.date <> '' |
| 3250 | 3250 | ORDER BY spotter_output.date ASC LIMIT 0,200"; |
| 3251 | 3251 | } else { |
| 3252 | - $query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 3252 | + $query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 3253 | 3253 | FROM spotter_output |
| 3254 | 3254 | WHERE spotter_output.date <> '' |
| 3255 | 3255 | ORDER BY spotter_output.date ASC LIMIT 0,200"; |
@@ -3261,7 +3261,7 @@ discard block |
||
| 3261 | 3261 | $date_array = array(); |
| 3262 | 3262 | $temp_array = array(); |
| 3263 | 3263 | |
| 3264 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3264 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3265 | 3265 | { |
| 3266 | 3266 | $temp_array['date'] = $row['date']; |
| 3267 | 3267 | |
@@ -3281,7 +3281,7 @@ discard block |
||
| 3281 | 3281 | */ |
| 3282 | 3282 | public function getAllRoutes() |
| 3283 | 3283 | { |
| 3284 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao |
|
| 3284 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao |
|
| 3285 | 3285 | FROM spotter_output |
| 3286 | 3286 | WHERE spotter_output.ident <> '' |
| 3287 | 3287 | GROUP BY route |
@@ -3292,7 +3292,7 @@ discard block |
||
| 3292 | 3292 | |
| 3293 | 3293 | $routes_array = array(); |
| 3294 | 3294 | $temp_array = array(); |
| 3295 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3295 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3296 | 3296 | { |
| 3297 | 3297 | $temp_array['route'] = $row['route']; |
| 3298 | 3298 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -3311,21 +3311,21 @@ discard block |
||
| 3311 | 3311 | * @return String success or false |
| 3312 | 3312 | * |
| 3313 | 3313 | */ |
| 3314 | - public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL) |
|
| 3314 | + public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL) |
|
| 3315 | 3315 | { |
| 3316 | 3316 | if (!is_numeric(substr($ident, 0, 3))) |
| 3317 | 3317 | { |
| 3318 | 3318 | if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
| 3319 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource); |
|
| 3319 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource); |
|
| 3320 | 3320 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
| 3321 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource); |
|
| 3321 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource); |
|
| 3322 | 3322 | } else { |
| 3323 | 3323 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3324 | 3324 | } |
| 3325 | 3325 | if (count($airline_array) == 0) { |
| 3326 | 3326 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3327 | 3327 | } |
| 3328 | - if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
|
| 3328 | + if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") { |
|
| 3329 | 3329 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3330 | 3330 | } |
| 3331 | 3331 | } else { |
@@ -3338,7 +3338,7 @@ discard block |
||
| 3338 | 3338 | |
| 3339 | 3339 | |
| 3340 | 3340 | $query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id'; |
| 3341 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type); |
|
| 3341 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type); |
|
| 3342 | 3342 | |
| 3343 | 3343 | try { |
| 3344 | 3344 | $sth = $this->db->prepare($query); |
@@ -3359,11 +3359,11 @@ discard block |
||
| 3359 | 3359 | * @return String success or false |
| 3360 | 3360 | * |
| 3361 | 3361 | */ |
| 3362 | - public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
|
| 3362 | + public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '') |
|
| 3363 | 3363 | { |
| 3364 | 3364 | if ($groundspeed == '') $groundspeed = NULL; |
| 3365 | 3365 | $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'; |
| 3366 | - $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); |
|
| 3366 | + $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); |
|
| 3367 | 3367 | |
| 3368 | 3368 | try { |
| 3369 | 3369 | $sth = $this->db->prepare($query); |
@@ -3403,7 +3403,7 @@ discard block |
||
| 3403 | 3403 | * @param String $verticalrate vertival rate of flight |
| 3404 | 3404 | * @return String success or false |
| 3405 | 3405 | */ |
| 3406 | - public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '') |
|
| 3406 | + public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false, $format_source = '', $source_name = '') |
|
| 3407 | 3407 | { |
| 3408 | 3408 | global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM; |
| 3409 | 3409 | |
@@ -3427,13 +3427,13 @@ discard block |
||
| 3427 | 3427 | if ($ModeS != '') { |
| 3428 | 3428 | $timeelapsed = microtime(true); |
| 3429 | 3429 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
| 3430 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3430 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3431 | 3431 | } else { |
| 3432 | - $myhex = explode('-',$flightaware_id); |
|
| 3432 | + $myhex = explode('-', $flightaware_id); |
|
| 3433 | 3433 | if (count($myhex) > 0) { |
| 3434 | 3434 | $timeelapsed = microtime(true); |
| 3435 | 3435 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
| 3436 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3436 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3437 | 3437 | } |
| 3438 | 3438 | } |
| 3439 | 3439 | } |
@@ -3455,24 +3455,24 @@ discard block |
||
| 3455 | 3455 | { |
| 3456 | 3456 | $timeelapsed = microtime(true); |
| 3457 | 3457 | if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
| 3458 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource); |
|
| 3458 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource); |
|
| 3459 | 3459 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
| 3460 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource); |
|
| 3460 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource); |
|
| 3461 | 3461 | } else { |
| 3462 | 3462 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3463 | 3463 | } |
| 3464 | 3464 | if (count($airline_array) == 0) { |
| 3465 | 3465 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3466 | 3466 | } |
| 3467 | - if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
|
| 3467 | + if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") { |
|
| 3468 | 3468 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3469 | 3469 | } |
| 3470 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3470 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3471 | 3471 | |
| 3472 | 3472 | } else { |
| 3473 | 3473 | $timeelapsed = microtime(true); |
| 3474 | 3474 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3475 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3475 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3476 | 3476 | } |
| 3477 | 3477 | } |
| 3478 | 3478 | } else $airline_array = array(); |
@@ -3489,27 +3489,27 @@ discard block |
||
| 3489 | 3489 | { |
| 3490 | 3490 | $timeelapsed = microtime(true); |
| 3491 | 3491 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3492 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3492 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3493 | 3493 | } else { |
| 3494 | 3494 | $timeelapsed = microtime(true); |
| 3495 | 3495 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3496 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3496 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3497 | 3497 | } |
| 3498 | 3498 | } |
| 3499 | 3499 | } else { |
| 3500 | 3500 | if ($ModeS != '') { |
| 3501 | 3501 | $timeelapsed = microtime(true); |
| 3502 | 3502 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
| 3503 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3503 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3504 | 3504 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
| 3505 | 3505 | { |
| 3506 | 3506 | $timeelapsed = microtime(true); |
| 3507 | 3507 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3508 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3508 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3509 | 3509 | } else { |
| 3510 | 3510 | $timeelapsed = microtime(true); |
| 3511 | 3511 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3512 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3512 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3513 | 3513 | } |
| 3514 | 3514 | } |
| 3515 | 3515 | } |
@@ -3525,7 +3525,7 @@ discard block |
||
| 3525 | 3525 | } else { |
| 3526 | 3526 | $timeelapsed = microtime(true); |
| 3527 | 3527 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
| 3528 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3528 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3529 | 3529 | } |
| 3530 | 3530 | } |
| 3531 | 3531 | |
@@ -3540,7 +3540,7 @@ discard block |
||
| 3540 | 3540 | } else { |
| 3541 | 3541 | $timeelapsed = microtime(true); |
| 3542 | 3542 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
| 3543 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3543 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3544 | 3544 | } |
| 3545 | 3545 | } |
| 3546 | 3546 | |
@@ -3603,7 +3603,7 @@ discard block |
||
| 3603 | 3603 | { |
| 3604 | 3604 | $timeelapsed = microtime(true); |
| 3605 | 3605 | $image_array = $Image->getSpotterImage($registration); |
| 3606 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3606 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3607 | 3607 | if (!isset($image_array[0]['registration'])) |
| 3608 | 3608 | { |
| 3609 | 3609 | //echo "Add image !!!! \n"; |
@@ -3611,7 +3611,7 @@ discard block |
||
| 3611 | 3611 | } |
| 3612 | 3612 | $timeelapsed = microtime(true); |
| 3613 | 3613 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
| 3614 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3614 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3615 | 3615 | if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
| 3616 | 3616 | } |
| 3617 | 3617 | |
@@ -3619,33 +3619,33 @@ discard block |
||
| 3619 | 3619 | { |
| 3620 | 3620 | if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
| 3621 | 3621 | else $airline_icao = ''; |
| 3622 | - $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
| 3622 | + $image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao); |
|
| 3623 | 3623 | if (!isset($image_array[0]['registration'])) |
| 3624 | 3624 | { |
| 3625 | 3625 | //echo "Add image !!!! \n"; |
| 3626 | - $Image->addSpotterImage('',$aircraft_icao,$airline_icao); |
|
| 3626 | + $Image->addSpotterImage('', $aircraft_icao, $airline_icao); |
|
| 3627 | 3627 | } |
| 3628 | 3628 | } |
| 3629 | 3629 | |
| 3630 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 3631 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 3632 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 3633 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 3634 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 3635 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 3636 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3637 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3638 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
| 3639 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3640 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 3641 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3642 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
| 3643 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
| 3644 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
| 3645 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
| 3646 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 3647 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 3648 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
| 3630 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 3631 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 3632 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 3633 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 3634 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 3635 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 3636 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3637 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3638 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
| 3639 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3640 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 3641 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3642 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
| 3643 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
| 3644 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
| 3645 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
| 3646 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 3647 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 3648 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
| 3649 | 3649 | |
| 3650 | 3650 | if (count($airline_array) == 0) |
| 3651 | 3651 | { |
@@ -3673,7 +3673,7 @@ discard block |
||
| 3673 | 3673 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
| 3674 | 3674 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
| 3675 | 3675 | if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
| 3676 | - $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) |
|
| 3676 | + $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) |
|
| 3677 | 3677 | 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)"; |
| 3678 | 3678 | |
| 3679 | 3679 | $airline_name = $airline_array[0]['name']; |
@@ -3683,7 +3683,7 @@ discard block |
||
| 3683 | 3683 | if ($airline_type == '') { |
| 3684 | 3684 | $timeelapsed = microtime(true); |
| 3685 | 3685 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3686 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3686 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3687 | 3687 | } |
| 3688 | 3688 | if ($airline_type == null) $airline_type = ''; |
| 3689 | 3689 | $aircraft_type = $aircraft_array[0]['type']; |
@@ -3695,7 +3695,7 @@ discard block |
||
| 3695 | 3695 | $arrival_airport_name = $arrival_airport_array[0]['name']; |
| 3696 | 3696 | $arrival_airport_city = $arrival_airport_array[0]['city']; |
| 3697 | 3697 | $arrival_airport_country = $arrival_airport_array[0]['country']; |
| 3698 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
| 3698 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
| 3699 | 3699 | |
| 3700 | 3700 | try { |
| 3701 | 3701 | |
@@ -3721,13 +3721,13 @@ discard block |
||
| 3721 | 3721 | { |
| 3722 | 3722 | global $globalDBdriver, $globalTimezone; |
| 3723 | 3723 | if ($globalDBdriver == 'mysql') { |
| 3724 | - $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3724 | + $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3725 | 3725 | WHERE spotter_output.ident = :ident |
| 3726 | 3726 | AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 3727 | 3727 | AND spotter_output.date < UTC_TIMESTAMP()"; |
| 3728 | 3728 | $query_data = array(':ident' => $ident); |
| 3729 | 3729 | } else { |
| 3730 | - $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3730 | + $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3731 | 3731 | WHERE spotter_output.ident = :ident |
| 3732 | 3732 | AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 3733 | 3733 | AND spotter_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -3736,8 +3736,8 @@ discard block |
||
| 3736 | 3736 | |
| 3737 | 3737 | $sth = $this->db->prepare($query); |
| 3738 | 3738 | $sth->execute($query_data); |
| 3739 | - $ident_result=''; |
|
| 3740 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3739 | + $ident_result = ''; |
|
| 3740 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3741 | 3741 | { |
| 3742 | 3742 | $ident_result = $row['ident']; |
| 3743 | 3743 | } |
@@ -3763,8 +3763,8 @@ discard block |
||
| 3763 | 3763 | return false; |
| 3764 | 3764 | } else { |
| 3765 | 3765 | $q_array = explode(" ", $q); |
| 3766 | - foreach ($q_array as $q_item){ |
|
| 3767 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 3766 | + foreach ($q_array as $q_item) { |
|
| 3767 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 3768 | 3768 | $additional_query .= " AND ("; |
| 3769 | 3769 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
| 3770 | 3770 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
@@ -3779,11 +3779,11 @@ discard block |
||
| 3779 | 3779 | } |
| 3780 | 3780 | } |
| 3781 | 3781 | if ($globalDBdriver == 'mysql') { |
| 3782 | - $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3782 | + $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3783 | 3783 | WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
| 3784 | 3784 | AND spotter_output.date < UTC_TIMESTAMP()"; |
| 3785 | 3785 | } else { |
| 3786 | - $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3786 | + $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3787 | 3787 | WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
| 3788 | 3788 | AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
| 3789 | 3789 | } |
@@ -3800,11 +3800,11 @@ discard block |
||
| 3800 | 3800 | * @return Array the airline list |
| 3801 | 3801 | * |
| 3802 | 3802 | */ |
| 3803 | - public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '') |
|
| 3803 | + public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 3804 | 3804 | { |
| 3805 | 3805 | global $globalDBdriver; |
| 3806 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3807 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3806 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3807 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3808 | 3808 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA'"; |
| 3809 | 3809 | if ($olderthanmonths > 0) { |
| 3810 | 3810 | if ($globalDBdriver == 'mysql') { |
@@ -3824,28 +3824,28 @@ discard block |
||
| 3824 | 3824 | if ($year != '') { |
| 3825 | 3825 | if ($globalDBdriver == 'mysql') { |
| 3826 | 3826 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 3827 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 3827 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 3828 | 3828 | } else { |
| 3829 | 3829 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 3830 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 3830 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 3831 | 3831 | } |
| 3832 | 3832 | } |
| 3833 | 3833 | if ($month != '') { |
| 3834 | 3834 | if ($globalDBdriver == 'mysql') { |
| 3835 | 3835 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 3836 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 3836 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 3837 | 3837 | } else { |
| 3838 | 3838 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 3839 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 3839 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 3840 | 3840 | } |
| 3841 | 3841 | } |
| 3842 | 3842 | if ($day != '') { |
| 3843 | 3843 | if ($globalDBdriver == 'mysql') { |
| 3844 | 3844 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 3845 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 3845 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 3846 | 3846 | } else { |
| 3847 | 3847 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 3848 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 3848 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 3849 | 3849 | } |
| 3850 | 3850 | } |
| 3851 | 3851 | $query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC"; |
@@ -3855,7 +3855,7 @@ discard block |
||
| 3855 | 3855 | $sth->execute($query_values); |
| 3856 | 3856 | $airline_array = array(); |
| 3857 | 3857 | $temp_array = array(); |
| 3858 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3858 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3859 | 3859 | { |
| 3860 | 3860 | $temp_array['airline_name'] = $row['airline_name']; |
| 3861 | 3861 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -3872,11 +3872,11 @@ discard block |
||
| 3872 | 3872 | * @return Array the pilots list |
| 3873 | 3873 | * |
| 3874 | 3874 | */ |
| 3875 | - public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '') |
|
| 3875 | + public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '') |
|
| 3876 | 3876 | { |
| 3877 | 3877 | global $globalDBdriver; |
| 3878 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3879 | - $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
| 3878 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3879 | + $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
| 3880 | 3880 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' "; |
| 3881 | 3881 | if ($olderthanmonths > 0) { |
| 3882 | 3882 | if ($globalDBdriver == 'mysql') { |
@@ -3896,28 +3896,28 @@ discard block |
||
| 3896 | 3896 | if ($year != '') { |
| 3897 | 3897 | if ($globalDBdriver == 'mysql') { |
| 3898 | 3898 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 3899 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 3899 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 3900 | 3900 | } else { |
| 3901 | 3901 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 3902 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 3902 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 3903 | 3903 | } |
| 3904 | 3904 | } |
| 3905 | 3905 | if ($month != '') { |
| 3906 | 3906 | if ($globalDBdriver == 'mysql') { |
| 3907 | 3907 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 3908 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 3908 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 3909 | 3909 | } else { |
| 3910 | 3910 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 3911 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 3911 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 3912 | 3912 | } |
| 3913 | 3913 | } |
| 3914 | 3914 | if ($day != '') { |
| 3915 | 3915 | if ($globalDBdriver == 'mysql') { |
| 3916 | 3916 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 3917 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 3917 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 3918 | 3918 | } else { |
| 3919 | 3919 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 3920 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 3920 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 3921 | 3921 | } |
| 3922 | 3922 | } |
| 3923 | 3923 | |
@@ -3929,7 +3929,7 @@ discard block |
||
| 3929 | 3929 | $sth->execute($query_values); |
| 3930 | 3930 | $airline_array = array(); |
| 3931 | 3931 | $temp_array = array(); |
| 3932 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3932 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3933 | 3933 | { |
| 3934 | 3934 | $temp_array['pilot_name'] = $row['pilot_name']; |
| 3935 | 3935 | $temp_array['pilot_id'] = $row['pilot_id']; |
@@ -3949,7 +3949,7 @@ discard block |
||
| 3949 | 3949 | public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
| 3950 | 3950 | { |
| 3951 | 3951 | global $globalDBdriver; |
| 3952 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
| 3952 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
| 3953 | 3953 | FROM spotter_output WHERE spotter_output.pilot_id <> '' "; |
| 3954 | 3954 | if ($olderthanmonths > 0) { |
| 3955 | 3955 | if ($globalDBdriver == 'mysql') { |
@@ -3975,7 +3975,7 @@ discard block |
||
| 3975 | 3975 | $airline_array = array(); |
| 3976 | 3976 | $temp_array = array(); |
| 3977 | 3977 | |
| 3978 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3978 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3979 | 3979 | { |
| 3980 | 3980 | $temp_array['pilot_name'] = $row['pilot_name']; |
| 3981 | 3981 | $temp_array['pilot_id'] = $row['pilot_id']; |
@@ -3993,11 +3993,11 @@ discard block |
||
| 3993 | 3993 | * @return Array the pilots list |
| 3994 | 3994 | * |
| 3995 | 3995 | */ |
| 3996 | - public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
| 3996 | + public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 3997 | 3997 | { |
| 3998 | 3998 | global $globalDBdriver; |
| 3999 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4000 | - $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 3999 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4000 | + $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 4001 | 4001 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL"; |
| 4002 | 4002 | if ($olderthanmonths > 0) { |
| 4003 | 4003 | if ($globalDBdriver == 'mysql') { |
@@ -4017,28 +4017,28 @@ discard block |
||
| 4017 | 4017 | if ($year != '') { |
| 4018 | 4018 | if ($globalDBdriver == 'mysql') { |
| 4019 | 4019 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 4020 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4020 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4021 | 4021 | } else { |
| 4022 | 4022 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 4023 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4023 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4024 | 4024 | } |
| 4025 | 4025 | } |
| 4026 | 4026 | if ($month != '') { |
| 4027 | 4027 | if ($globalDBdriver == 'mysql') { |
| 4028 | 4028 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 4029 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4029 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4030 | 4030 | } else { |
| 4031 | 4031 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 4032 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4032 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4033 | 4033 | } |
| 4034 | 4034 | } |
| 4035 | 4035 | if ($day != '') { |
| 4036 | 4036 | if ($globalDBdriver == 'mysql') { |
| 4037 | 4037 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 4038 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4038 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4039 | 4039 | } else { |
| 4040 | 4040 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 4041 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4041 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4042 | 4042 | } |
| 4043 | 4043 | } |
| 4044 | 4044 | $query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC"; |
@@ -4048,7 +4048,7 @@ discard block |
||
| 4048 | 4048 | $sth->execute($query_values); |
| 4049 | 4049 | $airline_array = array(); |
| 4050 | 4050 | $temp_array = array(); |
| 4051 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4051 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4052 | 4052 | { |
| 4053 | 4053 | $temp_array['owner_name'] = $row['owner_name']; |
| 4054 | 4054 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -4063,11 +4063,11 @@ discard block |
||
| 4063 | 4063 | * @return Array the pilots list |
| 4064 | 4064 | * |
| 4065 | 4065 | */ |
| 4066 | - public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 4066 | + public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 4067 | 4067 | { |
| 4068 | 4068 | global $globalDBdriver; |
| 4069 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4070 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 4069 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4070 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 4071 | 4071 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
| 4072 | 4072 | if ($olderthanmonths > 0) { |
| 4073 | 4073 | if ($globalDBdriver == 'mysql') { |
@@ -4093,7 +4093,7 @@ discard block |
||
| 4093 | 4093 | $airline_array = array(); |
| 4094 | 4094 | $temp_array = array(); |
| 4095 | 4095 | |
| 4096 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4096 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4097 | 4097 | { |
| 4098 | 4098 | $temp_array['owner_name'] = $row['owner_name']; |
| 4099 | 4099 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -4109,11 +4109,11 @@ discard block |
||
| 4109 | 4109 | * @return Array the airline list |
| 4110 | 4110 | * |
| 4111 | 4111 | */ |
| 4112 | - public function countAllAirlinesByAircraft($aircraft_icao,$filters = array()) |
|
| 4112 | + public function countAllAirlinesByAircraft($aircraft_icao, $filters = array()) |
|
| 4113 | 4113 | { |
| 4114 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 4115 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4116 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4114 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 4115 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4116 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4117 | 4117 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 4118 | 4118 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
| 4119 | 4119 | ORDER BY airline_count DESC"; |
@@ -4125,7 +4125,7 @@ discard block |
||
| 4125 | 4125 | $airline_array = array(); |
| 4126 | 4126 | $temp_array = array(); |
| 4127 | 4127 | |
| 4128 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4128 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4129 | 4129 | { |
| 4130 | 4130 | $temp_array['airline_name'] = $row['airline_name']; |
| 4131 | 4131 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4145,11 +4145,11 @@ discard block |
||
| 4145 | 4145 | * @return Array the airline country list |
| 4146 | 4146 | * |
| 4147 | 4147 | */ |
| 4148 | - public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array()) |
|
| 4148 | + public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array()) |
|
| 4149 | 4149 | { |
| 4150 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 4151 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4152 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4150 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 4151 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4152 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4153 | 4153 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 4154 | 4154 | GROUP BY spotter_output.airline_country |
| 4155 | 4155 | ORDER BY airline_country_count DESC |
@@ -4162,7 +4162,7 @@ discard block |
||
| 4162 | 4162 | $airline_country_array = array(); |
| 4163 | 4163 | $temp_array = array(); |
| 4164 | 4164 | |
| 4165 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4165 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4166 | 4166 | { |
| 4167 | 4167 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4168 | 4168 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4181,11 +4181,11 @@ discard block |
||
| 4181 | 4181 | * @return Array the airline list |
| 4182 | 4182 | * |
| 4183 | 4183 | */ |
| 4184 | - public function countAllAirlinesByAirport($airport_icao,$filters = array()) |
|
| 4184 | + public function countAllAirlinesByAirport($airport_icao, $filters = array()) |
|
| 4185 | 4185 | { |
| 4186 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 4187 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4188 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4186 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 4187 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4188 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4189 | 4189 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) |
| 4190 | 4190 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
| 4191 | 4191 | ORDER BY airline_count DESC"; |
@@ -4197,7 +4197,7 @@ discard block |
||
| 4197 | 4197 | $airline_array = array(); |
| 4198 | 4198 | $temp_array = array(); |
| 4199 | 4199 | |
| 4200 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4200 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4201 | 4201 | { |
| 4202 | 4202 | $temp_array['airline_name'] = $row['airline_name']; |
| 4203 | 4203 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4216,11 +4216,11 @@ discard block |
||
| 4216 | 4216 | * @return Array the airline country list |
| 4217 | 4217 | * |
| 4218 | 4218 | */ |
| 4219 | - public function countAllAirlineCountriesByAirport($airport_icao,$filters = array()) |
|
| 4219 | + public function countAllAirlineCountriesByAirport($airport_icao, $filters = array()) |
|
| 4220 | 4220 | { |
| 4221 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 4222 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4223 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4221 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 4222 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4223 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4224 | 4224 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) |
| 4225 | 4225 | GROUP BY spotter_output.airline_country |
| 4226 | 4226 | ORDER BY airline_country_count DESC |
@@ -4233,7 +4233,7 @@ discard block |
||
| 4233 | 4233 | $airline_country_array = array(); |
| 4234 | 4234 | $temp_array = array(); |
| 4235 | 4235 | |
| 4236 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4236 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4237 | 4237 | { |
| 4238 | 4238 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4239 | 4239 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4250,11 +4250,11 @@ discard block |
||
| 4250 | 4250 | * @return Array the airline list |
| 4251 | 4251 | * |
| 4252 | 4252 | */ |
| 4253 | - public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 4253 | + public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 4254 | 4254 | { |
| 4255 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 4256 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4257 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4255 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 4256 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4257 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4258 | 4258 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 4259 | 4259 | GROUP BY spotter_output.airline_name |
| 4260 | 4260 | ORDER BY airline_count DESC"; |
@@ -4265,7 +4265,7 @@ discard block |
||
| 4265 | 4265 | $airline_array = array(); |
| 4266 | 4266 | $temp_array = array(); |
| 4267 | 4267 | |
| 4268 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4268 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4269 | 4269 | { |
| 4270 | 4270 | $temp_array['airline_name'] = $row['airline_name']; |
| 4271 | 4271 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4285,11 +4285,11 @@ discard block |
||
| 4285 | 4285 | * @return Array the airline country list |
| 4286 | 4286 | * |
| 4287 | 4287 | */ |
| 4288 | - public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 4288 | + public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 4289 | 4289 | { |
| 4290 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 4291 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4292 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4290 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 4291 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4292 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4293 | 4293 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 4294 | 4294 | GROUP BY spotter_output.airline_country |
| 4295 | 4295 | ORDER BY airline_country_count DESC |
@@ -4302,7 +4302,7 @@ discard block |
||
| 4302 | 4302 | $airline_country_array = array(); |
| 4303 | 4303 | $temp_array = array(); |
| 4304 | 4304 | |
| 4305 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4305 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4306 | 4306 | { |
| 4307 | 4307 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4308 | 4308 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4318,11 +4318,11 @@ discard block |
||
| 4318 | 4318 | * @return Array the airline list |
| 4319 | 4319 | * |
| 4320 | 4320 | */ |
| 4321 | - public function countAllAirlinesByDate($date,$filters = array()) |
|
| 4321 | + public function countAllAirlinesByDate($date, $filters = array()) |
|
| 4322 | 4322 | { |
| 4323 | 4323 | global $globalTimezone, $globalDBdriver; |
| 4324 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4325 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 4324 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4325 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 4326 | 4326 | if ($globalTimezone != '') { |
| 4327 | 4327 | date_default_timezone_set($globalTimezone); |
| 4328 | 4328 | $datetime = new DateTime($date); |
@@ -4330,12 +4330,12 @@ discard block |
||
| 4330 | 4330 | } else $offset = '+00:00'; |
| 4331 | 4331 | |
| 4332 | 4332 | if ($globalDBdriver == 'mysql') { |
| 4333 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4333 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4334 | 4334 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 4335 | 4335 | GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country |
| 4336 | 4336 | ORDER BY airline_count DESC"; |
| 4337 | 4337 | } else { |
| 4338 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4338 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4339 | 4339 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 4340 | 4340 | GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country |
| 4341 | 4341 | ORDER BY airline_count DESC"; |
@@ -4346,7 +4346,7 @@ discard block |
||
| 4346 | 4346 | |
| 4347 | 4347 | $airline_array = array(); |
| 4348 | 4348 | $temp_array = array(); |
| 4349 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4349 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4350 | 4350 | { |
| 4351 | 4351 | $temp_array['airline_name'] = $row['airline_name']; |
| 4352 | 4352 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4366,11 +4366,11 @@ discard block |
||
| 4366 | 4366 | * @return Array the airline country list |
| 4367 | 4367 | * |
| 4368 | 4368 | */ |
| 4369 | - public function countAllAirlineCountriesByDate($date,$filters = array()) |
|
| 4369 | + public function countAllAirlineCountriesByDate($date, $filters = array()) |
|
| 4370 | 4370 | { |
| 4371 | 4371 | global $globalTimezone, $globalDBdriver; |
| 4372 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4373 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 4372 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4373 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 4374 | 4374 | if ($globalTimezone != '') { |
| 4375 | 4375 | date_default_timezone_set($globalTimezone); |
| 4376 | 4376 | $datetime = new DateTime($date); |
@@ -4378,13 +4378,13 @@ discard block |
||
| 4378 | 4378 | } else $offset = '+00:00'; |
| 4379 | 4379 | |
| 4380 | 4380 | if ($globalDBdriver == 'mysql') { |
| 4381 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4381 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4382 | 4382 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 4383 | 4383 | GROUP BY spotter_output.airline_country |
| 4384 | 4384 | ORDER BY airline_country_count DESC |
| 4385 | 4385 | LIMIT 10 OFFSET 0"; |
| 4386 | 4386 | } else { |
| 4387 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4387 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4388 | 4388 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 4389 | 4389 | GROUP BY spotter_output.airline_country |
| 4390 | 4390 | ORDER BY airline_country_count DESC |
@@ -4396,7 +4396,7 @@ discard block |
||
| 4396 | 4396 | |
| 4397 | 4397 | $airline_country_array = array(); |
| 4398 | 4398 | $temp_array = array(); |
| 4399 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4399 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4400 | 4400 | { |
| 4401 | 4401 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4402 | 4402 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4413,11 +4413,11 @@ discard block |
||
| 4413 | 4413 | * @return Array the airline list |
| 4414 | 4414 | * |
| 4415 | 4415 | */ |
| 4416 | - public function countAllAirlinesByIdent($ident,$filters = array()) |
|
| 4416 | + public function countAllAirlinesByIdent($ident, $filters = array()) |
|
| 4417 | 4417 | { |
| 4418 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 4419 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4420 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4418 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 4419 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4420 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4421 | 4421 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 4422 | 4422 | GROUP BY spotter_output.airline_name |
| 4423 | 4423 | ORDER BY airline_count DESC"; |
@@ -4429,7 +4429,7 @@ discard block |
||
| 4429 | 4429 | $airline_array = array(); |
| 4430 | 4430 | $temp_array = array(); |
| 4431 | 4431 | |
| 4432 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4432 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4433 | 4433 | { |
| 4434 | 4434 | $temp_array['airline_name'] = $row['airline_name']; |
| 4435 | 4435 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4447,25 +4447,25 @@ discard block |
||
| 4447 | 4447 | * @return Array the airline list |
| 4448 | 4448 | * |
| 4449 | 4449 | */ |
| 4450 | - public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 4450 | + public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 4451 | 4451 | { |
| 4452 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4453 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4454 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4452 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4453 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4454 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4455 | 4455 | |
| 4456 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4456 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4457 | 4457 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 4458 | 4458 | GROUP BY spotter_output.airline_name |
| 4459 | 4459 | ORDER BY airline_count DESC"; |
| 4460 | 4460 | |
| 4461 | 4461 | |
| 4462 | 4462 | $sth = $this->db->prepare($query); |
| 4463 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4463 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4464 | 4464 | |
| 4465 | 4465 | $airline_array = array(); |
| 4466 | 4466 | $temp_array = array(); |
| 4467 | 4467 | |
| 4468 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4468 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4469 | 4469 | { |
| 4470 | 4470 | $temp_array['airline_name'] = $row['airline_name']; |
| 4471 | 4471 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4483,13 +4483,13 @@ discard block |
||
| 4483 | 4483 | * @return Array the airline country list |
| 4484 | 4484 | * |
| 4485 | 4485 | */ |
| 4486 | - public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array()) |
|
| 4486 | + public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 4487 | 4487 | { |
| 4488 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4489 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4490 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4488 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4489 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4490 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4491 | 4491 | |
| 4492 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4492 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4493 | 4493 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 4494 | 4494 | GROUP BY spotter_output.airline_country |
| 4495 | 4495 | ORDER BY airline_country_count DESC |
@@ -4497,11 +4497,11 @@ discard block |
||
| 4497 | 4497 | |
| 4498 | 4498 | |
| 4499 | 4499 | $sth = $this->db->prepare($query); |
| 4500 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4500 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4501 | 4501 | |
| 4502 | 4502 | $airline_country_array = array(); |
| 4503 | 4503 | $temp_array = array(); |
| 4504 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4504 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4505 | 4505 | { |
| 4506 | 4506 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4507 | 4507 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4519,11 +4519,11 @@ discard block |
||
| 4519 | 4519 | * @return Array the airline list |
| 4520 | 4520 | * |
| 4521 | 4521 | */ |
| 4522 | - public function countAllAirlinesByCountry($country,$filters = array()) |
|
| 4522 | + public function countAllAirlinesByCountry($country, $filters = array()) |
|
| 4523 | 4523 | { |
| 4524 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 4525 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4526 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4524 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 4525 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4526 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4527 | 4527 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 4528 | 4528 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
| 4529 | 4529 | ORDER BY airline_count DESC"; |
@@ -4534,7 +4534,7 @@ discard block |
||
| 4534 | 4534 | |
| 4535 | 4535 | $airline_array = array(); |
| 4536 | 4536 | $temp_array = array(); |
| 4537 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4537 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4538 | 4538 | { |
| 4539 | 4539 | $temp_array['airline_name'] = $row['airline_name']; |
| 4540 | 4540 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4553,11 +4553,11 @@ discard block |
||
| 4553 | 4553 | * @return Array the airline country list |
| 4554 | 4554 | * |
| 4555 | 4555 | */ |
| 4556 | - public function countAllAirlineCountriesByCountry($country,$filters = array()) |
|
| 4556 | + public function countAllAirlineCountriesByCountry($country, $filters = array()) |
|
| 4557 | 4557 | { |
| 4558 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4559 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 4560 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4558 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4559 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 4560 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4561 | 4561 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 4562 | 4562 | GROUP BY spotter_output.airline_country |
| 4563 | 4563 | ORDER BY airline_country_count DESC |
@@ -4569,7 +4569,7 @@ discard block |
||
| 4569 | 4569 | |
| 4570 | 4570 | $airline_country_array = array(); |
| 4571 | 4571 | $temp_array = array(); |
| 4572 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4572 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4573 | 4573 | { |
| 4574 | 4574 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4575 | 4575 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4589,35 +4589,35 @@ discard block |
||
| 4589 | 4589 | public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '') |
| 4590 | 4590 | { |
| 4591 | 4591 | global $globalDBdriver; |
| 4592 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4593 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4592 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4593 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4594 | 4594 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA'"; |
| 4595 | 4595 | $query_values = array(); |
| 4596 | 4596 | if ($year != '') { |
| 4597 | 4597 | if ($globalDBdriver == 'mysql') { |
| 4598 | 4598 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 4599 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4599 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4600 | 4600 | } else { |
| 4601 | 4601 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 4602 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4602 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4603 | 4603 | } |
| 4604 | 4604 | } |
| 4605 | 4605 | if ($month != '') { |
| 4606 | 4606 | if ($globalDBdriver == 'mysql') { |
| 4607 | 4607 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 4608 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4608 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4609 | 4609 | } else { |
| 4610 | 4610 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 4611 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4611 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4612 | 4612 | } |
| 4613 | 4613 | } |
| 4614 | 4614 | if ($day != '') { |
| 4615 | 4615 | if ($globalDBdriver == 'mysql') { |
| 4616 | 4616 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 4617 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4617 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4618 | 4618 | } else { |
| 4619 | 4619 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 4620 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4620 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4621 | 4621 | } |
| 4622 | 4622 | } |
| 4623 | 4623 | $query .= " GROUP BY spotter_output.airline_country |
@@ -4629,7 +4629,7 @@ discard block |
||
| 4629 | 4629 | |
| 4630 | 4630 | $airline_array = array(); |
| 4631 | 4631 | $temp_array = array(); |
| 4632 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4632 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4633 | 4633 | { |
| 4634 | 4634 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4635 | 4635 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4645,11 +4645,11 @@ discard block |
||
| 4645 | 4645 | * @return Array the airline country list |
| 4646 | 4646 | * |
| 4647 | 4647 | */ |
| 4648 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 4648 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 4649 | 4649 | { |
| 4650 | 4650 | global $globalDBdriver; |
| 4651 | 4651 | //$filter_query = $this->getFilter($filters,true,true); |
| 4652 | - $Connection= new Connection($this->db); |
|
| 4652 | + $Connection = new Connection($this->db); |
|
| 4653 | 4653 | if (!$Connection->tableExists('countries')) return array(); |
| 4654 | 4654 | /* |
| 4655 | 4655 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -4664,7 +4664,7 @@ discard block |
||
| 4664 | 4664 | */ |
| 4665 | 4665 | require_once('class.SpotterLive.php'); |
| 4666 | 4666 | $SpotterLive = new SpotterLive(); |
| 4667 | - $filter_query = $SpotterLive->getFilter($filters,true,true); |
|
| 4667 | + $filter_query = $SpotterLive->getFilter($filters, true, true); |
|
| 4668 | 4668 | $filter_query .= ' over_country IS NOT NULL'; |
| 4669 | 4669 | if ($olderthanmonths > 0) { |
| 4670 | 4670 | if ($globalDBdriver == 'mysql') { |
@@ -4691,7 +4691,7 @@ discard block |
||
| 4691 | 4691 | $flight_array = array(); |
| 4692 | 4692 | $temp_array = array(); |
| 4693 | 4693 | |
| 4694 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4694 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4695 | 4695 | { |
| 4696 | 4696 | $temp_array['flight_count'] = $row['nb']; |
| 4697 | 4697 | $temp_array['flight_country'] = $row['name']; |
@@ -4709,11 +4709,11 @@ discard block |
||
| 4709 | 4709 | * @return Array the aircraft list |
| 4710 | 4710 | * |
| 4711 | 4711 | */ |
| 4712 | - public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
| 4712 | + public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 4713 | 4713 | { |
| 4714 | 4714 | global $globalDBdriver; |
| 4715 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4716 | - $query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4715 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4716 | + $query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4717 | 4717 | FROM spotter_output ".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> ''"; |
| 4718 | 4718 | if ($olderthanmonths > 0) { |
| 4719 | 4719 | if ($globalDBdriver == 'mysql') { |
@@ -4733,28 +4733,28 @@ discard block |
||
| 4733 | 4733 | if ($year != '') { |
| 4734 | 4734 | if ($globalDBdriver == 'mysql') { |
| 4735 | 4735 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 4736 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4736 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4737 | 4737 | } else { |
| 4738 | 4738 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 4739 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4739 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4740 | 4740 | } |
| 4741 | 4741 | } |
| 4742 | 4742 | if ($month != '') { |
| 4743 | 4743 | if ($globalDBdriver == 'mysql') { |
| 4744 | 4744 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 4745 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4745 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4746 | 4746 | } else { |
| 4747 | 4747 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 4748 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4748 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4749 | 4749 | } |
| 4750 | 4750 | } |
| 4751 | 4751 | if ($day != '') { |
| 4752 | 4752 | if ($globalDBdriver == 'mysql') { |
| 4753 | 4753 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 4754 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4754 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4755 | 4755 | } else { |
| 4756 | 4756 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 4757 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4757 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4758 | 4758 | } |
| 4759 | 4759 | } |
| 4760 | 4760 | |
@@ -4766,7 +4766,7 @@ discard block |
||
| 4766 | 4766 | |
| 4767 | 4767 | $aircraft_array = array(); |
| 4768 | 4768 | $temp_array = array(); |
| 4769 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4769 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4770 | 4770 | { |
| 4771 | 4771 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4772 | 4772 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4783,11 +4783,11 @@ discard block |
||
| 4783 | 4783 | * @return Array the aircraft list |
| 4784 | 4784 | * |
| 4785 | 4785 | */ |
| 4786 | - public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '') |
|
| 4786 | + public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 4787 | 4787 | { |
| 4788 | 4788 | global $globalDBdriver; |
| 4789 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4790 | - $query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4789 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4790 | + $query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4791 | 4791 | FROM spotter_output".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' "; |
| 4792 | 4792 | if ($olderthanmonths > 0) { |
| 4793 | 4793 | if ($globalDBdriver == 'mysql') { |
@@ -4807,28 +4807,28 @@ discard block |
||
| 4807 | 4807 | if ($year != '') { |
| 4808 | 4808 | if ($globalDBdriver == 'mysql') { |
| 4809 | 4809 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 4810 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4810 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4811 | 4811 | } else { |
| 4812 | 4812 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 4813 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4813 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4814 | 4814 | } |
| 4815 | 4815 | } |
| 4816 | 4816 | if ($month != '') { |
| 4817 | 4817 | if ($globalDBdriver == 'mysql') { |
| 4818 | 4818 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 4819 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4819 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4820 | 4820 | } else { |
| 4821 | 4821 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 4822 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4822 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4823 | 4823 | } |
| 4824 | 4824 | } |
| 4825 | 4825 | if ($day != '') { |
| 4826 | 4826 | if ($globalDBdriver == 'mysql') { |
| 4827 | 4827 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 4828 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4828 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4829 | 4829 | } else { |
| 4830 | 4830 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 4831 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4831 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4832 | 4832 | } |
| 4833 | 4833 | } |
| 4834 | 4834 | |
@@ -4840,7 +4840,7 @@ discard block |
||
| 4840 | 4840 | |
| 4841 | 4841 | $aircraft_array = array(); |
| 4842 | 4842 | $temp_array = array(); |
| 4843 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4843 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4844 | 4844 | { |
| 4845 | 4845 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 4846 | 4846 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -4858,11 +4858,11 @@ discard block |
||
| 4858 | 4858 | * @return Array the aircraft list |
| 4859 | 4859 | * |
| 4860 | 4860 | */ |
| 4861 | - public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 4861 | + public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 4862 | 4862 | { |
| 4863 | 4863 | global $globalDBdriver; |
| 4864 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4865 | - $query = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4864 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4865 | + $query = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4866 | 4866 | FROM spotter_output".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' "; |
| 4867 | 4867 | if ($olderthanmonths > 0) { |
| 4868 | 4868 | if ($globalDBdriver == 'mysql') { |
@@ -4887,7 +4887,7 @@ discard block |
||
| 4887 | 4887 | |
| 4888 | 4888 | $aircraft_array = array(); |
| 4889 | 4889 | $temp_array = array(); |
| 4890 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4890 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4891 | 4891 | { |
| 4892 | 4892 | //$temp_array['airline_icao'] = $row['airline_icao']; |
| 4893 | 4893 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -4906,13 +4906,13 @@ discard block |
||
| 4906 | 4906 | * @return Array the aircraft list |
| 4907 | 4907 | * |
| 4908 | 4908 | */ |
| 4909 | - public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array()) |
|
| 4909 | + public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array()) |
|
| 4910 | 4910 | { |
| 4911 | 4911 | $Image = new Image($this->db); |
| 4912 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4913 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 4912 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4913 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 4914 | 4914 | |
| 4915 | - $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 |
|
| 4915 | + $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 |
|
| 4916 | 4916 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 4917 | 4917 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
| 4918 | 4918 | ORDER BY registration_count DESC"; |
@@ -4923,14 +4923,14 @@ discard block |
||
| 4923 | 4923 | $aircraft_array = array(); |
| 4924 | 4924 | $temp_array = array(); |
| 4925 | 4925 | |
| 4926 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4926 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4927 | 4927 | { |
| 4928 | 4928 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4929 | 4929 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 4930 | 4930 | $temp_array['registration'] = $row['registration']; |
| 4931 | 4931 | $temp_array['airline_name'] = $row['airline_name']; |
| 4932 | 4932 | $temp_array['image_thumbnail'] = ""; |
| 4933 | - if($row['registration'] != "") |
|
| 4933 | + if ($row['registration'] != "") |
|
| 4934 | 4934 | { |
| 4935 | 4935 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4936 | 4936 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4949,11 +4949,11 @@ discard block |
||
| 4949 | 4949 | * @return Array the aircraft list |
| 4950 | 4950 | * |
| 4951 | 4951 | */ |
| 4952 | - public function countAllAircraftTypesByAirline($airline_icao,$filters = array()) |
|
| 4952 | + public function countAllAircraftTypesByAirline($airline_icao, $filters = array()) |
|
| 4953 | 4953 | { |
| 4954 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4955 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 4956 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4954 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4955 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 4956 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4957 | 4957 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao |
| 4958 | 4958 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 4959 | 4959 | ORDER BY aircraft_icao_count DESC"; |
@@ -4964,7 +4964,7 @@ discard block |
||
| 4964 | 4964 | $aircraft_array = array(); |
| 4965 | 4965 | $temp_array = array(); |
| 4966 | 4966 | |
| 4967 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4967 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4968 | 4968 | { |
| 4969 | 4969 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4970 | 4970 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4982,13 +4982,13 @@ discard block |
||
| 4982 | 4982 | * @return Array the aircraft list |
| 4983 | 4983 | * |
| 4984 | 4984 | */ |
| 4985 | - public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array()) |
|
| 4985 | + public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array()) |
|
| 4986 | 4986 | { |
| 4987 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4987 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4988 | 4988 | $Image = new Image($this->db); |
| 4989 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 4989 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 4990 | 4990 | |
| 4991 | - $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 |
|
| 4991 | + $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 |
|
| 4992 | 4992 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao |
| 4993 | 4993 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 4994 | 4994 | ORDER BY registration_count DESC"; |
@@ -4998,14 +4998,14 @@ discard block |
||
| 4998 | 4998 | |
| 4999 | 4999 | $aircraft_array = array(); |
| 5000 | 5000 | $temp_array = array(); |
| 5001 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5001 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5002 | 5002 | { |
| 5003 | 5003 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5004 | 5004 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5005 | 5005 | $temp_array['registration'] = $row['registration']; |
| 5006 | 5006 | $temp_array['airline_name'] = $row['airline_name']; |
| 5007 | 5007 | $temp_array['image_thumbnail'] = ""; |
| 5008 | - if($row['registration'] != "") |
|
| 5008 | + if ($row['registration'] != "") |
|
| 5009 | 5009 | { |
| 5010 | 5010 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5011 | 5011 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5024,11 +5024,11 @@ discard block |
||
| 5024 | 5024 | * @return Array the aircraft list |
| 5025 | 5025 | * |
| 5026 | 5026 | */ |
| 5027 | - public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array()) |
|
| 5027 | + public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array()) |
|
| 5028 | 5028 | { |
| 5029 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5030 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 5031 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5029 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5030 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 5031 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5032 | 5032 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao |
| 5033 | 5033 | GROUP BY spotter_output.aircraft_manufacturer |
| 5034 | 5034 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5039,7 +5039,7 @@ discard block |
||
| 5039 | 5039 | $aircraft_array = array(); |
| 5040 | 5040 | $temp_array = array(); |
| 5041 | 5041 | |
| 5042 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5042 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5043 | 5043 | { |
| 5044 | 5044 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5045 | 5045 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5056,12 +5056,12 @@ discard block |
||
| 5056 | 5056 | * @return Array the aircraft list |
| 5057 | 5057 | * |
| 5058 | 5058 | */ |
| 5059 | - public function countAllAircraftTypesByAirport($airport_icao,$filters = array()) |
|
| 5059 | + public function countAllAircraftTypesByAirport($airport_icao, $filters = array()) |
|
| 5060 | 5060 | { |
| 5061 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5062 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 5061 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5062 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 5063 | 5063 | |
| 5064 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5064 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5065 | 5065 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 5066 | 5066 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5067 | 5067 | ORDER BY aircraft_icao_count DESC"; |
@@ -5071,7 +5071,7 @@ discard block |
||
| 5071 | 5071 | |
| 5072 | 5072 | $aircraft_array = array(); |
| 5073 | 5073 | $temp_array = array(); |
| 5074 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5074 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5075 | 5075 | { |
| 5076 | 5076 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5077 | 5077 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5089,13 +5089,13 @@ discard block |
||
| 5089 | 5089 | * @return Array the aircraft list |
| 5090 | 5090 | * |
| 5091 | 5091 | */ |
| 5092 | - public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array()) |
|
| 5092 | + public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array()) |
|
| 5093 | 5093 | { |
| 5094 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5094 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5095 | 5095 | $Image = new Image($this->db); |
| 5096 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 5096 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 5097 | 5097 | |
| 5098 | - $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 |
|
| 5098 | + $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 |
|
| 5099 | 5099 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 5100 | 5100 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5101 | 5101 | ORDER BY registration_count DESC"; |
@@ -5105,14 +5105,14 @@ discard block |
||
| 5105 | 5105 | |
| 5106 | 5106 | $aircraft_array = array(); |
| 5107 | 5107 | $temp_array = array(); |
| 5108 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5108 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5109 | 5109 | { |
| 5110 | 5110 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5111 | 5111 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5112 | 5112 | $temp_array['registration'] = $row['registration']; |
| 5113 | 5113 | $temp_array['airline_name'] = $row['airline_name']; |
| 5114 | 5114 | $temp_array['image_thumbnail'] = ""; |
| 5115 | - if($row['registration'] != "") |
|
| 5115 | + if ($row['registration'] != "") |
|
| 5116 | 5116 | { |
| 5117 | 5117 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5118 | 5118 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5130,11 +5130,11 @@ discard block |
||
| 5130 | 5130 | * @return Array the aircraft list |
| 5131 | 5131 | * |
| 5132 | 5132 | */ |
| 5133 | - public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array()) |
|
| 5133 | + public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array()) |
|
| 5134 | 5134 | { |
| 5135 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5136 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 5137 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5135 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5136 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 5137 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5138 | 5138 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 5139 | 5139 | GROUP BY spotter_output.aircraft_manufacturer |
| 5140 | 5140 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5145,7 +5145,7 @@ discard block |
||
| 5145 | 5145 | |
| 5146 | 5146 | $aircraft_array = array(); |
| 5147 | 5147 | $temp_array = array(); |
| 5148 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5148 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5149 | 5149 | { |
| 5150 | 5150 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5151 | 5151 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5160,12 +5160,12 @@ discard block |
||
| 5160 | 5160 | * @return Array the aircraft list |
| 5161 | 5161 | * |
| 5162 | 5162 | */ |
| 5163 | - public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 5163 | + public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 5164 | 5164 | { |
| 5165 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5166 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 5165 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5166 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 5167 | 5167 | |
| 5168 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5168 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5169 | 5169 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 5170 | 5170 | GROUP BY spotter_output.aircraft_name |
| 5171 | 5171 | ORDER BY aircraft_icao_count DESC"; |
@@ -5174,7 +5174,7 @@ discard block |
||
| 5174 | 5174 | $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
| 5175 | 5175 | $aircraft_array = array(); |
| 5176 | 5176 | $temp_array = array(); |
| 5177 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5177 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5178 | 5178 | { |
| 5179 | 5179 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5180 | 5180 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5193,11 +5193,11 @@ discard block |
||
| 5193 | 5193 | */ |
| 5194 | 5194 | public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array()) |
| 5195 | 5195 | { |
| 5196 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5196 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5197 | 5197 | $Image = new Image($this->db); |
| 5198 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 5198 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 5199 | 5199 | |
| 5200 | - $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 |
|
| 5200 | + $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 |
|
| 5201 | 5201 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 5202 | 5202 | GROUP BY spotter_output.registration |
| 5203 | 5203 | ORDER BY registration_count DESC"; |
@@ -5207,14 +5207,14 @@ discard block |
||
| 5207 | 5207 | $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
| 5208 | 5208 | $aircraft_array = array(); |
| 5209 | 5209 | $temp_array = array(); |
| 5210 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5210 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5211 | 5211 | { |
| 5212 | 5212 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5213 | 5213 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5214 | 5214 | $temp_array['registration'] = $row['registration']; |
| 5215 | 5215 | $temp_array['airline_name'] = $row['airline_name']; |
| 5216 | 5216 | $temp_array['image_thumbnail'] = ""; |
| 5217 | - if($row['registration'] != "") |
|
| 5217 | + if ($row['registration'] != "") |
|
| 5218 | 5218 | { |
| 5219 | 5219 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5220 | 5220 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5231,11 +5231,11 @@ discard block |
||
| 5231 | 5231 | * @return Array the aircraft list |
| 5232 | 5232 | * |
| 5233 | 5233 | */ |
| 5234 | - public function countAllAircraftTypesByDate($date,$filters = array()) |
|
| 5234 | + public function countAllAircraftTypesByDate($date, $filters = array()) |
|
| 5235 | 5235 | { |
| 5236 | 5236 | global $globalTimezone, $globalDBdriver; |
| 5237 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5238 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 5237 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5238 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 5239 | 5239 | if ($globalTimezone != '') { |
| 5240 | 5240 | date_default_timezone_set($globalTimezone); |
| 5241 | 5241 | $datetime = new DateTime($date); |
@@ -5243,12 +5243,12 @@ discard block |
||
| 5243 | 5243 | } else $offset = '+00:00'; |
| 5244 | 5244 | |
| 5245 | 5245 | if ($globalDBdriver == 'mysql') { |
| 5246 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5246 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5247 | 5247 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 5248 | 5248 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5249 | 5249 | ORDER BY aircraft_icao_count DESC"; |
| 5250 | 5250 | } else { |
| 5251 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5251 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5252 | 5252 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 5253 | 5253 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5254 | 5254 | ORDER BY aircraft_icao_count DESC"; |
@@ -5259,7 +5259,7 @@ discard block |
||
| 5259 | 5259 | |
| 5260 | 5260 | $aircraft_array = array(); |
| 5261 | 5261 | $temp_array = array(); |
| 5262 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5262 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5263 | 5263 | { |
| 5264 | 5264 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5265 | 5265 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5277,12 +5277,12 @@ discard block |
||
| 5277 | 5277 | * @return Array the aircraft list |
| 5278 | 5278 | * |
| 5279 | 5279 | */ |
| 5280 | - public function countAllAircraftRegistrationByDate($date,$filters = array()) |
|
| 5280 | + public function countAllAircraftRegistrationByDate($date, $filters = array()) |
|
| 5281 | 5281 | { |
| 5282 | 5282 | global $globalTimezone, $globalDBdriver; |
| 5283 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5283 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5284 | 5284 | $Image = new Image($this->db); |
| 5285 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 5285 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 5286 | 5286 | if ($globalTimezone != '') { |
| 5287 | 5287 | date_default_timezone_set($globalTimezone); |
| 5288 | 5288 | $datetime = new DateTime($date); |
@@ -5290,12 +5290,12 @@ discard block |
||
| 5290 | 5290 | } else $offset = '+00:00'; |
| 5291 | 5291 | |
| 5292 | 5292 | if ($globalDBdriver == 'mysql') { |
| 5293 | - $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 |
|
| 5293 | + $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 |
|
| 5294 | 5294 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 5295 | 5295 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5296 | 5296 | ORDER BY registration_count DESC"; |
| 5297 | 5297 | } else { |
| 5298 | - $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 |
|
| 5298 | + $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 |
|
| 5299 | 5299 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 5300 | 5300 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5301 | 5301 | ORDER BY registration_count DESC"; |
@@ -5306,14 +5306,14 @@ discard block |
||
| 5306 | 5306 | |
| 5307 | 5307 | $aircraft_array = array(); |
| 5308 | 5308 | $temp_array = array(); |
| 5309 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5309 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5310 | 5310 | { |
| 5311 | 5311 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5312 | 5312 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5313 | 5313 | $temp_array['registration'] = $row['registration']; |
| 5314 | 5314 | $temp_array['airline_name'] = $row['airline_name']; |
| 5315 | 5315 | $temp_array['image_thumbnail'] = ""; |
| 5316 | - if($row['registration'] != "") |
|
| 5316 | + if ($row['registration'] != "") |
|
| 5317 | 5317 | { |
| 5318 | 5318 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5319 | 5319 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5332,11 +5332,11 @@ discard block |
||
| 5332 | 5332 | * @return Array the aircraft manufacturer list |
| 5333 | 5333 | * |
| 5334 | 5334 | */ |
| 5335 | - public function countAllAircraftManufacturerByDate($date,$filters = array()) |
|
| 5335 | + public function countAllAircraftManufacturerByDate($date, $filters = array()) |
|
| 5336 | 5336 | { |
| 5337 | 5337 | global $globalTimezone, $globalDBdriver; |
| 5338 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5339 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 5338 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5339 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 5340 | 5340 | if ($globalTimezone != '') { |
| 5341 | 5341 | date_default_timezone_set($globalTimezone); |
| 5342 | 5342 | $datetime = new DateTime($date); |
@@ -5344,12 +5344,12 @@ discard block |
||
| 5344 | 5344 | } else $offset = '+00:00'; |
| 5345 | 5345 | |
| 5346 | 5346 | if ($globalDBdriver == 'mysql') { |
| 5347 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5347 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5348 | 5348 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 5349 | 5349 | GROUP BY spotter_output.aircraft_manufacturer |
| 5350 | 5350 | ORDER BY aircraft_manufacturer_count DESC"; |
| 5351 | 5351 | } else { |
| 5352 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5352 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5353 | 5353 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 5354 | 5354 | GROUP BY spotter_output.aircraft_manufacturer |
| 5355 | 5355 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5361,7 +5361,7 @@ discard block |
||
| 5361 | 5361 | $aircraft_array = array(); |
| 5362 | 5362 | $temp_array = array(); |
| 5363 | 5363 | |
| 5364 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5364 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5365 | 5365 | { |
| 5366 | 5366 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5367 | 5367 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5378,11 +5378,11 @@ discard block |
||
| 5378 | 5378 | * @return Array the aircraft list |
| 5379 | 5379 | * |
| 5380 | 5380 | */ |
| 5381 | - public function countAllAircraftTypesByIdent($ident,$filters = array()) |
|
| 5381 | + public function countAllAircraftTypesByIdent($ident, $filters = array()) |
|
| 5382 | 5382 | { |
| 5383 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5384 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 5385 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5383 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5384 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 5385 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5386 | 5386 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 5387 | 5387 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5388 | 5388 | ORDER BY aircraft_icao_count DESC"; |
@@ -5393,7 +5393,7 @@ discard block |
||
| 5393 | 5393 | $aircraft_array = array(); |
| 5394 | 5394 | $temp_array = array(); |
| 5395 | 5395 | |
| 5396 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5396 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5397 | 5397 | { |
| 5398 | 5398 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5399 | 5399 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5411,13 +5411,13 @@ discard block |
||
| 5411 | 5411 | * @return Array the aircraft list |
| 5412 | 5412 | * |
| 5413 | 5413 | */ |
| 5414 | - public function countAllAircraftRegistrationByIdent($ident,$filters = array()) |
|
| 5414 | + public function countAllAircraftRegistrationByIdent($ident, $filters = array()) |
|
| 5415 | 5415 | { |
| 5416 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5416 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5417 | 5417 | $Image = new Image($this->db); |
| 5418 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 5418 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 5419 | 5419 | |
| 5420 | - $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 |
|
| 5420 | + $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 |
|
| 5421 | 5421 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident |
| 5422 | 5422 | GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5423 | 5423 | ORDER BY registration_count DESC"; |
@@ -5429,14 +5429,14 @@ discard block |
||
| 5429 | 5429 | $aircraft_array = array(); |
| 5430 | 5430 | $temp_array = array(); |
| 5431 | 5431 | |
| 5432 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5432 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5433 | 5433 | { |
| 5434 | 5434 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5435 | 5435 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5436 | 5436 | $temp_array['registration'] = $row['registration']; |
| 5437 | 5437 | $temp_array['airline_name'] = $row['airline_name']; |
| 5438 | 5438 | $temp_array['image_thumbnail'] = ""; |
| 5439 | - if($row['registration'] != "") |
|
| 5439 | + if ($row['registration'] != "") |
|
| 5440 | 5440 | { |
| 5441 | 5441 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5442 | 5442 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5455,11 +5455,11 @@ discard block |
||
| 5455 | 5455 | * @return Array the aircraft manufacturer list |
| 5456 | 5456 | * |
| 5457 | 5457 | */ |
| 5458 | - public function countAllAircraftManufacturerByIdent($ident,$filters = array()) |
|
| 5458 | + public function countAllAircraftManufacturerByIdent($ident, $filters = array()) |
|
| 5459 | 5459 | { |
| 5460 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5461 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 5462 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5460 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5461 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 5462 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5463 | 5463 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident |
| 5464 | 5464 | GROUP BY spotter_output.aircraft_manufacturer |
| 5465 | 5465 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5469,7 +5469,7 @@ discard block |
||
| 5469 | 5469 | $sth->execute(array(':ident' => $ident)); |
| 5470 | 5470 | $aircraft_array = array(); |
| 5471 | 5471 | $temp_array = array(); |
| 5472 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5472 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5473 | 5473 | { |
| 5474 | 5474 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5475 | 5475 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5485,24 +5485,24 @@ discard block |
||
| 5485 | 5485 | * @return Array the aircraft list |
| 5486 | 5486 | * |
| 5487 | 5487 | */ |
| 5488 | - public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 5488 | + public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 5489 | 5489 | { |
| 5490 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5491 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5492 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5490 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5491 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5492 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5493 | 5493 | |
| 5494 | 5494 | |
| 5495 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5495 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5496 | 5496 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 5497 | 5497 | GROUP BY spotter_output.aircraft_name |
| 5498 | 5498 | ORDER BY aircraft_icao_count DESC"; |
| 5499 | 5499 | |
| 5500 | 5500 | |
| 5501 | 5501 | $sth = $this->db->prepare($query); |
| 5502 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5502 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5503 | 5503 | $aircraft_array = array(); |
| 5504 | 5504 | $temp_array = array(); |
| 5505 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5505 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5506 | 5506 | { |
| 5507 | 5507 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5508 | 5508 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5518,33 +5518,33 @@ discard block |
||
| 5518 | 5518 | * @return Array the aircraft list |
| 5519 | 5519 | * |
| 5520 | 5520 | */ |
| 5521 | - public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 5521 | + public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 5522 | 5522 | { |
| 5523 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5523 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5524 | 5524 | $Image = new Image($this->db); |
| 5525 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5526 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5525 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5526 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5527 | 5527 | |
| 5528 | - $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 |
|
| 5528 | + $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 |
|
| 5529 | 5529 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 5530 | 5530 | GROUP BY spotter_output.registration |
| 5531 | 5531 | ORDER BY registration_count DESC"; |
| 5532 | 5532 | |
| 5533 | 5533 | |
| 5534 | 5534 | $sth = $this->db->prepare($query); |
| 5535 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5535 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5536 | 5536 | |
| 5537 | 5537 | $aircraft_array = array(); |
| 5538 | 5538 | $temp_array = array(); |
| 5539 | 5539 | |
| 5540 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5540 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5541 | 5541 | { |
| 5542 | 5542 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5543 | 5543 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5544 | 5544 | $temp_array['registration'] = $row['registration']; |
| 5545 | 5545 | $temp_array['airline_name'] = $row['airline_name']; |
| 5546 | 5546 | $temp_array['image_thumbnail'] = ""; |
| 5547 | - if($row['registration'] != "") |
|
| 5547 | + if ($row['registration'] != "") |
|
| 5548 | 5548 | { |
| 5549 | 5549 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5550 | 5550 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5564,25 +5564,25 @@ discard block |
||
| 5564 | 5564 | * @return Array the aircraft manufacturer list |
| 5565 | 5565 | * |
| 5566 | 5566 | */ |
| 5567 | - public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 5567 | + public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 5568 | 5568 | { |
| 5569 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5570 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5571 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5569 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5570 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5571 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5572 | 5572 | |
| 5573 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5573 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5574 | 5574 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 5575 | 5575 | GROUP BY spotter_output.aircraft_manufacturer |
| 5576 | 5576 | ORDER BY aircraft_manufacturer_count DESC"; |
| 5577 | 5577 | |
| 5578 | 5578 | |
| 5579 | 5579 | $sth = $this->db->prepare($query); |
| 5580 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5580 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5581 | 5581 | |
| 5582 | 5582 | $aircraft_array = array(); |
| 5583 | 5583 | $temp_array = array(); |
| 5584 | 5584 | |
| 5585 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5585 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5586 | 5586 | { |
| 5587 | 5587 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5588 | 5588 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5602,11 +5602,11 @@ discard block |
||
| 5602 | 5602 | * @return Array the aircraft list |
| 5603 | 5603 | * |
| 5604 | 5604 | */ |
| 5605 | - public function countAllAircraftTypesByCountry($country,$filters = array()) |
|
| 5605 | + public function countAllAircraftTypesByCountry($country, $filters = array()) |
|
| 5606 | 5606 | { |
| 5607 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5608 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 5609 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5607 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5608 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 5609 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5610 | 5610 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 5611 | 5611 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5612 | 5612 | ORDER BY aircraft_icao_count DESC"; |
@@ -5618,7 +5618,7 @@ discard block |
||
| 5618 | 5618 | $aircraft_array = array(); |
| 5619 | 5619 | $temp_array = array(); |
| 5620 | 5620 | |
| 5621 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5621 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5622 | 5622 | { |
| 5623 | 5623 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5624 | 5624 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5637,12 +5637,12 @@ discard block |
||
| 5637 | 5637 | * @return Array the aircraft list |
| 5638 | 5638 | * |
| 5639 | 5639 | */ |
| 5640 | - public function countAllAircraftRegistrationByCountry($country,$filters = array()) |
|
| 5640 | + public function countAllAircraftRegistrationByCountry($country, $filters = array()) |
|
| 5641 | 5641 | { |
| 5642 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5642 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5643 | 5643 | $Image = new Image($this->db); |
| 5644 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 5645 | - $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 |
|
| 5644 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 5645 | + $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 |
|
| 5646 | 5646 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) |
| 5647 | 5647 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5648 | 5648 | ORDER BY registration_count DESC"; |
@@ -5654,14 +5654,14 @@ discard block |
||
| 5654 | 5654 | $aircraft_array = array(); |
| 5655 | 5655 | $temp_array = array(); |
| 5656 | 5656 | |
| 5657 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5657 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5658 | 5658 | { |
| 5659 | 5659 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5660 | 5660 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5661 | 5661 | $temp_array['registration'] = $row['registration']; |
| 5662 | 5662 | $temp_array['airline_name'] = $row['airline_name']; |
| 5663 | 5663 | $temp_array['image_thumbnail'] = ""; |
| 5664 | - if($row['registration'] != "") |
|
| 5664 | + if ($row['registration'] != "") |
|
| 5665 | 5665 | { |
| 5666 | 5666 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5667 | 5667 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5681,11 +5681,11 @@ discard block |
||
| 5681 | 5681 | * @return Array the aircraft manufacturer list |
| 5682 | 5682 | * |
| 5683 | 5683 | */ |
| 5684 | - public function countAllAircraftManufacturerByCountry($country,$filters = array()) |
|
| 5684 | + public function countAllAircraftManufacturerByCountry($country, $filters = array()) |
|
| 5685 | 5685 | { |
| 5686 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5687 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 5688 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5686 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5687 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 5688 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5689 | 5689 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) |
| 5690 | 5690 | GROUP BY spotter_output.aircraft_manufacturer |
| 5691 | 5691 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5697,7 +5697,7 @@ discard block |
||
| 5697 | 5697 | $aircraft_array = array(); |
| 5698 | 5698 | $temp_array = array(); |
| 5699 | 5699 | |
| 5700 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5700 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5701 | 5701 | { |
| 5702 | 5702 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5703 | 5703 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5716,38 +5716,38 @@ discard block |
||
| 5716 | 5716 | * @return Array the aircraft list |
| 5717 | 5717 | * |
| 5718 | 5718 | */ |
| 5719 | - public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '') |
|
| 5719 | + public function countAllAircraftManufacturers($filters = array(), $year = '', $month = '', $day = '') |
|
| 5720 | 5720 | { |
| 5721 | 5721 | global $globalDBdriver; |
| 5722 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5723 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5722 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5723 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5724 | 5724 | FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'"; |
| 5725 | 5725 | $query_values = array(); |
| 5726 | 5726 | if ($year != '') { |
| 5727 | 5727 | if ($globalDBdriver == 'mysql') { |
| 5728 | 5728 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 5729 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 5729 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 5730 | 5730 | } else { |
| 5731 | 5731 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 5732 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 5732 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 5733 | 5733 | } |
| 5734 | 5734 | } |
| 5735 | 5735 | if ($month != '') { |
| 5736 | 5736 | if ($globalDBdriver == 'mysql') { |
| 5737 | 5737 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 5738 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 5738 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 5739 | 5739 | } else { |
| 5740 | 5740 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 5741 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 5741 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 5742 | 5742 | } |
| 5743 | 5743 | } |
| 5744 | 5744 | if ($day != '') { |
| 5745 | 5745 | if ($globalDBdriver == 'mysql') { |
| 5746 | 5746 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 5747 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 5747 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 5748 | 5748 | } else { |
| 5749 | 5749 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 5750 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 5750 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 5751 | 5751 | } |
| 5752 | 5752 | } |
| 5753 | 5753 | $query .= " GROUP BY spotter_output.aircraft_manufacturer |
@@ -5761,7 +5761,7 @@ discard block |
||
| 5761 | 5761 | $manufacturer_array = array(); |
| 5762 | 5762 | $temp_array = array(); |
| 5763 | 5763 | |
| 5764 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5764 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5765 | 5765 | { |
| 5766 | 5766 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5767 | 5767 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5780,12 +5780,12 @@ discard block |
||
| 5780 | 5780 | * @return Array the aircraft list |
| 5781 | 5781 | * |
| 5782 | 5782 | */ |
| 5783 | - public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
|
| 5783 | + public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 5784 | 5784 | { |
| 5785 | 5785 | global $globalDBdriver; |
| 5786 | 5786 | $Image = new Image($this->db); |
| 5787 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5788 | - $query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
| 5787 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5788 | + $query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
| 5789 | 5789 | FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'"; |
| 5790 | 5790 | if ($olderthanmonths > 0) { |
| 5791 | 5791 | if ($globalDBdriver == 'mysql') { |
@@ -5805,28 +5805,28 @@ discard block |
||
| 5805 | 5805 | if ($year != '') { |
| 5806 | 5806 | if ($globalDBdriver == 'mysql') { |
| 5807 | 5807 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 5808 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 5808 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 5809 | 5809 | } else { |
| 5810 | 5810 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 5811 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 5811 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 5812 | 5812 | } |
| 5813 | 5813 | } |
| 5814 | 5814 | if ($month != '') { |
| 5815 | 5815 | if ($globalDBdriver == 'mysql') { |
| 5816 | 5816 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 5817 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 5817 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 5818 | 5818 | } else { |
| 5819 | 5819 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 5820 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 5820 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 5821 | 5821 | } |
| 5822 | 5822 | } |
| 5823 | 5823 | if ($day != '') { |
| 5824 | 5824 | if ($globalDBdriver == 'mysql') { |
| 5825 | 5825 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 5826 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 5826 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 5827 | 5827 | } else { |
| 5828 | 5828 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 5829 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 5829 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 5830 | 5830 | } |
| 5831 | 5831 | } |
| 5832 | 5832 | $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
@@ -5838,7 +5838,7 @@ discard block |
||
| 5838 | 5838 | $aircraft_array = array(); |
| 5839 | 5839 | $temp_array = array(); |
| 5840 | 5840 | |
| 5841 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5841 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5842 | 5842 | { |
| 5843 | 5843 | $temp_array['registration'] = $row['registration']; |
| 5844 | 5844 | $temp_array['aircraft_registration_count'] = $row['aircraft_registration_count']; |
@@ -5846,7 +5846,7 @@ discard block |
||
| 5846 | 5846 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5847 | 5847 | $temp_array['airline_name'] = $row['airline_name']; |
| 5848 | 5848 | $temp_array['image_thumbnail'] = ""; |
| 5849 | - if($row['registration'] != "") |
|
| 5849 | + if ($row['registration'] != "") |
|
| 5850 | 5850 | { |
| 5851 | 5851 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5852 | 5852 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5865,12 +5865,12 @@ discard block |
||
| 5865 | 5865 | * @return Array the aircraft list |
| 5866 | 5866 | * |
| 5867 | 5867 | */ |
| 5868 | - public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 5868 | + public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5869 | 5869 | { |
| 5870 | 5870 | global $globalDBdriver; |
| 5871 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5871 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5872 | 5872 | $Image = new Image($this->db); |
| 5873 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
| 5873 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
| 5874 | 5874 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' "; |
| 5875 | 5875 | if ($olderthanmonths > 0) { |
| 5876 | 5876 | if ($globalDBdriver == 'mysql') { |
@@ -5898,7 +5898,7 @@ discard block |
||
| 5898 | 5898 | $aircraft_array = array(); |
| 5899 | 5899 | $temp_array = array(); |
| 5900 | 5900 | |
| 5901 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5901 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5902 | 5902 | { |
| 5903 | 5903 | $temp_array['registration'] = $row['registration']; |
| 5904 | 5904 | $temp_array['aircraft_registration_count'] = $row['aircraft_registration_count']; |
@@ -5907,7 +5907,7 @@ discard block |
||
| 5907 | 5907 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5908 | 5908 | $temp_array['airline_name'] = $row['airline_name']; |
| 5909 | 5909 | $temp_array['image_thumbnail'] = ""; |
| 5910 | - if($row['registration'] != "") |
|
| 5910 | + if ($row['registration'] != "") |
|
| 5911 | 5911 | { |
| 5912 | 5912 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5913 | 5913 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5926,11 +5926,11 @@ discard block |
||
| 5926 | 5926 | * @return Array the airport list |
| 5927 | 5927 | * |
| 5928 | 5928 | */ |
| 5929 | - public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
| 5929 | + public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 5930 | 5930 | { |
| 5931 | 5931 | global $globalDBdriver; |
| 5932 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5933 | - $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 |
|
| 5932 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5933 | + $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 |
|
| 5934 | 5934 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''"; |
| 5935 | 5935 | if ($olderthanmonths > 0) { |
| 5936 | 5936 | if ($globalDBdriver == 'mysql') { |
@@ -5950,28 +5950,28 @@ discard block |
||
| 5950 | 5950 | if ($year != '') { |
| 5951 | 5951 | if ($globalDBdriver == 'mysql') { |
| 5952 | 5952 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 5953 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 5953 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 5954 | 5954 | } else { |
| 5955 | 5955 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 5956 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 5956 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 5957 | 5957 | } |
| 5958 | 5958 | } |
| 5959 | 5959 | if ($month != '') { |
| 5960 | 5960 | if ($globalDBdriver == 'mysql') { |
| 5961 | 5961 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 5962 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 5962 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 5963 | 5963 | } else { |
| 5964 | 5964 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 5965 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 5965 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 5966 | 5966 | } |
| 5967 | 5967 | } |
| 5968 | 5968 | if ($day != '') { |
| 5969 | 5969 | if ($globalDBdriver == 'mysql') { |
| 5970 | 5970 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 5971 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 5971 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 5972 | 5972 | } else { |
| 5973 | 5973 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 5974 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 5974 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 5975 | 5975 | } |
| 5976 | 5976 | } |
| 5977 | 5977 | $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
@@ -5983,7 +5983,7 @@ discard block |
||
| 5983 | 5983 | |
| 5984 | 5984 | $airport_array = array(); |
| 5985 | 5985 | $temp_array = array(); |
| 5986 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5986 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5987 | 5987 | { |
| 5988 | 5988 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 5989 | 5989 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6002,11 +6002,11 @@ discard block |
||
| 6002 | 6002 | * @return Array the airport list |
| 6003 | 6003 | * |
| 6004 | 6004 | */ |
| 6005 | - public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 6005 | + public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 6006 | 6006 | { |
| 6007 | 6007 | global $globalDBdriver; |
| 6008 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6009 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6008 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6009 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6010 | 6010 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' "; |
| 6011 | 6011 | if ($olderthanmonths > 0) { |
| 6012 | 6012 | if ($globalDBdriver == 'mysql') { |
@@ -6035,7 +6035,7 @@ discard block |
||
| 6035 | 6035 | $airport_array = array(); |
| 6036 | 6036 | $temp_array = array(); |
| 6037 | 6037 | |
| 6038 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6038 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6039 | 6039 | { |
| 6040 | 6040 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 6041 | 6041 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -6055,11 +6055,11 @@ discard block |
||
| 6055 | 6055 | * @return Array the airport list |
| 6056 | 6056 | * |
| 6057 | 6057 | */ |
| 6058 | - public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
| 6058 | + public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 6059 | 6059 | { |
| 6060 | 6060 | global $globalDBdriver; |
| 6061 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6062 | - $query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
| 6061 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6062 | + $query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
| 6063 | 6063 | FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao"; |
| 6064 | 6064 | if ($olderthanmonths > 0) { |
| 6065 | 6065 | if ($globalDBdriver == 'mysql') { |
@@ -6079,28 +6079,28 @@ discard block |
||
| 6079 | 6079 | if ($year != '') { |
| 6080 | 6080 | if ($globalDBdriver == 'mysql') { |
| 6081 | 6081 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 6082 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6082 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6083 | 6083 | } else { |
| 6084 | 6084 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 6085 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6085 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6086 | 6086 | } |
| 6087 | 6087 | } |
| 6088 | 6088 | if ($month != '') { |
| 6089 | 6089 | if ($globalDBdriver == 'mysql') { |
| 6090 | 6090 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 6091 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6091 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6092 | 6092 | } else { |
| 6093 | 6093 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 6094 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6094 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6095 | 6095 | } |
| 6096 | 6096 | } |
| 6097 | 6097 | if ($day != '') { |
| 6098 | 6098 | if ($globalDBdriver == 'mysql') { |
| 6099 | 6099 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 6100 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6100 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6101 | 6101 | } else { |
| 6102 | 6102 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 6103 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6103 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6104 | 6104 | } |
| 6105 | 6105 | } |
| 6106 | 6106 | $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
@@ -6113,7 +6113,7 @@ discard block |
||
| 6113 | 6113 | $airport_array = array(); |
| 6114 | 6114 | $temp_array = array(); |
| 6115 | 6115 | |
| 6116 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6116 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6117 | 6117 | { |
| 6118 | 6118 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6119 | 6119 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6132,11 +6132,11 @@ discard block |
||
| 6132 | 6132 | * @return Array the airport list |
| 6133 | 6133 | * |
| 6134 | 6134 | */ |
| 6135 | - public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 6135 | + public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 6136 | 6136 | { |
| 6137 | 6137 | global $globalDBdriver; |
| 6138 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6139 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
| 6138 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6139 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
| 6140 | 6140 | FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao "; |
| 6141 | 6141 | if ($olderthanmonths > 0) { |
| 6142 | 6142 | if ($globalDBdriver == 'mysql') { |
@@ -6165,7 +6165,7 @@ discard block |
||
| 6165 | 6165 | $airport_array = array(); |
| 6166 | 6166 | $temp_array = array(); |
| 6167 | 6167 | |
| 6168 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6168 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6169 | 6169 | { |
| 6170 | 6170 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 6171 | 6171 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -6185,11 +6185,11 @@ discard block |
||
| 6185 | 6185 | * @return Array the airport list |
| 6186 | 6186 | * |
| 6187 | 6187 | */ |
| 6188 | - public function countAllDepartureAirportsByAirline($airline_icao,$filters = array()) |
|
| 6188 | + public function countAllDepartureAirportsByAirline($airline_icao, $filters = array()) |
|
| 6189 | 6189 | { |
| 6190 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6191 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 6192 | - $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 |
|
| 6190 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6191 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 6192 | + $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 |
|
| 6193 | 6193 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao AND spotter_output.departure_airport_icao <> '' |
| 6194 | 6194 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6195 | 6195 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6201,7 +6201,7 @@ discard block |
||
| 6201 | 6201 | $airport_array = array(); |
| 6202 | 6202 | $temp_array = array(); |
| 6203 | 6203 | |
| 6204 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6204 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6205 | 6205 | { |
| 6206 | 6206 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6207 | 6207 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6223,11 +6223,11 @@ discard block |
||
| 6223 | 6223 | * @return Array the airport list |
| 6224 | 6224 | * |
| 6225 | 6225 | */ |
| 6226 | - public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array()) |
|
| 6226 | + public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array()) |
|
| 6227 | 6227 | { |
| 6228 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6229 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 6230 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6228 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6229 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 6230 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6231 | 6231 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao |
| 6232 | 6232 | GROUP BY spotter_output.departure_airport_country |
| 6233 | 6233 | ORDER BY airport_departure_country_count DESC"; |
@@ -6239,7 +6239,7 @@ discard block |
||
| 6239 | 6239 | $airport_array = array(); |
| 6240 | 6240 | $temp_array = array(); |
| 6241 | 6241 | |
| 6242 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6242 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6243 | 6243 | { |
| 6244 | 6244 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6245 | 6245 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6258,11 +6258,11 @@ discard block |
||
| 6258 | 6258 | * @return Array the airport list |
| 6259 | 6259 | * |
| 6260 | 6260 | */ |
| 6261 | - public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array()) |
|
| 6261 | + public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array()) |
|
| 6262 | 6262 | { |
| 6263 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6264 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 6265 | - $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 |
|
| 6263 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6264 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 6265 | + $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 |
|
| 6266 | 6266 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao AND spotter_output.departure_airport_icao <> '' |
| 6267 | 6267 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6268 | 6268 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6274,7 +6274,7 @@ discard block |
||
| 6274 | 6274 | $airport_array = array(); |
| 6275 | 6275 | $temp_array = array(); |
| 6276 | 6276 | |
| 6277 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6277 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6278 | 6278 | { |
| 6279 | 6279 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6280 | 6280 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6295,11 +6295,11 @@ discard block |
||
| 6295 | 6295 | * @return Array the airport list |
| 6296 | 6296 | * |
| 6297 | 6297 | */ |
| 6298 | - public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
|
| 6298 | + public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array()) |
|
| 6299 | 6299 | { |
| 6300 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6301 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 6302 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6300 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6301 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 6302 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6303 | 6303 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 6304 | 6304 | GROUP BY spotter_output.departure_airport_country |
| 6305 | 6305 | ORDER BY airport_departure_country_count DESC"; |
@@ -6311,7 +6311,7 @@ discard block |
||
| 6311 | 6311 | $airport_array = array(); |
| 6312 | 6312 | $temp_array = array(); |
| 6313 | 6313 | |
| 6314 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6314 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6315 | 6315 | { |
| 6316 | 6316 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6317 | 6317 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6329,11 +6329,11 @@ discard block |
||
| 6329 | 6329 | * @return Array the airport list |
| 6330 | 6330 | * |
| 6331 | 6331 | */ |
| 6332 | - public function countAllDepartureAirportsByRegistration($registration,$filters = array()) |
|
| 6332 | + public function countAllDepartureAirportsByRegistration($registration, $filters = array()) |
|
| 6333 | 6333 | { |
| 6334 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6335 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 6336 | - $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 |
|
| 6334 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6335 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 6336 | + $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 |
|
| 6337 | 6337 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration AND spotter_output.departure_airport_icao <> '' |
| 6338 | 6338 | GROUP BY spotter_output.departure_airport_icao |
| 6339 | 6339 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6345,7 +6345,7 @@ discard block |
||
| 6345 | 6345 | $airport_array = array(); |
| 6346 | 6346 | $temp_array = array(); |
| 6347 | 6347 | |
| 6348 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6348 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6349 | 6349 | { |
| 6350 | 6350 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6351 | 6351 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6366,11 +6366,11 @@ discard block |
||
| 6366 | 6366 | * @return Array the airport list |
| 6367 | 6367 | * |
| 6368 | 6368 | */ |
| 6369 | - public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array()) |
|
| 6369 | + public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array()) |
|
| 6370 | 6370 | { |
| 6371 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6372 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 6373 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6371 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6372 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 6373 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6374 | 6374 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration |
| 6375 | 6375 | GROUP BY spotter_output.departure_airport_country |
| 6376 | 6376 | ORDER BY airport_departure_country_count DESC"; |
@@ -6382,7 +6382,7 @@ discard block |
||
| 6382 | 6382 | $airport_array = array(); |
| 6383 | 6383 | $temp_array = array(); |
| 6384 | 6384 | |
| 6385 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6385 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6386 | 6386 | { |
| 6387 | 6387 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6388 | 6388 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6400,11 +6400,11 @@ discard block |
||
| 6400 | 6400 | * @return Array the airport list |
| 6401 | 6401 | * |
| 6402 | 6402 | */ |
| 6403 | - public function countAllDepartureAirportsByAirport($airport_icao,$filters = array()) |
|
| 6403 | + public function countAllDepartureAirportsByAirport($airport_icao, $filters = array()) |
|
| 6404 | 6404 | { |
| 6405 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6406 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 6407 | - $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 |
|
| 6405 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6406 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 6407 | + $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 |
|
| 6408 | 6408 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao AND spotter_output.departure_airport_icao <> '' |
| 6409 | 6409 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6410 | 6410 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6416,7 +6416,7 @@ discard block |
||
| 6416 | 6416 | $airport_array = array(); |
| 6417 | 6417 | $temp_array = array(); |
| 6418 | 6418 | |
| 6419 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6419 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6420 | 6420 | { |
| 6421 | 6421 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6422 | 6422 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6437,11 +6437,11 @@ discard block |
||
| 6437 | 6437 | * @return Array the airport list |
| 6438 | 6438 | * |
| 6439 | 6439 | */ |
| 6440 | - public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array()) |
|
| 6440 | + public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array()) |
|
| 6441 | 6441 | { |
| 6442 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6443 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 6444 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6442 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6443 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 6444 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6445 | 6445 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao |
| 6446 | 6446 | GROUP BY spotter_output.departure_airport_country |
| 6447 | 6447 | ORDER BY airport_departure_country_count DESC"; |
@@ -6453,7 +6453,7 @@ discard block |
||
| 6453 | 6453 | $airport_array = array(); |
| 6454 | 6454 | $temp_array = array(); |
| 6455 | 6455 | |
| 6456 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6456 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6457 | 6457 | { |
| 6458 | 6458 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6459 | 6459 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6472,11 +6472,11 @@ discard block |
||
| 6472 | 6472 | * @return Array the airport list |
| 6473 | 6473 | * |
| 6474 | 6474 | */ |
| 6475 | - public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 6475 | + public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 6476 | 6476 | { |
| 6477 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6478 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 6479 | - $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 |
|
| 6477 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6478 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 6479 | + $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 |
|
| 6480 | 6480 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer AND spotter_output.departure_airport_icao <> '' |
| 6481 | 6481 | GROUP BY spotter_output.departure_airport_icao |
| 6482 | 6482 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6488,7 +6488,7 @@ discard block |
||
| 6488 | 6488 | $airport_array = array(); |
| 6489 | 6489 | $temp_array = array(); |
| 6490 | 6490 | |
| 6491 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6491 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6492 | 6492 | { |
| 6493 | 6493 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6494 | 6494 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6509,11 +6509,11 @@ discard block |
||
| 6509 | 6509 | * @return Array the airport list |
| 6510 | 6510 | * |
| 6511 | 6511 | */ |
| 6512 | - public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 6512 | + public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 6513 | 6513 | { |
| 6514 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6515 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 6516 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6514 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6515 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 6516 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6517 | 6517 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 6518 | 6518 | GROUP BY spotter_output.departure_airport_country |
| 6519 | 6519 | ORDER BY airport_departure_country_count DESC"; |
@@ -6525,7 +6525,7 @@ discard block |
||
| 6525 | 6525 | $airport_array = array(); |
| 6526 | 6526 | $temp_array = array(); |
| 6527 | 6527 | |
| 6528 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6528 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6529 | 6529 | { |
| 6530 | 6530 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6531 | 6531 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6543,11 +6543,11 @@ discard block |
||
| 6543 | 6543 | * @return Array the airport list |
| 6544 | 6544 | * |
| 6545 | 6545 | */ |
| 6546 | - public function countAllDepartureAirportsByDate($date,$filters = array()) |
|
| 6546 | + public function countAllDepartureAirportsByDate($date, $filters = array()) |
|
| 6547 | 6547 | { |
| 6548 | 6548 | global $globalTimezone, $globalDBdriver; |
| 6549 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6550 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 6549 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6550 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 6551 | 6551 | if ($globalTimezone != '') { |
| 6552 | 6552 | date_default_timezone_set($globalTimezone); |
| 6553 | 6553 | $datetime = new DateTime($date); |
@@ -6555,12 +6555,12 @@ discard block |
||
| 6555 | 6555 | } else $offset = '+00:00'; |
| 6556 | 6556 | |
| 6557 | 6557 | if ($globalDBdriver == 'mysql') { |
| 6558 | - $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 |
|
| 6558 | + $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 |
|
| 6559 | 6559 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 6560 | 6560 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6561 | 6561 | ORDER BY airport_departure_icao_count DESC"; |
| 6562 | 6562 | } else { |
| 6563 | - $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 |
|
| 6563 | + $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 |
|
| 6564 | 6564 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 6565 | 6565 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6566 | 6566 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6572,7 +6572,7 @@ discard block |
||
| 6572 | 6572 | $airport_array = array(); |
| 6573 | 6573 | $temp_array = array(); |
| 6574 | 6574 | |
| 6575 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6575 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6576 | 6576 | { |
| 6577 | 6577 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6578 | 6578 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6593,11 +6593,11 @@ discard block |
||
| 6593 | 6593 | * @return Array the airport list |
| 6594 | 6594 | * |
| 6595 | 6595 | */ |
| 6596 | - public function countAllDepartureAirportCountriesByDate($date,$filters = array()) |
|
| 6596 | + public function countAllDepartureAirportCountriesByDate($date, $filters = array()) |
|
| 6597 | 6597 | { |
| 6598 | 6598 | global $globalTimezone, $globalDBdriver; |
| 6599 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6600 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 6599 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6600 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 6601 | 6601 | if ($globalTimezone != '') { |
| 6602 | 6602 | date_default_timezone_set($globalTimezone); |
| 6603 | 6603 | $datetime = new DateTime($date); |
@@ -6605,12 +6605,12 @@ discard block |
||
| 6605 | 6605 | } else $offset = '+00:00'; |
| 6606 | 6606 | |
| 6607 | 6607 | if ($globalDBdriver == 'mysql') { |
| 6608 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6608 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6609 | 6609 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 6610 | 6610 | GROUP BY spotter_output.departure_airport_country |
| 6611 | 6611 | ORDER BY airport_departure_country_count DESC"; |
| 6612 | 6612 | } else { |
| 6613 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6613 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6614 | 6614 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 6615 | 6615 | GROUP BY spotter_output.departure_airport_country |
| 6616 | 6616 | ORDER BY airport_departure_country_count DESC"; |
@@ -6622,7 +6622,7 @@ discard block |
||
| 6622 | 6622 | $airport_array = array(); |
| 6623 | 6623 | $temp_array = array(); |
| 6624 | 6624 | |
| 6625 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6625 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6626 | 6626 | { |
| 6627 | 6627 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6628 | 6628 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6640,11 +6640,11 @@ discard block |
||
| 6640 | 6640 | * @return Array the airport list |
| 6641 | 6641 | * |
| 6642 | 6642 | */ |
| 6643 | - public function countAllDepartureAirportsByIdent($ident,$filters = array()) |
|
| 6643 | + public function countAllDepartureAirportsByIdent($ident, $filters = array()) |
|
| 6644 | 6644 | { |
| 6645 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6646 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 6647 | - $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 |
|
| 6645 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6646 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 6647 | + $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 |
|
| 6648 | 6648 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.ident = :ident |
| 6649 | 6649 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6650 | 6650 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6656,7 +6656,7 @@ discard block |
||
| 6656 | 6656 | $airport_array = array(); |
| 6657 | 6657 | $temp_array = array(); |
| 6658 | 6658 | |
| 6659 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6659 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6660 | 6660 | { |
| 6661 | 6661 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6662 | 6662 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6678,11 +6678,11 @@ discard block |
||
| 6678 | 6678 | * @return Array the airport list |
| 6679 | 6679 | * |
| 6680 | 6680 | */ |
| 6681 | - public function countAllDepartureAirportCountriesByIdent($ident,$filters = array()) |
|
| 6681 | + public function countAllDepartureAirportCountriesByIdent($ident, $filters = array()) |
|
| 6682 | 6682 | { |
| 6683 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6684 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 6685 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6683 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6684 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 6685 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6686 | 6686 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident |
| 6687 | 6687 | GROUP BY spotter_output.departure_airport_country |
| 6688 | 6688 | ORDER BY airport_departure_country_count DESC"; |
@@ -6694,7 +6694,7 @@ discard block |
||
| 6694 | 6694 | $airport_array = array(); |
| 6695 | 6695 | $temp_array = array(); |
| 6696 | 6696 | |
| 6697 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6697 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6698 | 6698 | { |
| 6699 | 6699 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6700 | 6700 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6713,12 +6713,12 @@ discard block |
||
| 6713 | 6713 | * @return Array the airport list |
| 6714 | 6714 | * |
| 6715 | 6715 | */ |
| 6716 | - public function countAllDepartureAirportsByCountry($country,$filters = array()) |
|
| 6716 | + public function countAllDepartureAirportsByCountry($country, $filters = array()) |
|
| 6717 | 6717 | { |
| 6718 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6719 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 6718 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6719 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 6720 | 6720 | |
| 6721 | - $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 |
|
| 6721 | + $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 |
|
| 6722 | 6722 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 6723 | 6723 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6724 | 6724 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6730,7 +6730,7 @@ discard block |
||
| 6730 | 6730 | $airport_array = array(); |
| 6731 | 6731 | $temp_array = array(); |
| 6732 | 6732 | |
| 6733 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6733 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6734 | 6734 | { |
| 6735 | 6735 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6736 | 6736 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6751,11 +6751,11 @@ discard block |
||
| 6751 | 6751 | * @return Array the airport list |
| 6752 | 6752 | * |
| 6753 | 6753 | */ |
| 6754 | - public function countAllDepartureAirportCountriesByCountry($country,$filters = array()) |
|
| 6754 | + public function countAllDepartureAirportCountriesByCountry($country, $filters = array()) |
|
| 6755 | 6755 | { |
| 6756 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6757 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 6758 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6756 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6757 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 6758 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6759 | 6759 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 6760 | 6760 | GROUP BY spotter_output.departure_airport_country |
| 6761 | 6761 | ORDER BY airport_departure_country_count DESC"; |
@@ -6767,7 +6767,7 @@ discard block |
||
| 6767 | 6767 | $airport_array = array(); |
| 6768 | 6768 | $temp_array = array(); |
| 6769 | 6769 | |
| 6770 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6770 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6771 | 6771 | { |
| 6772 | 6772 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6773 | 6773 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6790,11 +6790,11 @@ discard block |
||
| 6790 | 6790 | * @return Array the airport list |
| 6791 | 6791 | * |
| 6792 | 6792 | */ |
| 6793 | - public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '') |
|
| 6793 | + public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '') |
|
| 6794 | 6794 | { |
| 6795 | 6795 | global $globalDBdriver; |
| 6796 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6797 | - $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 |
|
| 6796 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6797 | + $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 |
|
| 6798 | 6798 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''"; |
| 6799 | 6799 | if ($olderthanmonths > 0) { |
| 6800 | 6800 | if ($globalDBdriver == 'mysql') { |
@@ -6814,28 +6814,28 @@ discard block |
||
| 6814 | 6814 | if ($year != '') { |
| 6815 | 6815 | if ($globalDBdriver == 'mysql') { |
| 6816 | 6816 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 6817 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6817 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6818 | 6818 | } else { |
| 6819 | 6819 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 6820 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6820 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6821 | 6821 | } |
| 6822 | 6822 | } |
| 6823 | 6823 | if ($month != '') { |
| 6824 | 6824 | if ($globalDBdriver == 'mysql') { |
| 6825 | 6825 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 6826 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6826 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6827 | 6827 | } else { |
| 6828 | 6828 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 6829 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6829 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6830 | 6830 | } |
| 6831 | 6831 | } |
| 6832 | 6832 | if ($day != '') { |
| 6833 | 6833 | if ($globalDBdriver == 'mysql') { |
| 6834 | 6834 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 6835 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6835 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6836 | 6836 | } else { |
| 6837 | 6837 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 6838 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6838 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6839 | 6839 | } |
| 6840 | 6840 | } |
| 6841 | 6841 | $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
@@ -6849,7 +6849,7 @@ discard block |
||
| 6849 | 6849 | $airport_array = array(); |
| 6850 | 6850 | $temp_array = array(); |
| 6851 | 6851 | |
| 6852 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6852 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6853 | 6853 | { |
| 6854 | 6854 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6855 | 6855 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6872,11 +6872,11 @@ discard block |
||
| 6872 | 6872 | * @return Array the airport list |
| 6873 | 6873 | * |
| 6874 | 6874 | */ |
| 6875 | - public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
|
| 6875 | + public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
| 6876 | 6876 | { |
| 6877 | 6877 | global $globalDBdriver; |
| 6878 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6879 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6878 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6879 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6880 | 6880 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' "; |
| 6881 | 6881 | if ($olderthanmonths > 0) { |
| 6882 | 6882 | if ($globalDBdriver == 'mysql') { |
@@ -6906,7 +6906,7 @@ discard block |
||
| 6906 | 6906 | $airport_array = array(); |
| 6907 | 6907 | $temp_array = array(); |
| 6908 | 6908 | |
| 6909 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6909 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6910 | 6910 | { |
| 6911 | 6911 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 6912 | 6912 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
@@ -6931,11 +6931,11 @@ discard block |
||
| 6931 | 6931 | * @return Array the airport list |
| 6932 | 6932 | * |
| 6933 | 6933 | */ |
| 6934 | - public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '') |
|
| 6934 | + public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '') |
|
| 6935 | 6935 | { |
| 6936 | 6936 | global $globalDBdriver; |
| 6937 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6938 | - $query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
| 6937 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6938 | + $query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
| 6939 | 6939 | FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao"; |
| 6940 | 6940 | if ($olderthanmonths > 0) { |
| 6941 | 6941 | if ($globalDBdriver == 'mysql') { |
@@ -6955,28 +6955,28 @@ discard block |
||
| 6955 | 6955 | if ($year != '') { |
| 6956 | 6956 | if ($globalDBdriver == 'mysql') { |
| 6957 | 6957 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 6958 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6958 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6959 | 6959 | } else { |
| 6960 | 6960 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 6961 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6961 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6962 | 6962 | } |
| 6963 | 6963 | } |
| 6964 | 6964 | if ($month != '') { |
| 6965 | 6965 | if ($globalDBdriver == 'mysql') { |
| 6966 | 6966 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 6967 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6967 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6968 | 6968 | } else { |
| 6969 | 6969 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 6970 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6970 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6971 | 6971 | } |
| 6972 | 6972 | } |
| 6973 | 6973 | if ($day != '') { |
| 6974 | 6974 | if ($globalDBdriver == 'mysql') { |
| 6975 | 6975 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 6976 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6976 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6977 | 6977 | } else { |
| 6978 | 6978 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 6979 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6979 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6980 | 6980 | } |
| 6981 | 6981 | } |
| 6982 | 6982 | $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
@@ -6989,7 +6989,7 @@ discard block |
||
| 6989 | 6989 | |
| 6990 | 6990 | $airport_array = array(); |
| 6991 | 6991 | $temp_array = array(); |
| 6992 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6992 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6993 | 6993 | { |
| 6994 | 6994 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6995 | 6995 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7012,11 +7012,11 @@ discard block |
||
| 7012 | 7012 | * @return Array the airport list |
| 7013 | 7013 | * |
| 7014 | 7014 | */ |
| 7015 | - public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
|
| 7015 | + public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
| 7016 | 7016 | { |
| 7017 | 7017 | global $globalDBdriver; |
| 7018 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7019 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
| 7018 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7019 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
| 7020 | 7020 | FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao "; |
| 7021 | 7021 | if ($olderthanmonths > 0) { |
| 7022 | 7022 | if ($globalDBdriver == 'mysql') { |
@@ -7046,7 +7046,7 @@ discard block |
||
| 7046 | 7046 | $airport_array = array(); |
| 7047 | 7047 | $temp_array = array(); |
| 7048 | 7048 | |
| 7049 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7049 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7050 | 7050 | { |
| 7051 | 7051 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7052 | 7052 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7072,9 +7072,9 @@ discard block |
||
| 7072 | 7072 | */ |
| 7073 | 7073 | public function countAllArrivalAirportsByAirline($airline_icao, $filters = array()) |
| 7074 | 7074 | { |
| 7075 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7076 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 7077 | - $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 |
|
| 7075 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7076 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 7077 | + $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 |
|
| 7078 | 7078 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.airline_icao = :airline_icao |
| 7079 | 7079 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7080 | 7080 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7085,7 +7085,7 @@ discard block |
||
| 7085 | 7085 | $airport_array = array(); |
| 7086 | 7086 | $temp_array = array(); |
| 7087 | 7087 | |
| 7088 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7088 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7089 | 7089 | { |
| 7090 | 7090 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7091 | 7091 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7106,12 +7106,12 @@ discard block |
||
| 7106 | 7106 | * @return Array the airport list |
| 7107 | 7107 | * |
| 7108 | 7108 | */ |
| 7109 | - public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array()) |
|
| 7109 | + public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array()) |
|
| 7110 | 7110 | { |
| 7111 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7112 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 7111 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7112 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 7113 | 7113 | |
| 7114 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7114 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7115 | 7115 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao |
| 7116 | 7116 | GROUP BY spotter_output.arrival_airport_country |
| 7117 | 7117 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7123,7 +7123,7 @@ discard block |
||
| 7123 | 7123 | $airport_array = array(); |
| 7124 | 7124 | $temp_array = array(); |
| 7125 | 7125 | |
| 7126 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7126 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7127 | 7127 | { |
| 7128 | 7128 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7129 | 7129 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7141,11 +7141,11 @@ discard block |
||
| 7141 | 7141 | * @return Array the airport list |
| 7142 | 7142 | * |
| 7143 | 7143 | */ |
| 7144 | - public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array()) |
|
| 7144 | + public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array()) |
|
| 7145 | 7145 | { |
| 7146 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7147 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 7148 | - $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 |
|
| 7146 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7147 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 7148 | + $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 |
|
| 7149 | 7149 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 7150 | 7150 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7151 | 7151 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7157,7 +7157,7 @@ discard block |
||
| 7157 | 7157 | $airport_array = array(); |
| 7158 | 7158 | $temp_array = array(); |
| 7159 | 7159 | |
| 7160 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7160 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7161 | 7161 | { |
| 7162 | 7162 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7163 | 7163 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7179,11 +7179,11 @@ discard block |
||
| 7179 | 7179 | * @return Array the airport list |
| 7180 | 7180 | * |
| 7181 | 7181 | */ |
| 7182 | - public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
|
| 7182 | + public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array()) |
|
| 7183 | 7183 | { |
| 7184 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7185 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 7186 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7184 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7185 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 7186 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7187 | 7187 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 7188 | 7188 | GROUP BY spotter_output.arrival_airport_country |
| 7189 | 7189 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7195,7 +7195,7 @@ discard block |
||
| 7195 | 7195 | $airport_array = array(); |
| 7196 | 7196 | $temp_array = array(); |
| 7197 | 7197 | |
| 7198 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7198 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7199 | 7199 | { |
| 7200 | 7200 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7201 | 7201 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7213,12 +7213,12 @@ discard block |
||
| 7213 | 7213 | * @return Array the airport list |
| 7214 | 7214 | * |
| 7215 | 7215 | */ |
| 7216 | - public function countAllArrivalAirportsByRegistration($registration,$filters = array()) |
|
| 7216 | + public function countAllArrivalAirportsByRegistration($registration, $filters = array()) |
|
| 7217 | 7217 | { |
| 7218 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7219 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 7218 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7219 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 7220 | 7220 | |
| 7221 | - $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 |
|
| 7221 | + $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 |
|
| 7222 | 7222 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.registration = :registration |
| 7223 | 7223 | GROUP BY spotter_output.arrival_airport_icao |
| 7224 | 7224 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7230,7 +7230,7 @@ discard block |
||
| 7230 | 7230 | $airport_array = array(); |
| 7231 | 7231 | $temp_array = array(); |
| 7232 | 7232 | |
| 7233 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7233 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7234 | 7234 | { |
| 7235 | 7235 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7236 | 7236 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7251,11 +7251,11 @@ discard block |
||
| 7251 | 7251 | * @return Array the airport list |
| 7252 | 7252 | * |
| 7253 | 7253 | */ |
| 7254 | - public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array()) |
|
| 7254 | + public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array()) |
|
| 7255 | 7255 | { |
| 7256 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7257 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 7258 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7256 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7257 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 7258 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7259 | 7259 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration |
| 7260 | 7260 | GROUP BY spotter_output.arrival_airport_country |
| 7261 | 7261 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7267,7 +7267,7 @@ discard block |
||
| 7267 | 7267 | $airport_array = array(); |
| 7268 | 7268 | $temp_array = array(); |
| 7269 | 7269 | |
| 7270 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7270 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7271 | 7271 | { |
| 7272 | 7272 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7273 | 7273 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7286,11 +7286,11 @@ discard block |
||
| 7286 | 7286 | * @return Array the airport list |
| 7287 | 7287 | * |
| 7288 | 7288 | */ |
| 7289 | - public function countAllArrivalAirportsByAirport($airport_icao,$filters = array()) |
|
| 7289 | + public function countAllArrivalAirportsByAirport($airport_icao, $filters = array()) |
|
| 7290 | 7290 | { |
| 7291 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7292 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 7293 | - $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 |
|
| 7291 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7292 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 7293 | + $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 |
|
| 7294 | 7294 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.departure_airport_icao = :airport_icao |
| 7295 | 7295 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7296 | 7296 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7302,7 +7302,7 @@ discard block |
||
| 7302 | 7302 | $airport_array = array(); |
| 7303 | 7303 | $temp_array = array(); |
| 7304 | 7304 | |
| 7305 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7305 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7306 | 7306 | { |
| 7307 | 7307 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7308 | 7308 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7323,11 +7323,11 @@ discard block |
||
| 7323 | 7323 | * @return Array the airport list |
| 7324 | 7324 | * |
| 7325 | 7325 | */ |
| 7326 | - public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array()) |
|
| 7326 | + public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array()) |
|
| 7327 | 7327 | { |
| 7328 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7329 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 7330 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7328 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7329 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 7330 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7331 | 7331 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao |
| 7332 | 7332 | GROUP BY spotter_output.arrival_airport_country |
| 7333 | 7333 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7339,7 +7339,7 @@ discard block |
||
| 7339 | 7339 | $airport_array = array(); |
| 7340 | 7340 | $temp_array = array(); |
| 7341 | 7341 | |
| 7342 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7342 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7343 | 7343 | { |
| 7344 | 7344 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7345 | 7345 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7357,11 +7357,11 @@ discard block |
||
| 7357 | 7357 | * @return Array the airport list |
| 7358 | 7358 | * |
| 7359 | 7359 | */ |
| 7360 | - public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 7360 | + public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 7361 | 7361 | { |
| 7362 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7363 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 7364 | - $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 |
|
| 7362 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7363 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 7364 | + $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 |
|
| 7365 | 7365 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 7366 | 7366 | GROUP BY spotter_output.arrival_airport_icao |
| 7367 | 7367 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7373,7 +7373,7 @@ discard block |
||
| 7373 | 7373 | $airport_array = array(); |
| 7374 | 7374 | $temp_array = array(); |
| 7375 | 7375 | |
| 7376 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7376 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7377 | 7377 | { |
| 7378 | 7378 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7379 | 7379 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7395,11 +7395,11 @@ discard block |
||
| 7395 | 7395 | * @return Array the airport list |
| 7396 | 7396 | * |
| 7397 | 7397 | */ |
| 7398 | - public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 7398 | + public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 7399 | 7399 | { |
| 7400 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7401 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 7402 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7400 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7401 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 7402 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7403 | 7403 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 7404 | 7404 | GROUP BY spotter_output.arrival_airport_country |
| 7405 | 7405 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7411,7 +7411,7 @@ discard block |
||
| 7411 | 7411 | $airport_array = array(); |
| 7412 | 7412 | $temp_array = array(); |
| 7413 | 7413 | |
| 7414 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7414 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7415 | 7415 | { |
| 7416 | 7416 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7417 | 7417 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7430,11 +7430,11 @@ discard block |
||
| 7430 | 7430 | * @return Array the airport list |
| 7431 | 7431 | * |
| 7432 | 7432 | */ |
| 7433 | - public function countAllArrivalAirportsByDate($date,$filters = array()) |
|
| 7433 | + public function countAllArrivalAirportsByDate($date, $filters = array()) |
|
| 7434 | 7434 | { |
| 7435 | 7435 | global $globalTimezone, $globalDBdriver; |
| 7436 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7437 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 7436 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7437 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 7438 | 7438 | if ($globalTimezone != '') { |
| 7439 | 7439 | date_default_timezone_set($globalTimezone); |
| 7440 | 7440 | $datetime = new DateTime($date); |
@@ -7442,12 +7442,12 @@ discard block |
||
| 7442 | 7442 | } else $offset = '+00:00'; |
| 7443 | 7443 | |
| 7444 | 7444 | if ($globalDBdriver == 'mysql') { |
| 7445 | - $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 |
|
| 7445 | + $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 |
|
| 7446 | 7446 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 7447 | 7447 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7448 | 7448 | ORDER BY airport_arrival_icao_count DESC"; |
| 7449 | 7449 | } else { |
| 7450 | - $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 |
|
| 7450 | + $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 |
|
| 7451 | 7451 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 7452 | 7452 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7453 | 7453 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7459,7 +7459,7 @@ discard block |
||
| 7459 | 7459 | $airport_array = array(); |
| 7460 | 7460 | $temp_array = array(); |
| 7461 | 7461 | |
| 7462 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7462 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7463 | 7463 | { |
| 7464 | 7464 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7465 | 7465 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7483,8 +7483,8 @@ discard block |
||
| 7483 | 7483 | public function countAllArrivalAirportCountriesByDate($date, $filters = array()) |
| 7484 | 7484 | { |
| 7485 | 7485 | global $globalTimezone, $globalDBdriver; |
| 7486 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7487 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 7486 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7487 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 7488 | 7488 | if ($globalTimezone != '') { |
| 7489 | 7489 | date_default_timezone_set($globalTimezone); |
| 7490 | 7490 | $datetime = new DateTime($date); |
@@ -7492,12 +7492,12 @@ discard block |
||
| 7492 | 7492 | } else $offset = '+00:00'; |
| 7493 | 7493 | |
| 7494 | 7494 | if ($globalDBdriver == 'mysql') { |
| 7495 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7495 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7496 | 7496 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 7497 | 7497 | GROUP BY spotter_output.arrival_airport_country |
| 7498 | 7498 | ORDER BY airport_arrival_country_count DESC"; |
| 7499 | 7499 | } else { |
| 7500 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7500 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7501 | 7501 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 7502 | 7502 | GROUP BY spotter_output.arrival_airport_country |
| 7503 | 7503 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7509,7 +7509,7 @@ discard block |
||
| 7509 | 7509 | $airport_array = array(); |
| 7510 | 7510 | $temp_array = array(); |
| 7511 | 7511 | |
| 7512 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7512 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7513 | 7513 | { |
| 7514 | 7514 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7515 | 7515 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7527,11 +7527,11 @@ discard block |
||
| 7527 | 7527 | * @return Array the airport list |
| 7528 | 7528 | * |
| 7529 | 7529 | */ |
| 7530 | - public function countAllArrivalAirportsByIdent($ident,$filters = array()) |
|
| 7530 | + public function countAllArrivalAirportsByIdent($ident, $filters = array()) |
|
| 7531 | 7531 | { |
| 7532 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7533 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 7534 | - $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 |
|
| 7532 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7533 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 7534 | + $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 |
|
| 7535 | 7535 | FROM spotter_output".$filter_query." WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.ident = :ident |
| 7536 | 7536 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7537 | 7537 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7543,7 +7543,7 @@ discard block |
||
| 7543 | 7543 | $airport_array = array(); |
| 7544 | 7544 | $temp_array = array(); |
| 7545 | 7545 | |
| 7546 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7546 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7547 | 7547 | { |
| 7548 | 7548 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7549 | 7549 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7566,9 +7566,9 @@ discard block |
||
| 7566 | 7566 | */ |
| 7567 | 7567 | public function countAllArrivalAirportCountriesByIdent($ident, $filters = array()) |
| 7568 | 7568 | { |
| 7569 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7570 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 7571 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7569 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7570 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 7571 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7572 | 7572 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident |
| 7573 | 7573 | GROUP BY spotter_output.arrival_airport_country |
| 7574 | 7574 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7580,7 +7580,7 @@ discard block |
||
| 7580 | 7580 | $airport_array = array(); |
| 7581 | 7581 | $temp_array = array(); |
| 7582 | 7582 | |
| 7583 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7583 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7584 | 7584 | { |
| 7585 | 7585 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7586 | 7586 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7599,11 +7599,11 @@ discard block |
||
| 7599 | 7599 | * @return Array the airport list |
| 7600 | 7600 | * |
| 7601 | 7601 | */ |
| 7602 | - public function countAllArrivalAirportsByCountry($country,$filters = array()) |
|
| 7602 | + public function countAllArrivalAirportsByCountry($country, $filters = array()) |
|
| 7603 | 7603 | { |
| 7604 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7605 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 7606 | - $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 |
|
| 7604 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7605 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 7606 | + $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 |
|
| 7607 | 7607 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 7608 | 7608 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7609 | 7609 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7615,7 +7615,7 @@ discard block |
||
| 7615 | 7615 | $airport_array = array(); |
| 7616 | 7616 | $temp_array = array(); |
| 7617 | 7617 | |
| 7618 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7618 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7619 | 7619 | { |
| 7620 | 7620 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7621 | 7621 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7636,12 +7636,12 @@ discard block |
||
| 7636 | 7636 | * @return Array the airport list |
| 7637 | 7637 | * |
| 7638 | 7638 | */ |
| 7639 | - public function countAllArrivalAirportCountriesByCountry($country,$filters = array()) |
|
| 7639 | + public function countAllArrivalAirportCountriesByCountry($country, $filters = array()) |
|
| 7640 | 7640 | { |
| 7641 | 7641 | global $globalDBdriver; |
| 7642 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7643 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 7644 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7642 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7643 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 7644 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7645 | 7645 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 7646 | 7646 | GROUP BY spotter_output.arrival_airport_country |
| 7647 | 7647 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7653,7 +7653,7 @@ discard block |
||
| 7653 | 7653 | $airport_array = array(); |
| 7654 | 7654 | $temp_array = array(); |
| 7655 | 7655 | |
| 7656 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7656 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7657 | 7657 | { |
| 7658 | 7658 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7659 | 7659 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7672,38 +7672,38 @@ discard block |
||
| 7672 | 7672 | * @return Array the airport departure list |
| 7673 | 7673 | * |
| 7674 | 7674 | */ |
| 7675 | - public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '') |
|
| 7675 | + public function countAllDepartureCountries($filters = array(), $year = '', $month = '', $day = '') |
|
| 7676 | 7676 | { |
| 7677 | 7677 | global $globalDBdriver; |
| 7678 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7679 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7678 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7679 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7680 | 7680 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''"; |
| 7681 | 7681 | $query_values = array(); |
| 7682 | 7682 | if ($year != '') { |
| 7683 | 7683 | if ($globalDBdriver == 'mysql') { |
| 7684 | 7684 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 7685 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 7685 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 7686 | 7686 | } else { |
| 7687 | 7687 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 7688 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 7688 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 7689 | 7689 | } |
| 7690 | 7690 | } |
| 7691 | 7691 | if ($month != '') { |
| 7692 | 7692 | if ($globalDBdriver == 'mysql') { |
| 7693 | 7693 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 7694 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 7694 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 7695 | 7695 | } else { |
| 7696 | 7696 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 7697 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 7697 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 7698 | 7698 | } |
| 7699 | 7699 | } |
| 7700 | 7700 | if ($day != '') { |
| 7701 | 7701 | if ($globalDBdriver == 'mysql') { |
| 7702 | 7702 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 7703 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 7703 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 7704 | 7704 | } else { |
| 7705 | 7705 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 7706 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 7706 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 7707 | 7707 | } |
| 7708 | 7708 | } |
| 7709 | 7709 | $query .= " GROUP BY spotter_output.departure_airport_country |
@@ -7717,7 +7717,7 @@ discard block |
||
| 7717 | 7717 | $airport_array = array(); |
| 7718 | 7718 | $temp_array = array(); |
| 7719 | 7719 | |
| 7720 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7720 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7721 | 7721 | { |
| 7722 | 7722 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
| 7723 | 7723 | $temp_array['airport_departure_country'] = $row['departure_airport_country']; |
@@ -7735,38 +7735,38 @@ discard block |
||
| 7735 | 7735 | * @return Array the airport arrival list |
| 7736 | 7736 | * |
| 7737 | 7737 | */ |
| 7738 | - public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '') |
|
| 7738 | + public function countAllArrivalCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '') |
|
| 7739 | 7739 | { |
| 7740 | 7740 | global $globalDBdriver; |
| 7741 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7742 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7741 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7742 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7743 | 7743 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''"; |
| 7744 | 7744 | $query_values = array(); |
| 7745 | 7745 | if ($year != '') { |
| 7746 | 7746 | if ($globalDBdriver == 'mysql') { |
| 7747 | 7747 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 7748 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 7748 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 7749 | 7749 | } else { |
| 7750 | 7750 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 7751 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 7751 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 7752 | 7752 | } |
| 7753 | 7753 | } |
| 7754 | 7754 | if ($month != '') { |
| 7755 | 7755 | if ($globalDBdriver == 'mysql') { |
| 7756 | 7756 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 7757 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 7757 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 7758 | 7758 | } else { |
| 7759 | 7759 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 7760 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 7760 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 7761 | 7761 | } |
| 7762 | 7762 | } |
| 7763 | 7763 | if ($day != '') { |
| 7764 | 7764 | if ($globalDBdriver == 'mysql') { |
| 7765 | 7765 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 7766 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 7766 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 7767 | 7767 | } else { |
| 7768 | 7768 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 7769 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 7769 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 7770 | 7770 | } |
| 7771 | 7771 | } |
| 7772 | 7772 | $query .= " GROUP BY spotter_output.arrival_airport_country |
@@ -7780,7 +7780,7 @@ discard block |
||
| 7780 | 7780 | $airport_array = array(); |
| 7781 | 7781 | $temp_array = array(); |
| 7782 | 7782 | |
| 7783 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7783 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7784 | 7784 | { |
| 7785 | 7785 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
| 7786 | 7786 | $temp_array['airport_arrival_country'] = $row['arrival_airport_country']; |
@@ -7803,8 +7803,8 @@ discard block |
||
| 7803 | 7803 | */ |
| 7804 | 7804 | public function countAllRoutes($filters = array()) |
| 7805 | 7805 | { |
| 7806 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7807 | - $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 |
|
| 7806 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7807 | + $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 |
|
| 7808 | 7808 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' |
| 7809 | 7809 | GROUP BY route,spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 7810 | 7810 | ORDER BY route_count DESC |
@@ -7817,7 +7817,7 @@ discard block |
||
| 7817 | 7817 | $routes_array = array(); |
| 7818 | 7818 | $temp_array = array(); |
| 7819 | 7819 | |
| 7820 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7820 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7821 | 7821 | { |
| 7822 | 7822 | $temp_array['route_count'] = $row['route_count']; |
| 7823 | 7823 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7844,11 +7844,11 @@ discard block |
||
| 7844 | 7844 | * @return Array the route list |
| 7845 | 7845 | * |
| 7846 | 7846 | */ |
| 7847 | - public function countAllRoutesByAircraft($aircraft_icao,$filters = array()) |
|
| 7847 | + public function countAllRoutesByAircraft($aircraft_icao, $filters = array()) |
|
| 7848 | 7848 | { |
| 7849 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7850 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 7851 | - $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 |
|
| 7849 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7850 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 7851 | + $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 |
|
| 7852 | 7852 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 7853 | 7853 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7854 | 7854 | ORDER BY route_count DESC"; |
@@ -7859,7 +7859,7 @@ discard block |
||
| 7859 | 7859 | $routes_array = array(); |
| 7860 | 7860 | $temp_array = array(); |
| 7861 | 7861 | |
| 7862 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7862 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7863 | 7863 | { |
| 7864 | 7864 | $temp_array['route_count'] = $row['route_count']; |
| 7865 | 7865 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7886,9 +7886,9 @@ discard block |
||
| 7886 | 7886 | */ |
| 7887 | 7887 | public function countAllRoutesByRegistration($registration, $filters = array()) |
| 7888 | 7888 | { |
| 7889 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7889 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7890 | 7890 | $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
| 7891 | - $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 |
|
| 7891 | + $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 |
|
| 7892 | 7892 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration |
| 7893 | 7893 | GROUP BY route |
| 7894 | 7894 | ORDER BY route_count DESC"; |
@@ -7900,7 +7900,7 @@ discard block |
||
| 7900 | 7900 | $routes_array = array(); |
| 7901 | 7901 | $temp_array = array(); |
| 7902 | 7902 | |
| 7903 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7903 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7904 | 7904 | { |
| 7905 | 7905 | $temp_array['route_count'] = $row['route_count']; |
| 7906 | 7906 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7928,9 +7928,9 @@ discard block |
||
| 7928 | 7928 | */ |
| 7929 | 7929 | public function countAllRoutesByAirline($airline_icao, $filters = array()) |
| 7930 | 7930 | { |
| 7931 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7932 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 7933 | - $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 |
|
| 7931 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7932 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 7933 | + $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 |
|
| 7934 | 7934 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao |
| 7935 | 7935 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7936 | 7936 | ORDER BY route_count DESC"; |
@@ -7942,7 +7942,7 @@ discard block |
||
| 7942 | 7942 | $routes_array = array(); |
| 7943 | 7943 | $temp_array = array(); |
| 7944 | 7944 | |
| 7945 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7945 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7946 | 7946 | { |
| 7947 | 7947 | $temp_array['route_count'] = $row['route_count']; |
| 7948 | 7948 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7970,9 +7970,9 @@ discard block |
||
| 7970 | 7970 | */ |
| 7971 | 7971 | public function countAllRoutesByAirport($airport_icao, $filters = array()) |
| 7972 | 7972 | { |
| 7973 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7974 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 7975 | - $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 |
|
| 7973 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7974 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 7975 | + $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 |
|
| 7976 | 7976 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 7977 | 7977 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7978 | 7978 | ORDER BY route_count DESC"; |
@@ -7983,7 +7983,7 @@ discard block |
||
| 7983 | 7983 | $routes_array = array(); |
| 7984 | 7984 | $temp_array = array(); |
| 7985 | 7985 | |
| 7986 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7986 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7987 | 7987 | { |
| 7988 | 7988 | $temp_array['route_count'] = $row['route_count']; |
| 7989 | 7989 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -8011,9 +8011,9 @@ discard block |
||
| 8011 | 8011 | */ |
| 8012 | 8012 | public function countAllRoutesByCountry($country, $filters = array()) |
| 8013 | 8013 | { |
| 8014 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8015 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 8016 | - $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 |
|
| 8014 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8015 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 8016 | + $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 |
|
| 8017 | 8017 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 8018 | 8018 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8019 | 8019 | ORDER BY route_count DESC"; |
@@ -8024,7 +8024,7 @@ discard block |
||
| 8024 | 8024 | $routes_array = array(); |
| 8025 | 8025 | $temp_array = array(); |
| 8026 | 8026 | |
| 8027 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8027 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8028 | 8028 | { |
| 8029 | 8029 | $temp_array['route_count'] = $row['route_count']; |
| 8030 | 8030 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -8052,8 +8052,8 @@ discard block |
||
| 8052 | 8052 | public function countAllRoutesByDate($date, $filters = array()) |
| 8053 | 8053 | { |
| 8054 | 8054 | global $globalTimezone, $globalDBdriver; |
| 8055 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8056 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 8055 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8056 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 8057 | 8057 | if ($globalTimezone != '') { |
| 8058 | 8058 | date_default_timezone_set($globalTimezone); |
| 8059 | 8059 | $datetime = new DateTime($date); |
@@ -8061,12 +8061,12 @@ discard block |
||
| 8061 | 8061 | } else $offset = '+00:00'; |
| 8062 | 8062 | |
| 8063 | 8063 | if ($globalDBdriver == 'mysql') { |
| 8064 | - $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 |
|
| 8064 | + $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 |
|
| 8065 | 8065 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 8066 | 8066 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8067 | 8067 | ORDER BY route_count DESC"; |
| 8068 | 8068 | } else { |
| 8069 | - $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 |
|
| 8069 | + $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 |
|
| 8070 | 8070 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 8071 | 8071 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8072 | 8072 | ORDER BY route_count DESC"; |
@@ -8078,7 +8078,7 @@ discard block |
||
| 8078 | 8078 | $routes_array = array(); |
| 8079 | 8079 | $temp_array = array(); |
| 8080 | 8080 | |
| 8081 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8081 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8082 | 8082 | { |
| 8083 | 8083 | $temp_array['route_count'] = $row['route_count']; |
| 8084 | 8084 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -8105,9 +8105,9 @@ discard block |
||
| 8105 | 8105 | */ |
| 8106 | 8106 | public function countAllRoutesByIdent($ident, $filters = array()) |
| 8107 | 8107 | { |
| 8108 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8109 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 8110 | - $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 |
|
| 8108 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8109 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 8110 | + $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 |
|
| 8111 | 8111 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident |
| 8112 | 8112 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8113 | 8113 | ORDER BY route_count DESC"; |
@@ -8119,7 +8119,7 @@ discard block |
||
| 8119 | 8119 | $routes_array = array(); |
| 8120 | 8120 | $temp_array = array(); |
| 8121 | 8121 | |
| 8122 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8122 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8123 | 8123 | { |
| 8124 | 8124 | $temp_array['route_count'] = $row['route_count']; |
| 8125 | 8125 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -8146,9 +8146,9 @@ discard block |
||
| 8146 | 8146 | */ |
| 8147 | 8147 | public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array()) |
| 8148 | 8148 | { |
| 8149 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8150 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 8151 | - $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 |
|
| 8149 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8150 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 8151 | + $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 |
|
| 8152 | 8152 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 8153 | 8153 | GROUP BY route |
| 8154 | 8154 | ORDER BY route_count DESC"; |
@@ -8160,7 +8160,7 @@ discard block |
||
| 8160 | 8160 | $routes_array = array(); |
| 8161 | 8161 | $temp_array = array(); |
| 8162 | 8162 | |
| 8163 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8163 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8164 | 8164 | { |
| 8165 | 8165 | $temp_array['route_count'] = $row['route_count']; |
| 8166 | 8166 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -8188,8 +8188,8 @@ discard block |
||
| 8188 | 8188 | */ |
| 8189 | 8189 | public function countAllRoutesWithWaypoints($filters = array()) |
| 8190 | 8190 | { |
| 8191 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8192 | - $query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8191 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8192 | + $query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8193 | 8193 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' |
| 8194 | 8194 | GROUP BY route, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8195 | 8195 | ORDER BY route_count DESC |
@@ -8202,7 +8202,7 @@ discard block |
||
| 8202 | 8202 | $routes_array = array(); |
| 8203 | 8203 | $temp_array = array(); |
| 8204 | 8204 | |
| 8205 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8205 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8206 | 8206 | { |
| 8207 | 8207 | $temp_array['spotter_id'] = $row['spotter_id']; |
| 8208 | 8208 | $temp_array['route_count'] = $row['route_count']; |
@@ -8227,11 +8227,11 @@ discard block |
||
| 8227 | 8227 | * @return Array the callsign list |
| 8228 | 8228 | * |
| 8229 | 8229 | */ |
| 8230 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
|
| 8230 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 8231 | 8231 | { |
| 8232 | 8232 | global $globalDBdriver; |
| 8233 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8234 | - $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
|
| 8233 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8234 | + $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
|
| 8235 | 8235 | FROM spotter_output".$filter_query." spotter_output.ident <> '' "; |
| 8236 | 8236 | if ($olderthanmonths > 0) { |
| 8237 | 8237 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -8245,28 +8245,28 @@ discard block |
||
| 8245 | 8245 | if ($year != '') { |
| 8246 | 8246 | if ($globalDBdriver == 'mysql') { |
| 8247 | 8247 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 8248 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 8248 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 8249 | 8249 | } else { |
| 8250 | 8250 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 8251 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 8251 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 8252 | 8252 | } |
| 8253 | 8253 | } |
| 8254 | 8254 | if ($month != '') { |
| 8255 | 8255 | if ($globalDBdriver == 'mysql') { |
| 8256 | 8256 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 8257 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 8257 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 8258 | 8258 | } else { |
| 8259 | 8259 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 8260 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 8260 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 8261 | 8261 | } |
| 8262 | 8262 | } |
| 8263 | 8263 | if ($day != '') { |
| 8264 | 8264 | if ($globalDBdriver == 'mysql') { |
| 8265 | 8265 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 8266 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 8266 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 8267 | 8267 | } else { |
| 8268 | 8268 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 8269 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 8269 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 8270 | 8270 | } |
| 8271 | 8271 | } |
| 8272 | 8272 | $query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
@@ -8278,7 +8278,7 @@ discard block |
||
| 8278 | 8278 | $callsign_array = array(); |
| 8279 | 8279 | $temp_array = array(); |
| 8280 | 8280 | |
| 8281 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8281 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8282 | 8282 | { |
| 8283 | 8283 | $temp_array['callsign_icao'] = $row['ident']; |
| 8284 | 8284 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -8300,8 +8300,8 @@ discard block |
||
| 8300 | 8300 | public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
| 8301 | 8301 | { |
| 8302 | 8302 | global $globalDBdriver; |
| 8303 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8304 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
|
| 8303 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8304 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
|
| 8305 | 8305 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
| 8306 | 8306 | if ($olderthanmonths > 0) { |
| 8307 | 8307 | if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
@@ -8320,7 +8320,7 @@ discard block |
||
| 8320 | 8320 | $callsign_array = array(); |
| 8321 | 8321 | $temp_array = array(); |
| 8322 | 8322 | |
| 8323 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8323 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8324 | 8324 | { |
| 8325 | 8325 | $temp_array['callsign_icao'] = $row['ident']; |
| 8326 | 8326 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -8374,7 +8374,7 @@ discard block |
||
| 8374 | 8374 | $date_array = array(); |
| 8375 | 8375 | $temp_array = array(); |
| 8376 | 8376 | |
| 8377 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8377 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8378 | 8378 | { |
| 8379 | 8379 | $temp_array['date_name'] = $row['date_name']; |
| 8380 | 8380 | $temp_array['date_count'] = $row['date_count']; |
@@ -8399,15 +8399,15 @@ discard block |
||
| 8399 | 8399 | $datetime = new DateTime(); |
| 8400 | 8400 | $offset = $datetime->format('P'); |
| 8401 | 8401 | } else $offset = '+00:00'; |
| 8402 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8402 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8403 | 8403 | if ($globalDBdriver == 'mysql') { |
| 8404 | - $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 8404 | + $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 8405 | 8405 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 8406 | 8406 | GROUP BY spotter_output.airline_icao, date_name |
| 8407 | 8407 | ORDER BY date_count DESC |
| 8408 | 8408 | LIMIT 10 OFFSET 0"; |
| 8409 | 8409 | } else { |
| 8410 | - $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 8410 | + $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 8411 | 8411 | FROM spotter_output |
| 8412 | 8412 | WHERE spotter_output.airline_icao <> '' |
| 8413 | 8413 | GROUP BY spotter_output.airline_icao, date_name |
@@ -8422,7 +8422,7 @@ discard block |
||
| 8422 | 8422 | $date_array = array(); |
| 8423 | 8423 | $temp_array = array(); |
| 8424 | 8424 | |
| 8425 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8425 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8426 | 8426 | { |
| 8427 | 8427 | $temp_array['date_name'] = $row['date_name']; |
| 8428 | 8428 | $temp_array['date_count'] = $row['date_count']; |
@@ -8448,7 +8448,7 @@ discard block |
||
| 8448 | 8448 | $datetime = new DateTime(); |
| 8449 | 8449 | $offset = $datetime->format('P'); |
| 8450 | 8450 | } else $offset = '+00:00'; |
| 8451 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8451 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8452 | 8452 | if ($globalDBdriver == 'mysql') { |
| 8453 | 8453 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 8454 | 8454 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -8469,7 +8469,7 @@ discard block |
||
| 8469 | 8469 | $date_array = array(); |
| 8470 | 8470 | $temp_array = array(); |
| 8471 | 8471 | |
| 8472 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8472 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8473 | 8473 | { |
| 8474 | 8474 | $temp_array['date_name'] = $row['date_name']; |
| 8475 | 8475 | $temp_array['date_count'] = $row['date_count']; |
@@ -8494,7 +8494,7 @@ discard block |
||
| 8494 | 8494 | $datetime = new DateTime(); |
| 8495 | 8495 | $offset = $datetime->format('P'); |
| 8496 | 8496 | } else $offset = '+00:00'; |
| 8497 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8497 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8498 | 8498 | if ($globalDBdriver == 'mysql') { |
| 8499 | 8499 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 8500 | 8500 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -8515,7 +8515,7 @@ discard block |
||
| 8515 | 8515 | $date_array = array(); |
| 8516 | 8516 | $temp_array = array(); |
| 8517 | 8517 | |
| 8518 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8518 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8519 | 8519 | { |
| 8520 | 8520 | $temp_array['date_name'] = $row['date_name']; |
| 8521 | 8521 | $temp_array['date_count'] = $row['date_count']; |
@@ -8536,7 +8536,7 @@ discard block |
||
| 8536 | 8536 | public function countAllDatesLastMonthByAirlines($filters = array()) |
| 8537 | 8537 | { |
| 8538 | 8538 | global $globalTimezone, $globalDBdriver; |
| 8539 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8539 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8540 | 8540 | if ($globalTimezone != '') { |
| 8541 | 8541 | date_default_timezone_set($globalTimezone); |
| 8542 | 8542 | $datetime = new DateTime(); |
@@ -8544,13 +8544,13 @@ discard block |
||
| 8544 | 8544 | } else $offset = '+00:00'; |
| 8545 | 8545 | |
| 8546 | 8546 | if ($globalDBdriver == 'mysql') { |
| 8547 | - $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 8547 | + $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 8548 | 8548 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH) |
| 8549 | 8549 | GROUP BY spotter_output.airline_icao, date_name |
| 8550 | 8550 | ORDER BY spotter_output.date ASC"; |
| 8551 | 8551 | $query_data = array(':offset' => $offset); |
| 8552 | 8552 | } else { |
| 8553 | - $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 8553 | + $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 8554 | 8554 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS' |
| 8555 | 8555 | GROUP BY spotter_output.airline_icao, date_name |
| 8556 | 8556 | ORDER BY date_name ASC"; |
@@ -8563,7 +8563,7 @@ discard block |
||
| 8563 | 8563 | $date_array = array(); |
| 8564 | 8564 | $temp_array = array(); |
| 8565 | 8565 | |
| 8566 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8566 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8567 | 8567 | { |
| 8568 | 8568 | $temp_array['date_name'] = $row['date_name']; |
| 8569 | 8569 | $temp_array['date_count'] = $row['date_count']; |
@@ -8610,7 +8610,7 @@ discard block |
||
| 8610 | 8610 | $date_array = array(); |
| 8611 | 8611 | $temp_array = array(); |
| 8612 | 8612 | |
| 8613 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8613 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8614 | 8614 | { |
| 8615 | 8615 | $temp_array['month_name'] = $row['month_name']; |
| 8616 | 8616 | $temp_array['year_name'] = $row['year_name']; |
@@ -8631,7 +8631,7 @@ discard block |
||
| 8631 | 8631 | public function countAllMonthsByAirlines($filters = array()) |
| 8632 | 8632 | { |
| 8633 | 8633 | global $globalTimezone, $globalDBdriver; |
| 8634 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8634 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8635 | 8635 | if ($globalTimezone != '') { |
| 8636 | 8636 | date_default_timezone_set($globalTimezone); |
| 8637 | 8637 | $datetime = new DateTime(); |
@@ -8639,12 +8639,12 @@ discard block |
||
| 8639 | 8639 | } else $offset = '+00:00'; |
| 8640 | 8640 | |
| 8641 | 8641 | if ($globalDBdriver == 'mysql') { |
| 8642 | - $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 |
|
| 8642 | + $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 |
|
| 8643 | 8643 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 8644 | 8644 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8645 | 8645 | ORDER BY date_count DESC"; |
| 8646 | 8646 | } else { |
| 8647 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 8647 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 8648 | 8648 | FROM spotter_output |
| 8649 | 8649 | WHERE spotter_output.airline_icao <> '' |
| 8650 | 8650 | GROUP BY spotter_output.airline_icao, year_name, month_name |
@@ -8658,7 +8658,7 @@ discard block |
||
| 8658 | 8658 | $date_array = array(); |
| 8659 | 8659 | $temp_array = array(); |
| 8660 | 8660 | |
| 8661 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8661 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8662 | 8662 | { |
| 8663 | 8663 | $temp_array['month_name'] = $row['month_name']; |
| 8664 | 8664 | $temp_array['year_name'] = $row['year_name']; |
@@ -8685,14 +8685,14 @@ discard block |
||
| 8685 | 8685 | $datetime = new DateTime(); |
| 8686 | 8686 | $offset = $datetime->format('P'); |
| 8687 | 8687 | } else $offset = '+00:00'; |
| 8688 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8688 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8689 | 8689 | if ($globalDBdriver == 'mysql') { |
| 8690 | - $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 |
|
| 8690 | + $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 |
|
| 8691 | 8691 | FROM spotter_output".$filter_query." spotter_output.airline_type = 'military' |
| 8692 | 8692 | GROUP BY year_name, month_name |
| 8693 | 8693 | ORDER BY date_count DESC"; |
| 8694 | 8694 | } else { |
| 8695 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 8695 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 8696 | 8696 | FROM spotter_output".$filter_query." spotter_output.airline_type = 'military' |
| 8697 | 8697 | GROUP BY year_name, month_name |
| 8698 | 8698 | ORDER BY date_count DESC"; |
@@ -8704,7 +8704,7 @@ discard block |
||
| 8704 | 8704 | $date_array = array(); |
| 8705 | 8705 | $temp_array = array(); |
| 8706 | 8706 | |
| 8707 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8707 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8708 | 8708 | { |
| 8709 | 8709 | $temp_array['month_name'] = $row['month_name']; |
| 8710 | 8710 | $temp_array['year_name'] = $row['year_name']; |
@@ -8730,15 +8730,15 @@ discard block |
||
| 8730 | 8730 | $datetime = new DateTime(); |
| 8731 | 8731 | $offset = $datetime->format('P'); |
| 8732 | 8732 | } else $offset = '+00:00'; |
| 8733 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8733 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8734 | 8734 | |
| 8735 | 8735 | if ($globalDBdriver == 'mysql') { |
| 8736 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
| 8736 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
| 8737 | 8737 | FROM spotter_output".$filter_query." owner_name <> '' |
| 8738 | 8738 | GROUP BY year_name, month_name |
| 8739 | 8739 | ORDER BY date_count DESC"; |
| 8740 | 8740 | } else { |
| 8741 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 8741 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 8742 | 8742 | FROM spotter_output".$filter_query." owner_name <> '' |
| 8743 | 8743 | GROUP BY year_name, month_name |
| 8744 | 8744 | ORDER BY date_count DESC"; |
@@ -8750,7 +8750,7 @@ discard block |
||
| 8750 | 8750 | $date_array = array(); |
| 8751 | 8751 | $temp_array = array(); |
| 8752 | 8752 | |
| 8753 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8753 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8754 | 8754 | { |
| 8755 | 8755 | $temp_array['month_name'] = $row['month_name']; |
| 8756 | 8756 | $temp_array['year_name'] = $row['year_name']; |
@@ -8771,7 +8771,7 @@ discard block |
||
| 8771 | 8771 | public function countAllMonthsOwnersByAirlines($filters = array()) |
| 8772 | 8772 | { |
| 8773 | 8773 | global $globalTimezone, $globalDBdriver; |
| 8774 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8774 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8775 | 8775 | if ($globalTimezone != '') { |
| 8776 | 8776 | date_default_timezone_set($globalTimezone); |
| 8777 | 8777 | $datetime = new DateTime(); |
@@ -8779,12 +8779,12 @@ discard block |
||
| 8779 | 8779 | } else $offset = '+00:00'; |
| 8780 | 8780 | |
| 8781 | 8781 | if ($globalDBdriver == 'mysql') { |
| 8782 | - $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 |
|
| 8782 | + $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 |
|
| 8783 | 8783 | FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' |
| 8784 | 8784 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8785 | 8785 | ORDER BY date_count DESC"; |
| 8786 | 8786 | } else { |
| 8787 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 8787 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 8788 | 8788 | FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' |
| 8789 | 8789 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8790 | 8790 | ORDER BY date_count DESC"; |
@@ -8796,7 +8796,7 @@ discard block |
||
| 8796 | 8796 | $date_array = array(); |
| 8797 | 8797 | $temp_array = array(); |
| 8798 | 8798 | |
| 8799 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8799 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8800 | 8800 | { |
| 8801 | 8801 | $temp_array['month_name'] = $row['month_name']; |
| 8802 | 8802 | $temp_array['year_name'] = $row['year_name']; |
@@ -8823,15 +8823,15 @@ discard block |
||
| 8823 | 8823 | $datetime = new DateTime(); |
| 8824 | 8824 | $offset = $datetime->format('P'); |
| 8825 | 8825 | } else $offset = '+00:00'; |
| 8826 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8826 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8827 | 8827 | |
| 8828 | 8828 | if ($globalDBdriver == 'mysql') { |
| 8829 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
| 8829 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
| 8830 | 8830 | FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL |
| 8831 | 8831 | GROUP BY year_name, month_name |
| 8832 | 8832 | ORDER BY date_count DESC"; |
| 8833 | 8833 | } else { |
| 8834 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 8834 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 8835 | 8835 | FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL |
| 8836 | 8836 | GROUP BY year_name, month_name |
| 8837 | 8837 | ORDER BY date_count DESC"; |
@@ -8843,7 +8843,7 @@ discard block |
||
| 8843 | 8843 | $date_array = array(); |
| 8844 | 8844 | $temp_array = array(); |
| 8845 | 8845 | |
| 8846 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8846 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8847 | 8847 | { |
| 8848 | 8848 | $temp_array['month_name'] = $row['month_name']; |
| 8849 | 8849 | $temp_array['year_name'] = $row['year_name']; |
@@ -8864,7 +8864,7 @@ discard block |
||
| 8864 | 8864 | public function countAllMonthsPilotsByAirlines($filters = array()) |
| 8865 | 8865 | { |
| 8866 | 8866 | global $globalTimezone, $globalDBdriver; |
| 8867 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8867 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8868 | 8868 | if ($globalTimezone != '') { |
| 8869 | 8869 | date_default_timezone_set($globalTimezone); |
| 8870 | 8870 | $datetime = new DateTime(); |
@@ -8872,12 +8872,12 @@ discard block |
||
| 8872 | 8872 | } else $offset = '+00:00'; |
| 8873 | 8873 | |
| 8874 | 8874 | if ($globalDBdriver == 'mysql') { |
| 8875 | - $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 |
|
| 8875 | + $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 |
|
| 8876 | 8876 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL |
| 8877 | 8877 | GROUP BY spotter_output.airline_icao,year_name, month_name |
| 8878 | 8878 | ORDER BY date_count DESC"; |
| 8879 | 8879 | } else { |
| 8880 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 8880 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 8881 | 8881 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL |
| 8882 | 8882 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8883 | 8883 | ORDER BY date_count DESC"; |
@@ -8889,7 +8889,7 @@ discard block |
||
| 8889 | 8889 | $date_array = array(); |
| 8890 | 8890 | $temp_array = array(); |
| 8891 | 8891 | |
| 8892 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8892 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8893 | 8893 | { |
| 8894 | 8894 | $temp_array['month_name'] = $row['month_name']; |
| 8895 | 8895 | $temp_array['year_name'] = $row['year_name']; |
@@ -8911,7 +8911,7 @@ discard block |
||
| 8911 | 8911 | public function countAllMonthsAirlines($filters = array()) |
| 8912 | 8912 | { |
| 8913 | 8913 | global $globalTimezone, $globalDBdriver; |
| 8914 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8914 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8915 | 8915 | if ($globalTimezone != '') { |
| 8916 | 8916 | date_default_timezone_set($globalTimezone); |
| 8917 | 8917 | $datetime = new DateTime(); |
@@ -8919,12 +8919,12 @@ discard block |
||
| 8919 | 8919 | } else $offset = '+00:00'; |
| 8920 | 8920 | |
| 8921 | 8921 | if ($globalDBdriver == 'mysql') { |
| 8922 | - $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 |
|
| 8922 | + $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 |
|
| 8923 | 8923 | FROM spotter_output".$filter_query." airline_icao <> '' |
| 8924 | 8924 | GROUP BY year_name, month_name |
| 8925 | 8925 | ORDER BY date_count DESC"; |
| 8926 | 8926 | } else { |
| 8927 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count |
|
| 8927 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count |
|
| 8928 | 8928 | FROM spotter_output".$filter_query." airline_icao <> '' |
| 8929 | 8929 | GROUP BY year_name, month_name |
| 8930 | 8930 | ORDER BY date_count DESC"; |
@@ -8936,7 +8936,7 @@ discard block |
||
| 8936 | 8936 | $date_array = array(); |
| 8937 | 8937 | $temp_array = array(); |
| 8938 | 8938 | |
| 8939 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8939 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8940 | 8940 | { |
| 8941 | 8941 | $temp_array['month_name'] = $row['month_name']; |
| 8942 | 8942 | $temp_array['year_name'] = $row['year_name']; |
@@ -8962,15 +8962,15 @@ discard block |
||
| 8962 | 8962 | $datetime = new DateTime(); |
| 8963 | 8963 | $offset = $datetime->format('P'); |
| 8964 | 8964 | } else $offset = '+00:00'; |
| 8965 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8965 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8966 | 8966 | |
| 8967 | 8967 | if ($globalDBdriver == 'mysql') { |
| 8968 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8968 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8969 | 8969 | FROM spotter_output".$filter_query." aircraft_icao <> '' |
| 8970 | 8970 | GROUP BY year_name, month_name |
| 8971 | 8971 | ORDER BY date_count DESC"; |
| 8972 | 8972 | } else { |
| 8973 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8973 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8974 | 8974 | FROM spotter_output".$filter_query." aircraft_icao <> '' |
| 8975 | 8975 | GROUP BY year_name, month_name |
| 8976 | 8976 | ORDER BY date_count DESC"; |
@@ -8982,7 +8982,7 @@ discard block |
||
| 8982 | 8982 | $date_array = array(); |
| 8983 | 8983 | $temp_array = array(); |
| 8984 | 8984 | |
| 8985 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8985 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8986 | 8986 | { |
| 8987 | 8987 | $temp_array['month_name'] = $row['month_name']; |
| 8988 | 8988 | $temp_array['year_name'] = $row['year_name']; |
@@ -9004,7 +9004,7 @@ discard block |
||
| 9004 | 9004 | public function countAllMonthsAircraftsByAirlines($filters = array()) |
| 9005 | 9005 | { |
| 9006 | 9006 | global $globalTimezone, $globalDBdriver; |
| 9007 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9007 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9008 | 9008 | if ($globalTimezone != '') { |
| 9009 | 9009 | date_default_timezone_set($globalTimezone); |
| 9010 | 9010 | $datetime = new DateTime(); |
@@ -9012,12 +9012,12 @@ discard block |
||
| 9012 | 9012 | } else $offset = '+00:00'; |
| 9013 | 9013 | |
| 9014 | 9014 | if ($globalDBdriver == 'mysql') { |
| 9015 | - $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 |
|
| 9015 | + $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 |
|
| 9016 | 9016 | FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' |
| 9017 | 9017 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 9018 | 9018 | ORDER BY date_count DESC"; |
| 9019 | 9019 | } else { |
| 9020 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 9020 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 9021 | 9021 | FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' |
| 9022 | 9022 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 9023 | 9023 | ORDER BY date_count DESC"; |
@@ -9029,7 +9029,7 @@ discard block |
||
| 9029 | 9029 | $date_array = array(); |
| 9030 | 9030 | $temp_array = array(); |
| 9031 | 9031 | |
| 9032 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9032 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9033 | 9033 | { |
| 9034 | 9034 | $temp_array['month_name'] = $row['month_name']; |
| 9035 | 9035 | $temp_array['year_name'] = $row['year_name']; |
@@ -9056,15 +9056,15 @@ discard block |
||
| 9056 | 9056 | $datetime = new DateTime(); |
| 9057 | 9057 | $offset = $datetime->format('P'); |
| 9058 | 9058 | } else $offset = '+00:00'; |
| 9059 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9059 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9060 | 9060 | |
| 9061 | 9061 | if ($globalDBdriver == 'mysql') { |
| 9062 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 9062 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 9063 | 9063 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' |
| 9064 | 9064 | GROUP BY year_name, month_name |
| 9065 | 9065 | ORDER BY date_count DESC"; |
| 9066 | 9066 | } else { |
| 9067 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 9067 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 9068 | 9068 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' |
| 9069 | 9069 | GROUP BY year_name, month_name |
| 9070 | 9070 | ORDER BY date_count DESC"; |
@@ -9076,7 +9076,7 @@ discard block |
||
| 9076 | 9076 | $date_array = array(); |
| 9077 | 9077 | $temp_array = array(); |
| 9078 | 9078 | |
| 9079 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9079 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9080 | 9080 | { |
| 9081 | 9081 | $temp_array['month_name'] = $row['month_name']; |
| 9082 | 9082 | $temp_array['year_name'] = $row['year_name']; |
@@ -9098,7 +9098,7 @@ discard block |
||
| 9098 | 9098 | public function countAllMonthsRealArrivalsByAirlines($filters = array()) |
| 9099 | 9099 | { |
| 9100 | 9100 | global $globalTimezone, $globalDBdriver; |
| 9101 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9101 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9102 | 9102 | if ($globalTimezone != '') { |
| 9103 | 9103 | date_default_timezone_set($globalTimezone); |
| 9104 | 9104 | $datetime = new DateTime(); |
@@ -9106,12 +9106,12 @@ discard block |
||
| 9106 | 9106 | } else $offset = '+00:00'; |
| 9107 | 9107 | |
| 9108 | 9108 | if ($globalDBdriver == 'mysql') { |
| 9109 | - $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 |
|
| 9109 | + $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 |
|
| 9110 | 9110 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' |
| 9111 | 9111 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 9112 | 9112 | ORDER BY date_count DESC"; |
| 9113 | 9113 | } else { |
| 9114 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 9114 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 9115 | 9115 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' |
| 9116 | 9116 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 9117 | 9117 | ORDER BY date_count DESC"; |
@@ -9123,7 +9123,7 @@ discard block |
||
| 9123 | 9123 | $date_array = array(); |
| 9124 | 9124 | $temp_array = array(); |
| 9125 | 9125 | |
| 9126 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9126 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9127 | 9127 | { |
| 9128 | 9128 | $temp_array['month_name'] = $row['month_name']; |
| 9129 | 9129 | $temp_array['year_name'] = $row['year_name']; |
@@ -9151,7 +9151,7 @@ discard block |
||
| 9151 | 9151 | $datetime = new DateTime(); |
| 9152 | 9152 | $offset = $datetime->format('P'); |
| 9153 | 9153 | } else $offset = '+00:00'; |
| 9154 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9154 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9155 | 9155 | if ($globalDBdriver == 'mysql') { |
| 9156 | 9156 | $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 |
| 9157 | 9157 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -9172,7 +9172,7 @@ discard block |
||
| 9172 | 9172 | $date_array = array(); |
| 9173 | 9173 | $temp_array = array(); |
| 9174 | 9174 | |
| 9175 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9175 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9176 | 9176 | { |
| 9177 | 9177 | $temp_array['year_name'] = $row['year_name']; |
| 9178 | 9178 | $temp_array['month_name'] = $row['month_name']; |
@@ -9192,7 +9192,7 @@ discard block |
||
| 9192 | 9192 | * @return Array the hour list |
| 9193 | 9193 | * |
| 9194 | 9194 | */ |
| 9195 | - public function countAllHours($orderby,$filters = array()) |
|
| 9195 | + public function countAllHours($orderby, $filters = array()) |
|
| 9196 | 9196 | { |
| 9197 | 9197 | global $globalTimezone, $globalDBdriver; |
| 9198 | 9198 | if ($globalTimezone != '') { |
@@ -9240,7 +9240,7 @@ discard block |
||
| 9240 | 9240 | $hour_array = array(); |
| 9241 | 9241 | $temp_array = array(); |
| 9242 | 9242 | |
| 9243 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9243 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9244 | 9244 | { |
| 9245 | 9245 | $temp_array['hour_name'] = $row['hour_name']; |
| 9246 | 9246 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9260,7 +9260,7 @@ discard block |
||
| 9260 | 9260 | public function countAllHoursByAirlines($orderby, $filters = array()) |
| 9261 | 9261 | { |
| 9262 | 9262 | global $globalTimezone, $globalDBdriver; |
| 9263 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9263 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9264 | 9264 | if ($globalTimezone != '') { |
| 9265 | 9265 | date_default_timezone_set($globalTimezone); |
| 9266 | 9266 | $datetime = new DateTime(); |
@@ -9278,7 +9278,7 @@ discard block |
||
| 9278 | 9278 | } |
| 9279 | 9279 | |
| 9280 | 9280 | if ($globalDBdriver == 'mysql') { |
| 9281 | - $query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9281 | + $query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9282 | 9282 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 9283 | 9283 | GROUP BY spotter_output.airline_icao, hour_name |
| 9284 | 9284 | ".$orderby_sql; |
@@ -9291,7 +9291,7 @@ discard block |
||
| 9291 | 9291 | */ |
| 9292 | 9292 | $query_data = array(':offset' => $offset); |
| 9293 | 9293 | } else { |
| 9294 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9294 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9295 | 9295 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 9296 | 9296 | GROUP BY spotter_output.airline_icao, hour_name |
| 9297 | 9297 | ".$orderby_sql; |
@@ -9304,7 +9304,7 @@ discard block |
||
| 9304 | 9304 | $hour_array = array(); |
| 9305 | 9305 | $temp_array = array(); |
| 9306 | 9306 | |
| 9307 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9307 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9308 | 9308 | { |
| 9309 | 9309 | $temp_array['hour_name'] = $row['hour_name']; |
| 9310 | 9310 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9327,34 +9327,34 @@ discard block |
||
| 9327 | 9327 | public function countAllHoursByAirline($airline_icao, $filters = array()) |
| 9328 | 9328 | { |
| 9329 | 9329 | global $globalTimezone, $globalDBdriver; |
| 9330 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9330 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9331 | 9331 | if ($globalTimezone != '') { |
| 9332 | 9332 | date_default_timezone_set($globalTimezone); |
| 9333 | 9333 | $datetime = new DateTime(); |
| 9334 | 9334 | $offset = $datetime->format('P'); |
| 9335 | 9335 | } else $offset = '+00:00'; |
| 9336 | 9336 | |
| 9337 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 9337 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 9338 | 9338 | |
| 9339 | 9339 | if ($globalDBdriver == 'mysql') { |
| 9340 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9340 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9341 | 9341 | FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao |
| 9342 | 9342 | GROUP BY hour_name |
| 9343 | 9343 | ORDER BY hour_name ASC"; |
| 9344 | 9344 | } else { |
| 9345 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9345 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9346 | 9346 | FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao |
| 9347 | 9347 | GROUP BY hour_name |
| 9348 | 9348 | ORDER BY hour_name ASC"; |
| 9349 | 9349 | } |
| 9350 | 9350 | |
| 9351 | 9351 | $sth = $this->db->prepare($query); |
| 9352 | - $sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset)); |
|
| 9352 | + $sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset)); |
|
| 9353 | 9353 | |
| 9354 | 9354 | $hour_array = array(); |
| 9355 | 9355 | $temp_array = array(); |
| 9356 | 9356 | |
| 9357 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9357 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9358 | 9358 | { |
| 9359 | 9359 | $temp_array['hour_name'] = $row['hour_name']; |
| 9360 | 9360 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9377,8 +9377,8 @@ discard block |
||
| 9377 | 9377 | public function countAllHoursByAircraft($aircraft_icao, $filters = array()) |
| 9378 | 9378 | { |
| 9379 | 9379 | global $globalTimezone, $globalDBdriver; |
| 9380 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9381 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 9380 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9381 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 9382 | 9382 | if ($globalTimezone != '') { |
| 9383 | 9383 | date_default_timezone_set($globalTimezone); |
| 9384 | 9384 | $datetime = new DateTime(); |
@@ -9386,24 +9386,24 @@ discard block |
||
| 9386 | 9386 | } else $offset = '+00:00'; |
| 9387 | 9387 | |
| 9388 | 9388 | if ($globalDBdriver == 'mysql') { |
| 9389 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9389 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9390 | 9390 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao |
| 9391 | 9391 | GROUP BY hour_name |
| 9392 | 9392 | ORDER BY hour_name ASC"; |
| 9393 | 9393 | } else { |
| 9394 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9394 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9395 | 9395 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao |
| 9396 | 9396 | GROUP BY hour_name |
| 9397 | 9397 | ORDER BY hour_name ASC"; |
| 9398 | 9398 | } |
| 9399 | 9399 | |
| 9400 | 9400 | $sth = $this->db->prepare($query); |
| 9401 | - $sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset)); |
|
| 9401 | + $sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset)); |
|
| 9402 | 9402 | |
| 9403 | 9403 | $hour_array = array(); |
| 9404 | 9404 | $temp_array = array(); |
| 9405 | 9405 | |
| 9406 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9406 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9407 | 9407 | { |
| 9408 | 9408 | $temp_array['hour_name'] = $row['hour_name']; |
| 9409 | 9409 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9424,8 +9424,8 @@ discard block |
||
| 9424 | 9424 | public function countAllHoursByRegistration($registration, $filters = array()) |
| 9425 | 9425 | { |
| 9426 | 9426 | global $globalTimezone, $globalDBdriver; |
| 9427 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9428 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 9427 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9428 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 9429 | 9429 | if ($globalTimezone != '') { |
| 9430 | 9430 | date_default_timezone_set($globalTimezone); |
| 9431 | 9431 | $datetime = new DateTime(); |
@@ -9433,24 +9433,24 @@ discard block |
||
| 9433 | 9433 | } else $offset = '+00:00'; |
| 9434 | 9434 | |
| 9435 | 9435 | if ($globalDBdriver == 'mysql') { |
| 9436 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9436 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9437 | 9437 | FROM spotter_output".$filter_query." spotter_output.registration = :registration |
| 9438 | 9438 | GROUP BY hour_name |
| 9439 | 9439 | ORDER BY hour_name ASC"; |
| 9440 | 9440 | } else { |
| 9441 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9441 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9442 | 9442 | FROM spotter_output".$filter_query." spotter_output.registration = :registration |
| 9443 | 9443 | GROUP BY hour_name |
| 9444 | 9444 | ORDER BY hour_name ASC"; |
| 9445 | 9445 | } |
| 9446 | 9446 | |
| 9447 | 9447 | $sth = $this->db->prepare($query); |
| 9448 | - $sth->execute(array(':registration' => $registration,':offset' => $offset)); |
|
| 9448 | + $sth->execute(array(':registration' => $registration, ':offset' => $offset)); |
|
| 9449 | 9449 | |
| 9450 | 9450 | $hour_array = array(); |
| 9451 | 9451 | $temp_array = array(); |
| 9452 | 9452 | |
| 9453 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9453 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9454 | 9454 | { |
| 9455 | 9455 | $temp_array['hour_name'] = $row['hour_name']; |
| 9456 | 9456 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9471,8 +9471,8 @@ discard block |
||
| 9471 | 9471 | public function countAllHoursByAirport($airport_icao, $filters = array()) |
| 9472 | 9472 | { |
| 9473 | 9473 | global $globalTimezone, $globalDBdriver; |
| 9474 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9475 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 9474 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9475 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 9476 | 9476 | if ($globalTimezone != '') { |
| 9477 | 9477 | date_default_timezone_set($globalTimezone); |
| 9478 | 9478 | $datetime = new DateTime(); |
@@ -9480,24 +9480,24 @@ discard block |
||
| 9480 | 9480 | } else $offset = '+00:00'; |
| 9481 | 9481 | |
| 9482 | 9482 | if ($globalDBdriver == 'mysql') { |
| 9483 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9483 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9484 | 9484 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 9485 | 9485 | GROUP BY hour_name |
| 9486 | 9486 | ORDER BY hour_name ASC"; |
| 9487 | 9487 | } else { |
| 9488 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9488 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9489 | 9489 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 9490 | 9490 | GROUP BY hour_name |
| 9491 | 9491 | ORDER BY hour_name ASC"; |
| 9492 | 9492 | } |
| 9493 | 9493 | |
| 9494 | 9494 | $sth = $this->db->prepare($query); |
| 9495 | - $sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset)); |
|
| 9495 | + $sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset)); |
|
| 9496 | 9496 | |
| 9497 | 9497 | $hour_array = array(); |
| 9498 | 9498 | $temp_array = array(); |
| 9499 | 9499 | |
| 9500 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9500 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9501 | 9501 | { |
| 9502 | 9502 | $temp_array['hour_name'] = $row['hour_name']; |
| 9503 | 9503 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9516,11 +9516,11 @@ discard block |
||
| 9516 | 9516 | * @return Array the hour list |
| 9517 | 9517 | * |
| 9518 | 9518 | */ |
| 9519 | - public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array()) |
|
| 9519 | + public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 9520 | 9520 | { |
| 9521 | 9521 | global $globalTimezone, $globalDBdriver; |
| 9522 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9523 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 9522 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9523 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 9524 | 9524 | if ($globalTimezone != '') { |
| 9525 | 9525 | date_default_timezone_set($globalTimezone); |
| 9526 | 9526 | $datetime = new DateTime(); |
@@ -9528,24 +9528,24 @@ discard block |
||
| 9528 | 9528 | } else $offset = '+00:00'; |
| 9529 | 9529 | |
| 9530 | 9530 | if ($globalDBdriver == 'mysql') { |
| 9531 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9531 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9532 | 9532 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 9533 | 9533 | GROUP BY hour_name |
| 9534 | 9534 | ORDER BY hour_name ASC"; |
| 9535 | 9535 | } else { |
| 9536 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9536 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9537 | 9537 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 9538 | 9538 | GROUP BY hour_name |
| 9539 | 9539 | ORDER BY hour_name ASC"; |
| 9540 | 9540 | } |
| 9541 | 9541 | |
| 9542 | 9542 | $sth = $this->db->prepare($query); |
| 9543 | - $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset)); |
|
| 9543 | + $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset)); |
|
| 9544 | 9544 | |
| 9545 | 9545 | $hour_array = array(); |
| 9546 | 9546 | $temp_array = array(); |
| 9547 | 9547 | |
| 9548 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9548 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9549 | 9549 | { |
| 9550 | 9550 | $temp_array['hour_name'] = $row['hour_name']; |
| 9551 | 9551 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9567,8 +9567,8 @@ discard block |
||
| 9567 | 9567 | public function countAllHoursByDate($date, $filters = array()) |
| 9568 | 9568 | { |
| 9569 | 9569 | global $globalTimezone, $globalDBdriver; |
| 9570 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9571 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 9570 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9571 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 9572 | 9572 | if ($globalTimezone != '') { |
| 9573 | 9573 | date_default_timezone_set($globalTimezone); |
| 9574 | 9574 | $datetime = new DateTime($date); |
@@ -9576,12 +9576,12 @@ discard block |
||
| 9576 | 9576 | } else $offset = '+00:00'; |
| 9577 | 9577 | |
| 9578 | 9578 | if ($globalDBdriver == 'mysql') { |
| 9579 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9579 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9580 | 9580 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 9581 | 9581 | GROUP BY hour_name |
| 9582 | 9582 | ORDER BY hour_name ASC"; |
| 9583 | 9583 | } else { |
| 9584 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9584 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9585 | 9585 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
| 9586 | 9586 | GROUP BY hour_name |
| 9587 | 9587 | ORDER BY hour_name ASC"; |
@@ -9593,7 +9593,7 @@ discard block |
||
| 9593 | 9593 | $hour_array = array(); |
| 9594 | 9594 | $temp_array = array(); |
| 9595 | 9595 | |
| 9596 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9596 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9597 | 9597 | { |
| 9598 | 9598 | $temp_array['hour_name'] = $row['hour_name']; |
| 9599 | 9599 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9615,8 +9615,8 @@ discard block |
||
| 9615 | 9615 | public function countAllHoursByIdent($ident, $filters = array()) |
| 9616 | 9616 | { |
| 9617 | 9617 | global $globalTimezone, $globalDBdriver; |
| 9618 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9619 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 9618 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9619 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 9620 | 9620 | if ($globalTimezone != '') { |
| 9621 | 9621 | date_default_timezone_set($globalTimezone); |
| 9622 | 9622 | $datetime = new DateTime(); |
@@ -9624,12 +9624,12 @@ discard block |
||
| 9624 | 9624 | } else $offset = '+00:00'; |
| 9625 | 9625 | |
| 9626 | 9626 | if ($globalDBdriver == 'mysql') { |
| 9627 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9627 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9628 | 9628 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 9629 | 9629 | GROUP BY hour_name |
| 9630 | 9630 | ORDER BY hour_name ASC"; |
| 9631 | 9631 | } else { |
| 9632 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9632 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9633 | 9633 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 9634 | 9634 | GROUP BY hour_name |
| 9635 | 9635 | ORDER BY hour_name ASC"; |
@@ -9637,12 +9637,12 @@ discard block |
||
| 9637 | 9637 | |
| 9638 | 9638 | |
| 9639 | 9639 | $sth = $this->db->prepare($query); |
| 9640 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
| 9640 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
| 9641 | 9641 | |
| 9642 | 9642 | $hour_array = array(); |
| 9643 | 9643 | $temp_array = array(); |
| 9644 | 9644 | |
| 9645 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9645 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9646 | 9646 | { |
| 9647 | 9647 | $temp_array['hour_name'] = $row['hour_name']; |
| 9648 | 9648 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9661,12 +9661,12 @@ discard block |
||
| 9661 | 9661 | * @return Array the hour list |
| 9662 | 9662 | * |
| 9663 | 9663 | */ |
| 9664 | - public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array()) |
|
| 9664 | + public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 9665 | 9665 | { |
| 9666 | 9666 | global $globalTimezone, $globalDBdriver; |
| 9667 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9668 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 9669 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 9667 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9668 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 9669 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 9670 | 9670 | if ($globalTimezone != '') { |
| 9671 | 9671 | date_default_timezone_set($globalTimezone); |
| 9672 | 9672 | $datetime = new DateTime(); |
@@ -9674,24 +9674,24 @@ discard block |
||
| 9674 | 9674 | } else $offset = '+00:00'; |
| 9675 | 9675 | |
| 9676 | 9676 | if ($globalDBdriver == 'mysql') { |
| 9677 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9677 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9678 | 9678 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 9679 | 9679 | GROUP BY hour_name |
| 9680 | 9680 | ORDER BY hour_name ASC"; |
| 9681 | 9681 | } else { |
| 9682 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9682 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9683 | 9683 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 9684 | 9684 | GROUP BY hour_name |
| 9685 | 9685 | ORDER BY hour_name ASC"; |
| 9686 | 9686 | } |
| 9687 | 9687 | |
| 9688 | 9688 | $sth = $this->db->prepare($query); |
| 9689 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset)); |
|
| 9689 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset)); |
|
| 9690 | 9690 | |
| 9691 | 9691 | $hour_array = array(); |
| 9692 | 9692 | $temp_array = array(); |
| 9693 | 9693 | |
| 9694 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9694 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9695 | 9695 | { |
| 9696 | 9696 | $temp_array['hour_name'] = $row['hour_name']; |
| 9697 | 9697 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9712,8 +9712,8 @@ discard block |
||
| 9712 | 9712 | public function countAllHoursByCountry($country, $filters = array()) |
| 9713 | 9713 | { |
| 9714 | 9714 | global $globalTimezone, $globalDBdriver; |
| 9715 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9716 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 9715 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9716 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 9717 | 9717 | if ($globalTimezone != '') { |
| 9718 | 9718 | date_default_timezone_set($globalTimezone); |
| 9719 | 9719 | $datetime = new DateTime(); |
@@ -9721,24 +9721,24 @@ discard block |
||
| 9721 | 9721 | } else $offset = '+00:00'; |
| 9722 | 9722 | |
| 9723 | 9723 | if ($globalDBdriver == 'mysql') { |
| 9724 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9724 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9725 | 9725 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 9726 | 9726 | GROUP BY hour_name |
| 9727 | 9727 | ORDER BY hour_name ASC"; |
| 9728 | 9728 | } else { |
| 9729 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9729 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9730 | 9730 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 9731 | 9731 | GROUP BY hour_name |
| 9732 | 9732 | ORDER BY hour_name ASC"; |
| 9733 | 9733 | } |
| 9734 | 9734 | |
| 9735 | 9735 | $sth = $this->db->prepare($query); |
| 9736 | - $sth->execute(array(':country' => $country,':offset' => $offset)); |
|
| 9736 | + $sth->execute(array(':country' => $country, ':offset' => $offset)); |
|
| 9737 | 9737 | |
| 9738 | 9738 | $hour_array = array(); |
| 9739 | 9739 | $temp_array = array(); |
| 9740 | 9740 | |
| 9741 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9741 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9742 | 9742 | { |
| 9743 | 9743 | $temp_array['hour_name'] = $row['hour_name']; |
| 9744 | 9744 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9758,29 +9758,29 @@ discard block |
||
| 9758 | 9758 | * @return Integer the number of aircrafts |
| 9759 | 9759 | * |
| 9760 | 9760 | */ |
| 9761 | - public function countOverallAircrafts($filters = array(),$year = '',$month = '') |
|
| 9761 | + public function countOverallAircrafts($filters = array(), $year = '', $month = '') |
|
| 9762 | 9762 | { |
| 9763 | 9763 | global $globalDBdriver; |
| 9764 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9765 | - $query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count |
|
| 9764 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9765 | + $query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count |
|
| 9766 | 9766 | FROM spotter_output".$filter_query." spotter_output.ident <> ''"; |
| 9767 | 9767 | $query_values = array(); |
| 9768 | 9768 | if ($year != '') { |
| 9769 | 9769 | if ($globalDBdriver == 'mysql') { |
| 9770 | 9770 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 9771 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 9771 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 9772 | 9772 | } else { |
| 9773 | 9773 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 9774 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 9774 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 9775 | 9775 | } |
| 9776 | 9776 | } |
| 9777 | 9777 | if ($month != '') { |
| 9778 | 9778 | if ($globalDBdriver == 'mysql') { |
| 9779 | 9779 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 9780 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 9780 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 9781 | 9781 | } else { |
| 9782 | 9782 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 9783 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 9783 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 9784 | 9784 | } |
| 9785 | 9785 | } |
| 9786 | 9786 | |
@@ -9795,29 +9795,29 @@ discard block |
||
| 9795 | 9795 | * @return Integer the number of aircrafts |
| 9796 | 9796 | * |
| 9797 | 9797 | */ |
| 9798 | - public function countOverallArrival($filters = array(),$year = '',$month = '') |
|
| 9798 | + public function countOverallArrival($filters = array(), $year = '', $month = '') |
|
| 9799 | 9799 | { |
| 9800 | 9800 | global $globalDBdriver; |
| 9801 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9802 | - $query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count |
|
| 9801 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9802 | + $query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count |
|
| 9803 | 9803 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''"; |
| 9804 | 9804 | $query_values = array(); |
| 9805 | 9805 | if ($year != '') { |
| 9806 | 9806 | if ($globalDBdriver == 'mysql') { |
| 9807 | 9807 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 9808 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 9808 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 9809 | 9809 | } else { |
| 9810 | 9810 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 9811 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 9811 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 9812 | 9812 | } |
| 9813 | 9813 | } |
| 9814 | 9814 | if ($month != '') { |
| 9815 | 9815 | if ($globalDBdriver == 'mysql') { |
| 9816 | 9816 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 9817 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 9817 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 9818 | 9818 | } else { |
| 9819 | 9819 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 9820 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 9820 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 9821 | 9821 | } |
| 9822 | 9822 | } |
| 9823 | 9823 | |
@@ -9832,28 +9832,28 @@ discard block |
||
| 9832 | 9832 | * @return Integer the number of pilots |
| 9833 | 9833 | * |
| 9834 | 9834 | */ |
| 9835 | - public function countOverallPilots($filters = array(),$year = '',$month = '') |
|
| 9835 | + public function countOverallPilots($filters = array(), $year = '', $month = '') |
|
| 9836 | 9836 | { |
| 9837 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9838 | - $query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count |
|
| 9837 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9838 | + $query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count |
|
| 9839 | 9839 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''"; |
| 9840 | 9840 | $query_values = array(); |
| 9841 | 9841 | if ($year != '') { |
| 9842 | 9842 | if ($globalDBdriver == 'mysql') { |
| 9843 | 9843 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 9844 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 9844 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 9845 | 9845 | } else { |
| 9846 | 9846 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 9847 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 9847 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 9848 | 9848 | } |
| 9849 | 9849 | } |
| 9850 | 9850 | if ($month != '') { |
| 9851 | 9851 | if ($globalDBdriver == 'mysql') { |
| 9852 | 9852 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 9853 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 9853 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 9854 | 9854 | } else { |
| 9855 | 9855 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 9856 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 9856 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 9857 | 9857 | } |
| 9858 | 9858 | } |
| 9859 | 9859 | $sth = $this->db->prepare($query); |
@@ -9867,29 +9867,29 @@ discard block |
||
| 9867 | 9867 | * @return Integer the number of owners |
| 9868 | 9868 | * |
| 9869 | 9869 | */ |
| 9870 | - public function countOverallOwners($filters = array(),$year = '',$month = '') |
|
| 9870 | + public function countOverallOwners($filters = array(), $year = '', $month = '') |
|
| 9871 | 9871 | { |
| 9872 | 9872 | global $globalDBdriver; |
| 9873 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9874 | - $query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count |
|
| 9873 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9874 | + $query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count |
|
| 9875 | 9875 | FROM spotter_output".$filter_query." spotter_output.owner_name <> ''"; |
| 9876 | 9876 | $query_values = array(); |
| 9877 | 9877 | if ($year != '') { |
| 9878 | 9878 | if ($globalDBdriver == 'mysql') { |
| 9879 | 9879 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 9880 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 9880 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 9881 | 9881 | } else { |
| 9882 | 9882 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 9883 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 9883 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 9884 | 9884 | } |
| 9885 | 9885 | } |
| 9886 | 9886 | if ($month != '') { |
| 9887 | 9887 | if ($globalDBdriver == 'mysql') { |
| 9888 | 9888 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 9889 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 9889 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 9890 | 9890 | } else { |
| 9891 | 9891 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 9892 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 9892 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 9893 | 9893 | } |
| 9894 | 9894 | } |
| 9895 | 9895 | $sth = $this->db->prepare($query); |
@@ -9904,32 +9904,32 @@ discard block |
||
| 9904 | 9904 | * @return Integer the number of flights |
| 9905 | 9905 | * |
| 9906 | 9906 | */ |
| 9907 | - public function countOverallFlights($filters = array(),$year = '',$month = '') |
|
| 9907 | + public function countOverallFlights($filters = array(), $year = '', $month = '') |
|
| 9908 | 9908 | { |
| 9909 | 9909 | global $globalDBdriver; |
| 9910 | - $queryi = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output"; |
|
| 9910 | + $queryi = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output"; |
|
| 9911 | 9911 | $query_values = array(); |
| 9912 | 9912 | $query = ''; |
| 9913 | 9913 | if ($year != '') { |
| 9914 | 9914 | if ($globalDBdriver == 'mysql') { |
| 9915 | 9915 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 9916 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 9916 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 9917 | 9917 | } else { |
| 9918 | 9918 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 9919 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 9919 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 9920 | 9920 | } |
| 9921 | 9921 | } |
| 9922 | 9922 | if ($month != '') { |
| 9923 | 9923 | if ($globalDBdriver == 'mysql') { |
| 9924 | 9924 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 9925 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 9925 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 9926 | 9926 | } else { |
| 9927 | 9927 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 9928 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 9928 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 9929 | 9929 | } |
| 9930 | 9930 | } |
| 9931 | 9931 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
| 9932 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 9932 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
| 9933 | 9933 | |
| 9934 | 9934 | //echo $query; |
| 9935 | 9935 | $sth = $this->db->prepare($queryi); |
@@ -9943,29 +9943,29 @@ discard block |
||
| 9943 | 9943 | * @return Integer the number of flights |
| 9944 | 9944 | * |
| 9945 | 9945 | */ |
| 9946 | - public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '') |
|
| 9946 | + public function countOverallMilitaryFlights($filters = array(), $year = '', $month = '') |
|
| 9947 | 9947 | { |
| 9948 | 9948 | global $globalDBdriver; |
| 9949 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9950 | - $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
|
| 9949 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9950 | + $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
|
| 9951 | 9951 | FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'"; |
| 9952 | 9952 | $query_values = array(); |
| 9953 | 9953 | if ($year != '') { |
| 9954 | 9954 | if ($globalDBdriver == 'mysql') { |
| 9955 | 9955 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 9956 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 9956 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 9957 | 9957 | } else { |
| 9958 | 9958 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 9959 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 9959 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 9960 | 9960 | } |
| 9961 | 9961 | } |
| 9962 | 9962 | if ($month != '') { |
| 9963 | 9963 | if ($globalDBdriver == 'mysql') { |
| 9964 | 9964 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 9965 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 9965 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 9966 | 9966 | } else { |
| 9967 | 9967 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 9968 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 9968 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 9969 | 9969 | } |
| 9970 | 9970 | } |
| 9971 | 9971 | |
@@ -9982,10 +9982,10 @@ discard block |
||
| 9982 | 9982 | * @return Integer the number of airlines |
| 9983 | 9983 | * |
| 9984 | 9984 | */ |
| 9985 | - public function countOverallAirlines($filters = array(),$year = '',$month = '') |
|
| 9985 | + public function countOverallAirlines($filters = array(), $year = '', $month = '') |
|
| 9986 | 9986 | { |
| 9987 | 9987 | global $globalDBdriver; |
| 9988 | - $queryi = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count |
|
| 9988 | + $queryi = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count |
|
| 9989 | 9989 | FROM spotter_output"; |
| 9990 | 9990 | |
| 9991 | 9991 | $query_values = array(); |
@@ -9993,23 +9993,23 @@ discard block |
||
| 9993 | 9993 | if ($year != '') { |
| 9994 | 9994 | if ($globalDBdriver == 'mysql') { |
| 9995 | 9995 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 9996 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 9996 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 9997 | 9997 | } else { |
| 9998 | 9998 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 9999 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 9999 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 10000 | 10000 | } |
| 10001 | 10001 | } |
| 10002 | 10002 | if ($month != '') { |
| 10003 | 10003 | if ($globalDBdriver == 'mysql') { |
| 10004 | 10004 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 10005 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 10005 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 10006 | 10006 | } else { |
| 10007 | 10007 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 10008 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 10008 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 10009 | 10009 | } |
| 10010 | 10010 | } |
| 10011 | 10011 | if ($query == '') $queryi .= $this->getFilter($filters); |
| 10012 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 10012 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
| 10013 | 10013 | |
| 10014 | 10014 | |
| 10015 | 10015 | $sth = $this->db->prepare($queryi); |
@@ -10027,7 +10027,7 @@ discard block |
||
| 10027 | 10027 | public function countAllHoursFromToday($filters = array()) |
| 10028 | 10028 | { |
| 10029 | 10029 | global $globalTimezone, $globalDBdriver; |
| 10030 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10030 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10031 | 10031 | if ($globalTimezone != '') { |
| 10032 | 10032 | date_default_timezone_set($globalTimezone); |
| 10033 | 10033 | $datetime = new DateTime(); |
@@ -10035,12 +10035,12 @@ discard block |
||
| 10035 | 10035 | } else $offset = '+00:00'; |
| 10036 | 10036 | |
| 10037 | 10037 | if ($globalDBdriver == 'mysql') { |
| 10038 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10038 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10039 | 10039 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE() |
| 10040 | 10040 | GROUP BY hour_name |
| 10041 | 10041 | ORDER BY hour_name ASC"; |
| 10042 | 10042 | } else { |
| 10043 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10043 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10044 | 10044 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
| 10045 | 10045 | GROUP BY hour_name |
| 10046 | 10046 | ORDER BY hour_name ASC"; |
@@ -10052,7 +10052,7 @@ discard block |
||
| 10052 | 10052 | $hour_array = array(); |
| 10053 | 10053 | $temp_array = array(); |
| 10054 | 10054 | |
| 10055 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10055 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10056 | 10056 | { |
| 10057 | 10057 | $temp_array['hour_name'] = $row['hour_name']; |
| 10058 | 10058 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10071,14 +10071,14 @@ discard block |
||
| 10071 | 10071 | public function getUpcomingFlights($limit = '', $sort = '', $filters = array()) |
| 10072 | 10072 | { |
| 10073 | 10073 | global $global_query, $globalDBdriver, $globalTimezone; |
| 10074 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10074 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10075 | 10075 | date_default_timezone_set('UTC'); |
| 10076 | 10076 | $limit_query = ''; |
| 10077 | 10077 | if ($limit != "") |
| 10078 | 10078 | { |
| 10079 | 10079 | $limit_array = explode(",", $limit); |
| 10080 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 10081 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 10080 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 10081 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 10082 | 10082 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 10083 | 10083 | { |
| 10084 | 10084 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -10131,7 +10131,7 @@ discard block |
||
| 10131 | 10131 | GROUP BY spotter_output.ident,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time, to_char(spotter_output.date,'HH') |
| 10132 | 10132 | HAVING count(spotter_output.ident) > 5$orderby_query"; |
| 10133 | 10133 | //echo $query; |
| 10134 | - $spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone)); |
|
| 10134 | + $spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone)); |
|
| 10135 | 10135 | /* |
| 10136 | 10136 | $sth = $this->db->prepare($query); |
| 10137 | 10137 | $sth->execute(array(':timezone' => $globalTimezone)); |
@@ -10150,9 +10150,9 @@ discard block |
||
| 10150 | 10150 | */ |
| 10151 | 10151 | public function getSpotterIDBasedOnFlightAwareID($flightaware_id) |
| 10152 | 10152 | { |
| 10153 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 10153 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 10154 | 10154 | |
| 10155 | - $query = "SELECT spotter_output.spotter_id |
|
| 10155 | + $query = "SELECT spotter_output.spotter_id |
|
| 10156 | 10156 | FROM spotter_output |
| 10157 | 10157 | WHERE spotter_output.flightaware_id = '".$flightaware_id."'"; |
| 10158 | 10158 | |
@@ -10160,7 +10160,7 @@ discard block |
||
| 10160 | 10160 | $sth = $this->db->prepare($query); |
| 10161 | 10161 | $sth->execute(); |
| 10162 | 10162 | |
| 10163 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10163 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10164 | 10164 | { |
| 10165 | 10165 | return $row['spotter_id']; |
| 10166 | 10166 | } |
@@ -10185,23 +10185,23 @@ discard block |
||
| 10185 | 10185 | } |
| 10186 | 10186 | |
| 10187 | 10187 | $current_date = date("Y-m-d H:i:s"); |
| 10188 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
| 10188 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
| 10189 | 10189 | |
| 10190 | 10190 | $diff = abs(strtotime($current_date) - strtotime($date)); |
| 10191 | 10191 | |
| 10192 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
| 10192 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
| 10193 | 10193 | $years = $time_array['years']; |
| 10194 | 10194 | |
| 10195 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
| 10195 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
| 10196 | 10196 | $months = $time_array['months']; |
| 10197 | 10197 | |
| 10198 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
| 10198 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
| 10199 | 10199 | $days = $time_array['days']; |
| 10200 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
| 10200 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
| 10201 | 10201 | $hours = $time_array['hours']; |
| 10202 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
| 10202 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
| 10203 | 10203 | $minutes = $time_array['minutes']; |
| 10204 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 10204 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 10205 | 10205 | |
| 10206 | 10206 | return $time_array; |
| 10207 | 10207 | } |
@@ -10227,63 +10227,63 @@ discard block |
||
| 10227 | 10227 | $temp_array['direction_degree'] = $direction; |
| 10228 | 10228 | $temp_array['direction_shortname'] = "N"; |
| 10229 | 10229 | $temp_array['direction_fullname'] = "North"; |
| 10230 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
| 10230 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
| 10231 | 10231 | $temp_array['direction_degree'] = $direction; |
| 10232 | 10232 | $temp_array['direction_shortname'] = "NNE"; |
| 10233 | 10233 | $temp_array['direction_fullname'] = "North-Northeast"; |
| 10234 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
| 10234 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
| 10235 | 10235 | $temp_array['direction_degree'] = $direction; |
| 10236 | 10236 | $temp_array['direction_shortname'] = "NE"; |
| 10237 | 10237 | $temp_array['direction_fullname'] = "Northeast"; |
| 10238 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
| 10238 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
| 10239 | 10239 | $temp_array['direction_degree'] = $direction; |
| 10240 | 10240 | $temp_array['direction_shortname'] = "ENE"; |
| 10241 | 10241 | $temp_array['direction_fullname'] = "East-Northeast"; |
| 10242 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
| 10242 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
| 10243 | 10243 | $temp_array['direction_degree'] = $direction; |
| 10244 | 10244 | $temp_array['direction_shortname'] = "E"; |
| 10245 | 10245 | $temp_array['direction_fullname'] = "East"; |
| 10246 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
| 10246 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
| 10247 | 10247 | $temp_array['direction_degree'] = $direction; |
| 10248 | 10248 | $temp_array['direction_shortname'] = "ESE"; |
| 10249 | 10249 | $temp_array['direction_fullname'] = "East-Southeast"; |
| 10250 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
| 10250 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
| 10251 | 10251 | $temp_array['direction_degree'] = $direction; |
| 10252 | 10252 | $temp_array['direction_shortname'] = "SE"; |
| 10253 | 10253 | $temp_array['direction_fullname'] = "Southeast"; |
| 10254 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
| 10254 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
| 10255 | 10255 | $temp_array['direction_degree'] = $direction; |
| 10256 | 10256 | $temp_array['direction_shortname'] = "SSE"; |
| 10257 | 10257 | $temp_array['direction_fullname'] = "South-Southeast"; |
| 10258 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
| 10258 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
| 10259 | 10259 | $temp_array['direction_degree'] = $direction; |
| 10260 | 10260 | $temp_array['direction_shortname'] = "S"; |
| 10261 | 10261 | $temp_array['direction_fullname'] = "South"; |
| 10262 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
| 10262 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
| 10263 | 10263 | $temp_array['direction_degree'] = $direction; |
| 10264 | 10264 | $temp_array['direction_shortname'] = "SSW"; |
| 10265 | 10265 | $temp_array['direction_fullname'] = "South-Southwest"; |
| 10266 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
| 10266 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
| 10267 | 10267 | $temp_array['direction_degree'] = $direction; |
| 10268 | 10268 | $temp_array['direction_shortname'] = "SW"; |
| 10269 | 10269 | $temp_array['direction_fullname'] = "Southwest"; |
| 10270 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
| 10270 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
| 10271 | 10271 | $temp_array['direction_degree'] = $direction; |
| 10272 | 10272 | $temp_array['direction_shortname'] = "WSW"; |
| 10273 | 10273 | $temp_array['direction_fullname'] = "West-Southwest"; |
| 10274 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
| 10274 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
| 10275 | 10275 | $temp_array['direction_degree'] = $direction; |
| 10276 | 10276 | $temp_array['direction_shortname'] = "W"; |
| 10277 | 10277 | $temp_array['direction_fullname'] = "West"; |
| 10278 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
| 10278 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
| 10279 | 10279 | $temp_array['direction_degree'] = $direction; |
| 10280 | 10280 | $temp_array['direction_shortname'] = "WNW"; |
| 10281 | 10281 | $temp_array['direction_fullname'] = "West-Northwest"; |
| 10282 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
| 10282 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
| 10283 | 10283 | $temp_array['direction_degree'] = $direction; |
| 10284 | 10284 | $temp_array['direction_shortname'] = "NW"; |
| 10285 | 10285 | $temp_array['direction_fullname'] = "Northwest"; |
| 10286 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
| 10286 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
| 10287 | 10287 | $temp_array['direction_degree'] = $direction; |
| 10288 | 10288 | $temp_array['direction_shortname'] = "NNW"; |
| 10289 | 10289 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -10336,9 +10336,9 @@ discard block |
||
| 10336 | 10336 | */ |
| 10337 | 10337 | public function getAircraftRegistrationBymodeS($aircraft_modes) |
| 10338 | 10338 | { |
| 10339 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
| 10339 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
| 10340 | 10340 | |
| 10341 | - $query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 10341 | + $query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 10342 | 10342 | |
| 10343 | 10343 | $sth = $this->db->prepare($query); |
| 10344 | 10344 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -10361,9 +10361,9 @@ discard block |
||
| 10361 | 10361 | */ |
| 10362 | 10362 | public function getAircraftTypeBymodeS($aircraft_modes) |
| 10363 | 10363 | { |
| 10364 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
| 10364 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
| 10365 | 10365 | |
| 10366 | - $query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 10366 | + $query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 10367 | 10367 | |
| 10368 | 10368 | $sth = $this->db->prepare($query); |
| 10369 | 10369 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -10384,11 +10384,11 @@ discard block |
||
| 10384 | 10384 | * @param Float $longitude longitute of the flight |
| 10385 | 10385 | * @return String the countrie |
| 10386 | 10386 | */ |
| 10387 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
| 10387 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
| 10388 | 10388 | { |
| 10389 | 10389 | global $globalDBdriver, $globalDebug; |
| 10390 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 10391 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 10390 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 10391 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 10392 | 10392 | |
| 10393 | 10393 | $Connection = new Connection($this->db); |
| 10394 | 10394 | if (!$Connection->tableExists('countries')) return ''; |
@@ -10428,7 +10428,7 @@ discard block |
||
| 10428 | 10428 | public function getCountryFromISO2($iso2) |
| 10429 | 10429 | { |
| 10430 | 10430 | global $globalDBdriver, $globalDebug; |
| 10431 | - $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
|
| 10431 | + $iso2 = filter_var($iso2, FILTER_SANITIZE_STRING); |
|
| 10432 | 10432 | |
| 10433 | 10433 | $Connection = new Connection($this->db); |
| 10434 | 10434 | if (!$Connection->tableExists('countries')) return ''; |
@@ -10460,19 +10460,19 @@ discard block |
||
| 10460 | 10460 | */ |
| 10461 | 10461 | public function convertAircraftRegistration($registration) |
| 10462 | 10462 | { |
| 10463 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 10463 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 10464 | 10464 | $registration_prefix = ''; |
| 10465 | 10465 | $registration_1 = substr($registration, 0, 1); |
| 10466 | 10466 | $registration_2 = substr($registration, 0, 2); |
| 10467 | 10467 | |
| 10468 | 10468 | //first get the prefix based on two characters |
| 10469 | - $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2"; |
|
| 10469 | + $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2"; |
|
| 10470 | 10470 | |
| 10471 | 10471 | |
| 10472 | 10472 | $sth = $this->db->prepare($query); |
| 10473 | 10473 | $sth->execute(array(':registration_2' => $registration_2)); |
| 10474 | 10474 | |
| 10475 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10475 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10476 | 10476 | { |
| 10477 | 10477 | $registration_prefix = $row['registration_prefix']; |
| 10478 | 10478 | } |
@@ -10480,11 +10480,11 @@ discard block |
||
| 10480 | 10480 | //if we didn't find a two chracter prefix lets just search the one with one character |
| 10481 | 10481 | if ($registration_prefix == '') |
| 10482 | 10482 | { |
| 10483 | - $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1"; |
|
| 10483 | + $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1"; |
|
| 10484 | 10484 | $sth = $this->db->prepare($query); |
| 10485 | 10485 | $sth->execute(array(':registration_1' => $registration_1)); |
| 10486 | 10486 | |
| 10487 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10487 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10488 | 10488 | { |
| 10489 | 10489 | $registration_prefix = $row['registration_prefix']; |
| 10490 | 10490 | } |
@@ -10498,7 +10498,7 @@ discard block |
||
| 10498 | 10498 | } else { |
| 10499 | 10499 | $registration = preg_replace("/^(.{1})/", "$1-", $registration); |
| 10500 | 10500 | } |
| 10501 | - } else if(strlen($registration_prefix) == 2){ |
|
| 10501 | + } else if (strlen($registration_prefix) == 2) { |
|
| 10502 | 10502 | if (0 === strpos($registration, 'N')) { |
| 10503 | 10503 | $registration = preg_replace("/^(.{2})/", "$1", $registration); |
| 10504 | 10504 | } else { |
@@ -10517,17 +10517,17 @@ discard block |
||
| 10517 | 10517 | */ |
| 10518 | 10518 | public function countryFromAircraftRegistration($registration) |
| 10519 | 10519 | { |
| 10520 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 10520 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 10521 | 10521 | |
| 10522 | 10522 | $registration_prefix = ''; |
| 10523 | - $registration_test = explode('-',$registration); |
|
| 10523 | + $registration_test = explode('-', $registration); |
|
| 10524 | 10524 | $country = ''; |
| 10525 | 10525 | if ($registration_test[0] != $registration) { |
| 10526 | 10526 | $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
| 10527 | 10527 | |
| 10528 | 10528 | $sth = $this->db->prepare($query); |
| 10529 | 10529 | $sth->execute(array(':registration_1' => $registration_test[0])); |
| 10530 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10530 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10531 | 10531 | { |
| 10532 | 10532 | //$registration_prefix = $row['registration_prefix']; |
| 10533 | 10533 | $country = $row['country']; |
@@ -10538,13 +10538,13 @@ discard block |
||
| 10538 | 10538 | |
| 10539 | 10539 | $country = ''; |
| 10540 | 10540 | //first get the prefix based on two characters |
| 10541 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
| 10541 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
| 10542 | 10542 | |
| 10543 | 10543 | |
| 10544 | 10544 | $sth = $this->db->prepare($query); |
| 10545 | 10545 | $sth->execute(array(':registration_2' => $registration_2)); |
| 10546 | 10546 | |
| 10547 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10547 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10548 | 10548 | { |
| 10549 | 10549 | $registration_prefix = $row['registration_prefix']; |
| 10550 | 10550 | $country = $row['country']; |
@@ -10553,12 +10553,12 @@ discard block |
||
| 10553 | 10553 | //if we didn't find a two chracter prefix lets just search the one with one character |
| 10554 | 10554 | if ($registration_prefix == "") |
| 10555 | 10555 | { |
| 10556 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 10556 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 10557 | 10557 | |
| 10558 | 10558 | $sth = $this->db->prepare($query); |
| 10559 | 10559 | $sth->execute(array(':registration_1' => $registration_1)); |
| 10560 | 10560 | |
| 10561 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10561 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10562 | 10562 | { |
| 10563 | 10563 | //$registration_prefix = $row['registration_prefix']; |
| 10564 | 10564 | $country = $row['country']; |
@@ -10578,17 +10578,17 @@ discard block |
||
| 10578 | 10578 | */ |
| 10579 | 10579 | public function registrationPrefixFromAircraftRegistration($registration) |
| 10580 | 10580 | { |
| 10581 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 10581 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 10582 | 10582 | |
| 10583 | 10583 | $registration_prefix = ''; |
| 10584 | - $registration_test = explode('-',$registration); |
|
| 10584 | + $registration_test = explode('-', $registration); |
|
| 10585 | 10585 | //$country = ''; |
| 10586 | 10586 | if ($registration_test[0] != $registration) { |
| 10587 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 10587 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 10588 | 10588 | |
| 10589 | 10589 | $sth = $this->db->prepare($query); |
| 10590 | 10590 | $sth->execute(array(':registration_1' => $registration_test[0])); |
| 10591 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10591 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10592 | 10592 | { |
| 10593 | 10593 | $registration_prefix = $row['registration_prefix']; |
| 10594 | 10594 | //$country = $row['country']; |
@@ -10598,13 +10598,13 @@ discard block |
||
| 10598 | 10598 | $registration_2 = substr($registration, 0, 2); |
| 10599 | 10599 | |
| 10600 | 10600 | //first get the prefix based on two characters |
| 10601 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
| 10601 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
| 10602 | 10602 | |
| 10603 | 10603 | |
| 10604 | 10604 | $sth = $this->db->prepare($query); |
| 10605 | 10605 | $sth->execute(array(':registration_2' => $registration_2)); |
| 10606 | 10606 | |
| 10607 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10607 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10608 | 10608 | { |
| 10609 | 10609 | $registration_prefix = $row['registration_prefix']; |
| 10610 | 10610 | //$country = $row['country']; |
@@ -10613,12 +10613,12 @@ discard block |
||
| 10613 | 10613 | //if we didn't find a two chracter prefix lets just search the one with one character |
| 10614 | 10614 | if ($registration_prefix == "") |
| 10615 | 10615 | { |
| 10616 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 10616 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 10617 | 10617 | |
| 10618 | 10618 | $sth = $this->db->prepare($query); |
| 10619 | 10619 | $sth->execute(array(':registration_1' => $registration_1)); |
| 10620 | 10620 | |
| 10621 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10621 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10622 | 10622 | { |
| 10623 | 10623 | $registration_prefix = $row['registration_prefix']; |
| 10624 | 10624 | //$country = $row['country']; |
@@ -10639,13 +10639,13 @@ discard block |
||
| 10639 | 10639 | */ |
| 10640 | 10640 | public function countryFromAircraftRegistrationCode($registration) |
| 10641 | 10641 | { |
| 10642 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 10642 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 10643 | 10643 | |
| 10644 | 10644 | $country = ''; |
| 10645 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1"; |
|
| 10645 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1"; |
|
| 10646 | 10646 | $sth = $this->db->prepare($query); |
| 10647 | 10647 | $sth->execute(array(':registration' => $registration)); |
| 10648 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10648 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10649 | 10649 | { |
| 10650 | 10650 | $country = $row['country']; |
| 10651 | 10651 | } |
@@ -10658,9 +10658,9 @@ discard block |
||
| 10658 | 10658 | * @param String $flightaware_id flightaware_id from spotter_output table |
| 10659 | 10659 | * @param String $highlight New highlight value |
| 10660 | 10660 | */ |
| 10661 | - public function setHighlightFlight($flightaware_id,$highlight) { |
|
| 10661 | + public function setHighlightFlight($flightaware_id, $highlight) { |
|
| 10662 | 10662 | |
| 10663 | - $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
|
| 10663 | + $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
|
| 10664 | 10664 | $sth = $this->db->prepare($query); |
| 10665 | 10665 | $sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight)); |
| 10666 | 10666 | } |
@@ -10672,13 +10672,13 @@ discard block |
||
| 10672 | 10672 | * @param String $date Date of spotted aircraft |
| 10673 | 10673 | * @param String $highlight New highlight value |
| 10674 | 10674 | */ |
| 10675 | - public function setHighlightFlightByRegistration($registration,$highlight, $date = '') { |
|
| 10675 | + public function setHighlightFlightByRegistration($registration, $highlight, $date = '') { |
|
| 10676 | 10676 | if ($date == '') { |
| 10677 | 10677 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)"; |
| 10678 | 10678 | $query_values = array(':registration' => $registration, ':highlight' => $highlight); |
| 10679 | 10679 | } else { |
| 10680 | 10680 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE registration = :registration AND date(date) = :date"; |
| 10681 | - $query_values = array(':registration' => $registration, ':highlight' => $highlight,':date' => $date); |
|
| 10681 | + $query_values = array(':registration' => $registration, ':highlight' => $highlight, ':date' => $date); |
|
| 10682 | 10682 | } |
| 10683 | 10683 | $sth = $this->db->prepare($query); |
| 10684 | 10684 | $sth->execute($query_values); |
@@ -10708,7 +10708,7 @@ discard block |
||
| 10708 | 10708 | |
| 10709 | 10709 | $bitly_data = json_decode($bitly_data); |
| 10710 | 10710 | $bitly_url = ''; |
| 10711 | - if ($bitly_data->status_txt = "OK"){ |
|
| 10711 | + if ($bitly_data->status_txt = "OK") { |
|
| 10712 | 10712 | $bitly_url = $bitly_data->data->url; |
| 10713 | 10713 | } |
| 10714 | 10714 | |
@@ -10718,7 +10718,7 @@ discard block |
||
| 10718 | 10718 | |
| 10719 | 10719 | public function getOrderBy() |
| 10720 | 10720 | { |
| 10721 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC")); |
|
| 10721 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC")); |
|
| 10722 | 10722 | |
| 10723 | 10723 | return $orderby; |
| 10724 | 10724 | |
@@ -10852,14 +10852,14 @@ discard block |
||
| 10852 | 10852 | } |
| 10853 | 10853 | $sth = $this->db->prepare($query); |
| 10854 | 10854 | $sth->execute(); |
| 10855 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10855 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10856 | 10856 | { |
| 10857 | 10857 | $departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']); |
| 10858 | 10858 | $arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']); |
| 10859 | 10859 | if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) { |
| 10860 | - $update_query="UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id"; |
|
| 10860 | + $update_query = "UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id"; |
|
| 10861 | 10861 | $sthu = $this->db->prepare($update_query); |
| 10862 | - $sthu->execute(array(':fromicao' => $row['fromairport_icao'],':toicao' => $row['toairport_icao'],':spotter_id' => $row['spotter_id'],':departure_airport_name' => $departure_airport_array[0]['name'],':departure_airport_city' => $departure_airport_array[0]['city'],':departure_airport_country' => $departure_airport_array[0]['country'],':arrival_airport_name' => $arrival_airport_array[0]['name'],':arrival_airport_city' => $arrival_airport_array[0]['city'],':arrival_airport_country' => $arrival_airport_array[0]['country'])); |
|
| 10862 | + $sthu->execute(array(':fromicao' => $row['fromairport_icao'], ':toicao' => $row['toairport_icao'], ':spotter_id' => $row['spotter_id'], ':departure_airport_name' => $departure_airport_array[0]['name'], ':departure_airport_city' => $departure_airport_array[0]['city'], ':departure_airport_country' => $departure_airport_array[0]['country'], ':arrival_airport_name' => $arrival_airport_array[0]['name'], ':arrival_airport_city' => $arrival_airport_array[0]['city'], ':arrival_airport_country' => $arrival_airport_array[0]['country'])); |
|
| 10863 | 10863 | } |
| 10864 | 10864 | } |
| 10865 | 10865 | |
@@ -10872,7 +10872,7 @@ discard block |
||
| 10872 | 10872 | } |
| 10873 | 10873 | $sth = $this->db->prepare($query); |
| 10874 | 10874 | $sth->execute(); |
| 10875 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10875 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10876 | 10876 | { |
| 10877 | 10877 | if (is_numeric(substr($row['ident'], -1, 1))) |
| 10878 | 10878 | { |
@@ -10881,11 +10881,11 @@ discard block |
||
| 10881 | 10881 | elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
| 10882 | 10882 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
| 10883 | 10883 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
| 10884 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
|
| 10884 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource); |
|
| 10885 | 10885 | if (isset($airline_array[0]['name'])) { |
| 10886 | - $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"; |
|
| 10886 | + $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"; |
|
| 10887 | 10887 | $sthu = $this->db->prepare($update_query); |
| 10888 | - $sthu->execute(array(':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id'])); |
|
| 10888 | + $sthu->execute(array(':airline_name' => $airline_array[0]['name'], ':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id'])); |
|
| 10889 | 10889 | } |
| 10890 | 10890 | } |
| 10891 | 10891 | } |
@@ -10905,18 +10905,18 @@ discard block |
||
| 10905 | 10905 | } |
| 10906 | 10906 | $sth = $this->db->prepare($query); |
| 10907 | 10907 | $sth->execute(); |
| 10908 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10908 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10909 | 10909 | { |
| 10910 | 10910 | if ($row['aircraft_icao'] != '') { |
| 10911 | 10911 | $aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']); |
| 10912 | - if ($row['registration'] != ""){ |
|
| 10912 | + if ($row['registration'] != "") { |
|
| 10913 | 10913 | $image_array = $Image->getSpotterImage($row['registration']); |
| 10914 | 10914 | if (!isset($image_array[0]['registration'])) { |
| 10915 | 10915 | $Image->addSpotterImage($row['registration']); |
| 10916 | 10916 | } |
| 10917 | 10917 | } |
| 10918 | 10918 | if (count($aircraft_name) > 0) { |
| 10919 | - $update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id"; |
|
| 10919 | + $update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id"; |
|
| 10920 | 10920 | $sthu = $this->db->prepare($update_query); |
| 10921 | 10921 | $sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id'])); |
| 10922 | 10922 | } |
@@ -10931,10 +10931,10 @@ discard block |
||
| 10931 | 10931 | $query = "SELECT spotter_output.spotter_id, spotter_output.last_latitude, spotter_output.last_longitude, spotter_output.last_altitude, spotter_output.arrival_airport_icao, spotter_output.real_arrival_airport_icao FROM spotter_output"; |
| 10932 | 10932 | $sth = $this->db->prepare($query); |
| 10933 | 10933 | $sth->execute(); |
| 10934 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10934 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10935 | 10935 | { |
| 10936 | 10936 | if ($row['last_latitude'] != '' && $row['last_longitude'] != '') { |
| 10937 | - $closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist); |
|
| 10937 | + $closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist); |
|
| 10938 | 10938 | $airport_icao = ''; |
| 10939 | 10939 | if (isset($closestAirports[0])) { |
| 10940 | 10940 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
@@ -10948,7 +10948,7 @@ discard block |
||
| 10948 | 10948 | break; |
| 10949 | 10949 | } |
| 10950 | 10950 | } |
| 10951 | - } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
|
| 10951 | + } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) { |
|
| 10952 | 10952 | $airport_icao = $closestAirports[0]['icao']; |
| 10953 | 10953 | 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"; |
| 10954 | 10954 | } else { |
@@ -10959,28 +10959,28 @@ discard block |
||
| 10959 | 10959 | } |
| 10960 | 10960 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
| 10961 | 10961 | if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
| 10962 | - $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
|
| 10962 | + $update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
|
| 10963 | 10963 | $sthu = $this->db->prepare($update_query); |
| 10964 | - $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
|
| 10964 | + $sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id'])); |
|
| 10965 | 10965 | } |
| 10966 | 10966 | } |
| 10967 | 10967 | } |
| 10968 | 10968 | } |
| 10969 | 10969 | |
| 10970 | - public function closestAirports($origLat,$origLon,$dist = 10) { |
|
| 10970 | + public function closestAirports($origLat, $origLon, $dist = 10) { |
|
| 10971 | 10971 | global $globalDBdriver; |
| 10972 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
| 10972 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
| 10973 | 10973 | /* |
| 10974 | 10974 | $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - abs(latitude))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(abs(latitude)*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
| 10975 | 10975 | FROM airport WHERE longitude between ($origLon-$dist/abs(cos(radians($origLat))*69)) and ($origLon+$dist/abs(cos(radians($origLat))*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 10976 | 10976 | having distance < $dist ORDER BY distance limit 100;"; |
| 10977 | 10977 | */ |
| 10978 | 10978 | if ($globalDBdriver == 'mysql') { |
| 10979 | - $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
|
| 10979 | + $query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
|
| 10980 | 10980 | FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 10981 | 10981 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
| 10982 | 10982 | } else { |
| 10983 | - $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance |
|
| 10983 | + $query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance |
|
| 10984 | 10984 | FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 10985 | 10985 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
| 10986 | 10986 | } |
@@ -69,7 +69,9 @@ discard block |
||
| 69 | 69 | $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 72 | + if (is_array($globalFilter)) { |
|
| 73 | + $filter = array_merge($filter,$globalFilter); |
|
| 74 | + } |
|
| 73 | 75 | $filter_query_join = ''; |
| 74 | 76 | $filter_query_where = ''; |
| 75 | 77 | foreach($filters as $flt) { |
@@ -122,8 +124,11 @@ discard block |
||
| 122 | 124 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 123 | 125 | } |
| 124 | 126 | } |
| 125 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 126 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 127 | + if ($filter_query_where == '' && $where) { |
|
| 128 | + $filter_query_where = ' WHERE'; |
|
| 129 | + } elseif ($filter_query_where != '' && $and) { |
|
| 130 | + $filter_query_where .= ' AND'; |
|
| 131 | + } |
|
| 127 | 132 | $filter_query = $filter_query_join.$filter_query_where; |
| 128 | 133 | return $filter_query; |
| 129 | 134 | } |
@@ -143,10 +148,18 @@ discard block |
||
| 143 | 148 | $Image = new Image($this->db); |
| 144 | 149 | $Schedule = new Schedule($this->db); |
| 145 | 150 | $ACARS = new ACARS($this->db); |
| 146 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 147 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 148 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 149 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 151 | + if (!isset($globalIVAO)) { |
|
| 152 | + $globalIVAO = FALSE; |
|
| 153 | + } |
|
| 154 | + if (!isset($globalVATSIM)) { |
|
| 155 | + $globalVATSIM = FALSE; |
|
| 156 | + } |
|
| 157 | + if (!isset($globalphpVMS)) { |
|
| 158 | + $globalphpVMS = FALSE; |
|
| 159 | + } |
|
| 160 | + if (!isset($globalVAM)) { |
|
| 161 | + $globalVAM = FALSE; |
|
| 162 | + } |
|
| 150 | 163 | date_default_timezone_set('UTC'); |
| 151 | 164 | |
| 152 | 165 | if (!is_string($query)) |
@@ -193,21 +206,35 @@ discard block |
||
| 193 | 206 | } else { |
| 194 | 207 | $temp_array['spotter_id'] = ''; |
| 195 | 208 | } |
| 196 | - if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 197 | - if (isset($row['modes'])) $temp_array['modes'] = $row['modes']; |
|
| 209 | + if (isset($row['flightaware_id'])) { |
|
| 210 | + $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 211 | + } |
|
| 212 | + if (isset($row['modes'])) { |
|
| 213 | + $temp_array['modes'] = $row['modes']; |
|
| 214 | + } |
|
| 198 | 215 | $temp_array['ident'] = $row['ident']; |
| 199 | 216 | if (isset($row['registration']) && $row['registration'] != '') { |
| 200 | 217 | $temp_array['registration'] = $row['registration']; |
| 201 | 218 | } elseif (isset($temp_array['modes'])) { |
| 202 | 219 | $temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']); |
| 203 | - } else $temp_array['registration'] = ''; |
|
| 204 | - if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 220 | + } else { |
|
| 221 | + $temp_array['registration'] = ''; |
|
| 222 | + } |
|
| 223 | + if (isset($row['aircraft_icao'])) { |
|
| 224 | + $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 225 | + } |
|
| 205 | 226 | |
| 206 | 227 | $temp_array['departure_airport'] = $row['departure_airport_icao']; |
| 207 | 228 | $temp_array['arrival_airport'] = $row['arrival_airport_icao']; |
| 208 | - if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 209 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
| 210 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
| 229 | + if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) { |
|
| 230 | + $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 231 | + } |
|
| 232 | + if (isset($row['latitude'])) { |
|
| 233 | + $temp_array['latitude'] = $row['latitude']; |
|
| 234 | + } |
|
| 235 | + if (isset($row['longitude'])) { |
|
| 236 | + $temp_array['longitude'] = $row['longitude']; |
|
| 237 | + } |
|
| 211 | 238 | /* |
| 212 | 239 | if (Connection->tableExists('countries')) { |
| 213 | 240 | $country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']); |
@@ -217,8 +244,12 @@ discard block |
||
| 217 | 244 | } |
| 218 | 245 | } |
| 219 | 246 | */ |
| 220 | - if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints']; |
|
| 221 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
| 247 | + if (isset($row['waypoints'])) { |
|
| 248 | + $temp_array['waypoints'] = $row['waypoints']; |
|
| 249 | + } |
|
| 250 | + if (isset($row['format_source'])) { |
|
| 251 | + $temp_array['format_source'] = $row['format_source']; |
|
| 252 | + } |
|
| 222 | 253 | if (isset($row['route_stop'])) { |
| 223 | 254 | $temp_array['route_stop'] = $row['route_stop']; |
| 224 | 255 | if ($row['route_stop'] != '') { |
@@ -237,13 +268,19 @@ discard block |
||
| 237 | 268 | } |
| 238 | 269 | } |
| 239 | 270 | } |
| 240 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
| 271 | + if (isset($row['altitude'])) { |
|
| 272 | + $temp_array['altitude'] = $row['altitude']; |
|
| 273 | + } |
|
| 241 | 274 | if (isset($row['heading'])) { |
| 242 | 275 | $temp_array['heading'] = $row['heading']; |
| 243 | 276 | $heading_direction = $this->parseDirection($row['heading']); |
| 244 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 277 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
| 278 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 279 | + } |
|
| 280 | + } |
|
| 281 | + if (isset($row['ground_speed'])) { |
|
| 282 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 245 | 283 | } |
| 246 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 247 | 284 | $temp_array['image'] = ""; |
| 248 | 285 | $temp_array['image_thumbnail'] = ""; |
| 249 | 286 | $temp_array['image_source'] = ""; |
@@ -251,7 +288,9 @@ discard block |
||
| 251 | 288 | |
| 252 | 289 | if (isset($row['highlight'])) { |
| 253 | 290 | $temp_array['highlight'] = $row['highlight']; |
| 254 | - } else $temp_array['highlight'] = ''; |
|
| 291 | + } else { |
|
| 292 | + $temp_array['highlight'] = ''; |
|
| 293 | + } |
|
| 255 | 294 | |
| 256 | 295 | if (isset($row['date'])) { |
| 257 | 296 | $dateArray = $this->parseDateString($row['date']); |
@@ -299,7 +338,9 @@ discard block |
||
| 299 | 338 | |
| 300 | 339 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
| 301 | 340 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
| 302 | - } else $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 341 | + } else { |
|
| 342 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 343 | + } |
|
| 303 | 344 | } else { |
| 304 | 345 | $temp_array['aircraft_shadow'] = 'default.png'; |
| 305 | 346 | $temp_array['aircraft_name'] = 'N/A'; |
@@ -307,11 +348,17 @@ discard block |
||
| 307 | 348 | } |
| 308 | 349 | } |
| 309 | 350 | $fromsource = NULL; |
| 310 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 311 | - elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 312 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 313 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 314 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 351 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 352 | + $fromsource = $globalAirlinesSource; |
|
| 353 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 354 | + $fromsource = 'vatsim'; |
|
| 355 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 356 | + $fromsource = 'ivao'; |
|
| 357 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 358 | + $fromsource = 'vatsim'; |
|
| 359 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 360 | + $fromsource = 'ivao'; |
|
| 361 | + } |
|
| 315 | 362 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
| 316 | 363 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
| 317 | 364 | if (is_numeric(substr($row['ident'], 2, 1))) { |
@@ -334,12 +381,18 @@ discard block |
||
| 334 | 381 | } |
| 335 | 382 | } else { |
| 336 | 383 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 337 | - if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 338 | - else $temp_array['airline_iata'] = 'N/A'; |
|
| 384 | + if (isset($row['airline_iata'])) { |
|
| 385 | + $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 386 | + } else { |
|
| 387 | + $temp_array['airline_iata'] = 'N/A'; |
|
| 388 | + } |
|
| 339 | 389 | $temp_array['airline_name'] = $row['airline_name']; |
| 340 | 390 | $temp_array['airline_country'] = $row['airline_country']; |
| 341 | - if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 342 | - else $temp_array['airline_callsign'] = 'N/A'; |
|
| 391 | + if (isset($row['airline_callsign'])) { |
|
| 392 | + $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 393 | + } else { |
|
| 394 | + $temp_array['airline_callsign'] = 'N/A'; |
|
| 395 | + } |
|
| 343 | 396 | $temp_array['airline_type'] = $row['airline_type']; |
| 344 | 397 | if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') { |
| 345 | 398 | $airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']); |
@@ -366,7 +419,9 @@ discard block |
||
| 366 | 419 | } |
| 367 | 420 | if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) { |
| 368 | 421 | $owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']); |
| 369 | - if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 422 | + if ($owner_info['owner'] != '') { |
|
| 423 | + $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 424 | + } |
|
| 370 | 425 | $temp_array['aircraft_base'] = $owner_info['base']; |
| 371 | 426 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
| 372 | 427 | } |
@@ -374,9 +429,14 @@ discard block |
||
| 374 | 429 | if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
| 375 | 430 | { |
| 376 | 431 | if ($globalIVAO) { |
| 377 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 378 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 379 | - } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 432 | + if (isset($temp_array['airline_icao'])) { |
|
| 433 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 434 | + } else { |
|
| 435 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 436 | + } |
|
| 437 | + } else { |
|
| 438 | + $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 439 | + } |
|
| 380 | 440 | if (count($image_array) > 0) { |
| 381 | 441 | $temp_array['image'] = $image_array[0]['image']; |
| 382 | 442 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -428,7 +488,9 @@ discard block |
||
| 428 | 488 | //if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') { |
| 429 | 489 | if ($row['departure_airport_icao'] != '') { |
| 430 | 490 | $departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']); |
| 431 | - if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 491 | + if (!isset($departure_airport_array[0]['name'])) { |
|
| 492 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 493 | + } |
|
| 432 | 494 | /* |
| 433 | 495 | } elseif ($row['departure_airport_name'] != '') { |
| 434 | 496 | $temp_array['departure_airport_name'] = $row['departure_airport_name']; |
@@ -436,7 +498,9 @@ discard block |
||
| 436 | 498 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 437 | 499 | $temp_array['departure_airport_icao'] = $row['departure_airport_icao']; |
| 438 | 500 | */ |
| 439 | - } else $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 501 | + } else { |
|
| 502 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 503 | + } |
|
| 440 | 504 | if (isset($departure_airport_array[0]['name'])) { |
| 441 | 505 | $temp_array['departure_airport_name'] = $departure_airport_array[0]['name']; |
| 442 | 506 | $temp_array['departure_airport_city'] = $departure_airport_array[0]['city']; |
@@ -456,8 +520,12 @@ discard block |
||
| 456 | 520 | |
| 457 | 521 | if ($row['arrival_airport_icao'] != '') { |
| 458 | 522 | $arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']); |
| 459 | - if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 460 | - } else $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 523 | + if (count($arrival_airport_array) == 0) { |
|
| 524 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 525 | + } |
|
| 526 | + } else { |
|
| 527 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 528 | + } |
|
| 461 | 529 | if (isset($arrival_airport_array[0]['name'])) { |
| 462 | 530 | $temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name']; |
| 463 | 531 | $temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city']; |
@@ -473,27 +541,45 @@ discard block |
||
| 473 | 541 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
| 474 | 542 | } |
| 475 | 543 | */ |
| 476 | - if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 477 | - if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 478 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
| 479 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
| 480 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
| 544 | + if (isset($row['pilot_id']) && $row['pilot_id'] != '') { |
|
| 545 | + $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 546 | + } |
|
| 547 | + if (isset($row['pilot_name']) && $row['pilot_name'] != '') { |
|
| 548 | + $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 549 | + } |
|
| 550 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
| 551 | + $temp_array['source_name'] = $row['source_name']; |
|
| 552 | + } |
|
| 553 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
| 554 | + $temp_array['over_country'] = $row['over_country']; |
|
| 555 | + } |
|
| 556 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
| 557 | + $temp_array['distance'] = $row['distance']; |
|
| 558 | + } |
|
| 481 | 559 | if (isset($row['squawk'])) { |
| 482 | 560 | $temp_array['squawk'] = $row['squawk']; |
| 483 | 561 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
| 484 | 562 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
| 485 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 563 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 564 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 565 | + } |
|
| 486 | 566 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
| 487 | 567 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
| 488 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 489 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 568 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 569 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 570 | + } |
|
| 571 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) { |
|
| 572 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 573 | + } |
|
| 490 | 574 | } |
| 491 | 575 | |
| 492 | 576 | $temp_array['query_number_rows'] = $num_rows; |
| 493 | 577 | |
| 494 | 578 | $spotter_array[] = $temp_array; |
| 495 | 579 | } |
| 496 | - if ($num_rows == 0) return array(); |
|
| 580 | + if ($num_rows == 0) { |
|
| 581 | + return array(); |
|
| 582 | + } |
|
| 497 | 583 | $spotter_array[0]['query_number_rows'] = $num_rows; |
| 498 | 584 | return $spotter_array; |
| 499 | 585 | } |
@@ -526,7 +612,9 @@ discard block |
||
| 526 | 612 | foreach ($q_array as $q_item){ |
| 527 | 613 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
| 528 | 614 | $additional_query .= " AND ("; |
| 529 | - if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 615 | + if (is_int($q_item)) { |
|
| 616 | + $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 617 | + } |
|
| 530 | 618 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
| 531 | 619 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
| 532 | 620 | $additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
@@ -547,7 +635,9 @@ discard block |
||
| 547 | 635 | $additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR "; |
| 548 | 636 | $additional_query .= "(spotter_output.ident like '%".$q_item."%') OR "; |
| 549 | 637 | $translate = $Translation->ident2icao($q_item); |
| 550 | - if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 638 | + if ($translate != $q_item) { |
|
| 639 | + $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 640 | + } |
|
| 551 | 641 | $additional_query .= "(spotter_output.highlight like '%".$q_item."%')"; |
| 552 | 642 | $additional_query .= ")"; |
| 553 | 643 | } |
@@ -774,7 +864,9 @@ discard block |
||
| 774 | 864 | date_default_timezone_set($globalTimezone); |
| 775 | 865 | $datetime = new DateTime(); |
| 776 | 866 | $offset = $datetime->format('P'); |
| 777 | - } else $offset = '+00:00'; |
|
| 867 | + } else { |
|
| 868 | + $offset = '+00:00'; |
|
| 869 | + } |
|
| 778 | 870 | |
| 779 | 871 | if ($date_array[1] != "") |
| 780 | 872 | { |
@@ -806,8 +898,12 @@ discard block |
||
| 806 | 898 | { |
| 807 | 899 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 808 | 900 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 809 | - } else $limit_query = ""; |
|
| 810 | - } else $limit_query = ""; |
|
| 901 | + } else { |
|
| 902 | + $limit_query = ""; |
|
| 903 | + } |
|
| 904 | + } else { |
|
| 905 | + $limit_query = ""; |
|
| 906 | + } |
|
| 811 | 907 | |
| 812 | 908 | |
| 813 | 909 | if ($sort != "") |
@@ -875,8 +971,12 @@ discard block |
||
| 875 | 971 | { |
| 876 | 972 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 877 | 973 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 878 | - } else $limit_query = ""; |
|
| 879 | - } else $limit_query = ""; |
|
| 974 | + } else { |
|
| 975 | + $limit_query = ""; |
|
| 976 | + } |
|
| 977 | + } else { |
|
| 978 | + $limit_query = ""; |
|
| 979 | + } |
|
| 880 | 980 | |
| 881 | 981 | if ($sort != "") |
| 882 | 982 | { |
@@ -1200,7 +1300,9 @@ discard block |
||
| 1200 | 1300 | global $global_query; |
| 1201 | 1301 | |
| 1202 | 1302 | date_default_timezone_set('UTC'); |
| 1203 | - if ($id == '') return array(); |
|
| 1303 | + if ($id == '') { |
|
| 1304 | + return array(); |
|
| 1305 | + } |
|
| 1204 | 1306 | $additional_query = "spotter_output.spotter_id = :id"; |
| 1205 | 1307 | $query_values = array(':id' => $id); |
| 1206 | 1308 | |
@@ -1832,7 +1934,9 @@ discard block |
||
| 1832 | 1934 | { |
| 1833 | 1935 | $highlight = $row['highlight']; |
| 1834 | 1936 | } |
| 1835 | - if (isset($highlight)) return $highlight; |
|
| 1937 | + if (isset($highlight)) { |
|
| 1938 | + return $highlight; |
|
| 1939 | + } |
|
| 1836 | 1940 | } |
| 1837 | 1941 | |
| 1838 | 1942 | |
@@ -1860,7 +1964,9 @@ discard block |
||
| 1860 | 1964 | $sth->closeCursor(); |
| 1861 | 1965 | if (count($row) > 0) { |
| 1862 | 1966 | return $row['usage']; |
| 1863 | - } else return ''; |
|
| 1967 | + } else { |
|
| 1968 | + return ''; |
|
| 1969 | + } |
|
| 1864 | 1970 | } |
| 1865 | 1971 | |
| 1866 | 1972 | /** |
@@ -1885,7 +1991,9 @@ discard block |
||
| 1885 | 1991 | $sth->closeCursor(); |
| 1886 | 1992 | if (count($row) > 0) { |
| 1887 | 1993 | return $row['icao']; |
| 1888 | - } else return ''; |
|
| 1994 | + } else { |
|
| 1995 | + return ''; |
|
| 1996 | + } |
|
| 1889 | 1997 | } |
| 1890 | 1998 | |
| 1891 | 1999 | /** |
@@ -1913,7 +2021,9 @@ discard block |
||
| 1913 | 2021 | $airport_longitude = $row['longitude']; |
| 1914 | 2022 | $Common = new Common(); |
| 1915 | 2023 | return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
| 1916 | - } else return ''; |
|
| 2024 | + } else { |
|
| 2025 | + return ''; |
|
| 2026 | + } |
|
| 1917 | 2027 | } |
| 1918 | 2028 | |
| 1919 | 2029 | /** |
@@ -2025,7 +2135,9 @@ discard block |
||
| 2025 | 2135 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2026 | 2136 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2027 | 2137 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2028 | - } else return array(); |
|
| 2138 | + } else { |
|
| 2139 | + return array(); |
|
| 2140 | + } |
|
| 2029 | 2141 | if ($globalDBdriver == 'mysql') { |
| 2030 | 2142 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
| 2031 | 2143 | } else { |
@@ -2060,7 +2172,9 @@ discard block |
||
| 2060 | 2172 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2061 | 2173 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2062 | 2174 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2063 | - } else return array(); |
|
| 2175 | + } else { |
|
| 2176 | + return array(); |
|
| 2177 | + } |
|
| 2064 | 2178 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
| 2065 | 2179 | $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.")"; |
| 2066 | 2180 | //$query = "SELECT waypoints.* FROM waypoints"; |
@@ -2095,7 +2209,9 @@ discard block |
||
| 2095 | 2209 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
| 2096 | 2210 | { |
| 2097 | 2211 | global $globalUseRealAirlines; |
| 2098 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2212 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2213 | + $fromsource = NULL; |
|
| 2214 | + } |
|
| 2099 | 2215 | $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
| 2100 | 2216 | if ($airline_icao == 'NA') { |
| 2101 | 2217 | $airline_array = array(); |
@@ -2145,7 +2261,9 @@ discard block |
||
| 2145 | 2261 | $sth->execute(array(':fromsource' => $fromsource)); |
| 2146 | 2262 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2147 | 2263 | $sth->closeCursor(); |
| 2148 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao); |
|
| 2264 | + if ($row['nb'] == 0) { |
|
| 2265 | + $result = $this->getAllAirlineInfo($airline_icao); |
|
| 2266 | + } |
|
| 2149 | 2267 | } |
| 2150 | 2268 | return $result; |
| 2151 | 2269 | } |
@@ -2161,7 +2279,9 @@ discard block |
||
| 2161 | 2279 | public function getAllAirlineInfoByName($airline_name, $fromsource = NULL) |
| 2162 | 2280 | { |
| 2163 | 2281 | global $globalUseRealAirlines; |
| 2164 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2282 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2283 | + $fromsource = NULL; |
|
| 2284 | + } |
|
| 2165 | 2285 | $airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING)); |
| 2166 | 2286 | $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"; |
| 2167 | 2287 | $sth = $this->db->prepare($query); |
@@ -2177,7 +2297,9 @@ discard block |
||
| 2177 | 2297 | $sth->execute(array(':fromsource' => $fromsource)); |
| 2178 | 2298 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2179 | 2299 | $sth->closeCursor(); |
| 2180 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name); |
|
| 2300 | + if ($row['nb'] == 0) { |
|
| 2301 | + $result = $this->getAllAirlineInfoByName($airline_name); |
|
| 2302 | + } |
|
| 2181 | 2303 | } |
| 2182 | 2304 | return $result; |
| 2183 | 2305 | } |
@@ -2240,15 +2362,20 @@ discard block |
||
| 2240 | 2362 | 'A320-211' => 'A320', |
| 2241 | 2363 | '747-8i' => 'B748', |
| 2242 | 2364 | 'A380' => 'A388'); |
| 2243 | - if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
|
| 2365 | + if (isset($all_aircraft[$aircraft_type])) { |
|
| 2366 | + return $all_aircraft[$aircraft_type]; |
|
| 2367 | + } |
|
| 2244 | 2368 | |
| 2245 | 2369 | $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
| 2246 | 2370 | $aircraft_type = strtoupper($aircraft_type); |
| 2247 | 2371 | $sth = $this->db->prepare($query); |
| 2248 | 2372 | $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
| 2249 | 2373 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2250 | - if (isset($result[0]['icao'])) return $result[0]['icao']; |
|
| 2251 | - else return ''; |
|
| 2374 | + if (isset($result[0]['icao'])) { |
|
| 2375 | + return $result[0]['icao']; |
|
| 2376 | + } else { |
|
| 2377 | + return ''; |
|
| 2378 | + } |
|
| 2252 | 2379 | } |
| 2253 | 2380 | |
| 2254 | 2381 | /** |
@@ -2271,9 +2398,13 @@ discard block |
||
| 2271 | 2398 | $sth->closeCursor(); |
| 2272 | 2399 | if (isset($row['icaotypecode'])) { |
| 2273 | 2400 | $icao = $row['icaotypecode']; |
| 2274 | - if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao]; |
|
| 2401 | + if (isset($this->aircraft_correct_icaotype[$icao])) { |
|
| 2402 | + $icao = $this->aircraft_correct_icaotype[$icao]; |
|
| 2403 | + } |
|
| 2275 | 2404 | return $icao; |
| 2276 | - } else return ''; |
|
| 2405 | + } else { |
|
| 2406 | + return ''; |
|
| 2407 | + } |
|
| 2277 | 2408 | } |
| 2278 | 2409 | |
| 2279 | 2410 | /** |
@@ -2296,7 +2427,9 @@ discard block |
||
| 2296 | 2427 | $sth->closeCursor(); |
| 2297 | 2428 | if (isset($row['icaotypecode'])) { |
| 2298 | 2429 | return $row['icaotypecode']; |
| 2299 | - } else return ''; |
|
| 2430 | + } else { |
|
| 2431 | + return ''; |
|
| 2432 | + } |
|
| 2300 | 2433 | } |
| 2301 | 2434 | |
| 2302 | 2435 | /** |
@@ -2342,7 +2475,9 @@ discard block |
||
| 2342 | 2475 | $sth->closeCursor(); |
| 2343 | 2476 | if (isset($row['operator_correct'])) { |
| 2344 | 2477 | return $row['operator_correct']; |
| 2345 | - } else return $operator; |
|
| 2478 | + } else { |
|
| 2479 | + return $operator; |
|
| 2480 | + } |
|
| 2346 | 2481 | } |
| 2347 | 2482 | |
| 2348 | 2483 | /** |
@@ -2355,7 +2490,9 @@ discard block |
||
| 2355 | 2490 | public function getRouteInfo($callsign) |
| 2356 | 2491 | { |
| 2357 | 2492 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
| 2358 | - if ($callsign == '') return array(); |
|
| 2493 | + if ($callsign == '') { |
|
| 2494 | + return array(); |
|
| 2495 | + } |
|
| 2359 | 2496 | $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"; |
| 2360 | 2497 | |
| 2361 | 2498 | $sth = $this->db->prepare($query); |
@@ -2365,7 +2502,9 @@ discard block |
||
| 2365 | 2502 | $sth->closeCursor(); |
| 2366 | 2503 | if (count($row) > 0) { |
| 2367 | 2504 | return $row; |
| 2368 | - } else return array(); |
|
| 2505 | + } else { |
|
| 2506 | + return array(); |
|
| 2507 | + } |
|
| 2369 | 2508 | } |
| 2370 | 2509 | |
| 2371 | 2510 | /** |
@@ -2418,7 +2557,9 @@ discard block |
||
| 2418 | 2557 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 2419 | 2558 | $sth->closeCursor(); |
| 2420 | 2559 | return $result; |
| 2421 | - } else return array(); |
|
| 2560 | + } else { |
|
| 2561 | + return array(); |
|
| 2562 | + } |
|
| 2422 | 2563 | } |
| 2423 | 2564 | |
| 2424 | 2565 | |
@@ -2577,8 +2718,11 @@ discard block |
||
| 2577 | 2718 | $query .= " ORDER BY spotter_output.source_name ASC"; |
| 2578 | 2719 | |
| 2579 | 2720 | $sth = $this->db->prepare($query); |
| 2580 | - if (!empty($query_values)) $sth->execute($query_values); |
|
| 2581 | - else $sth->execute(); |
|
| 2721 | + if (!empty($query_values)) { |
|
| 2722 | + $sth->execute($query_values); |
|
| 2723 | + } else { |
|
| 2724 | + $sth->execute(); |
|
| 2725 | + } |
|
| 2582 | 2726 | |
| 2583 | 2727 | $source_array = array(); |
| 2584 | 2728 | $temp_array = array(); |
@@ -2611,9 +2755,13 @@ discard block |
||
| 2611 | 2755 | WHERE spotter_output.airline_icao <> '' |
| 2612 | 2756 | ORDER BY spotter_output.airline_name ASC"; |
| 2613 | 2757 | */ |
| 2614 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2615 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2616 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2758 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2759 | + $forsource = $globalAirlinesSource; |
|
| 2760 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2761 | + $forsource = 'vatsim'; |
|
| 2762 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2763 | + $forsource = 'ivao'; |
|
| 2764 | + } |
|
| 2617 | 2765 | if ($forsource === NULL) { |
| 2618 | 2766 | $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"; |
| 2619 | 2767 | $query_data = array(); |
@@ -2656,9 +2804,13 @@ discard block |
||
| 2656 | 2804 | { |
| 2657 | 2805 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
| 2658 | 2806 | $filter_query = $this->getFilter($filters,true,true); |
| 2659 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2660 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2661 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2807 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2808 | + $forsource = $globalAirlinesSource; |
|
| 2809 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2810 | + $forsource = 'vatsim'; |
|
| 2811 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2812 | + $forsource = 'ivao'; |
|
| 2813 | + } |
|
| 2662 | 2814 | if ($forsource === NULL) { |
| 2663 | 2815 | $query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC"; |
| 2664 | 2816 | $query_data = array(); |
@@ -2933,7 +3085,9 @@ discard block |
||
| 2933 | 3085 | date_default_timezone_set($globalTimezone); |
| 2934 | 3086 | $datetime = new DateTime(); |
| 2935 | 3087 | $offset = $datetime->format('P'); |
| 2936 | - } else $offset = '+00:00'; |
|
| 3088 | + } else { |
|
| 3089 | + $offset = '+00:00'; |
|
| 3090 | + } |
|
| 2937 | 3091 | if ($airport_icao == '') { |
| 2938 | 3092 | if ($globalDBdriver == 'mysql') { |
| 2939 | 3093 | $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"; |
@@ -2965,7 +3119,9 @@ discard block |
||
| 2965 | 3119 | date_default_timezone_set($globalTimezone); |
| 2966 | 3120 | $datetime = new DateTime(); |
| 2967 | 3121 | $offset = $datetime->format('P'); |
| 2968 | - } else $offset = '+00:00'; |
|
| 3122 | + } else { |
|
| 3123 | + $offset = '+00:00'; |
|
| 3124 | + } |
|
| 2969 | 3125 | if ($airport_icao == '') { |
| 2970 | 3126 | if ($globalDBdriver == 'mysql') { |
| 2971 | 3127 | $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"; |
@@ -2998,7 +3154,9 @@ discard block |
||
| 2998 | 3154 | date_default_timezone_set($globalTimezone); |
| 2999 | 3155 | $datetime = new DateTime(); |
| 3000 | 3156 | $offset = $datetime->format('P'); |
| 3001 | - } else $offset = '+00:00'; |
|
| 3157 | + } else { |
|
| 3158 | + $offset = '+00:00'; |
|
| 3159 | + } |
|
| 3002 | 3160 | if ($airport_icao == '') { |
| 3003 | 3161 | if ($globalDBdriver == 'mysql') { |
| 3004 | 3162 | $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 |
@@ -3037,7 +3195,9 @@ discard block |
||
| 3037 | 3195 | date_default_timezone_set($globalTimezone); |
| 3038 | 3196 | $datetime = new DateTime(); |
| 3039 | 3197 | $offset = $datetime->format('P'); |
| 3040 | - } else $offset = '+00:00'; |
|
| 3198 | + } else { |
|
| 3199 | + $offset = '+00:00'; |
|
| 3200 | + } |
|
| 3041 | 3201 | if ($airport_icao == '') { |
| 3042 | 3202 | if ($globalDBdriver == 'mysql') { |
| 3043 | 3203 | $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 |
@@ -3082,7 +3242,9 @@ discard block |
||
| 3082 | 3242 | date_default_timezone_set($globalTimezone); |
| 3083 | 3243 | $datetime = new DateTime(); |
| 3084 | 3244 | $offset = $datetime->format('P'); |
| 3085 | - } else $offset = '+00:00'; |
|
| 3245 | + } else { |
|
| 3246 | + $offset = '+00:00'; |
|
| 3247 | + } |
|
| 3086 | 3248 | if ($airport_icao == '') { |
| 3087 | 3249 | if ($globalDBdriver == 'mysql') { |
| 3088 | 3250 | $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"; |
@@ -3117,7 +3279,9 @@ discard block |
||
| 3117 | 3279 | date_default_timezone_set($globalTimezone); |
| 3118 | 3280 | $datetime = new DateTime(); |
| 3119 | 3281 | $offset = $datetime->format('P'); |
| 3120 | - } else $offset = '+00:00'; |
|
| 3282 | + } else { |
|
| 3283 | + $offset = '+00:00'; |
|
| 3284 | + } |
|
| 3121 | 3285 | if ($airport_icao == '') { |
| 3122 | 3286 | if ($globalDBdriver == 'mysql') { |
| 3123 | 3287 | $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 |
@@ -3159,7 +3323,9 @@ discard block |
||
| 3159 | 3323 | date_default_timezone_set($globalTimezone); |
| 3160 | 3324 | $datetime = new DateTime(); |
| 3161 | 3325 | $offset = $datetime->format('P'); |
| 3162 | - } else $offset = '+00:00'; |
|
| 3326 | + } else { |
|
| 3327 | + $offset = '+00:00'; |
|
| 3328 | + } |
|
| 3163 | 3329 | if ($airport_icao == '') { |
| 3164 | 3330 | if ($globalDBdriver == 'mysql') { |
| 3165 | 3331 | $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"; |
@@ -3193,7 +3359,9 @@ discard block |
||
| 3193 | 3359 | date_default_timezone_set($globalTimezone); |
| 3194 | 3360 | $datetime = new DateTime(); |
| 3195 | 3361 | $offset = $datetime->format('P'); |
| 3196 | - } else $offset = '+00:00'; |
|
| 3362 | + } else { |
|
| 3363 | + $offset = '+00:00'; |
|
| 3364 | + } |
|
| 3197 | 3365 | if ($airport_icao == '') { |
| 3198 | 3366 | if ($globalDBdriver == 'mysql') { |
| 3199 | 3367 | $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 |
@@ -3241,7 +3409,9 @@ discard block |
||
| 3241 | 3409 | date_default_timezone_set($globalTimezone); |
| 3242 | 3410 | $datetime = new DateTime(); |
| 3243 | 3411 | $offset = $datetime->format('P'); |
| 3244 | - } else $offset = '+00:00'; |
|
| 3412 | + } else { |
|
| 3413 | + $offset = '+00:00'; |
|
| 3414 | + } |
|
| 3245 | 3415 | |
| 3246 | 3416 | if ($globalDBdriver == 'mysql') { |
| 3247 | 3417 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
@@ -3361,7 +3531,9 @@ discard block |
||
| 3361 | 3531 | */ |
| 3362 | 3532 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
| 3363 | 3533 | { |
| 3364 | - if ($groundspeed == '') $groundspeed = NULL; |
|
| 3534 | + if ($groundspeed == '') { |
|
| 3535 | + $groundspeed = NULL; |
|
| 3536 | + } |
|
| 3365 | 3537 | $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'; |
| 3366 | 3538 | $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); |
| 3367 | 3539 | |
@@ -3411,10 +3583,18 @@ discard block |
||
| 3411 | 3583 | $Image = new Image($this->db); |
| 3412 | 3584 | $Common = new Common(); |
| 3413 | 3585 | |
| 3414 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 3415 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 3416 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 3417 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 3586 | + if (!isset($globalIVAO)) { |
|
| 3587 | + $globalIVAO = FALSE; |
|
| 3588 | + } |
|
| 3589 | + if (!isset($globalVATSIM)) { |
|
| 3590 | + $globalVATSIM = FALSE; |
|
| 3591 | + } |
|
| 3592 | + if (!isset($globalphpVMS)) { |
|
| 3593 | + $globalphpVMS = FALSE; |
|
| 3594 | + } |
|
| 3595 | + if (!isset($globalVAM)) { |
|
| 3596 | + $globalVAM = FALSE; |
|
| 3597 | + } |
|
| 3418 | 3598 | date_default_timezone_set('UTC'); |
| 3419 | 3599 | |
| 3420 | 3600 | //getting the registration |
@@ -3427,23 +3607,33 @@ discard block |
||
| 3427 | 3607 | if ($ModeS != '') { |
| 3428 | 3608 | $timeelapsed = microtime(true); |
| 3429 | 3609 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
| 3430 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3610 | + if ($globalDebugTimeElapsed) { |
|
| 3611 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3612 | + } |
|
| 3431 | 3613 | } else { |
| 3432 | 3614 | $myhex = explode('-',$flightaware_id); |
| 3433 | 3615 | if (count($myhex) > 0) { |
| 3434 | 3616 | $timeelapsed = microtime(true); |
| 3435 | 3617 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
| 3436 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3618 | + if ($globalDebugTimeElapsed) { |
|
| 3619 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3620 | + } |
|
| 3437 | 3621 | } |
| 3438 | 3622 | } |
| 3439 | 3623 | } |
| 3440 | 3624 | } |
| 3441 | 3625 | $fromsource = NULL; |
| 3442 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 3443 | - elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 3444 | - elseif ($format_source == 'whazzup') $fromsource = 'ivao'; |
|
| 3445 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 3446 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 3626 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 3627 | + $fromsource = $globalAirlinesSource; |
|
| 3628 | + } elseif ($format_source == 'vatsimtxt') { |
|
| 3629 | + $fromsource = 'vatsim'; |
|
| 3630 | + } elseif ($format_source == 'whazzup') { |
|
| 3631 | + $fromsource = 'ivao'; |
|
| 3632 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 3633 | + $fromsource = 'vatsim'; |
|
| 3634 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 3635 | + $fromsource = 'ivao'; |
|
| 3636 | + } |
|
| 3447 | 3637 | //getting the airline information |
| 3448 | 3638 | if ($ident != "") |
| 3449 | 3639 | { |
@@ -3467,15 +3657,21 @@ discard block |
||
| 3467 | 3657 | if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
| 3468 | 3658 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3469 | 3659 | } |
| 3470 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3660 | + if ($globalDebugTimeElapsed) { |
|
| 3661 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3662 | + } |
|
| 3471 | 3663 | |
| 3472 | 3664 | } else { |
| 3473 | 3665 | $timeelapsed = microtime(true); |
| 3474 | 3666 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3475 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3667 | + if ($globalDebugTimeElapsed) { |
|
| 3668 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3669 | + } |
|
| 3476 | 3670 | } |
| 3477 | 3671 | } |
| 3478 | - } else $airline_array = array(); |
|
| 3672 | + } else { |
|
| 3673 | + $airline_array = array(); |
|
| 3674 | + } |
|
| 3479 | 3675 | |
| 3480 | 3676 | //getting the aircraft information |
| 3481 | 3677 | $aircraft_array = array(); |
@@ -3489,27 +3685,37 @@ discard block |
||
| 3489 | 3685 | { |
| 3490 | 3686 | $timeelapsed = microtime(true); |
| 3491 | 3687 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3492 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3688 | + if ($globalDebugTimeElapsed) { |
|
| 3689 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3690 | + } |
|
| 3493 | 3691 | } else { |
| 3494 | 3692 | $timeelapsed = microtime(true); |
| 3495 | 3693 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3496 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3694 | + if ($globalDebugTimeElapsed) { |
|
| 3695 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3696 | + } |
|
| 3497 | 3697 | } |
| 3498 | 3698 | } |
| 3499 | 3699 | } else { |
| 3500 | 3700 | if ($ModeS != '') { |
| 3501 | 3701 | $timeelapsed = microtime(true); |
| 3502 | 3702 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
| 3503 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3703 | + if ($globalDebugTimeElapsed) { |
|
| 3704 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3705 | + } |
|
| 3504 | 3706 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
| 3505 | 3707 | { |
| 3506 | 3708 | $timeelapsed = microtime(true); |
| 3507 | 3709 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3508 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3710 | + if ($globalDebugTimeElapsed) { |
|
| 3711 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3712 | + } |
|
| 3509 | 3713 | } else { |
| 3510 | 3714 | $timeelapsed = microtime(true); |
| 3511 | 3715 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3512 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3716 | + if ($globalDebugTimeElapsed) { |
|
| 3717 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3718 | + } |
|
| 3513 | 3719 | } |
| 3514 | 3720 | } |
| 3515 | 3721 | } |
@@ -3525,7 +3731,9 @@ discard block |
||
| 3525 | 3731 | } else { |
| 3526 | 3732 | $timeelapsed = microtime(true); |
| 3527 | 3733 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
| 3528 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3734 | + if ($globalDebugTimeElapsed) { |
|
| 3735 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3736 | + } |
|
| 3529 | 3737 | } |
| 3530 | 3738 | } |
| 3531 | 3739 | |
@@ -3540,7 +3748,9 @@ discard block |
||
| 3540 | 3748 | } else { |
| 3541 | 3749 | $timeelapsed = microtime(true); |
| 3542 | 3750 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
| 3543 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3751 | + if ($globalDebugTimeElapsed) { |
|
| 3752 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3753 | + } |
|
| 3544 | 3754 | } |
| 3545 | 3755 | } |
| 3546 | 3756 | |
@@ -3574,7 +3784,9 @@ discard block |
||
| 3574 | 3784 | { |
| 3575 | 3785 | return false; |
| 3576 | 3786 | } |
| 3577 | - } else $altitude = 0; |
|
| 3787 | + } else { |
|
| 3788 | + $altitude = 0; |
|
| 3789 | + } |
|
| 3578 | 3790 | |
| 3579 | 3791 | if ($heading != "") |
| 3580 | 3792 | { |
@@ -3603,7 +3815,9 @@ discard block |
||
| 3603 | 3815 | { |
| 3604 | 3816 | $timeelapsed = microtime(true); |
| 3605 | 3817 | $image_array = $Image->getSpotterImage($registration); |
| 3606 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3818 | + if ($globalDebugTimeElapsed) { |
|
| 3819 | + echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3820 | + } |
|
| 3607 | 3821 | if (!isset($image_array[0]['registration'])) |
| 3608 | 3822 | { |
| 3609 | 3823 | //echo "Add image !!!! \n"; |
@@ -3611,14 +3825,21 @@ discard block |
||
| 3611 | 3825 | } |
| 3612 | 3826 | $timeelapsed = microtime(true); |
| 3613 | 3827 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
| 3614 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3615 | - if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 3828 | + if ($globalDebugTimeElapsed) { |
|
| 3829 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3830 | + } |
|
| 3831 | + if ($owner_info['owner'] != '') { |
|
| 3832 | + $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 3833 | + } |
|
| 3616 | 3834 | } |
| 3617 | 3835 | |
| 3618 | 3836 | if ($globalIVAO && $aircraft_icao != '') |
| 3619 | 3837 | { |
| 3620 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3621 | - else $airline_icao = ''; |
|
| 3838 | + if (isset($airline_array[0]['icao'])) { |
|
| 3839 | + $airline_icao = $airline_array[0]['icao']; |
|
| 3840 | + } else { |
|
| 3841 | + $airline_icao = ''; |
|
| 3842 | + } |
|
| 3622 | 3843 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
| 3623 | 3844 | if (!isset($image_array[0]['registration'])) |
| 3624 | 3845 | { |
@@ -3663,16 +3884,28 @@ discard block |
||
| 3663 | 3884 | { |
| 3664 | 3885 | $arrival_airport_array = $this->getAllAirportInfo('NA'); |
| 3665 | 3886 | } |
| 3666 | - if ($registration == '') $registration = 'NA'; |
|
| 3887 | + if ($registration == '') { |
|
| 3888 | + $registration = 'NA'; |
|
| 3889 | + } |
|
| 3667 | 3890 | if ($latitude == '' && $longitude == '') { |
| 3668 | 3891 | $latitude = 0; |
| 3669 | 3892 | $longitude = 0; |
| 3670 | 3893 | } |
| 3671 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3672 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3673 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3674 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3675 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 3894 | + if ($squawk == '' || $Common->isInteger($squawk) === false) { |
|
| 3895 | + $squawk = NULL; |
|
| 3896 | + } |
|
| 3897 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) { |
|
| 3898 | + $verticalrate = NULL; |
|
| 3899 | + } |
|
| 3900 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
| 3901 | + $heading = 0; |
|
| 3902 | + } |
|
| 3903 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
| 3904 | + $groundspeed = 0; |
|
| 3905 | + } |
|
| 3906 | + if (!isset($aircraft_owner)) { |
|
| 3907 | + $aircraft_owner = NULL; |
|
| 3908 | + } |
|
| 3676 | 3909 | $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) |
| 3677 | 3910 | 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)"; |
| 3678 | 3911 | |
@@ -3683,9 +3916,13 @@ discard block |
||
| 3683 | 3916 | if ($airline_type == '') { |
| 3684 | 3917 | $timeelapsed = microtime(true); |
| 3685 | 3918 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3686 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3919 | + if ($globalDebugTimeElapsed) { |
|
| 3920 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3921 | + } |
|
| 3922 | + } |
|
| 3923 | + if ($airline_type == null) { |
|
| 3924 | + $airline_type = ''; |
|
| 3687 | 3925 | } |
| 3688 | - if ($airline_type == null) $airline_type = ''; |
|
| 3689 | 3926 | $aircraft_type = $aircraft_array[0]['type']; |
| 3690 | 3927 | $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
| 3691 | 3928 | $departure_airport_name = $departure_airport_array[0]['name']; |
@@ -3849,7 +4086,9 @@ discard block |
||
| 3849 | 4086 | } |
| 3850 | 4087 | } |
| 3851 | 4088 | $query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC"; |
| 3852 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4089 | + if ($limit) { |
|
| 4090 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4091 | + } |
|
| 3853 | 4092 | |
| 3854 | 4093 | $sth = $this->db->prepare($query); |
| 3855 | 4094 | $sth->execute($query_values); |
@@ -3922,7 +4161,9 @@ discard block |
||
| 3922 | 4161 | } |
| 3923 | 4162 | |
| 3924 | 4163 | $query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 3925 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4164 | + if ($limit) { |
|
| 4165 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4166 | + } |
|
| 3926 | 4167 | |
| 3927 | 4168 | |
| 3928 | 4169 | $sth = $this->db->prepare($query); |
@@ -3966,7 +4207,9 @@ discard block |
||
| 3966 | 4207 | } |
| 3967 | 4208 | } |
| 3968 | 4209 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 3969 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4210 | + if ($limit) { |
|
| 4211 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4212 | + } |
|
| 3970 | 4213 | |
| 3971 | 4214 | |
| 3972 | 4215 | $sth = $this->db->prepare($query); |
@@ -4042,7 +4285,9 @@ discard block |
||
| 4042 | 4285 | } |
| 4043 | 4286 | } |
| 4044 | 4287 | $query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC"; |
| 4045 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4288 | + if ($limit) { |
|
| 4289 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4290 | + } |
|
| 4046 | 4291 | |
| 4047 | 4292 | $sth = $this->db->prepare($query); |
| 4048 | 4293 | $sth->execute($query_values); |
@@ -4084,7 +4329,9 @@ discard block |
||
| 4084 | 4329 | } |
| 4085 | 4330 | } |
| 4086 | 4331 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC"; |
| 4087 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4332 | + if ($limit) { |
|
| 4333 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4334 | + } |
|
| 4088 | 4335 | |
| 4089 | 4336 | |
| 4090 | 4337 | $sth = $this->db->prepare($query); |
@@ -4327,7 +4574,9 @@ discard block |
||
| 4327 | 4574 | date_default_timezone_set($globalTimezone); |
| 4328 | 4575 | $datetime = new DateTime($date); |
| 4329 | 4576 | $offset = $datetime->format('P'); |
| 4330 | - } else $offset = '+00:00'; |
|
| 4577 | + } else { |
|
| 4578 | + $offset = '+00:00'; |
|
| 4579 | + } |
|
| 4331 | 4580 | |
| 4332 | 4581 | if ($globalDBdriver == 'mysql') { |
| 4333 | 4582 | $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
@@ -4375,7 +4624,9 @@ discard block |
||
| 4375 | 4624 | date_default_timezone_set($globalTimezone); |
| 4376 | 4625 | $datetime = new DateTime($date); |
| 4377 | 4626 | $offset = $datetime->format('P'); |
| 4378 | - } else $offset = '+00:00'; |
|
| 4627 | + } else { |
|
| 4628 | + $offset = '+00:00'; |
|
| 4629 | + } |
|
| 4379 | 4630 | |
| 4380 | 4631 | if ($globalDBdriver == 'mysql') { |
| 4381 | 4632 | $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
@@ -4622,7 +4873,9 @@ discard block |
||
| 4622 | 4873 | } |
| 4623 | 4874 | $query .= " GROUP BY spotter_output.airline_country |
| 4624 | 4875 | ORDER BY airline_country_count DESC"; |
| 4625 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4876 | + if ($limit) { |
|
| 4877 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4878 | + } |
|
| 4626 | 4879 | |
| 4627 | 4880 | $sth = $this->db->prepare($query); |
| 4628 | 4881 | $sth->execute($query_values); |
@@ -4650,7 +4903,9 @@ discard block |
||
| 4650 | 4903 | global $globalDBdriver; |
| 4651 | 4904 | //$filter_query = $this->getFilter($filters,true,true); |
| 4652 | 4905 | $Connection= new Connection($this->db); |
| 4653 | - if (!$Connection->tableExists('countries')) return array(); |
|
| 4906 | + if (!$Connection->tableExists('countries')) { |
|
| 4907 | + return array(); |
|
| 4908 | + } |
|
| 4654 | 4909 | /* |
| 4655 | 4910 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
| 4656 | 4911 | FROM countries c, spotter_output s |
@@ -4682,7 +4937,9 @@ discard block |
||
| 4682 | 4937 | } |
| 4683 | 4938 | $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 "; |
| 4684 | 4939 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
| 4685 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4940 | + if ($limit) { |
|
| 4941 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4942 | + } |
|
| 4686 | 4943 | |
| 4687 | 4944 | |
| 4688 | 4945 | $sth = $this->db->prepare($query); |
@@ -4759,7 +5016,9 @@ discard block |
||
| 4759 | 5016 | } |
| 4760 | 5017 | |
| 4761 | 5018 | $query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 4762 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5019 | + if ($limit) { |
|
| 5020 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5021 | + } |
|
| 4763 | 5022 | |
| 4764 | 5023 | $sth = $this->db->prepare($query); |
| 4765 | 5024 | $sth->execute($query_values); |
@@ -4833,7 +5092,9 @@ discard block |
||
| 4833 | 5092 | } |
| 4834 | 5093 | |
| 4835 | 5094 | $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"; |
| 4836 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5095 | + if ($limit) { |
|
| 5096 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5097 | + } |
|
| 4837 | 5098 | |
| 4838 | 5099 | $sth = $this->db->prepare($query); |
| 4839 | 5100 | $sth->execute($query_values); |
@@ -4880,7 +5141,9 @@ discard block |
||
| 4880 | 5141 | } |
| 4881 | 5142 | |
| 4882 | 5143 | $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"; |
| 4883 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5144 | + if ($limit) { |
|
| 5145 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5146 | + } |
|
| 4884 | 5147 | |
| 4885 | 5148 | $sth = $this->db->prepare($query); |
| 4886 | 5149 | $sth->execute(); |
@@ -4933,7 +5196,9 @@ discard block |
||
| 4933 | 5196 | if($row['registration'] != "") |
| 4934 | 5197 | { |
| 4935 | 5198 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4936 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5199 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5200 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5201 | + } |
|
| 4937 | 5202 | } |
| 4938 | 5203 | $temp_array['registration_count'] = $row['registration_count']; |
| 4939 | 5204 | |
@@ -5008,7 +5273,9 @@ discard block |
||
| 5008 | 5273 | if($row['registration'] != "") |
| 5009 | 5274 | { |
| 5010 | 5275 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5011 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5276 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5277 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5278 | + } |
|
| 5012 | 5279 | } |
| 5013 | 5280 | $temp_array['registration_count'] = $row['registration_count']; |
| 5014 | 5281 | |
@@ -5115,7 +5382,9 @@ discard block |
||
| 5115 | 5382 | if($row['registration'] != "") |
| 5116 | 5383 | { |
| 5117 | 5384 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5118 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5385 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5386 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5387 | + } |
|
| 5119 | 5388 | } |
| 5120 | 5389 | $temp_array['registration_count'] = $row['registration_count']; |
| 5121 | 5390 | $aircraft_array[] = $temp_array; |
@@ -5240,7 +5509,9 @@ discard block |
||
| 5240 | 5509 | date_default_timezone_set($globalTimezone); |
| 5241 | 5510 | $datetime = new DateTime($date); |
| 5242 | 5511 | $offset = $datetime->format('P'); |
| 5243 | - } else $offset = '+00:00'; |
|
| 5512 | + } else { |
|
| 5513 | + $offset = '+00:00'; |
|
| 5514 | + } |
|
| 5244 | 5515 | |
| 5245 | 5516 | if ($globalDBdriver == 'mysql') { |
| 5246 | 5517 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
@@ -5287,7 +5558,9 @@ discard block |
||
| 5287 | 5558 | date_default_timezone_set($globalTimezone); |
| 5288 | 5559 | $datetime = new DateTime($date); |
| 5289 | 5560 | $offset = $datetime->format('P'); |
| 5290 | - } else $offset = '+00:00'; |
|
| 5561 | + } else { |
|
| 5562 | + $offset = '+00:00'; |
|
| 5563 | + } |
|
| 5291 | 5564 | |
| 5292 | 5565 | if ($globalDBdriver == 'mysql') { |
| 5293 | 5566 | $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 |
@@ -5316,7 +5589,9 @@ discard block |
||
| 5316 | 5589 | if($row['registration'] != "") |
| 5317 | 5590 | { |
| 5318 | 5591 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5319 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5592 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5593 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5594 | + } |
|
| 5320 | 5595 | } |
| 5321 | 5596 | $temp_array['registration_count'] = $row['registration_count']; |
| 5322 | 5597 | |
@@ -5341,7 +5616,9 @@ discard block |
||
| 5341 | 5616 | date_default_timezone_set($globalTimezone); |
| 5342 | 5617 | $datetime = new DateTime($date); |
| 5343 | 5618 | $offset = $datetime->format('P'); |
| 5344 | - } else $offset = '+00:00'; |
|
| 5619 | + } else { |
|
| 5620 | + $offset = '+00:00'; |
|
| 5621 | + } |
|
| 5345 | 5622 | |
| 5346 | 5623 | if ($globalDBdriver == 'mysql') { |
| 5347 | 5624 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
@@ -5439,8 +5716,11 @@ discard block |
||
| 5439 | 5716 | if($row['registration'] != "") |
| 5440 | 5717 | { |
| 5441 | 5718 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5442 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5443 | - else $temp_array['image_thumbnail'] = ''; |
|
| 5719 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5720 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5721 | + } else { |
|
| 5722 | + $temp_array['image_thumbnail'] = ''; |
|
| 5723 | + } |
|
| 5444 | 5724 | } |
| 5445 | 5725 | $temp_array['registration_count'] = $row['registration_count']; |
| 5446 | 5726 | $aircraft_array[] = $temp_array; |
@@ -5547,7 +5827,9 @@ discard block |
||
| 5547 | 5827 | if($row['registration'] != "") |
| 5548 | 5828 | { |
| 5549 | 5829 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5550 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5830 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5831 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5832 | + } |
|
| 5551 | 5833 | } |
| 5552 | 5834 | $temp_array['registration_count'] = $row['registration_count']; |
| 5553 | 5835 | |
@@ -5664,7 +5946,9 @@ discard block |
||
| 5664 | 5946 | if($row['registration'] != "") |
| 5665 | 5947 | { |
| 5666 | 5948 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5667 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5949 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5950 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5951 | + } |
|
| 5668 | 5952 | } |
| 5669 | 5953 | $temp_array['registration_count'] = $row['registration_count']; |
| 5670 | 5954 | |
@@ -5830,7 +6114,9 @@ discard block |
||
| 5830 | 6114 | } |
| 5831 | 6115 | } |
| 5832 | 6116 | $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
| 5833 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6117 | + if ($limit) { |
|
| 6118 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6119 | + } |
|
| 5834 | 6120 | |
| 5835 | 6121 | $sth = $this->db->prepare($query); |
| 5836 | 6122 | $sth->execute($query_values); |
@@ -5849,7 +6135,9 @@ discard block |
||
| 5849 | 6135 | if($row['registration'] != "") |
| 5850 | 6136 | { |
| 5851 | 6137 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5852 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6138 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6139 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6140 | + } |
|
| 5853 | 6141 | } |
| 5854 | 6142 | |
| 5855 | 6143 | $aircraft_array[] = $temp_array; |
@@ -5890,7 +6178,9 @@ discard block |
||
| 5890 | 6178 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5891 | 6179 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5892 | 6180 | $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"; |
| 5893 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6181 | + if ($limit) { |
|
| 6182 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6183 | + } |
|
| 5894 | 6184 | |
| 5895 | 6185 | $sth = $this->db->prepare($query); |
| 5896 | 6186 | $sth->execute(); |
@@ -5910,7 +6200,9 @@ discard block |
||
| 5910 | 6200 | if($row['registration'] != "") |
| 5911 | 6201 | { |
| 5912 | 6202 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5913 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6203 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6204 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6205 | + } |
|
| 5914 | 6206 | } |
| 5915 | 6207 | |
| 5916 | 6208 | $aircraft_array[] = $temp_array; |
@@ -5976,7 +6268,9 @@ discard block |
||
| 5976 | 6268 | } |
| 5977 | 6269 | $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 5978 | 6270 | ORDER BY airport_departure_icao_count DESC"; |
| 5979 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6271 | + if ($limit) { |
|
| 6272 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6273 | + } |
|
| 5980 | 6274 | |
| 5981 | 6275 | $sth = $this->db->prepare($query); |
| 5982 | 6276 | $sth->execute($query_values); |
@@ -6027,7 +6321,9 @@ discard block |
||
| 6027 | 6321 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6028 | 6322 | $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 |
| 6029 | 6323 | ORDER BY airport_departure_icao_count DESC"; |
| 6030 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6324 | + if ($limit) { |
|
| 6325 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6326 | + } |
|
| 6031 | 6327 | |
| 6032 | 6328 | $sth = $this->db->prepare($query); |
| 6033 | 6329 | $sth->execute(); |
@@ -6105,7 +6401,9 @@ discard block |
||
| 6105 | 6401 | } |
| 6106 | 6402 | $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
| 6107 | 6403 | ORDER BY airport_departure_icao_count DESC"; |
| 6108 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6404 | + if ($limit) { |
|
| 6405 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6406 | + } |
|
| 6109 | 6407 | //echo $query; |
| 6110 | 6408 | $sth = $this->db->prepare($query); |
| 6111 | 6409 | $sth->execute($query_values); |
@@ -6157,7 +6455,9 @@ discard block |
||
| 6157 | 6455 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6158 | 6456 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
| 6159 | 6457 | ORDER BY airport_departure_icao_count DESC"; |
| 6160 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6458 | + if ($limit) { |
|
| 6459 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6460 | + } |
|
| 6161 | 6461 | |
| 6162 | 6462 | $sth = $this->db->prepare($query); |
| 6163 | 6463 | $sth->execute(); |
@@ -6552,7 +6852,9 @@ discard block |
||
| 6552 | 6852 | date_default_timezone_set($globalTimezone); |
| 6553 | 6853 | $datetime = new DateTime($date); |
| 6554 | 6854 | $offset = $datetime->format('P'); |
| 6555 | - } else $offset = '+00:00'; |
|
| 6855 | + } else { |
|
| 6856 | + $offset = '+00:00'; |
|
| 6857 | + } |
|
| 6556 | 6858 | |
| 6557 | 6859 | if ($globalDBdriver == 'mysql') { |
| 6558 | 6860 | $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 |
@@ -6602,7 +6904,9 @@ discard block |
||
| 6602 | 6904 | date_default_timezone_set($globalTimezone); |
| 6603 | 6905 | $datetime = new DateTime($date); |
| 6604 | 6906 | $offset = $datetime->format('P'); |
| 6605 | - } else $offset = '+00:00'; |
|
| 6907 | + } else { |
|
| 6908 | + $offset = '+00:00'; |
|
| 6909 | + } |
|
| 6606 | 6910 | |
| 6607 | 6911 | if ($globalDBdriver == 'mysql') { |
| 6608 | 6912 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
@@ -6840,7 +7144,9 @@ discard block |
||
| 6840 | 7144 | } |
| 6841 | 7145 | $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6842 | 7146 | ORDER BY airport_arrival_icao_count DESC"; |
| 6843 | - if ($limit) $query .= " LIMIT 10"; |
|
| 7147 | + if ($limit) { |
|
| 7148 | + $query .= " LIMIT 10"; |
|
| 7149 | + } |
|
| 6844 | 7150 | |
| 6845 | 7151 | |
| 6846 | 7152 | $sth = $this->db->prepare($query); |
@@ -6860,7 +7166,9 @@ discard block |
||
| 6860 | 7166 | if ($icaoaskey) { |
| 6861 | 7167 | $icao = $row['arrival_airport_icao']; |
| 6862 | 7168 | $airport_array[$icao] = $temp_array; |
| 6863 | - } else $airport_array[] = $temp_array; |
|
| 7169 | + } else { |
|
| 7170 | + $airport_array[] = $temp_array; |
|
| 7171 | + } |
|
| 6864 | 7172 | } |
| 6865 | 7173 | |
| 6866 | 7174 | return $airport_array; |
@@ -6897,7 +7205,9 @@ discard block |
||
| 6897 | 7205 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6898 | 7206 | $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 |
| 6899 | 7207 | ORDER BY airport_arrival_icao_count DESC"; |
| 6900 | - if ($limit) $query .= " LIMIT 10"; |
|
| 7208 | + if ($limit) { |
|
| 7209 | + $query .= " LIMIT 10"; |
|
| 7210 | + } |
|
| 6901 | 7211 | |
| 6902 | 7212 | |
| 6903 | 7213 | $sth = $this->db->prepare($query); |
@@ -6918,7 +7228,9 @@ discard block |
||
| 6918 | 7228 | if ($icaoaskey) { |
| 6919 | 7229 | $icao = $row['arrival_airport_icao']; |
| 6920 | 7230 | $airport_array[$icao] = $temp_array; |
| 6921 | - } else $airport_array[] = $temp_array; |
|
| 7231 | + } else { |
|
| 7232 | + $airport_array[] = $temp_array; |
|
| 7233 | + } |
|
| 6922 | 7234 | } |
| 6923 | 7235 | |
| 6924 | 7236 | return $airport_array; |
@@ -6981,7 +7293,9 @@ discard block |
||
| 6981 | 7293 | } |
| 6982 | 7294 | $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
| 6983 | 7295 | ORDER BY airport_arrival_icao_count DESC"; |
| 6984 | - if ($limit) $query .= " LIMIT 10"; |
|
| 7296 | + if ($limit) { |
|
| 7297 | + $query .= " LIMIT 10"; |
|
| 7298 | + } |
|
| 6985 | 7299 | |
| 6986 | 7300 | |
| 6987 | 7301 | $sth = $this->db->prepare($query); |
@@ -7000,7 +7314,9 @@ discard block |
||
| 7000 | 7314 | if ($icaoaskey) { |
| 7001 | 7315 | $icao = $row['arrival_airport_icao']; |
| 7002 | 7316 | $airport_array[$icao] = $temp_array; |
| 7003 | - } else $airport_array[] = $temp_array; |
|
| 7317 | + } else { |
|
| 7318 | + $airport_array[] = $temp_array; |
|
| 7319 | + } |
|
| 7004 | 7320 | } |
| 7005 | 7321 | |
| 7006 | 7322 | return $airport_array; |
@@ -7037,7 +7353,9 @@ discard block |
||
| 7037 | 7353 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 7038 | 7354 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
| 7039 | 7355 | ORDER BY airport_arrival_icao_count DESC"; |
| 7040 | - if ($limit) $query .= " LIMIT 10"; |
|
| 7356 | + if ($limit) { |
|
| 7357 | + $query .= " LIMIT 10"; |
|
| 7358 | + } |
|
| 7041 | 7359 | |
| 7042 | 7360 | |
| 7043 | 7361 | $sth = $this->db->prepare($query); |
@@ -7058,7 +7376,9 @@ discard block |
||
| 7058 | 7376 | if ($icaoaskey) { |
| 7059 | 7377 | $icao = $row['arrival_airport_icao']; |
| 7060 | 7378 | $airport_array[$icao] = $temp_array; |
| 7061 | - } else $airport_array[] = $temp_array; |
|
| 7379 | + } else { |
|
| 7380 | + $airport_array[] = $temp_array; |
|
| 7381 | + } |
|
| 7062 | 7382 | } |
| 7063 | 7383 | |
| 7064 | 7384 | return $airport_array; |
@@ -7439,7 +7759,9 @@ discard block |
||
| 7439 | 7759 | date_default_timezone_set($globalTimezone); |
| 7440 | 7760 | $datetime = new DateTime($date); |
| 7441 | 7761 | $offset = $datetime->format('P'); |
| 7442 | - } else $offset = '+00:00'; |
|
| 7762 | + } else { |
|
| 7763 | + $offset = '+00:00'; |
|
| 7764 | + } |
|
| 7443 | 7765 | |
| 7444 | 7766 | if ($globalDBdriver == 'mysql') { |
| 7445 | 7767 | $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 |
@@ -7489,7 +7811,9 @@ discard block |
||
| 7489 | 7811 | date_default_timezone_set($globalTimezone); |
| 7490 | 7812 | $datetime = new DateTime($date); |
| 7491 | 7813 | $offset = $datetime->format('P'); |
| 7492 | - } else $offset = '+00:00'; |
|
| 7814 | + } else { |
|
| 7815 | + $offset = '+00:00'; |
|
| 7816 | + } |
|
| 7493 | 7817 | |
| 7494 | 7818 | if ($globalDBdriver == 'mysql') { |
| 7495 | 7819 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
@@ -7771,7 +8095,9 @@ discard block |
||
| 7771 | 8095 | } |
| 7772 | 8096 | $query .= " GROUP BY spotter_output.arrival_airport_country |
| 7773 | 8097 | ORDER BY airport_arrival_country_count DESC"; |
| 7774 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 8098 | + if ($limit) { |
|
| 8099 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 8100 | + } |
|
| 7775 | 8101 | |
| 7776 | 8102 | |
| 7777 | 8103 | $sth = $this->db->prepare($query); |
@@ -8058,7 +8384,9 @@ discard block |
||
| 8058 | 8384 | date_default_timezone_set($globalTimezone); |
| 8059 | 8385 | $datetime = new DateTime($date); |
| 8060 | 8386 | $offset = $datetime->format('P'); |
| 8061 | - } else $offset = '+00:00'; |
|
| 8387 | + } else { |
|
| 8388 | + $offset = '+00:00'; |
|
| 8389 | + } |
|
| 8062 | 8390 | |
| 8063 | 8391 | if ($globalDBdriver == 'mysql') { |
| 8064 | 8392 | $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 |
@@ -8234,12 +8562,18 @@ discard block |
||
| 8234 | 8562 | $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
| 8235 | 8563 | FROM spotter_output".$filter_query." spotter_output.ident <> '' "; |
| 8236 | 8564 | if ($olderthanmonths > 0) { |
| 8237 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 8238 | - else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 8565 | + if ($globalDBdriver == 'mysql') { |
|
| 8566 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 8567 | + } else { |
|
| 8568 | + $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 8569 | + } |
|
| 8239 | 8570 | } |
| 8240 | 8571 | if ($sincedate != '') { |
| 8241 | - if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 8242 | - else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 8572 | + if ($globalDBdriver == 'mysql') { |
|
| 8573 | + $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 8574 | + } else { |
|
| 8575 | + $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 8576 | + } |
|
| 8243 | 8577 | } |
| 8244 | 8578 | $query_values = array(); |
| 8245 | 8579 | if ($year != '') { |
@@ -8270,7 +8604,9 @@ discard block |
||
| 8270 | 8604 | } |
| 8271 | 8605 | } |
| 8272 | 8606 | $query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 8273 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 8607 | + if ($limit) { |
|
| 8608 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 8609 | + } |
|
| 8274 | 8610 | |
| 8275 | 8611 | $sth = $this->db->prepare($query); |
| 8276 | 8612 | $sth->execute($query_values); |
@@ -8304,15 +8640,23 @@ discard block |
||
| 8304 | 8640 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
| 8305 | 8641 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
| 8306 | 8642 | if ($olderthanmonths > 0) { |
| 8307 | - if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 8308 | - else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 8643 | + if ($globalDBdriver == 'mysql') { |
|
| 8644 | + $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 8645 | + } else { |
|
| 8646 | + $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 8647 | + } |
|
| 8309 | 8648 | } |
| 8310 | 8649 | if ($sincedate != '') { |
| 8311 | - if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 8312 | - else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 8650 | + if ($globalDBdriver == 'mysql') { |
|
| 8651 | + $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 8652 | + } else { |
|
| 8653 | + $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 8654 | + } |
|
| 8313 | 8655 | } |
| 8314 | 8656 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 8315 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 8657 | + if ($limit) { |
|
| 8658 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 8659 | + } |
|
| 8316 | 8660 | |
| 8317 | 8661 | $sth = $this->db->prepare($query); |
| 8318 | 8662 | $sth->execute(); |
@@ -8349,7 +8693,9 @@ discard block |
||
| 8349 | 8693 | date_default_timezone_set($globalTimezone); |
| 8350 | 8694 | $datetime = new DateTime(); |
| 8351 | 8695 | $offset = $datetime->format('P'); |
| 8352 | - } else $offset = '+00:00'; |
|
| 8696 | + } else { |
|
| 8697 | + $offset = '+00:00'; |
|
| 8698 | + } |
|
| 8353 | 8699 | |
| 8354 | 8700 | if ($globalDBdriver == 'mysql') { |
| 8355 | 8701 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8398,7 +8744,9 @@ discard block |
||
| 8398 | 8744 | date_default_timezone_set($globalTimezone); |
| 8399 | 8745 | $datetime = new DateTime(); |
| 8400 | 8746 | $offset = $datetime->format('P'); |
| 8401 | - } else $offset = '+00:00'; |
|
| 8747 | + } else { |
|
| 8748 | + $offset = '+00:00'; |
|
| 8749 | + } |
|
| 8402 | 8750 | $filter_query = $this->getFilter($filters,true,true); |
| 8403 | 8751 | if ($globalDBdriver == 'mysql') { |
| 8404 | 8752 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8447,7 +8795,9 @@ discard block |
||
| 8447 | 8795 | date_default_timezone_set($globalTimezone); |
| 8448 | 8796 | $datetime = new DateTime(); |
| 8449 | 8797 | $offset = $datetime->format('P'); |
| 8450 | - } else $offset = '+00:00'; |
|
| 8798 | + } else { |
|
| 8799 | + $offset = '+00:00'; |
|
| 8800 | + } |
|
| 8451 | 8801 | $filter_query = $this->getFilter($filters,true,true); |
| 8452 | 8802 | if ($globalDBdriver == 'mysql') { |
| 8453 | 8803 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8493,7 +8843,9 @@ discard block |
||
| 8493 | 8843 | date_default_timezone_set($globalTimezone); |
| 8494 | 8844 | $datetime = new DateTime(); |
| 8495 | 8845 | $offset = $datetime->format('P'); |
| 8496 | - } else $offset = '+00:00'; |
|
| 8846 | + } else { |
|
| 8847 | + $offset = '+00:00'; |
|
| 8848 | + } |
|
| 8497 | 8849 | $filter_query = $this->getFilter($filters,true,true); |
| 8498 | 8850 | if ($globalDBdriver == 'mysql') { |
| 8499 | 8851 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8541,7 +8893,9 @@ discard block |
||
| 8541 | 8893 | date_default_timezone_set($globalTimezone); |
| 8542 | 8894 | $datetime = new DateTime(); |
| 8543 | 8895 | $offset = $datetime->format('P'); |
| 8544 | - } else $offset = '+00:00'; |
|
| 8896 | + } else { |
|
| 8897 | + $offset = '+00:00'; |
|
| 8898 | + } |
|
| 8545 | 8899 | |
| 8546 | 8900 | if ($globalDBdriver == 'mysql') { |
| 8547 | 8901 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8589,7 +8943,9 @@ discard block |
||
| 8589 | 8943 | date_default_timezone_set($globalTimezone); |
| 8590 | 8944 | $datetime = new DateTime(); |
| 8591 | 8945 | $offset = $datetime->format('P'); |
| 8592 | - } else $offset = '+00:00'; |
|
| 8946 | + } else { |
|
| 8947 | + $offset = '+00:00'; |
|
| 8948 | + } |
|
| 8593 | 8949 | |
| 8594 | 8950 | if ($globalDBdriver == 'mysql') { |
| 8595 | 8951 | $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 |
@@ -8636,7 +8992,9 @@ discard block |
||
| 8636 | 8992 | date_default_timezone_set($globalTimezone); |
| 8637 | 8993 | $datetime = new DateTime(); |
| 8638 | 8994 | $offset = $datetime->format('P'); |
| 8639 | - } else $offset = '+00:00'; |
|
| 8995 | + } else { |
|
| 8996 | + $offset = '+00:00'; |
|
| 8997 | + } |
|
| 8640 | 8998 | |
| 8641 | 8999 | if ($globalDBdriver == 'mysql') { |
| 8642 | 9000 | $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 |
@@ -8684,7 +9042,9 @@ discard block |
||
| 8684 | 9042 | date_default_timezone_set($globalTimezone); |
| 8685 | 9043 | $datetime = new DateTime(); |
| 8686 | 9044 | $offset = $datetime->format('P'); |
| 8687 | - } else $offset = '+00:00'; |
|
| 9045 | + } else { |
|
| 9046 | + $offset = '+00:00'; |
|
| 9047 | + } |
|
| 8688 | 9048 | $filter_query = $this->getFilter($filters,true,true); |
| 8689 | 9049 | if ($globalDBdriver == 'mysql') { |
| 8690 | 9050 | $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 |
@@ -8729,7 +9089,9 @@ discard block |
||
| 8729 | 9089 | date_default_timezone_set($globalTimezone); |
| 8730 | 9090 | $datetime = new DateTime(); |
| 8731 | 9091 | $offset = $datetime->format('P'); |
| 8732 | - } else $offset = '+00:00'; |
|
| 9092 | + } else { |
|
| 9093 | + $offset = '+00:00'; |
|
| 9094 | + } |
|
| 8733 | 9095 | $filter_query = $this->getFilter($filters,true,true); |
| 8734 | 9096 | |
| 8735 | 9097 | if ($globalDBdriver == 'mysql') { |
@@ -8776,7 +9138,9 @@ discard block |
||
| 8776 | 9138 | date_default_timezone_set($globalTimezone); |
| 8777 | 9139 | $datetime = new DateTime(); |
| 8778 | 9140 | $offset = $datetime->format('P'); |
| 8779 | - } else $offset = '+00:00'; |
|
| 9141 | + } else { |
|
| 9142 | + $offset = '+00:00'; |
|
| 9143 | + } |
|
| 8780 | 9144 | |
| 8781 | 9145 | if ($globalDBdriver == 'mysql') { |
| 8782 | 9146 | $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 |
@@ -8822,7 +9186,9 @@ discard block |
||
| 8822 | 9186 | date_default_timezone_set($globalTimezone); |
| 8823 | 9187 | $datetime = new DateTime(); |
| 8824 | 9188 | $offset = $datetime->format('P'); |
| 8825 | - } else $offset = '+00:00'; |
|
| 9189 | + } else { |
|
| 9190 | + $offset = '+00:00'; |
|
| 9191 | + } |
|
| 8826 | 9192 | $filter_query = $this->getFilter($filters,true,true); |
| 8827 | 9193 | |
| 8828 | 9194 | if ($globalDBdriver == 'mysql') { |
@@ -8869,7 +9235,9 @@ discard block |
||
| 8869 | 9235 | date_default_timezone_set($globalTimezone); |
| 8870 | 9236 | $datetime = new DateTime(); |
| 8871 | 9237 | $offset = $datetime->format('P'); |
| 8872 | - } else $offset = '+00:00'; |
|
| 9238 | + } else { |
|
| 9239 | + $offset = '+00:00'; |
|
| 9240 | + } |
|
| 8873 | 9241 | |
| 8874 | 9242 | if ($globalDBdriver == 'mysql') { |
| 8875 | 9243 | $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 |
@@ -8916,7 +9284,9 @@ discard block |
||
| 8916 | 9284 | date_default_timezone_set($globalTimezone); |
| 8917 | 9285 | $datetime = new DateTime(); |
| 8918 | 9286 | $offset = $datetime->format('P'); |
| 8919 | - } else $offset = '+00:00'; |
|
| 9287 | + } else { |
|
| 9288 | + $offset = '+00:00'; |
|
| 9289 | + } |
|
| 8920 | 9290 | |
| 8921 | 9291 | if ($globalDBdriver == 'mysql') { |
| 8922 | 9292 | $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 |
@@ -8961,7 +9331,9 @@ discard block |
||
| 8961 | 9331 | date_default_timezone_set($globalTimezone); |
| 8962 | 9332 | $datetime = new DateTime(); |
| 8963 | 9333 | $offset = $datetime->format('P'); |
| 8964 | - } else $offset = '+00:00'; |
|
| 9334 | + } else { |
|
| 9335 | + $offset = '+00:00'; |
|
| 9336 | + } |
|
| 8965 | 9337 | $filter_query = $this->getFilter($filters,true,true); |
| 8966 | 9338 | |
| 8967 | 9339 | if ($globalDBdriver == 'mysql') { |
@@ -9009,7 +9381,9 @@ discard block |
||
| 9009 | 9381 | date_default_timezone_set($globalTimezone); |
| 9010 | 9382 | $datetime = new DateTime(); |
| 9011 | 9383 | $offset = $datetime->format('P'); |
| 9012 | - } else $offset = '+00:00'; |
|
| 9384 | + } else { |
|
| 9385 | + $offset = '+00:00'; |
|
| 9386 | + } |
|
| 9013 | 9387 | |
| 9014 | 9388 | if ($globalDBdriver == 'mysql') { |
| 9015 | 9389 | $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 |
@@ -9055,7 +9429,9 @@ discard block |
||
| 9055 | 9429 | date_default_timezone_set($globalTimezone); |
| 9056 | 9430 | $datetime = new DateTime(); |
| 9057 | 9431 | $offset = $datetime->format('P'); |
| 9058 | - } else $offset = '+00:00'; |
|
| 9432 | + } else { |
|
| 9433 | + $offset = '+00:00'; |
|
| 9434 | + } |
|
| 9059 | 9435 | $filter_query = $this->getFilter($filters,true,true); |
| 9060 | 9436 | |
| 9061 | 9437 | if ($globalDBdriver == 'mysql') { |
@@ -9103,7 +9479,9 @@ discard block |
||
| 9103 | 9479 | date_default_timezone_set($globalTimezone); |
| 9104 | 9480 | $datetime = new DateTime(); |
| 9105 | 9481 | $offset = $datetime->format('P'); |
| 9106 | - } else $offset = '+00:00'; |
|
| 9482 | + } else { |
|
| 9483 | + $offset = '+00:00'; |
|
| 9484 | + } |
|
| 9107 | 9485 | |
| 9108 | 9486 | if ($globalDBdriver == 'mysql') { |
| 9109 | 9487 | $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 |
@@ -9150,7 +9528,9 @@ discard block |
||
| 9150 | 9528 | date_default_timezone_set($globalTimezone); |
| 9151 | 9529 | $datetime = new DateTime(); |
| 9152 | 9530 | $offset = $datetime->format('P'); |
| 9153 | - } else $offset = '+00:00'; |
|
| 9531 | + } else { |
|
| 9532 | + $offset = '+00:00'; |
|
| 9533 | + } |
|
| 9154 | 9534 | $filter_query = $this->getFilter($filters,true,true); |
| 9155 | 9535 | if ($globalDBdriver == 'mysql') { |
| 9156 | 9536 | $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 |
@@ -9199,7 +9579,9 @@ discard block |
||
| 9199 | 9579 | date_default_timezone_set($globalTimezone); |
| 9200 | 9580 | $datetime = new DateTime(); |
| 9201 | 9581 | $offset = $datetime->format('P'); |
| 9202 | - } else $offset = '+00:00'; |
|
| 9582 | + } else { |
|
| 9583 | + $offset = '+00:00'; |
|
| 9584 | + } |
|
| 9203 | 9585 | |
| 9204 | 9586 | $orderby_sql = ''; |
| 9205 | 9587 | if ($orderby == "hour") |
@@ -9265,7 +9647,9 @@ discard block |
||
| 9265 | 9647 | date_default_timezone_set($globalTimezone); |
| 9266 | 9648 | $datetime = new DateTime(); |
| 9267 | 9649 | $offset = $datetime->format('P'); |
| 9268 | - } else $offset = '+00:00'; |
|
| 9650 | + } else { |
|
| 9651 | + $offset = '+00:00'; |
|
| 9652 | + } |
|
| 9269 | 9653 | |
| 9270 | 9654 | $orderby_sql = ''; |
| 9271 | 9655 | if ($orderby == "hour") |
@@ -9332,7 +9716,9 @@ discard block |
||
| 9332 | 9716 | date_default_timezone_set($globalTimezone); |
| 9333 | 9717 | $datetime = new DateTime(); |
| 9334 | 9718 | $offset = $datetime->format('P'); |
| 9335 | - } else $offset = '+00:00'; |
|
| 9719 | + } else { |
|
| 9720 | + $offset = '+00:00'; |
|
| 9721 | + } |
|
| 9336 | 9722 | |
| 9337 | 9723 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
| 9338 | 9724 | |
@@ -9383,7 +9769,9 @@ discard block |
||
| 9383 | 9769 | date_default_timezone_set($globalTimezone); |
| 9384 | 9770 | $datetime = new DateTime(); |
| 9385 | 9771 | $offset = $datetime->format('P'); |
| 9386 | - } else $offset = '+00:00'; |
|
| 9772 | + } else { |
|
| 9773 | + $offset = '+00:00'; |
|
| 9774 | + } |
|
| 9387 | 9775 | |
| 9388 | 9776 | if ($globalDBdriver == 'mysql') { |
| 9389 | 9777 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9430,7 +9818,9 @@ discard block |
||
| 9430 | 9818 | date_default_timezone_set($globalTimezone); |
| 9431 | 9819 | $datetime = new DateTime(); |
| 9432 | 9820 | $offset = $datetime->format('P'); |
| 9433 | - } else $offset = '+00:00'; |
|
| 9821 | + } else { |
|
| 9822 | + $offset = '+00:00'; |
|
| 9823 | + } |
|
| 9434 | 9824 | |
| 9435 | 9825 | if ($globalDBdriver == 'mysql') { |
| 9436 | 9826 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9477,7 +9867,9 @@ discard block |
||
| 9477 | 9867 | date_default_timezone_set($globalTimezone); |
| 9478 | 9868 | $datetime = new DateTime(); |
| 9479 | 9869 | $offset = $datetime->format('P'); |
| 9480 | - } else $offset = '+00:00'; |
|
| 9870 | + } else { |
|
| 9871 | + $offset = '+00:00'; |
|
| 9872 | + } |
|
| 9481 | 9873 | |
| 9482 | 9874 | if ($globalDBdriver == 'mysql') { |
| 9483 | 9875 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9525,7 +9917,9 @@ discard block |
||
| 9525 | 9917 | date_default_timezone_set($globalTimezone); |
| 9526 | 9918 | $datetime = new DateTime(); |
| 9527 | 9919 | $offset = $datetime->format('P'); |
| 9528 | - } else $offset = '+00:00'; |
|
| 9920 | + } else { |
|
| 9921 | + $offset = '+00:00'; |
|
| 9922 | + } |
|
| 9529 | 9923 | |
| 9530 | 9924 | if ($globalDBdriver == 'mysql') { |
| 9531 | 9925 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9573,7 +9967,9 @@ discard block |
||
| 9573 | 9967 | date_default_timezone_set($globalTimezone); |
| 9574 | 9968 | $datetime = new DateTime($date); |
| 9575 | 9969 | $offset = $datetime->format('P'); |
| 9576 | - } else $offset = '+00:00'; |
|
| 9970 | + } else { |
|
| 9971 | + $offset = '+00:00'; |
|
| 9972 | + } |
|
| 9577 | 9973 | |
| 9578 | 9974 | if ($globalDBdriver == 'mysql') { |
| 9579 | 9975 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9621,7 +10017,9 @@ discard block |
||
| 9621 | 10017 | date_default_timezone_set($globalTimezone); |
| 9622 | 10018 | $datetime = new DateTime(); |
| 9623 | 10019 | $offset = $datetime->format('P'); |
| 9624 | - } else $offset = '+00:00'; |
|
| 10020 | + } else { |
|
| 10021 | + $offset = '+00:00'; |
|
| 10022 | + } |
|
| 9625 | 10023 | |
| 9626 | 10024 | if ($globalDBdriver == 'mysql') { |
| 9627 | 10025 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9671,7 +10069,9 @@ discard block |
||
| 9671 | 10069 | date_default_timezone_set($globalTimezone); |
| 9672 | 10070 | $datetime = new DateTime(); |
| 9673 | 10071 | $offset = $datetime->format('P'); |
| 9674 | - } else $offset = '+00:00'; |
|
| 10072 | + } else { |
|
| 10073 | + $offset = '+00:00'; |
|
| 10074 | + } |
|
| 9675 | 10075 | |
| 9676 | 10076 | if ($globalDBdriver == 'mysql') { |
| 9677 | 10077 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9718,7 +10118,9 @@ discard block |
||
| 9718 | 10118 | date_default_timezone_set($globalTimezone); |
| 9719 | 10119 | $datetime = new DateTime(); |
| 9720 | 10120 | $offset = $datetime->format('P'); |
| 9721 | - } else $offset = '+00:00'; |
|
| 10121 | + } else { |
|
| 10122 | + $offset = '+00:00'; |
|
| 10123 | + } |
|
| 9722 | 10124 | |
| 9723 | 10125 | if ($globalDBdriver == 'mysql') { |
| 9724 | 10126 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9928,8 +10330,11 @@ discard block |
||
| 9928 | 10330 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 9929 | 10331 | } |
| 9930 | 10332 | } |
| 9931 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
| 9932 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 10333 | + if (empty($query_values)) { |
|
| 10334 | + $queryi .= $this->getFilter($filters); |
|
| 10335 | + } else { |
|
| 10336 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 10337 | + } |
|
| 9933 | 10338 | |
| 9934 | 10339 | //echo $query; |
| 9935 | 10340 | $sth = $this->db->prepare($queryi); |
@@ -10008,8 +10413,11 @@ discard block |
||
| 10008 | 10413 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 10009 | 10414 | } |
| 10010 | 10415 | } |
| 10011 | - if ($query == '') $queryi .= $this->getFilter($filters); |
|
| 10012 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 10416 | + if ($query == '') { |
|
| 10417 | + $queryi .= $this->getFilter($filters); |
|
| 10418 | + } else { |
|
| 10419 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 10420 | + } |
|
| 10013 | 10421 | |
| 10014 | 10422 | |
| 10015 | 10423 | $sth = $this->db->prepare($queryi); |
@@ -10032,7 +10440,9 @@ discard block |
||
| 10032 | 10440 | date_default_timezone_set($globalTimezone); |
| 10033 | 10441 | $datetime = new DateTime(); |
| 10034 | 10442 | $offset = $datetime->format('P'); |
| 10035 | - } else $offset = '+00:00'; |
|
| 10443 | + } else { |
|
| 10444 | + $offset = '+00:00'; |
|
| 10445 | + } |
|
| 10036 | 10446 | |
| 10037 | 10447 | if ($globalDBdriver == 'mysql') { |
| 10038 | 10448 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10218,7 +10628,9 @@ discard block |
||
| 10218 | 10628 | */ |
| 10219 | 10629 | public function parseDirection($direction = 0) |
| 10220 | 10630 | { |
| 10221 | - if ($direction == '') $direction = 0; |
|
| 10631 | + if ($direction == '') { |
|
| 10632 | + $direction = 0; |
|
| 10633 | + } |
|
| 10222 | 10634 | $direction_array = array(); |
| 10223 | 10635 | $temp_array = array(); |
| 10224 | 10636 | |
@@ -10319,7 +10731,9 @@ discard block |
||
| 10319 | 10731 | if (isset($result->AirlineFlightInfoResult)) |
| 10320 | 10732 | { |
| 10321 | 10733 | $registration = $result->AirlineFlightInfoResult->tailnumber; |
| 10322 | - } else return ''; |
|
| 10734 | + } else { |
|
| 10735 | + return ''; |
|
| 10736 | + } |
|
| 10323 | 10737 | |
| 10324 | 10738 | $registration = $this->convertAircraftRegistration($registration); |
| 10325 | 10739 | |
@@ -10348,7 +10762,9 @@ discard block |
||
| 10348 | 10762 | if (count($row) > 0) { |
| 10349 | 10763 | //return $row['Registration']; |
| 10350 | 10764 | return $row['registration']; |
| 10351 | - } else return ''; |
|
| 10765 | + } else { |
|
| 10766 | + return ''; |
|
| 10767 | + } |
|
| 10352 | 10768 | |
| 10353 | 10769 | } |
| 10354 | 10770 | |
@@ -10371,9 +10787,14 @@ discard block |
||
| 10371 | 10787 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 10372 | 10788 | $sth->closeCursor(); |
| 10373 | 10789 | if (count($row) > 0) { |
| 10374 | - if ($row['type_flight'] == null) return ''; |
|
| 10375 | - else return $row['type_flight']; |
|
| 10376 | - } else return ''; |
|
| 10790 | + if ($row['type_flight'] == null) { |
|
| 10791 | + return ''; |
|
| 10792 | + } else { |
|
| 10793 | + return $row['type_flight']; |
|
| 10794 | + } |
|
| 10795 | + } else { |
|
| 10796 | + return ''; |
|
| 10797 | + } |
|
| 10377 | 10798 | |
| 10378 | 10799 | } |
| 10379 | 10800 | |
@@ -10391,7 +10812,9 @@ discard block |
||
| 10391 | 10812 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 10392 | 10813 | |
| 10393 | 10814 | $Connection = new Connection($this->db); |
| 10394 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 10815 | + if (!$Connection->tableExists('countries')) { |
|
| 10816 | + return ''; |
|
| 10817 | + } |
|
| 10395 | 10818 | |
| 10396 | 10819 | try { |
| 10397 | 10820 | /* |
@@ -10411,9 +10834,13 @@ discard block |
||
| 10411 | 10834 | $sth->closeCursor(); |
| 10412 | 10835 | if (count($row) > 0) { |
| 10413 | 10836 | return $row; |
| 10414 | - } else return ''; |
|
| 10837 | + } else { |
|
| 10838 | + return ''; |
|
| 10839 | + } |
|
| 10415 | 10840 | } catch (PDOException $e) { |
| 10416 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 10841 | + if (isset($globalDebug) && $globalDebug) { |
|
| 10842 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 10843 | + } |
|
| 10417 | 10844 | return ''; |
| 10418 | 10845 | } |
| 10419 | 10846 | |
@@ -10431,7 +10858,9 @@ discard block |
||
| 10431 | 10858 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
| 10432 | 10859 | |
| 10433 | 10860 | $Connection = new Connection($this->db); |
| 10434 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 10861 | + if (!$Connection->tableExists('countries')) { |
|
| 10862 | + return ''; |
|
| 10863 | + } |
|
| 10435 | 10864 | |
| 10436 | 10865 | try { |
| 10437 | 10866 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -10443,9 +10872,13 @@ discard block |
||
| 10443 | 10872 | $sth->closeCursor(); |
| 10444 | 10873 | if (count($row) > 0) { |
| 10445 | 10874 | return $row; |
| 10446 | - } else return ''; |
|
| 10875 | + } else { |
|
| 10876 | + return ''; |
|
| 10877 | + } |
|
| 10447 | 10878 | } catch (PDOException $e) { |
| 10448 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 10879 | + if (isset($globalDebug) && $globalDebug) { |
|
| 10880 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 10881 | + } |
|
| 10449 | 10882 | return ''; |
| 10450 | 10883 | } |
| 10451 | 10884 | |
@@ -10695,7 +11128,9 @@ discard block |
||
| 10695 | 11128 | { |
| 10696 | 11129 | global $globalBitlyAccessToken; |
| 10697 | 11130 | |
| 10698 | - if ($globalBitlyAccessToken == '') return $url; |
|
| 11131 | + if ($globalBitlyAccessToken == '') { |
|
| 11132 | + return $url; |
|
| 11133 | + } |
|
| 10699 | 11134 | |
| 10700 | 11135 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
| 10701 | 11136 | |
@@ -10844,7 +11279,9 @@ discard block |
||
| 10844 | 11279 | |
| 10845 | 11280 | |
| 10846 | 11281 | // routes |
| 10847 | - if ($globalDebug) print "Routes...\n"; |
|
| 11282 | + if ($globalDebug) { |
|
| 11283 | + print "Routes...\n"; |
|
| 11284 | + } |
|
| 10848 | 11285 | if ($globalDBdriver == 'mysql') { |
| 10849 | 11286 | $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)"; |
| 10850 | 11287 | } else { |
@@ -10863,7 +11300,9 @@ discard block |
||
| 10863 | 11300 | } |
| 10864 | 11301 | } |
| 10865 | 11302 | |
| 10866 | - if ($globalDebug) print "Airlines...\n"; |
|
| 11303 | + if ($globalDebug) { |
|
| 11304 | + print "Airlines...\n"; |
|
| 11305 | + } |
|
| 10867 | 11306 | //airlines |
| 10868 | 11307 | if ($globalDBdriver == 'mysql') { |
| 10869 | 11308 | $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)"; |
@@ -10877,10 +11316,15 @@ discard block |
||
| 10877 | 11316 | if (is_numeric(substr($row['ident'], -1, 1))) |
| 10878 | 11317 | { |
| 10879 | 11318 | $fromsource = NULL; |
| 10880 | - if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 10881 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 10882 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 10883 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 11319 | + if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 11320 | + $fromsource = 'vatsim'; |
|
| 11321 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 11322 | + $fromsource = 'ivao'; |
|
| 11323 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 11324 | + $fromsource = 'vatsim'; |
|
| 11325 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 11326 | + $fromsource = 'ivao'; |
|
| 11327 | + } |
|
| 10884 | 11328 | $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
| 10885 | 11329 | if (isset($airline_array[0]['name'])) { |
| 10886 | 11330 | $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"; |
@@ -10890,13 +11334,17 @@ discard block |
||
| 10890 | 11334 | } |
| 10891 | 11335 | } |
| 10892 | 11336 | |
| 10893 | - if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n"; |
|
| 11337 | + if ($globalDebug) { |
|
| 11338 | + print "Remove Duplicate in aircraft_modes...\n"; |
|
| 11339 | + } |
|
| 10894 | 11340 | //duplicate modes |
| 10895 | 11341 | $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"; |
| 10896 | 11342 | $sth = $this->db->prepare($query); |
| 10897 | 11343 | $sth->execute(); |
| 10898 | 11344 | |
| 10899 | - if ($globalDebug) print "Aircraft...\n"; |
|
| 11345 | + if ($globalDebug) { |
|
| 11346 | + print "Aircraft...\n"; |
|
| 11347 | + } |
|
| 10900 | 11348 | //aircraft |
| 10901 | 11349 | if ($globalDBdriver == 'mysql') { |
| 10902 | 11350 | $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)"; |
@@ -10939,26 +11387,38 @@ discard block |
||
| 10939 | 11387 | if (isset($closestAirports[0])) { |
| 10940 | 11388 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
| 10941 | 11389 | $airport_icao = $closestAirports[0]['icao']; |
| 10942 | - if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 11390 | + if ($globalDebug) { |
|
| 11391 | + echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 11392 | + } |
|
| 10943 | 11393 | } elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') { |
| 10944 | 11394 | foreach ($closestAirports as $airport) { |
| 10945 | 11395 | if ($row['arrival_airport_icao'] == $airport['icao']) { |
| 10946 | 11396 | $airport_icao = $airport['icao']; |
| 10947 | - if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 11397 | + if ($globalDebug) { |
|
| 11398 | + echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 11399 | + } |
|
| 10948 | 11400 | break; |
| 10949 | 11401 | } |
| 10950 | 11402 | } |
| 10951 | 11403 | } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
| 10952 | 11404 | $airport_icao = $closestAirports[0]['icao']; |
| 10953 | - 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"; |
|
| 11405 | + if ($globalDebug) { |
|
| 11406 | + 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"; |
|
| 11407 | + } |
|
| 10954 | 11408 | } else { |
| 10955 | - 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"; |
|
| 11409 | + if ($globalDebug) { |
|
| 11410 | + 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"; |
|
| 11411 | + } |
|
| 10956 | 11412 | } |
| 10957 | 11413 | } else { |
| 10958 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 11414 | + if ($globalDebug) { |
|
| 11415 | + echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 11416 | + } |
|
| 10959 | 11417 | } |
| 10960 | 11418 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
| 10961 | - if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
|
| 11419 | + if ($globalDebug) { |
|
| 11420 | + echo "Updating airport to ".$airport_icao."...\n"; |
|
| 11421 | + } |
|
| 10962 | 11422 | $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
| 10963 | 11423 | $sthu = $this->db->prepare($update_query); |
| 10964 | 11424 | $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
@@ -6,19 +6,19 @@ discard block |
||
| 6 | 6 | $title = _("Statistics").' - '._("Most common Departure Airport by Country"); |
| 7 | 7 | |
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 10 | 10 | if ($airline_icao == 'all') { |
| 11 | 11 | unset($_COOKIE['stats_airline_icao']); |
| 12 | - setcookie('stats_airline_icao', '', time()-3600); |
|
| 12 | + setcookie('stats_airline_icao', '', time() - 3600); |
|
| 13 | 13 | $airline_icao = ''; |
| 14 | 14 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | 15 | $airline_icao = $_COOKIE['stats_airline_icao']; |
| 16 | 16 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | 17 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
| 18 | 18 | } |
| 19 | -setcookie('stats_airline_icao',$airline_icao); |
|
| 20 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
| 21 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
| 19 | +setcookie('stats_airline_icao', $airline_icao); |
|
| 20 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
| 21 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
| 22 | 22 | |
| 23 | 23 | require_once('header.php'); |
| 24 | 24 | include('statistics-sub-menu.php'); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | </div> |
| 30 | 30 | <p>'._("Below are the <strong>Top 10</strong> most common countries of all the departure airports.").'</p>'; |
| 31 | 31 | |
| 32 | -$airport_country_array = $Stats->countAllDepartureCountries(true,$airline_icao,$filter_name,$year,$month); |
|
| 32 | +$airport_country_array = $Stats->countAllDepartureCountries(true, $airline_icao, $filter_name, $year, $month); |
|
| 33 | 33 | print '<script> |
| 34 | 34 | google.load("visualization", "1", {packages:["geochart"]}); |
| 35 | 35 | google.setOnLoadCallback(drawCharts); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | ["'._("Country").'", "'._("# of times").'"],'; |
| 43 | 43 | |
| 44 | 44 | $country_data = ''; |
| 45 | -foreach($airport_country_array as $airport_item) |
|
| 45 | +foreach ($airport_country_array as $airport_item) |
|
| 46 | 46 | { |
| 47 | 47 | $country_data .= '[ "'.$airport_item['airport_departure_country'].'",'.$airport_item['airport_departure_country_count'].'],'; |
| 48 | 48 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | print '</thead>'; |
| 78 | 78 | print '<tbody>'; |
| 79 | 79 | $i = 1; |
| 80 | -foreach($airport_country_array as $airport_item) |
|
| 80 | +foreach ($airport_country_array as $airport_item) |
|
| 81 | 81 | { |
| 82 | 82 | print '<tr>'; |
| 83 | 83 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -5,7 +5,9 @@ discard block |
||
| 5 | 5 | $Stats = new Stats(); |
| 6 | 6 | $title = _("Statistics").' - '._("Most common Departure Airport by Country"); |
| 7 | 7 | |
| 8 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 8 | +if (!isset($filter_name)) { |
|
| 9 | + $filter_name = ''; |
|
| 10 | +} |
|
| 9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 12 | if ($airline_icao == 'all') { |
| 11 | 13 | unset($_COOKIE['stats_airline_icao']); |
@@ -14,8 +16,10 @@ discard block |
||
| 14 | 16 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | 17 | $airline_icao = $_COOKIE['stats_airline_icao']; |
| 16 | 18 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 18 | -} |
|
| 19 | + if (isset($globalFilter['airline'])) { |
|
| 20 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 21 | + } |
|
| 22 | + } |
|
| 19 | 23 | setcookie('stats_airline_icao',$airline_icao); |
| 20 | 24 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 21 | 25 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -6,19 +6,19 @@ discard block |
||
| 6 | 6 | $title = _("Statistics").' - '._("Most common Callsign"); |
| 7 | 7 | |
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 10 | 10 | if ($airline_icao == 'all') { |
| 11 | 11 | unset($_COOKIE['stats_airline_icao']); |
| 12 | - setcookie('stats_airline_icao', '', time()-3600); |
|
| 12 | + setcookie('stats_airline_icao', '', time() - 3600); |
|
| 13 | 13 | $airline_icao = ''; |
| 14 | 14 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | 15 | $airline_icao = $_COOKIE['stats_airline_icao']; |
| 16 | 16 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | 17 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
| 18 | 18 | } |
| 19 | -setcookie('stats_airline_icao',$airline_icao); |
|
| 20 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
| 21 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
| 19 | +setcookie('stats_airline_icao', $airline_icao); |
|
| 20 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
| 21 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
| 22 | 22 | require_once('header.php'); |
| 23 | 23 | include('statistics-sub-menu.php'); |
| 24 | 24 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | </div> |
| 29 | 29 | <p>'._("Below are the <strong>Top 10</strong> most common ident/callsigns of all airlines.").'</p>'; |
| 30 | 30 | |
| 31 | -$callsign_array = $Stats->countAllCallsigns(true,$airline_icao,$filter_name,$year,$month); |
|
| 31 | +$callsign_array = $Stats->countAllCallsigns(true, $airline_icao, $filter_name, $year, $month); |
|
| 32 | 32 | print '<div id="chart" class="chart" width="100%"></div> |
| 33 | 33 | <script> |
| 34 | 34 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | var data = google.visualization.arrayToDataTable([ |
| 38 | 38 | ["'._("Aircraft").'", "'._("# of times").'"], '; |
| 39 | 39 | $callsign_data = ''; |
| 40 | -foreach($callsign_array as $callsign_item) |
|
| 40 | +foreach ($callsign_array as $callsign_item) |
|
| 41 | 41 | { |
| 42 | 42 | $callsign_data .= '[ "'.$callsign_item['callsign_icao'].' ('.$callsign_item['airline_name'].')",'.$callsign_item['callsign_icao_count'].'],'; |
| 43 | 43 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | print '</thead>'; |
| 72 | 72 | print '<tbody>'; |
| 73 | 73 | $i = 1; |
| 74 | - foreach($callsign_array as $callsign_item) |
|
| 74 | + foreach ($callsign_array as $callsign_item) |
|
| 75 | 75 | { |
| 76 | 76 | print '<tr>'; |
| 77 | 77 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -5,7 +5,9 @@ discard block |
||
| 5 | 5 | $Stats = new Stats(); |
| 6 | 6 | $title = _("Statistics").' - '._("Most common Callsign"); |
| 7 | 7 | |
| 8 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 8 | +if (!isset($filter_name)) { |
|
| 9 | + $filter_name = ''; |
|
| 10 | +} |
|
| 9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 12 | if ($airline_icao == 'all') { |
| 11 | 13 | unset($_COOKIE['stats_airline_icao']); |
@@ -14,8 +16,10 @@ discard block |
||
| 14 | 16 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | 17 | $airline_icao = $_COOKIE['stats_airline_icao']; |
| 16 | 18 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 18 | -} |
|
| 19 | + if (isset($globalFilter['airline'])) { |
|
| 20 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 21 | + } |
|
| 22 | + } |
|
| 19 | 23 | setcookie('stats_airline_icao',$airline_icao); |
| 20 | 24 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 21 | 25 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -6,19 +6,19 @@ discard block |
||
| 6 | 6 | $title = _("Statistics").' - '._("Most common Arrival Airport"); |
| 7 | 7 | |
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 10 | 10 | if ($airline_icao == 'all') { |
| 11 | 11 | unset($_COOKIE['stats_airline_icao']); |
| 12 | - setcookie('stats_airline_icao', '', time()-3600); |
|
| 12 | + setcookie('stats_airline_icao', '', time() - 3600); |
|
| 13 | 13 | $airline_icao = ''; |
| 14 | 14 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | 15 | $airline_icao = $_COOKIE['stats_airline_icao']; |
| 16 | 16 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | 17 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
| 18 | 18 | } |
| 19 | -setcookie('stats_airline_icao',$airline_icao); |
|
| 20 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
| 21 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
| 19 | +setcookie('stats_airline_icao', $airline_icao); |
|
| 20 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
| 21 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
| 22 | 22 | |
| 23 | 23 | require_once('header.php'); |
| 24 | 24 | include('statistics-sub-menu.php'); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | </div> |
| 30 | 30 | <p>'._("Below are the <strong>Top 10</strong> most common arrival airports.").'</p>'; |
| 31 | 31 | |
| 32 | -$airport_airport_array = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month); |
|
| 32 | +$airport_airport_array = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month); |
|
| 33 | 33 | print '<script> |
| 34 | 34 | google.load("visualization", "1", {packages:["geochart"]}); |
| 35 | 35 | google.setOnLoadCallback(drawCharts); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | ["'._("Airport").'", "'._("# of times").'"],'; |
| 43 | 43 | |
| 44 | 44 | $airport_data = ''; |
| 45 | -foreach($airport_airport_array as $airport_item) |
|
| 45 | +foreach ($airport_airport_array as $airport_item) |
|
| 46 | 46 | { |
| 47 | 47 | $name = $airport_item['airport_arrival_city'].', '.$airport_item['airport_arrival_country'].' ('.$airport_item['airport_arrival_icao'].')'; |
| 48 | 48 | $name = str_replace("'", "", $name); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | print '</thead>'; |
| 83 | 83 | print '<tbody>'; |
| 84 | 84 | $i = 1; |
| 85 | -foreach($airport_airport_array as $airport_item) |
|
| 85 | +foreach ($airport_airport_array as $airport_item) |
|
| 86 | 86 | { |
| 87 | 87 | print '<tr>'; |
| 88 | 88 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -5,7 +5,9 @@ discard block |
||
| 5 | 5 | $Stats = new Stats(); |
| 6 | 6 | $title = _("Statistics").' - '._("Most common Arrival Airport"); |
| 7 | 7 | |
| 8 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 8 | +if (!isset($filter_name)) { |
|
| 9 | + $filter_name = ''; |
|
| 10 | +} |
|
| 9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 12 | if ($airline_icao == 'all') { |
| 11 | 13 | unset($_COOKIE['stats_airline_icao']); |
@@ -14,8 +16,10 @@ discard block |
||
| 14 | 16 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | 17 | $airline_icao = $_COOKIE['stats_airline_icao']; |
| 16 | 18 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 18 | -} |
|
| 19 | + if (isset($globalFilter['airline'])) { |
|
| 20 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 21 | + } |
|
| 22 | + } |
|
| 19 | 23 | setcookie('stats_airline_icao',$airline_icao); |
| 20 | 24 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 21 | 25 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -6,19 +6,19 @@ discard block |
||
| 6 | 6 | $title = _("Statistics").' - '._("Most common Aircraft"); |
| 7 | 7 | |
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 10 | 10 | if ($airline_icao == 'all') { |
| 11 | 11 | unset($_COOKIE['stats_airline_icao']); |
| 12 | - setcookie('stats_airline_icao', '', time()-3600); |
|
| 12 | + setcookie('stats_airline_icao', '', time() - 3600); |
|
| 13 | 13 | $airline_icao = ''; |
| 14 | 14 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | 15 | $airline_icao = $_COOKIE['stats_airline_icao']; |
| 16 | 16 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | 17 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
| 18 | 18 | } |
| 19 | -setcookie('stats_airline_icao',$airline_icao); |
|
| 20 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
| 21 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
| 19 | +setcookie('stats_airline_icao', $airline_icao); |
|
| 20 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
| 21 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
| 22 | 22 | |
| 23 | 23 | require_once('header.php'); |
| 24 | 24 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | </div> |
| 30 | 30 | <p>'._("Below are the <strong>Top 10</strong> most common aircraft types.").'</p>'; |
| 31 | 31 | |
| 32 | -$aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
| 32 | +$aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month); |
|
| 33 | 33 | print '<div id="chart" class="chart" width="100%"></div> |
| 34 | 34 | <script> |
| 35 | 35 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | var data = google.visualization.arrayToDataTable([ |
| 39 | 39 | ["'._("Aircraft").'", "'._("# of times").'"], '; |
| 40 | 40 | $aircraft_data = ''; |
| 41 | -foreach($aircraft_array as $aircraft_item) |
|
| 41 | +foreach ($aircraft_array as $aircraft_item) |
|
| 42 | 42 | { |
| 43 | 43 | $aircraft_data .= '[ "'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
| 44 | 44 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | print '</thead>'; |
| 72 | 72 | print '<tbody>'; |
| 73 | 73 | $i = 1; |
| 74 | - foreach($aircraft_array as $aircraft_item) |
|
| 74 | + foreach ($aircraft_array as $aircraft_item) |
|
| 75 | 75 | { |
| 76 | 76 | print '<tr>'; |
| 77 | 77 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -5,7 +5,9 @@ discard block |
||
| 5 | 5 | $Stats = new Stats(); |
| 6 | 6 | $title = _("Statistics").' - '._("Most common Aircraft"); |
| 7 | 7 | |
| 8 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 8 | +if (!isset($filter_name)) { |
|
| 9 | + $filter_name = ''; |
|
| 10 | +} |
|
| 9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 12 | if ($airline_icao == 'all') { |
| 11 | 13 | unset($_COOKIE['stats_airline_icao']); |
@@ -14,8 +16,10 @@ discard block |
||
| 14 | 16 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | 17 | $airline_icao = $_COOKIE['stats_airline_icao']; |
| 16 | 18 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 18 | -} |
|
| 19 | + if (isset($globalFilter['airline'])) { |
|
| 20 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 21 | + } |
|
| 22 | + } |
|
| 19 | 23 | setcookie('stats_airline_icao',$airline_icao); |
| 20 | 24 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 21 | 25 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |