@@ -16,33 +16,33 @@ discard block |
||
| 16 | 16 | if (isset($globalFilterName)) $this->filter_name = $globalFilterName; |
| 17 | 17 | $Connection = new Connection($dbc); |
| 18 | 18 | $this->db = $Connection->db(); |
| 19 | - } |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | 21 | public function addLastStatsUpdate($type,$stats_date) { |
| 22 | - $query = "DELETE FROM config WHERE name = :type; |
|
| 22 | + $query = "DELETE FROM config WHERE name = :type; |
|
| 23 | 23 | INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
| 24 | - $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
| 25 | - try { |
|
| 26 | - $sth = $this->db->prepare($query); |
|
| 27 | - $sth->execute($query_values); |
|
| 28 | - } catch(PDOException $e) { |
|
| 29 | - return "error : ".$e->getMessage(); |
|
| 30 | - } |
|
| 31 | - } |
|
| 24 | + $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
| 25 | + try { |
|
| 26 | + $sth = $this->db->prepare($query); |
|
| 27 | + $sth->execute($query_values); |
|
| 28 | + } catch(PDOException $e) { |
|
| 29 | + return "error : ".$e->getMessage(); |
|
| 30 | + } |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | public function getLastStatsUpdate($type = 'last_update_stats') { |
| 34 | - $query = "SELECT value FROM config WHERE name = :type"; |
|
| 35 | - try { |
|
| 36 | - $sth = $this->db->prepare($query); |
|
| 37 | - $sth->execute(array(':type' => $type)); |
|
| 38 | - } catch(PDOException $e) { |
|
| 39 | - echo "error : ".$e->getMessage(); |
|
| 40 | - } |
|
| 41 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 42 | - return $all; |
|
| 43 | - } |
|
| 44 | - public function deleteStats($filter_name = '') { |
|
| 45 | - /* |
|
| 34 | + $query = "SELECT value FROM config WHERE name = :type"; |
|
| 35 | + try { |
|
| 36 | + $sth = $this->db->prepare($query); |
|
| 37 | + $sth->execute(array(':type' => $type)); |
|
| 38 | + } catch(PDOException $e) { |
|
| 39 | + echo "error : ".$e->getMessage(); |
|
| 40 | + } |
|
| 41 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 42 | + return $all; |
|
| 43 | + } |
|
| 44 | + public function deleteStats($filter_name = '') { |
|
| 45 | + /* |
|
| 46 | 46 | $query = "DELETE FROM config WHERE name = 'last_update_stats'"; |
| 47 | 47 | try { |
| 48 | 48 | $sth = $this->db->prepare($query); |
@@ -51,109 +51,109 @@ discard block |
||
| 51 | 51 | return "error : ".$e->getMessage(); |
| 52 | 52 | } |
| 53 | 53 | */ |
| 54 | - $query = "DELETE FROM stats WHERE filter_name = :filter_name;DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_airport WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_flight WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;"; |
|
| 55 | - try { |
|
| 56 | - $sth = $this->db->prepare($query); |
|
| 57 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
| 58 | - } catch(PDOException $e) { |
|
| 59 | - return "error : ".$e->getMessage(); |
|
| 60 | - } |
|
| 61 | - } |
|
| 62 | - public function deleteOldStats($filter_name = '') { |
|
| 63 | - if ($filter_name == '') { |
|
| 64 | - $query = "DELETE FROM config WHERE name = 'last_update_stats'"; |
|
| 65 | - } else { |
|
| 66 | - $query = "DELETE FROM config WHERE name = 'last_update_stats_".$filter_name."'"; |
|
| 67 | - } |
|
| 68 | - try { |
|
| 69 | - $sth = $this->db->prepare($query); |
|
| 70 | - $sth->execute(); |
|
| 71 | - } catch(PDOException $e) { |
|
| 72 | - return "error : ".$e->getMessage(); |
|
| 73 | - } |
|
| 54 | + $query = "DELETE FROM stats WHERE filter_name = :filter_name;DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_airport WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_flight WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;"; |
|
| 55 | + try { |
|
| 56 | + $sth = $this->db->prepare($query); |
|
| 57 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
| 58 | + } catch(PDOException $e) { |
|
| 59 | + return "error : ".$e->getMessage(); |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | + public function deleteOldStats($filter_name = '') { |
|
| 63 | + if ($filter_name == '') { |
|
| 64 | + $query = "DELETE FROM config WHERE name = 'last_update_stats'"; |
|
| 65 | + } else { |
|
| 66 | + $query = "DELETE FROM config WHERE name = 'last_update_stats_".$filter_name."'"; |
|
| 67 | + } |
|
| 68 | + try { |
|
| 69 | + $sth = $this->db->prepare($query); |
|
| 70 | + $sth->execute(); |
|
| 71 | + } catch(PDOException $e) { |
|
| 72 | + return "error : ".$e->getMessage(); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - $query = "DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;"; |
|
| 76 | - try { |
|
| 77 | - $sth = $this->db->prepare($query); |
|
| 78 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
| 79 | - } catch(PDOException $e) { |
|
| 80 | - return "error : ".$e->getMessage(); |
|
| 81 | - } |
|
| 82 | - } |
|
| 75 | + $query = "DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;"; |
|
| 76 | + try { |
|
| 77 | + $sth = $this->db->prepare($query); |
|
| 78 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
| 79 | + } catch(PDOException $e) { |
|
| 80 | + return "error : ".$e->getMessage(); |
|
| 81 | + } |
|
| 82 | + } |
|
| 83 | 83 | public function getAllAirlineNames($filter_name = '') { |
| 84 | 84 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 85 | - $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
|
| 86 | - try { |
|
| 87 | - $sth = $this->db->prepare($query); |
|
| 88 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
| 89 | - } catch(PDOException $e) { |
|
| 90 | - echo "error : ".$e->getMessage(); |
|
| 91 | - } |
|
| 92 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 93 | - return $all; |
|
| 94 | - } |
|
| 85 | + $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
|
| 86 | + try { |
|
| 87 | + $sth = $this->db->prepare($query); |
|
| 88 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
| 89 | + } catch(PDOException $e) { |
|
| 90 | + echo "error : ".$e->getMessage(); |
|
| 91 | + } |
|
| 92 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 93 | + return $all; |
|
| 94 | + } |
|
| 95 | 95 | public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
| 96 | 96 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 97 | - $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
|
| 98 | - try { |
|
| 99 | - $sth = $this->db->prepare($query); |
|
| 100 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 101 | - } catch(PDOException $e) { |
|
| 102 | - echo "error : ".$e->getMessage(); |
|
| 103 | - } |
|
| 104 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 105 | - return $all; |
|
| 106 | - } |
|
| 97 | + $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
|
| 98 | + try { |
|
| 99 | + $sth = $this->db->prepare($query); |
|
| 100 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 101 | + } catch(PDOException $e) { |
|
| 102 | + echo "error : ".$e->getMessage(); |
|
| 103 | + } |
|
| 104 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 105 | + return $all; |
|
| 106 | + } |
|
| 107 | 107 | public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
| 108 | 108 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 109 | - $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC"; |
|
| 110 | - try { |
|
| 111 | - $sth = $this->db->prepare($query); |
|
| 112 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 113 | - } catch(PDOException $e) { |
|
| 114 | - echo "error : ".$e->getMessage(); |
|
| 115 | - } |
|
| 116 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 117 | - return $all; |
|
| 118 | - } |
|
| 109 | + $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC"; |
|
| 110 | + try { |
|
| 111 | + $sth = $this->db->prepare($query); |
|
| 112 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 113 | + } catch(PDOException $e) { |
|
| 114 | + echo "error : ".$e->getMessage(); |
|
| 115 | + } |
|
| 116 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 117 | + return $all; |
|
| 118 | + } |
|
| 119 | 119 | public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
| 120 | 120 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 121 | - $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
|
| 122 | - try { |
|
| 123 | - $sth = $this->db->prepare($query); |
|
| 124 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 125 | - } catch(PDOException $e) { |
|
| 126 | - echo "error : ".$e->getMessage(); |
|
| 127 | - } |
|
| 128 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 129 | - return $all; |
|
| 130 | - } |
|
| 121 | + $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
|
| 122 | + try { |
|
| 123 | + $sth = $this->db->prepare($query); |
|
| 124 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 125 | + } catch(PDOException $e) { |
|
| 126 | + echo "error : ".$e->getMessage(); |
|
| 127 | + } |
|
| 128 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 129 | + return $all; |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | 132 | public function getAllOwnerNames($stats_airline = '',$filter_name = '') { |
| 133 | 133 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 134 | - $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC"; |
|
| 135 | - try { |
|
| 136 | - $sth = $this->db->prepare($query); |
|
| 137 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 138 | - } catch(PDOException $e) { |
|
| 139 | - echo "error : ".$e->getMessage(); |
|
| 140 | - } |
|
| 141 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 142 | - return $all; |
|
| 143 | - } |
|
| 134 | + $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC"; |
|
| 135 | + try { |
|
| 136 | + $sth = $this->db->prepare($query); |
|
| 137 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 138 | + } catch(PDOException $e) { |
|
| 139 | + echo "error : ".$e->getMessage(); |
|
| 140 | + } |
|
| 141 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 142 | + return $all; |
|
| 143 | + } |
|
| 144 | 144 | |
| 145 | 145 | public function getAllPilotNames($stats_airline = '',$filter_name = '') { |
| 146 | 146 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 147 | - $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC"; |
|
| 148 | - try { |
|
| 149 | - $sth = $this->db->prepare($query); |
|
| 150 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 151 | - } catch(PDOException $e) { |
|
| 152 | - echo "error : ".$e->getMessage(); |
|
| 153 | - } |
|
| 154 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 155 | - return $all; |
|
| 156 | - } |
|
| 147 | + $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC"; |
|
| 148 | + try { |
|
| 149 | + $sth = $this->db->prepare($query); |
|
| 150 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 151 | + } catch(PDOException $e) { |
|
| 152 | + echo "error : ".$e->getMessage(); |
|
| 153 | + } |
|
| 154 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 155 | + return $all; |
|
| 156 | + } |
|
| 157 | 157 | |
| 158 | 158 | |
| 159 | 159 | public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
@@ -170,16 +170,16 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 172 | 172 | } else $all = array(); |
| 173 | - if (empty($all)) { |
|
| 174 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 175 | - if ($filter_name != '') { |
|
| 176 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 177 | - } |
|
| 178 | - $Spotter = new Spotter($this->db); |
|
| 179 | - //$all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month); |
|
| 180 | - $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
| 181 | - } |
|
| 182 | - return $all; |
|
| 173 | + if (empty($all)) { |
|
| 174 | + $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 175 | + if ($filter_name != '') { |
|
| 176 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 177 | + } |
|
| 178 | + $Spotter = new Spotter($this->db); |
|
| 179 | + //$all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month); |
|
| 180 | + $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
| 181 | + } |
|
| 182 | + return $all; |
|
| 183 | 183 | } |
| 184 | 184 | public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
| 185 | 185 | global $globalStatsFilters; |
@@ -195,17 +195,17 @@ discard block |
||
| 195 | 195 | } |
| 196 | 196 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 197 | 197 | } else $all = array(); |
| 198 | - if (empty($all)) { |
|
| 199 | - $Spotter = new Spotter($this->db); |
|
| 200 | - $filters = array(); |
|
| 201 | - $filters = array('year' => $year,'month' => $month); |
|
| 202 | - if ($filter_name != '') { |
|
| 203 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 204 | - } |
|
| 205 | - //$all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month); |
|
| 206 | - $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
| 207 | - } |
|
| 208 | - return $all; |
|
| 198 | + if (empty($all)) { |
|
| 199 | + $Spotter = new Spotter($this->db); |
|
| 200 | + $filters = array(); |
|
| 201 | + $filters = array('year' => $year,'month' => $month); |
|
| 202 | + if ($filter_name != '') { |
|
| 203 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 204 | + } |
|
| 205 | + //$all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month); |
|
| 206 | + $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
| 207 | + } |
|
| 208 | + return $all; |
|
| 209 | 209 | } |
| 210 | 210 | public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 211 | 211 | global $globalStatsFilters; |
@@ -247,39 +247,39 @@ discard block |
||
| 247 | 247 | } |
| 248 | 248 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 249 | 249 | } else $all = array(); |
| 250 | - if (empty($all)) { |
|
| 250 | + if (empty($all)) { |
|
| 251 | 251 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 252 | 252 | if ($filter_name != '') { |
| 253 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 253 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 254 | 254 | } |
| 255 | 255 | $Spotter = new Spotter($this->db); |
| 256 | 256 | //$all = $Spotter->countAllArrivalCountries($limit,$filters,$year,$month); |
| 257 | 257 | $all = $Spotter->countAllArrivalCountries($limit,$filters); |
| 258 | - } |
|
| 259 | - return $all; |
|
| 258 | + } |
|
| 259 | + return $all; |
|
| 260 | 260 | } |
| 261 | 261 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
| 262 | 262 | global $globalStatsFilters; |
| 263 | 263 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 264 | 264 | if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
| 265 | 265 | else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
| 266 | - try { |
|
| 267 | - $sth = $this->db->prepare($query); |
|
| 268 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 269 | - } catch(PDOException $e) { |
|
| 270 | - echo "error : ".$e->getMessage(); |
|
| 271 | - } |
|
| 272 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 273 | - if (empty($all)) { |
|
| 266 | + try { |
|
| 267 | + $sth = $this->db->prepare($query); |
|
| 268 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 269 | + } catch(PDOException $e) { |
|
| 270 | + echo "error : ".$e->getMessage(); |
|
| 271 | + } |
|
| 272 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 273 | + if (empty($all)) { |
|
| 274 | 274 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 275 | 275 | if ($filter_name != '') { |
| 276 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 276 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 277 | 277 | } |
| 278 | 278 | $Spotter = new Spotter($this->db); |
| 279 | 279 | //$all = $Spotter->countAllDepartureCountries($filters,$year,$month); |
| 280 | 280 | $all = $Spotter->countAllDepartureCountries($filters); |
| 281 | - } |
|
| 282 | - return $all; |
|
| 281 | + } |
|
| 282 | + return $all; |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
@@ -305,17 +305,17 @@ discard block |
||
| 305 | 305 | } |
| 306 | 306 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 307 | 307 | } else $all = array(); |
| 308 | - if (empty($all)) { |
|
| 309 | - $Spotter = new Spotter($this->db); |
|
| 310 | - $filters = array(); |
|
| 308 | + if (empty($all)) { |
|
| 309 | + $Spotter = new Spotter($this->db); |
|
| 310 | + $filters = array(); |
|
| 311 | 311 | $filters = array('year' => $year,'month' => $month); |
| 312 | - if ($filter_name != '') { |
|
| 313 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 312 | + if ($filter_name != '') { |
|
| 313 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 314 | 314 | } |
| 315 | 315 | //$all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month); |
| 316 | - $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
| 317 | - } |
|
| 318 | - return $all; |
|
| 316 | + $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
| 317 | + } |
|
| 318 | + return $all; |
|
| 319 | 319 | } |
| 320 | 320 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 321 | 321 | global $globalStatsFilters; |
@@ -331,16 +331,16 @@ discard block |
||
| 331 | 331 | } |
| 332 | 332 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 333 | 333 | } else $all = array(); |
| 334 | - if (empty($all)) { |
|
| 334 | + if (empty($all)) { |
|
| 335 | 335 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 336 | 336 | if ($filter_name != '') { |
| 337 | 337 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
| 338 | 338 | } |
| 339 | - $Spotter = new Spotter($this->db); |
|
| 340 | - //$all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters,$year,$month); |
|
| 341 | - $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
| 342 | - } |
|
| 343 | - return $all; |
|
| 339 | + $Spotter = new Spotter($this->db); |
|
| 340 | + //$all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters,$year,$month); |
|
| 341 | + $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
| 342 | + } |
|
| 343 | + return $all; |
|
| 344 | 344 | } |
| 345 | 345 | public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 346 | 346 | global $globalStatsFilters; |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | echo "error : ".$e->getMessage(); |
| 382 | 382 | } |
| 383 | 383 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 384 | - /* |
|
| 384 | + /* |
|
| 385 | 385 | if (empty($all)) { |
| 386 | 386 | $Spotter = new Spotter($this->db); |
| 387 | 387 | $all = $Spotter->countAllFlightOverCountries($limit); |
@@ -433,16 +433,16 @@ discard block |
||
| 433 | 433 | } |
| 434 | 434 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 435 | 435 | } else $all = array(); |
| 436 | - if (empty($all)) { |
|
| 436 | + if (empty($all)) { |
|
| 437 | 437 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 438 | 438 | if ($filter_name != '') { |
| 439 | 439 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
| 440 | 440 | } |
| 441 | - $Spotter = new Spotter($this->db); |
|
| 442 | - //$all = $Spotter->countAllOwners($limit,0,'',$filters,$year,$month); |
|
| 443 | - $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
| 444 | - } |
|
| 445 | - return $all; |
|
| 441 | + $Spotter = new Spotter($this->db); |
|
| 442 | + //$all = $Spotter->countAllOwners($limit,0,'',$filters,$year,$month); |
|
| 443 | + $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
| 444 | + } |
|
| 445 | + return $all; |
|
| 446 | 446 | } |
| 447 | 447 | public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 448 | 448 | global $globalStatsFilters; |
@@ -458,35 +458,35 @@ discard block |
||
| 458 | 458 | } |
| 459 | 459 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 460 | 460 | } else $all = array(); |
| 461 | - if (empty($all)) { |
|
| 461 | + if (empty($all)) { |
|
| 462 | 462 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 463 | - if ($filter_name != '') { |
|
| 464 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 463 | + if ($filter_name != '') { |
|
| 464 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 465 | 465 | } |
| 466 | - $Spotter = new Spotter($this->db); |
|
| 466 | + $Spotter = new Spotter($this->db); |
|
| 467 | 467 | // $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters,$year,$month); |
| 468 | 468 | // $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters,$year,$month); |
| 469 | - $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
| 470 | - $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
| 471 | - $all = array(); |
|
| 472 | - foreach ($pall as $value) { |
|
| 473 | - $icao = $value['airport_departure_icao']; |
|
| 474 | - $all[$icao] = $value; |
|
| 475 | - } |
|
| 469 | + $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
| 470 | + $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
| 471 | + $all = array(); |
|
| 472 | + foreach ($pall as $value) { |
|
| 473 | + $icao = $value['airport_departure_icao']; |
|
| 474 | + $all[$icao] = $value; |
|
| 475 | + } |
|
| 476 | 476 | |
| 477 | - foreach ($dall as $value) { |
|
| 478 | - $icao = $value['airport_departure_icao']; |
|
| 479 | - if (isset($all[$icao])) { |
|
| 480 | - $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 481 | - } else $all[$icao] = $value; |
|
| 482 | - } |
|
| 483 | - $count = array(); |
|
| 484 | - foreach ($all as $key => $row) { |
|
| 485 | - $count[$key] = $row['airport_departure_icao_count']; |
|
| 486 | - } |
|
| 487 | - array_multisort($count,SORT_DESC,$all); |
|
| 488 | - } |
|
| 489 | - return $all; |
|
| 477 | + foreach ($dall as $value) { |
|
| 478 | + $icao = $value['airport_departure_icao']; |
|
| 479 | + if (isset($all[$icao])) { |
|
| 480 | + $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 481 | + } else $all[$icao] = $value; |
|
| 482 | + } |
|
| 483 | + $count = array(); |
|
| 484 | + foreach ($all as $key => $row) { |
|
| 485 | + $count[$key] = $row['airport_departure_icao_count']; |
|
| 486 | + } |
|
| 487 | + array_multisort($count,SORT_DESC,$all); |
|
| 488 | + } |
|
| 489 | + return $all; |
|
| 490 | 490 | } |
| 491 | 491 | public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 492 | 492 | global $globalStatsFilters; |
@@ -512,26 +512,26 @@ discard block |
||
| 512 | 512 | // $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters,$year,$month); |
| 513 | 513 | $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters); |
| 514 | 514 | $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters); |
| 515 | - $all = array(); |
|
| 516 | - foreach ($pall as $value) { |
|
| 517 | - $icao = $value['airport_arrival_icao']; |
|
| 518 | - $all[$icao] = $value; |
|
| 519 | - } |
|
| 515 | + $all = array(); |
|
| 516 | + foreach ($pall as $value) { |
|
| 517 | + $icao = $value['airport_arrival_icao']; |
|
| 518 | + $all[$icao] = $value; |
|
| 519 | + } |
|
| 520 | 520 | |
| 521 | - foreach ($dall as $value) { |
|
| 522 | - $icao = $value['airport_arrival_icao']; |
|
| 523 | - if (isset($all[$icao])) { |
|
| 524 | - $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 525 | - } else $all[$icao] = $value; |
|
| 526 | - } |
|
| 527 | - $count = array(); |
|
| 528 | - foreach ($all as $key => $row) { |
|
| 529 | - $count[$key] = $row['airport_arrival_icao_count']; |
|
| 530 | - } |
|
| 531 | - array_multisort($count,SORT_DESC,$all); |
|
| 532 | - } |
|
| 521 | + foreach ($dall as $value) { |
|
| 522 | + $icao = $value['airport_arrival_icao']; |
|
| 523 | + if (isset($all[$icao])) { |
|
| 524 | + $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 525 | + } else $all[$icao] = $value; |
|
| 526 | + } |
|
| 527 | + $count = array(); |
|
| 528 | + foreach ($all as $key => $row) { |
|
| 529 | + $count[$key] = $row['airport_arrival_icao_count']; |
|
| 530 | + } |
|
| 531 | + array_multisort($count,SORT_DESC,$all); |
|
| 532 | + } |
|
| 533 | 533 | |
| 534 | - return $all; |
|
| 534 | + return $all; |
|
| 535 | 535 | } |
| 536 | 536 | public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
| 537 | 537 | global $globalDBdriver, $globalStatsFilters; |
@@ -544,23 +544,23 @@ discard block |
||
| 544 | 544 | else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 545 | 545 | } |
| 546 | 546 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 547 | - try { |
|
| 548 | - $sth = $this->db->prepare($query); |
|
| 549 | - $sth->execute($query_data); |
|
| 550 | - } catch(PDOException $e) { |
|
| 551 | - echo "error : ".$e->getMessage(); |
|
| 552 | - } |
|
| 553 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 554 | - if (empty($all)) { |
|
| 547 | + try { |
|
| 548 | + $sth = $this->db->prepare($query); |
|
| 549 | + $sth->execute($query_data); |
|
| 550 | + } catch(PDOException $e) { |
|
| 551 | + echo "error : ".$e->getMessage(); |
|
| 552 | + } |
|
| 553 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 554 | + if (empty($all)) { |
|
| 555 | 555 | $filters = array('airlines' => array($stats_airline)); |
| 556 | 556 | if ($filter_name != '') { |
| 557 | 557 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
| 558 | 558 | } |
| 559 | - $Spotter = new Spotter($this->db); |
|
| 560 | - $all = $Spotter->countAllMonthsLastYear($filters); |
|
| 561 | - } |
|
| 559 | + $Spotter = new Spotter($this->db); |
|
| 560 | + $all = $Spotter->countAllMonthsLastYear($filters); |
|
| 561 | + } |
|
| 562 | 562 | |
| 563 | - return $all; |
|
| 563 | + return $all; |
|
| 564 | 564 | } |
| 565 | 565 | |
| 566 | 566 | public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
@@ -568,22 +568,22 @@ discard block |
||
| 568 | 568 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 569 | 569 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 570 | 570 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 571 | - try { |
|
| 572 | - $sth = $this->db->prepare($query); |
|
| 573 | - $sth->execute($query_data); |
|
| 574 | - } catch(PDOException $e) { |
|
| 575 | - echo "error : ".$e->getMessage(); |
|
| 576 | - } |
|
| 577 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 578 | - if (empty($all)) { |
|
| 571 | + try { |
|
| 572 | + $sth = $this->db->prepare($query); |
|
| 573 | + $sth->execute($query_data); |
|
| 574 | + } catch(PDOException $e) { |
|
| 575 | + echo "error : ".$e->getMessage(); |
|
| 576 | + } |
|
| 577 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 578 | + if (empty($all)) { |
|
| 579 | 579 | $filters = array('airlines' => array($stats_airline)); |
| 580 | 580 | if ($filter_name != '') { |
| 581 | 581 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
| 582 | 582 | } |
| 583 | - $Spotter = new Spotter($this->db); |
|
| 584 | - $all = $Spotter->countAllDatesLastMonth($filters); |
|
| 585 | - } |
|
| 586 | - return $all; |
|
| 583 | + $Spotter = new Spotter($this->db); |
|
| 584 | + $all = $Spotter->countAllDatesLastMonth($filters); |
|
| 585 | + } |
|
| 586 | + return $all; |
|
| 587 | 587 | } |
| 588 | 588 | public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
| 589 | 589 | global $globalDBdriver, $globalStatsFilters; |
@@ -594,66 +594,66 @@ discard block |
||
| 594 | 594 | $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"; |
| 595 | 595 | } |
| 596 | 596 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 597 | - try { |
|
| 598 | - $sth = $this->db->prepare($query); |
|
| 599 | - $sth->execute($query_data); |
|
| 600 | - } catch(PDOException $e) { |
|
| 601 | - echo "error : ".$e->getMessage(); |
|
| 602 | - } |
|
| 603 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 604 | - if (empty($all)) { |
|
| 597 | + try { |
|
| 598 | + $sth = $this->db->prepare($query); |
|
| 599 | + $sth->execute($query_data); |
|
| 600 | + } catch(PDOException $e) { |
|
| 601 | + echo "error : ".$e->getMessage(); |
|
| 602 | + } |
|
| 603 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 604 | + if (empty($all)) { |
|
| 605 | 605 | $filters = array('airlines' => array($stats_airline)); |
| 606 | 606 | if ($filter_name != '') { |
| 607 | 607 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
| 608 | 608 | } |
| 609 | - $Spotter = new Spotter($this->db); |
|
| 610 | - $all = $Spotter->countAllDatesLast7Days($filters); |
|
| 611 | - } |
|
| 612 | - return $all; |
|
| 609 | + $Spotter = new Spotter($this->db); |
|
| 610 | + $all = $Spotter->countAllDatesLast7Days($filters); |
|
| 611 | + } |
|
| 612 | + return $all; |
|
| 613 | 613 | } |
| 614 | 614 | public function countAllDates($stats_airline = '',$filter_name = '') { |
| 615 | 615 | global $globalStatsFilters; |
| 616 | 616 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 617 | 617 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 618 | 618 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 619 | - try { |
|
| 620 | - $sth = $this->db->prepare($query); |
|
| 621 | - $sth->execute($query_data); |
|
| 622 | - } catch(PDOException $e) { |
|
| 623 | - echo "error : ".$e->getMessage(); |
|
| 624 | - } |
|
| 625 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 626 | - if (empty($all)) { |
|
| 619 | + try { |
|
| 620 | + $sth = $this->db->prepare($query); |
|
| 621 | + $sth->execute($query_data); |
|
| 622 | + } catch(PDOException $e) { |
|
| 623 | + echo "error : ".$e->getMessage(); |
|
| 624 | + } |
|
| 625 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 626 | + if (empty($all)) { |
|
| 627 | 627 | $filters = array('airlines' => array($stats_airline)); |
| 628 | 628 | if ($filter_name != '') { |
| 629 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 629 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 630 | 630 | } |
| 631 | - $Spotter = new Spotter($this->db); |
|
| 632 | - $all = $Spotter->countAllDates($filters); |
|
| 633 | - } |
|
| 634 | - return $all; |
|
| 631 | + $Spotter = new Spotter($this->db); |
|
| 632 | + $all = $Spotter->countAllDates($filters); |
|
| 633 | + } |
|
| 634 | + return $all; |
|
| 635 | 635 | } |
| 636 | 636 | public function countAllDatesByAirlines($filter_name = '') { |
| 637 | 637 | global $globalStatsFilters; |
| 638 | 638 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 639 | 639 | $query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name"; |
| 640 | 640 | $query_data = array('filter_name' => $filter_name); |
| 641 | - try { |
|
| 642 | - $sth = $this->db->prepare($query); |
|
| 643 | - $sth->execute($query_data); |
|
| 644 | - } catch(PDOException $e) { |
|
| 645 | - echo "error : ".$e->getMessage(); |
|
| 646 | - } |
|
| 647 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 648 | - if (empty($all)) { |
|
| 649 | - $filters = array(); |
|
| 650 | - if ($filter_name != '') { |
|
| 651 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 641 | + try { |
|
| 642 | + $sth = $this->db->prepare($query); |
|
| 643 | + $sth->execute($query_data); |
|
| 644 | + } catch(PDOException $e) { |
|
| 645 | + echo "error : ".$e->getMessage(); |
|
| 646 | + } |
|
| 647 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 648 | + if (empty($all)) { |
|
| 649 | + $filters = array(); |
|
| 650 | + if ($filter_name != '') { |
|
| 651 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 652 | 652 | } |
| 653 | - $Spotter = new Spotter($this->db); |
|
| 654 | - $all = $Spotter->countAllDatesByAirlines($filters); |
|
| 655 | - } |
|
| 656 | - return $all; |
|
| 653 | + $Spotter = new Spotter($this->db); |
|
| 654 | + $all = $Spotter->countAllDatesByAirlines($filters); |
|
| 655 | + } |
|
| 656 | + return $all; |
|
| 657 | 657 | } |
| 658 | 658 | public function countAllMonths($stats_airline = '',$filter_name = '') { |
| 659 | 659 | global $globalStatsFilters, $globalDBdriver; |
@@ -663,24 +663,24 @@ discard block |
||
| 663 | 663 | } else { |
| 664 | 664 | $query = "SELECT EXTRACT(YEAR FROM stats_date) AS year_name,EXTRACT(MONTH FROM 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"; |
| 665 | 665 | } |
| 666 | - try { |
|
| 667 | - $sth = $this->db->prepare($query); |
|
| 668 | - $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 669 | - } catch(PDOException $e) { |
|
| 670 | - echo "error : ".$e->getMessage(); |
|
| 671 | - } |
|
| 672 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 666 | + try { |
|
| 667 | + $sth = $this->db->prepare($query); |
|
| 668 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 669 | + } catch(PDOException $e) { |
|
| 670 | + echo "error : ".$e->getMessage(); |
|
| 671 | + } |
|
| 672 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 673 | 673 | |
| 674 | - if (empty($all)) { |
|
| 674 | + if (empty($all)) { |
|
| 675 | 675 | $filters = array('airlines' => array($stats_airline)); |
| 676 | 676 | if ($filter_name != '') { |
| 677 | 677 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
| 678 | 678 | } |
| 679 | - $Spotter = new Spotter($this->db); |
|
| 680 | - $all = $Spotter->countAllMonths($filters); |
|
| 681 | - } |
|
| 679 | + $Spotter = new Spotter($this->db); |
|
| 680 | + $all = $Spotter->countAllMonths($filters); |
|
| 681 | + } |
|
| 682 | 682 | |
| 683 | - return $all; |
|
| 683 | + return $all; |
|
| 684 | 684 | } |
| 685 | 685 | public function countFatalitiesLast12Months() { |
| 686 | 686 | global $globalStatsFilters, $globalDBdriver; |
@@ -689,19 +689,19 @@ discard block |
||
| 689 | 689 | } else { |
| 690 | 690 | $query = "SELECT EXTRACT(YEAR FROM stats_date) AS year, EXTRACT(MONTH FROM stats_date) as month,cnt as count FROM stats WHERE stats_type = 'fatalities_bymonth' ORDER BY stats_date"; |
| 691 | 691 | } |
| 692 | - try { |
|
| 693 | - $sth = $this->db->prepare($query); |
|
| 694 | - $sth->execute(); |
|
| 695 | - } catch(PDOException $e) { |
|
| 696 | - echo "error : ".$e->getMessage(); |
|
| 697 | - } |
|
| 698 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 692 | + try { |
|
| 693 | + $sth = $this->db->prepare($query); |
|
| 694 | + $sth->execute(); |
|
| 695 | + } catch(PDOException $e) { |
|
| 696 | + echo "error : ".$e->getMessage(); |
|
| 697 | + } |
|
| 698 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 699 | 699 | |
| 700 | - if (empty($all)) { |
|
| 701 | - $Accident = new Accident($this->db); |
|
| 702 | - $all = $Accident->countFatalitiesLast12Months(); |
|
| 703 | - } |
|
| 704 | - return $all; |
|
| 700 | + if (empty($all)) { |
|
| 701 | + $Accident = new Accident($this->db); |
|
| 702 | + $all = $Accident->countFatalitiesLast12Months(); |
|
| 703 | + } |
|
| 704 | + return $all; |
|
| 705 | 705 | } |
| 706 | 706 | public function countFatalitiesByYear() { |
| 707 | 707 | global $globalStatsFilters, $globalDBdriver; |
@@ -710,40 +710,40 @@ discard block |
||
| 710 | 710 | } else { |
| 711 | 711 | $query = "SELECT EXTRACT(YEAR FROM stats_date) AS year, cnt as count FROM stats WHERE stats_type = 'fatalities_byyear' ORDER BY stats_date"; |
| 712 | 712 | } |
| 713 | - try { |
|
| 714 | - $sth = $this->db->prepare($query); |
|
| 715 | - $sth->execute(); |
|
| 716 | - } catch(PDOException $e) { |
|
| 717 | - echo "error : ".$e->getMessage(); |
|
| 718 | - } |
|
| 719 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 713 | + try { |
|
| 714 | + $sth = $this->db->prepare($query); |
|
| 715 | + $sth->execute(); |
|
| 716 | + } catch(PDOException $e) { |
|
| 717 | + echo "error : ".$e->getMessage(); |
|
| 718 | + } |
|
| 719 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 720 | 720 | |
| 721 | - if (empty($all)) { |
|
| 722 | - $Accident = new Accident($this->db); |
|
| 723 | - $all = $Accident->countFatalitiesByYear(); |
|
| 724 | - } |
|
| 725 | - return $all; |
|
| 721 | + if (empty($all)) { |
|
| 722 | + $Accident = new Accident($this->db); |
|
| 723 | + $all = $Accident->countFatalitiesByYear(); |
|
| 724 | + } |
|
| 725 | + return $all; |
|
| 726 | 726 | } |
| 727 | 727 | public function countAllMilitaryMonths($filter_name = '') { |
| 728 | 728 | global $globalStatsFilters; |
| 729 | 729 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 730 | - $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name"; |
|
| 731 | - try { |
|
| 732 | - $sth = $this->db->prepare($query); |
|
| 733 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
| 734 | - } catch(PDOException $e) { |
|
| 735 | - echo "error : ".$e->getMessage(); |
|
| 736 | - } |
|
| 737 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 738 | - if (empty($all)) { |
|
| 739 | - $filters = array(); |
|
| 740 | - if ($filter_name != '') { |
|
| 741 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 730 | + $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name"; |
|
| 731 | + try { |
|
| 732 | + $sth = $this->db->prepare($query); |
|
| 733 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
| 734 | + } catch(PDOException $e) { |
|
| 735 | + echo "error : ".$e->getMessage(); |
|
| 736 | + } |
|
| 737 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 738 | + if (empty($all)) { |
|
| 739 | + $filters = array(); |
|
| 740 | + if ($filter_name != '') { |
|
| 741 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 742 | 742 | } |
| 743 | - $Spotter = new Spotter($this->db); |
|
| 744 | - $all = $Spotter->countAllMilitaryMonths($filters); |
|
| 745 | - } |
|
| 746 | - return $all; |
|
| 743 | + $Spotter = new Spotter($this->db); |
|
| 744 | + $all = $Spotter->countAllMilitaryMonths($filters); |
|
| 745 | + } |
|
| 746 | + return $all; |
|
| 747 | 747 | } |
| 748 | 748 | public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
| 749 | 749 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
@@ -759,22 +759,22 @@ discard block |
||
| 759 | 759 | } |
| 760 | 760 | } |
| 761 | 761 | if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
| 762 | - try { |
|
| 763 | - $sth = $this->db->prepare($query); |
|
| 764 | - $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 765 | - } catch(PDOException $e) { |
|
| 766 | - echo "error : ".$e->getMessage(); |
|
| 767 | - } |
|
| 768 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 769 | - if (empty($all)) { |
|
| 762 | + try { |
|
| 763 | + $sth = $this->db->prepare($query); |
|
| 764 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 765 | + } catch(PDOException $e) { |
|
| 766 | + echo "error : ".$e->getMessage(); |
|
| 767 | + } |
|
| 768 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 769 | + if (empty($all)) { |
|
| 770 | 770 | $filters = array('airlines' => array($stats_airline)); |
| 771 | 771 | if ($filter_name != '') { |
| 772 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 772 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 773 | 773 | } |
| 774 | - $Spotter = new Spotter($this->db); |
|
| 775 | - $all = $Spotter->countAllHours($orderby,$filters); |
|
| 776 | - } |
|
| 777 | - return $all; |
|
| 774 | + $Spotter = new Spotter($this->db); |
|
| 775 | + $all = $Spotter->countAllHours($orderby,$filters); |
|
| 776 | + } |
|
| 777 | + return $all; |
|
| 778 | 778 | } |
| 779 | 779 | |
| 780 | 780 | public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
@@ -799,10 +799,10 @@ discard block |
||
| 799 | 799 | if ($year == '') $year = date('Y'); |
| 800 | 800 | $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
| 801 | 801 | if (empty($all)) { |
| 802 | - $filters = array(); |
|
| 802 | + $filters = array(); |
|
| 803 | 803 | $filters = array('year' => $year,'month' => $month); |
| 804 | - if ($filter_name != '') { |
|
| 805 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 804 | + if ($filter_name != '') { |
|
| 805 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 806 | 806 | } |
| 807 | 807 | $Spotter = new Spotter($this->db); |
| 808 | 808 | //$all = $Spotter->countOverallMilitaryFlights($filters,$year,$month); |
@@ -866,10 +866,10 @@ discard block |
||
| 866 | 866 | $all = $result[0]['nb_airline']; |
| 867 | 867 | } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
| 868 | 868 | if (empty($all)) { |
| 869 | - $filters = array(); |
|
| 869 | + $filters = array(); |
|
| 870 | 870 | $filters = array('year' => $year,'month' => $month); |
| 871 | - if ($filter_name != '') { |
|
| 872 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 871 | + if ($filter_name != '') { |
|
| 872 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 873 | 873 | } |
| 874 | 874 | $Spotter = new Spotter($this->db); |
| 875 | 875 | //$all = $Spotter->countOverallAirlines($filters,$year,$month); |
@@ -939,44 +939,44 @@ discard block |
||
| 939 | 939 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 940 | 940 | $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date"; |
| 941 | 941 | $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
| 942 | - try { |
|
| 943 | - $sth = $this->db->prepare($query); |
|
| 944 | - $sth->execute($query_values); |
|
| 945 | - } catch(PDOException $e) { |
|
| 946 | - echo "error : ".$e->getMessage(); |
|
| 947 | - } |
|
| 948 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 949 | - return $all; |
|
| 942 | + try { |
|
| 943 | + $sth = $this->db->prepare($query); |
|
| 944 | + $sth->execute($query_values); |
|
| 945 | + } catch(PDOException $e) { |
|
| 946 | + echo "error : ".$e->getMessage(); |
|
| 947 | + } |
|
| 948 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 949 | + return $all; |
|
| 950 | 950 | } |
| 951 | 951 | public function getStats($type,$stats_airline = '', $filter_name = '') { |
| 952 | 952 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 953 | - $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
|
| 954 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 955 | - try { |
|
| 956 | - $sth = $this->db->prepare($query); |
|
| 957 | - $sth->execute($query_values); |
|
| 958 | - } catch(PDOException $e) { |
|
| 959 | - echo "error : ".$e->getMessage(); |
|
| 960 | - } |
|
| 961 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 962 | - return $all; |
|
| 963 | - } |
|
| 953 | + $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
|
| 954 | + $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 955 | + try { |
|
| 956 | + $sth = $this->db->prepare($query); |
|
| 957 | + $sth->execute($query_values); |
|
| 958 | + } catch(PDOException $e) { |
|
| 959 | + echo "error : ".$e->getMessage(); |
|
| 960 | + } |
|
| 961 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 962 | + return $all; |
|
| 963 | + } |
|
| 964 | 964 | public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') { |
| 965 | 965 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 966 | - $query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 967 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 968 | - try { |
|
| 969 | - $sth = $this->db->prepare($query); |
|
| 970 | - $sth->execute($query_values); |
|
| 971 | - } catch(PDOException $e) { |
|
| 972 | - echo "error : ".$e->getMessage(); |
|
| 973 | - } |
|
| 974 | - } |
|
| 966 | + $query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 967 | + $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 968 | + try { |
|
| 969 | + $sth = $this->db->prepare($query); |
|
| 970 | + $sth->execute($query_values); |
|
| 971 | + } catch(PDOException $e) { |
|
| 972 | + echo "error : ".$e->getMessage(); |
|
| 973 | + } |
|
| 974 | + } |
|
| 975 | 975 | public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
| 976 | 976 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 977 | - global $globalArchiveMonths, $globalDBdriver; |
|
| 978 | - if ($globalDBdriver == 'mysql') { |
|
| 979 | - if ($month == '') { |
|
| 977 | + global $globalArchiveMonths, $globalDBdriver; |
|
| 978 | + if ($globalDBdriver == 'mysql') { |
|
| 979 | + if ($month == '') { |
|
| 980 | 980 | $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"; |
| 981 | 981 | $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 982 | 982 | } else { |
@@ -991,165 +991,165 @@ discard block |
||
| 991 | 991 | $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"; |
| 992 | 992 | $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
| 993 | 993 | } |
| 994 | - } |
|
| 995 | - try { |
|
| 996 | - $sth = $this->db->prepare($query); |
|
| 997 | - $sth->execute($query_values); |
|
| 998 | - } catch(PDOException $e) { |
|
| 999 | - echo "error : ".$e->getMessage(); |
|
| 1000 | - } |
|
| 1001 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 1002 | - return $all[0]['total']; |
|
| 1003 | - } |
|
| 994 | + } |
|
| 995 | + try { |
|
| 996 | + $sth = $this->db->prepare($query); |
|
| 997 | + $sth->execute($query_values); |
|
| 998 | + } catch(PDOException $e) { |
|
| 999 | + echo "error : ".$e->getMessage(); |
|
| 1000 | + } |
|
| 1001 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 1002 | + return $all[0]['total']; |
|
| 1003 | + } |
|
| 1004 | 1004 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
| 1005 | - global $globalArchiveMonths, $globalDBdriver; |
|
| 1005 | + global $globalArchiveMonths, $globalDBdriver; |
|
| 1006 | 1006 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1007 | - if ($globalDBdriver == 'mysql') { |
|
| 1007 | + if ($globalDBdriver == 'mysql') { |
|
| 1008 | 1008 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 1009 | 1009 | } else { |
| 1010 | 1010 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 1011 | - } |
|
| 1012 | - $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 1013 | - try { |
|
| 1014 | - $sth = $this->db->prepare($query); |
|
| 1015 | - $sth->execute($query_values); |
|
| 1016 | - } catch(PDOException $e) { |
|
| 1017 | - echo "error : ".$e->getMessage(); |
|
| 1018 | - } |
|
| 1019 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 1020 | - return $all[0]['total']; |
|
| 1021 | - } |
|
| 1011 | + } |
|
| 1012 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 1013 | + try { |
|
| 1014 | + $sth = $this->db->prepare($query); |
|
| 1015 | + $sth->execute($query_values); |
|
| 1016 | + } catch(PDOException $e) { |
|
| 1017 | + echo "error : ".$e->getMessage(); |
|
| 1018 | + } |
|
| 1019 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 1020 | + return $all[0]['total']; |
|
| 1021 | + } |
|
| 1022 | 1022 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
| 1023 | - global $globalArchiveMonths, $globalDBdriver; |
|
| 1023 | + global $globalArchiveMonths, $globalDBdriver; |
|
| 1024 | 1024 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1025 | - if ($globalDBdriver == 'mysql') { |
|
| 1025 | + if ($globalDBdriver == 'mysql') { |
|
| 1026 | 1026 | $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 1027 | - } else { |
|
| 1027 | + } else { |
|
| 1028 | 1028 | $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 1029 | - } |
|
| 1030 | - try { |
|
| 1031 | - $sth = $this->db->prepare($query); |
|
| 1032 | - $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 1033 | - } catch(PDOException $e) { |
|
| 1034 | - echo "error : ".$e->getMessage(); |
|
| 1035 | - } |
|
| 1036 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 1037 | - return $all[0]['total']; |
|
| 1038 | - } |
|
| 1029 | + } |
|
| 1030 | + try { |
|
| 1031 | + $sth = $this->db->prepare($query); |
|
| 1032 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 1033 | + } catch(PDOException $e) { |
|
| 1034 | + echo "error : ".$e->getMessage(); |
|
| 1035 | + } |
|
| 1036 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 1037 | + return $all[0]['total']; |
|
| 1038 | + } |
|
| 1039 | 1039 | public function getStatsAirlineTotal($filter_name = '') { |
| 1040 | - global $globalArchiveMonths, $globalDBdriver; |
|
| 1040 | + global $globalArchiveMonths, $globalDBdriver; |
|
| 1041 | 1041 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1042 | - if ($globalDBdriver == 'mysql') { |
|
| 1042 | + if ($globalDBdriver == 'mysql') { |
|
| 1043 | 1043 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
| 1044 | - } else { |
|
| 1044 | + } else { |
|
| 1045 | 1045 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
| 1046 | - } |
|
| 1047 | - try { |
|
| 1048 | - $sth = $this->db->prepare($query); |
|
| 1049 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
| 1050 | - } catch(PDOException $e) { |
|
| 1051 | - echo "error : ".$e->getMessage(); |
|
| 1052 | - } |
|
| 1053 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 1054 | - return $all[0]['total']; |
|
| 1055 | - } |
|
| 1046 | + } |
|
| 1047 | + try { |
|
| 1048 | + $sth = $this->db->prepare($query); |
|
| 1049 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
| 1050 | + } catch(PDOException $e) { |
|
| 1051 | + echo "error : ".$e->getMessage(); |
|
| 1052 | + } |
|
| 1053 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 1054 | + return $all[0]['total']; |
|
| 1055 | + } |
|
| 1056 | 1056 | public function getStatsOwnerTotal($filter_name = '') { |
| 1057 | - global $globalArchiveMonths, $globalDBdriver; |
|
| 1057 | + global $globalArchiveMonths, $globalDBdriver; |
|
| 1058 | 1058 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1059 | - if ($globalDBdriver == 'mysql') { |
|
| 1059 | + if ($globalDBdriver == 'mysql') { |
|
| 1060 | 1060 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
| 1061 | 1061 | } else { |
| 1062 | 1062 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
| 1063 | - } |
|
| 1064 | - try { |
|
| 1065 | - $sth = $this->db->prepare($query); |
|
| 1066 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
| 1067 | - } catch(PDOException $e) { |
|
| 1068 | - echo "error : ".$e->getMessage(); |
|
| 1069 | - } |
|
| 1070 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 1071 | - return $all[0]['total']; |
|
| 1072 | - } |
|
| 1063 | + } |
|
| 1064 | + try { |
|
| 1065 | + $sth = $this->db->prepare($query); |
|
| 1066 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
| 1067 | + } catch(PDOException $e) { |
|
| 1068 | + echo "error : ".$e->getMessage(); |
|
| 1069 | + } |
|
| 1070 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 1071 | + return $all[0]['total']; |
|
| 1072 | + } |
|
| 1073 | 1073 | public function getStatsOwner($owner_name,$filter_name = '') { |
| 1074 | - global $globalArchiveMonths, $globalDBdriver; |
|
| 1074 | + global $globalArchiveMonths, $globalDBdriver; |
|
| 1075 | 1075 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1076 | 1076 | $query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name"; |
| 1077 | - try { |
|
| 1078 | - $sth = $this->db->prepare($query); |
|
| 1079 | - $sth->execute(array(':filter_name' => $filter_name,':owner_name' => $owner_name)); |
|
| 1080 | - } catch(PDOException $e) { |
|
| 1081 | - echo "error : ".$e->getMessage(); |
|
| 1082 | - } |
|
| 1083 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 1084 | - if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
| 1085 | - else return 0; |
|
| 1086 | - } |
|
| 1077 | + try { |
|
| 1078 | + $sth = $this->db->prepare($query); |
|
| 1079 | + $sth->execute(array(':filter_name' => $filter_name,':owner_name' => $owner_name)); |
|
| 1080 | + } catch(PDOException $e) { |
|
| 1081 | + echo "error : ".$e->getMessage(); |
|
| 1082 | + } |
|
| 1083 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 1084 | + if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
| 1085 | + else return 0; |
|
| 1086 | + } |
|
| 1087 | 1087 | public function getStatsPilotTotal($filter_name = '') { |
| 1088 | - global $globalArchiveMonths, $globalDBdriver; |
|
| 1088 | + global $globalArchiveMonths, $globalDBdriver; |
|
| 1089 | 1089 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1090 | - if ($globalDBdriver == 'mysql') { |
|
| 1091 | - $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
| 1092 | - } else { |
|
| 1093 | - $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
| 1094 | - } |
|
| 1095 | - try { |
|
| 1096 | - $sth = $this->db->prepare($query); |
|
| 1097 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
| 1098 | - } catch(PDOException $e) { |
|
| 1099 | - echo "error : ".$e->getMessage(); |
|
| 1100 | - } |
|
| 1101 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 1102 | - return $all[0]['total']; |
|
| 1103 | - } |
|
| 1090 | + if ($globalDBdriver == 'mysql') { |
|
| 1091 | + $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
| 1092 | + } else { |
|
| 1093 | + $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
| 1094 | + } |
|
| 1095 | + try { |
|
| 1096 | + $sth = $this->db->prepare($query); |
|
| 1097 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
| 1098 | + } catch(PDOException $e) { |
|
| 1099 | + echo "error : ".$e->getMessage(); |
|
| 1100 | + } |
|
| 1101 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 1102 | + return $all[0]['total']; |
|
| 1103 | + } |
|
| 1104 | 1104 | public function getStatsPilot($pilot,$filter_name = '') { |
| 1105 | - global $globalArchiveMonths, $globalDBdriver; |
|
| 1105 | + global $globalArchiveMonths, $globalDBdriver; |
|
| 1106 | 1106 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1107 | 1107 | $query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)"; |
| 1108 | - try { |
|
| 1109 | - $sth = $this->db->prepare($query); |
|
| 1110 | - $sth->execute(array(':filter_name' => $filter_name,':pilot' => $pilot)); |
|
| 1111 | - } catch(PDOException $e) { |
|
| 1112 | - echo "error : ".$e->getMessage(); |
|
| 1113 | - } |
|
| 1114 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 1115 | - if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
| 1116 | - else return 0; |
|
| 1117 | - } |
|
| 1108 | + try { |
|
| 1109 | + $sth = $this->db->prepare($query); |
|
| 1110 | + $sth->execute(array(':filter_name' => $filter_name,':pilot' => $pilot)); |
|
| 1111 | + } catch(PDOException $e) { |
|
| 1112 | + echo "error : ".$e->getMessage(); |
|
| 1113 | + } |
|
| 1114 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 1115 | + if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
| 1116 | + else return 0; |
|
| 1117 | + } |
|
| 1118 | 1118 | |
| 1119 | 1119 | public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 1120 | 1120 | global $globalDBdriver; |
| 1121 | 1121 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1122 | 1122 | if ($globalDBdriver == 'mysql') { |
| 1123 | 1123 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt"; |
| 1124 | - } else { |
|
| 1124 | + } else { |
|
| 1125 | 1125 | $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);"; |
| 1126 | 1126 | } |
| 1127 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1128 | - try { |
|
| 1129 | - $sth = $this->db->prepare($query); |
|
| 1130 | - $sth->execute($query_values); |
|
| 1131 | - } catch(PDOException $e) { |
|
| 1132 | - return "error : ".$e->getMessage(); |
|
| 1133 | - } |
|
| 1134 | - } |
|
| 1127 | + $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1128 | + try { |
|
| 1129 | + $sth = $this->db->prepare($query); |
|
| 1130 | + $sth->execute($query_values); |
|
| 1131 | + } catch(PDOException $e) { |
|
| 1132 | + return "error : ".$e->getMessage(); |
|
| 1133 | + } |
|
| 1134 | + } |
|
| 1135 | 1135 | public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 1136 | 1136 | global $globalDBdriver; |
| 1137 | 1137 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1138 | 1138 | if ($globalDBdriver == 'mysql') { |
| 1139 | 1139 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
| 1140 | 1140 | } else { |
| 1141 | - //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
|
| 1141 | + //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
|
| 1142 | 1142 | $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);"; |
| 1143 | - } |
|
| 1144 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1145 | - try { |
|
| 1146 | - $sth = $this->db->prepare($query); |
|
| 1147 | - $sth->execute($query_values); |
|
| 1148 | - } catch(PDOException $e) { |
|
| 1149 | - return "error : ".$e->getMessage(); |
|
| 1150 | - } |
|
| 1151 | - } |
|
| 1152 | - /* |
|
| 1143 | + } |
|
| 1144 | + $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1145 | + try { |
|
| 1146 | + $sth = $this->db->prepare($query); |
|
| 1147 | + $sth->execute($query_values); |
|
| 1148 | + } catch(PDOException $e) { |
|
| 1149 | + return "error : ".$e->getMessage(); |
|
| 1150 | + } |
|
| 1151 | + } |
|
| 1152 | + /* |
|
| 1153 | 1153 | public function getStatsSource($date,$stats_type = '') { |
| 1154 | 1154 | if ($stats_type == '') { |
| 1155 | 1155 | $query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name"; |
@@ -1218,25 +1218,25 @@ discard block |
||
| 1218 | 1218 | $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"; |
| 1219 | 1219 | } else { |
| 1220 | 1220 | $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);"; |
| 1221 | - } |
|
| 1222 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
| 1223 | - try { |
|
| 1224 | - $sth = $this->db->prepare($query); |
|
| 1225 | - $sth->execute($query_values); |
|
| 1226 | - } catch(PDOException $e) { |
|
| 1227 | - return "error : ".$e->getMessage(); |
|
| 1228 | - } |
|
| 1229 | - } |
|
| 1230 | - public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
|
| 1231 | - $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
|
| 1232 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1233 | - try { |
|
| 1234 | - $sth = $this->db->prepare($query); |
|
| 1235 | - $sth->execute($query_values); |
|
| 1236 | - } catch(PDOException $e) { |
|
| 1237 | - return "error : ".$e->getMessage(); |
|
| 1238 | - } |
|
| 1239 | - } |
|
| 1221 | + } |
|
| 1222 | + $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
| 1223 | + try { |
|
| 1224 | + $sth = $this->db->prepare($query); |
|
| 1225 | + $sth->execute($query_values); |
|
| 1226 | + } catch(PDOException $e) { |
|
| 1227 | + return "error : ".$e->getMessage(); |
|
| 1228 | + } |
|
| 1229 | + } |
|
| 1230 | + public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
|
| 1231 | + $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
|
| 1232 | + $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1233 | + try { |
|
| 1234 | + $sth = $this->db->prepare($query); |
|
| 1235 | + $sth->execute($query_values); |
|
| 1236 | + } catch(PDOException $e) { |
|
| 1237 | + return "error : ".$e->getMessage(); |
|
| 1238 | + } |
|
| 1239 | + } |
|
| 1240 | 1240 | public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '',$reset = false) { |
| 1241 | 1241 | global $globalDBdriver; |
| 1242 | 1242 | if ($globalDBdriver == 'mysql') { |
@@ -1252,14 +1252,14 @@ discard block |
||
| 1252 | 1252 | $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);"; |
| 1253 | 1253 | } |
| 1254 | 1254 | } |
| 1255 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 1256 | - try { |
|
| 1257 | - $sth = $this->db->prepare($query); |
|
| 1258 | - $sth->execute($query_values); |
|
| 1259 | - } catch(PDOException $e) { |
|
| 1260 | - return "error : ".$e->getMessage(); |
|
| 1261 | - } |
|
| 1262 | - } |
|
| 1255 | + $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 1256 | + try { |
|
| 1257 | + $sth = $this->db->prepare($query); |
|
| 1258 | + $sth->execute($query_values); |
|
| 1259 | + } catch(PDOException $e) { |
|
| 1260 | + return "error : ".$e->getMessage(); |
|
| 1261 | + } |
|
| 1262 | + } |
|
| 1263 | 1263 | public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '', $reset = false) { |
| 1264 | 1264 | global $globalDBdriver; |
| 1265 | 1265 | if ($globalDBdriver == 'mysql') { |
@@ -1275,14 +1275,14 @@ discard block |
||
| 1275 | 1275 | $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);"; |
| 1276 | 1276 | } |
| 1277 | 1277 | } |
| 1278 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 1279 | - try { |
|
| 1280 | - $sth = $this->db->prepare($query); |
|
| 1281 | - $sth->execute($query_values); |
|
| 1282 | - } catch(PDOException $e) { |
|
| 1283 | - return "error : ".$e->getMessage(); |
|
| 1284 | - } |
|
| 1285 | - } |
|
| 1278 | + $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 1279 | + try { |
|
| 1280 | + $sth = $this->db->prepare($query); |
|
| 1281 | + $sth->execute($query_values); |
|
| 1282 | + } catch(PDOException $e) { |
|
| 1283 | + return "error : ".$e->getMessage(); |
|
| 1284 | + } |
|
| 1285 | + } |
|
| 1286 | 1286 | public function addStatCountry($iso2,$iso3,$name,$cnt,$airline_icao = '',$filter_name = '',$reset = false) { |
| 1287 | 1287 | global $globalDBdriver; |
| 1288 | 1288 | if ($globalDBdriver == 'mysql') { |
@@ -1298,14 +1298,14 @@ discard block |
||
| 1298 | 1298 | $query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name AND stats_airline = :airline; INSERT INTO stats_country (iso2,iso3,name,cnt,stats_airline,filter_name) SELECT :iso2,:iso3,:name,:cnt,:airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name AND stats_airline = :airline);"; |
| 1299 | 1299 | } |
| 1300 | 1300 | } |
| 1301 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name,':airline' => $airline_icao); |
|
| 1302 | - try { |
|
| 1303 | - $sth = $this->db->prepare($query); |
|
| 1304 | - $sth->execute($query_values); |
|
| 1305 | - } catch(PDOException $e) { |
|
| 1306 | - return "error : ".$e->getMessage(); |
|
| 1307 | - } |
|
| 1308 | - } |
|
| 1301 | + $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name,':airline' => $airline_icao); |
|
| 1302 | + try { |
|
| 1303 | + $sth = $this->db->prepare($query); |
|
| 1304 | + $sth->execute($query_values); |
|
| 1305 | + } catch(PDOException $e) { |
|
| 1306 | + return "error : ".$e->getMessage(); |
|
| 1307 | + } |
|
| 1308 | + } |
|
| 1309 | 1309 | public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
| 1310 | 1310 | global $globalDBdriver; |
| 1311 | 1311 | if ($globalDBdriver == 'mysql') { |
@@ -1321,14 +1321,14 @@ discard block |
||
| 1321 | 1321 | $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);"; |
| 1322 | 1322 | } |
| 1323 | 1323 | } |
| 1324 | - $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); |
|
| 1325 | - try { |
|
| 1326 | - $sth = $this->db->prepare($query); |
|
| 1327 | - $sth->execute($query_values); |
|
| 1328 | - } catch(PDOException $e) { |
|
| 1329 | - return "error : ".$e->getMessage(); |
|
| 1330 | - } |
|
| 1331 | - } |
|
| 1324 | + $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); |
|
| 1325 | + try { |
|
| 1326 | + $sth = $this->db->prepare($query); |
|
| 1327 | + $sth->execute($query_values); |
|
| 1328 | + } catch(PDOException $e) { |
|
| 1329 | + return "error : ".$e->getMessage(); |
|
| 1330 | + } |
|
| 1331 | + } |
|
| 1332 | 1332 | public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '', $reset = false) { |
| 1333 | 1333 | global $globalDBdriver; |
| 1334 | 1334 | if ($globalDBdriver == 'mysql') { |
@@ -1344,14 +1344,14 @@ discard block |
||
| 1344 | 1344 | $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);"; |
| 1345 | 1345 | } |
| 1346 | 1346 | } |
| 1347 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
| 1348 | - try { |
|
| 1349 | - $sth = $this->db->prepare($query); |
|
| 1350 | - $sth->execute($query_values); |
|
| 1351 | - } catch(PDOException $e) { |
|
| 1352 | - return "error : ".$e->getMessage(); |
|
| 1353 | - } |
|
| 1354 | - } |
|
| 1347 | + $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
| 1348 | + try { |
|
| 1349 | + $sth = $this->db->prepare($query); |
|
| 1350 | + $sth->execute($query_values); |
|
| 1351 | + } catch(PDOException $e) { |
|
| 1352 | + return "error : ".$e->getMessage(); |
|
| 1353 | + } |
|
| 1354 | + } |
|
| 1355 | 1355 | public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '', $reset = false) { |
| 1356 | 1356 | global $globalDBdriver; |
| 1357 | 1357 | if ($globalDBdriver == 'mysql') { |
@@ -1367,14 +1367,14 @@ discard block |
||
| 1367 | 1367 | $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);"; |
| 1368 | 1368 | } |
| 1369 | 1369 | } |
| 1370 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1371 | - try { |
|
| 1372 | - $sth = $this->db->prepare($query); |
|
| 1373 | - $sth->execute($query_values); |
|
| 1374 | - } catch(PDOException $e) { |
|
| 1375 | - return "error : ".$e->getMessage(); |
|
| 1376 | - } |
|
| 1377 | - } |
|
| 1370 | + $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1371 | + try { |
|
| 1372 | + $sth = $this->db->prepare($query); |
|
| 1373 | + $sth->execute($query_values); |
|
| 1374 | + } catch(PDOException $e) { |
|
| 1375 | + return "error : ".$e->getMessage(); |
|
| 1376 | + } |
|
| 1377 | + } |
|
| 1378 | 1378 | public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '',$reset = false) { |
| 1379 | 1379 | global $globalDBdriver; |
| 1380 | 1380 | if ($globalDBdriver == 'mysql') { |
@@ -1390,14 +1390,14 @@ discard block |
||
| 1390 | 1390 | $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);"; |
| 1391 | 1391 | } |
| 1392 | 1392 | } |
| 1393 | - $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); |
|
| 1394 | - try { |
|
| 1395 | - $sth = $this->db->prepare($query); |
|
| 1396 | - $sth->execute($query_values); |
|
| 1397 | - } catch(PDOException $e) { |
|
| 1398 | - return "error : ".$e->getMessage(); |
|
| 1399 | - } |
|
| 1400 | - } |
|
| 1393 | + $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); |
|
| 1394 | + try { |
|
| 1395 | + $sth = $this->db->prepare($query); |
|
| 1396 | + $sth->execute($query_values); |
|
| 1397 | + } catch(PDOException $e) { |
|
| 1398 | + return "error : ".$e->getMessage(); |
|
| 1399 | + } |
|
| 1400 | + } |
|
| 1401 | 1401 | public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '',$reset = false) { |
| 1402 | 1402 | global $globalDBdriver; |
| 1403 | 1403 | if ($airport_icao != '') { |
@@ -1421,8 +1421,8 @@ discard block |
||
| 1421 | 1421 | } catch(PDOException $e) { |
| 1422 | 1422 | return "error : ".$e->getMessage(); |
| 1423 | 1423 | } |
| 1424 | - } |
|
| 1425 | - } |
|
| 1424 | + } |
|
| 1425 | + } |
|
| 1426 | 1426 | public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
| 1427 | 1427 | global $globalDBdriver; |
| 1428 | 1428 | if ($airport_icao != '') { |
@@ -1438,8 +1438,8 @@ discard block |
||
| 1438 | 1438 | } catch(PDOException $e) { |
| 1439 | 1439 | return "error : ".$e->getMessage(); |
| 1440 | 1440 | } |
| 1441 | - } |
|
| 1442 | - } |
|
| 1441 | + } |
|
| 1442 | + } |
|
| 1443 | 1443 | public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '',$reset = false) { |
| 1444 | 1444 | global $globalDBdriver; |
| 1445 | 1445 | if ($airport_icao != '') { |
@@ -1456,15 +1456,15 @@ discard block |
||
| 1456 | 1456 | $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);"; |
| 1457 | 1457 | } |
| 1458 | 1458 | } |
| 1459 | - $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); |
|
| 1459 | + $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); |
|
| 1460 | 1460 | try { |
| 1461 | - $sth = $this->db->prepare($query); |
|
| 1462 | - $sth->execute($query_values); |
|
| 1463 | - } catch(PDOException $e) { |
|
| 1464 | - return "error : ".$e->getMessage(); |
|
| 1465 | - } |
|
| 1466 | - } |
|
| 1467 | - } |
|
| 1461 | + $sth = $this->db->prepare($query); |
|
| 1462 | + $sth->execute($query_values); |
|
| 1463 | + } catch(PDOException $e) { |
|
| 1464 | + return "error : ".$e->getMessage(); |
|
| 1465 | + } |
|
| 1466 | + } |
|
| 1467 | + } |
|
| 1468 | 1468 | public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
| 1469 | 1469 | global $globalDBdriver; |
| 1470 | 1470 | if ($airport_icao != '') { |
@@ -1480,46 +1480,46 @@ discard block |
||
| 1480 | 1480 | } catch(PDOException $e) { |
| 1481 | 1481 | return "error : ".$e->getMessage(); |
| 1482 | 1482 | } |
| 1483 | - } |
|
| 1484 | - } |
|
| 1483 | + } |
|
| 1484 | + } |
|
| 1485 | 1485 | |
| 1486 | 1486 | public function deleteStat($id) { |
| 1487 | - $query = "DELETE FROM stats WHERE stats_id = :id"; |
|
| 1488 | - $query_values = array(':id' => $id); |
|
| 1489 | - try { |
|
| 1490 | - $sth = $this->db->prepare($query); |
|
| 1491 | - $sth->execute($query_values); |
|
| 1492 | - } catch(PDOException $e) { |
|
| 1493 | - return "error : ".$e->getMessage(); |
|
| 1494 | - } |
|
| 1495 | - } |
|
| 1487 | + $query = "DELETE FROM stats WHERE stats_id = :id"; |
|
| 1488 | + $query_values = array(':id' => $id); |
|
| 1489 | + try { |
|
| 1490 | + $sth = $this->db->prepare($query); |
|
| 1491 | + $sth->execute($query_values); |
|
| 1492 | + } catch(PDOException $e) { |
|
| 1493 | + return "error : ".$e->getMessage(); |
|
| 1494 | + } |
|
| 1495 | + } |
|
| 1496 | 1496 | public function deleteStatFlight($type) { |
| 1497 | - $query = "DELETE FROM stats_flight WHERE stats_type = :type"; |
|
| 1498 | - $query_values = array(':type' => $type); |
|
| 1499 | - try { |
|
| 1500 | - $sth = $this->db->prepare($query); |
|
| 1501 | - $sth->execute($query_values); |
|
| 1502 | - } catch(PDOException $e) { |
|
| 1503 | - return "error : ".$e->getMessage(); |
|
| 1504 | - } |
|
| 1505 | - } |
|
| 1497 | + $query = "DELETE FROM stats_flight WHERE stats_type = :type"; |
|
| 1498 | + $query_values = array(':type' => $type); |
|
| 1499 | + try { |
|
| 1500 | + $sth = $this->db->prepare($query); |
|
| 1501 | + $sth->execute($query_values); |
|
| 1502 | + } catch(PDOException $e) { |
|
| 1503 | + return "error : ".$e->getMessage(); |
|
| 1504 | + } |
|
| 1505 | + } |
|
| 1506 | 1506 | public function deleteStatAirport($type) { |
| 1507 | - $query = "DELETE FROM stats_airport WHERE stats_type = :type"; |
|
| 1508 | - $query_values = array(':type' => $type); |
|
| 1509 | - try { |
|
| 1510 | - $sth = $this->db->prepare($query); |
|
| 1511 | - $sth->execute($query_values); |
|
| 1512 | - } catch(PDOException $e) { |
|
| 1513 | - return "error : ".$e->getMessage(); |
|
| 1514 | - } |
|
| 1515 | - } |
|
| 1507 | + $query = "DELETE FROM stats_airport WHERE stats_type = :type"; |
|
| 1508 | + $query_values = array(':type' => $type); |
|
| 1509 | + try { |
|
| 1510 | + $sth = $this->db->prepare($query); |
|
| 1511 | + $sth->execute($query_values); |
|
| 1512 | + } catch(PDOException $e) { |
|
| 1513 | + return "error : ".$e->getMessage(); |
|
| 1514 | + } |
|
| 1515 | + } |
|
| 1516 | 1516 | |
| 1517 | - public function addOldStats() { |
|
| 1518 | - global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear; |
|
| 1519 | - $Common = new Common(); |
|
| 1520 | - $Connection = new Connection(); |
|
| 1521 | - date_default_timezone_set('UTC'); |
|
| 1522 | - $last_update = $this->getLastStatsUpdate('last_update_stats'); |
|
| 1517 | + public function addOldStats() { |
|
| 1518 | + global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear; |
|
| 1519 | + $Common = new Common(); |
|
| 1520 | + $Connection = new Connection(); |
|
| 1521 | + date_default_timezone_set('UTC'); |
|
| 1522 | + $last_update = $this->getLastStatsUpdate('last_update_stats'); |
|
| 1523 | 1523 | if ($globalDebug) echo 'Update stats !'."\n"; |
| 1524 | 1524 | if (isset($last_update[0]['value'])) { |
| 1525 | 1525 | $last_update_day = $last_update[0]['value']; |
@@ -1566,24 +1566,24 @@ discard block |
||
| 1566 | 1566 | if ($globalDebug) echo 'Count all departure airports...'."\n"; |
| 1567 | 1567 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
| 1568 | 1568 | if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
| 1569 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
| 1569 | + $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
| 1570 | 1570 | if ($globalDebug) echo 'Order departure airports...'."\n"; |
| 1571 | - $alldata = array(); |
|
| 1571 | + $alldata = array(); |
|
| 1572 | 1572 | |
| 1573 | - foreach ($pall as $value) { |
|
| 1574 | - $icao = $value['airport_departure_icao']; |
|
| 1575 | - $alldata[$icao] = $value; |
|
| 1576 | - } |
|
| 1577 | - foreach ($dall as $value) { |
|
| 1578 | - $icao = $value['airport_departure_icao']; |
|
| 1579 | - if (isset($alldata[$icao])) { |
|
| 1580 | - $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 1581 | - } else $alldata[$icao] = $value; |
|
| 1582 | - } |
|
| 1583 | - $count = array(); |
|
| 1584 | - foreach ($alldata as $key => $row) { |
|
| 1585 | - $count[$key] = $row['airport_departure_icao_count']; |
|
| 1586 | - } |
|
| 1573 | + foreach ($pall as $value) { |
|
| 1574 | + $icao = $value['airport_departure_icao']; |
|
| 1575 | + $alldata[$icao] = $value; |
|
| 1576 | + } |
|
| 1577 | + foreach ($dall as $value) { |
|
| 1578 | + $icao = $value['airport_departure_icao']; |
|
| 1579 | + if (isset($alldata[$icao])) { |
|
| 1580 | + $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 1581 | + } else $alldata[$icao] = $value; |
|
| 1582 | + } |
|
| 1583 | + $count = array(); |
|
| 1584 | + foreach ($alldata as $key => $row) { |
|
| 1585 | + $count[$key] = $row['airport_departure_icao_count']; |
|
| 1586 | + } |
|
| 1587 | 1587 | array_multisort($count,SORT_DESC,$alldata); |
| 1588 | 1588 | foreach ($alldata as $number) { |
| 1589 | 1589 | 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); |
@@ -1591,25 +1591,25 @@ discard block |
||
| 1591 | 1591 | if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
| 1592 | 1592 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
| 1593 | 1593 | if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
| 1594 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
| 1594 | + $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
| 1595 | 1595 | if ($globalDebug) echo 'Order arrival airports...'."\n"; |
| 1596 | - $alldata = array(); |
|
| 1597 | - foreach ($pall as $value) { |
|
| 1598 | - $icao = $value['airport_arrival_icao']; |
|
| 1599 | - $alldata[$icao] = $value; |
|
| 1600 | - } |
|
| 1601 | - foreach ($dall as $value) { |
|
| 1602 | - $icao = $value['airport_arrival_icao']; |
|
| 1603 | - if (isset($alldata[$icao])) { |
|
| 1604 | - $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 1605 | - } else $alldata[$icao] = $value; |
|
| 1606 | - } |
|
| 1607 | - $count = array(); |
|
| 1608 | - foreach ($alldata as $key => $row) { |
|
| 1609 | - $count[$key] = $row['airport_arrival_icao_count']; |
|
| 1610 | - } |
|
| 1611 | - array_multisort($count,SORT_DESC,$alldata); |
|
| 1612 | - foreach ($alldata as $number) { |
|
| 1596 | + $alldata = array(); |
|
| 1597 | + foreach ($pall as $value) { |
|
| 1598 | + $icao = $value['airport_arrival_icao']; |
|
| 1599 | + $alldata[$icao] = $value; |
|
| 1600 | + } |
|
| 1601 | + foreach ($dall as $value) { |
|
| 1602 | + $icao = $value['airport_arrival_icao']; |
|
| 1603 | + if (isset($alldata[$icao])) { |
|
| 1604 | + $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 1605 | + } else $alldata[$icao] = $value; |
|
| 1606 | + } |
|
| 1607 | + $count = array(); |
|
| 1608 | + foreach ($alldata as $key => $row) { |
|
| 1609 | + $count[$key] = $row['airport_arrival_icao_count']; |
|
| 1610 | + } |
|
| 1611 | + array_multisort($count,SORT_DESC,$alldata); |
|
| 1612 | + foreach ($alldata as $number) { |
|
| 1613 | 1613 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset); |
| 1614 | 1614 | } |
| 1615 | 1615 | if ($Connection->tableExists('countries')) { |
@@ -1682,8 +1682,8 @@ discard block |
||
| 1682 | 1682 | // $pall = $Spotter->getLast7DaysAirportsDeparture(); |
| 1683 | 1683 | // $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
| 1684 | 1684 | $pall = $Spotter->getLast7DaysAirportsDeparture(); |
| 1685 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
|
| 1686 | - /* |
|
| 1685 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
|
| 1686 | + /* |
|
| 1687 | 1687 | $alldata = array(); |
| 1688 | 1688 | foreach ($pall as $value) { |
| 1689 | 1689 | $icao = $value['departure_airport_icao']; |
@@ -1702,29 +1702,29 @@ discard block |
||
| 1702 | 1702 | } |
| 1703 | 1703 | array_multisort($count,SORT_DESC,$alldata); |
| 1704 | 1704 | */ |
| 1705 | - foreach ($dall as $value) { |
|
| 1706 | - $icao = $value['departure_airport_icao']; |
|
| 1707 | - $ddate = $value['date']; |
|
| 1708 | - $find = false; |
|
| 1709 | - foreach ($pall as $pvalue) { |
|
| 1710 | - if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 1711 | - $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
| 1712 | - $find = true; |
|
| 1713 | - break; |
|
| 1714 | - } |
|
| 1715 | - } |
|
| 1716 | - if ($find === false) { |
|
| 1717 | - $pall[] = $value; |
|
| 1718 | - } |
|
| 1719 | - } |
|
| 1720 | - $alldata = $pall; |
|
| 1705 | + foreach ($dall as $value) { |
|
| 1706 | + $icao = $value['departure_airport_icao']; |
|
| 1707 | + $ddate = $value['date']; |
|
| 1708 | + $find = false; |
|
| 1709 | + foreach ($pall as $pvalue) { |
|
| 1710 | + if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 1711 | + $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
| 1712 | + $find = true; |
|
| 1713 | + break; |
|
| 1714 | + } |
|
| 1715 | + } |
|
| 1716 | + if ($find === false) { |
|
| 1717 | + $pall[] = $value; |
|
| 1718 | + } |
|
| 1719 | + } |
|
| 1720 | + $alldata = $pall; |
|
| 1721 | 1721 | foreach ($alldata as $number) { |
| 1722 | 1722 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
| 1723 | 1723 | } |
| 1724 | 1724 | echo '...Arrival'."\n"; |
| 1725 | 1725 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
| 1726 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival(); |
|
| 1727 | - /* |
|
| 1726 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival(); |
|
| 1727 | + /* |
|
| 1728 | 1728 | $alldata = array(); |
| 1729 | 1729 | foreach ($pall as $value) { |
| 1730 | 1730 | $icao = $value['arrival_airport_icao']; |
@@ -1744,22 +1744,22 @@ discard block |
||
| 1744 | 1744 | */ |
| 1745 | 1745 | |
| 1746 | 1746 | |
| 1747 | - foreach ($dall as $value) { |
|
| 1748 | - $icao = $value['arrival_airport_icao']; |
|
| 1749 | - $ddate = $value['date']; |
|
| 1750 | - $find = false; |
|
| 1751 | - foreach ($pall as $pvalue) { |
|
| 1752 | - if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 1753 | - $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
| 1754 | - $find = true; |
|
| 1755 | - break; |
|
| 1756 | - } |
|
| 1757 | - } |
|
| 1758 | - if ($find === false) { |
|
| 1759 | - $pall[] = $value; |
|
| 1760 | - } |
|
| 1761 | - } |
|
| 1762 | - $alldata = $pall; |
|
| 1747 | + foreach ($dall as $value) { |
|
| 1748 | + $icao = $value['arrival_airport_icao']; |
|
| 1749 | + $ddate = $value['date']; |
|
| 1750 | + $find = false; |
|
| 1751 | + foreach ($pall as $pvalue) { |
|
| 1752 | + if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 1753 | + $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
| 1754 | + $find = true; |
|
| 1755 | + break; |
|
| 1756 | + } |
|
| 1757 | + } |
|
| 1758 | + if ($find === false) { |
|
| 1759 | + $pall[] = $value; |
|
| 1760 | + } |
|
| 1761 | + } |
|
| 1762 | + $alldata = $pall; |
|
| 1763 | 1763 | foreach ($alldata as $number) { |
| 1764 | 1764 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
| 1765 | 1765 | } |
@@ -1834,51 +1834,51 @@ discard block |
||
| 1834 | 1834 | if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
| 1835 | 1835 | $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
| 1836 | 1836 | if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
| 1837 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
| 1837 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
| 1838 | 1838 | if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
| 1839 | - //$alldata = array(); |
|
| 1840 | - foreach ($dall as $value) { |
|
| 1841 | - $icao = $value['airport_departure_icao']; |
|
| 1842 | - $dicao = $value['airline_icao']; |
|
| 1843 | - $find = false; |
|
| 1844 | - foreach ($pall as $pvalue) { |
|
| 1845 | - if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
| 1846 | - $pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 1847 | - $find = true; |
|
| 1848 | - break; |
|
| 1849 | - } |
|
| 1850 | - } |
|
| 1851 | - if ($find === false) { |
|
| 1852 | - $pall[] = $value; |
|
| 1853 | - } |
|
| 1854 | - } |
|
| 1855 | - $alldata = $pall; |
|
| 1839 | + //$alldata = array(); |
|
| 1840 | + foreach ($dall as $value) { |
|
| 1841 | + $icao = $value['airport_departure_icao']; |
|
| 1842 | + $dicao = $value['airline_icao']; |
|
| 1843 | + $find = false; |
|
| 1844 | + foreach ($pall as $pvalue) { |
|
| 1845 | + if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
| 1846 | + $pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 1847 | + $find = true; |
|
| 1848 | + break; |
|
| 1849 | + } |
|
| 1850 | + } |
|
| 1851 | + if ($find === false) { |
|
| 1852 | + $pall[] = $value; |
|
| 1853 | + } |
|
| 1854 | + } |
|
| 1855 | + $alldata = $pall; |
|
| 1856 | 1856 | foreach ($alldata as $number) { |
| 1857 | 1857 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset); |
| 1858 | 1858 | } |
| 1859 | 1859 | if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
| 1860 | 1860 | $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
| 1861 | 1861 | if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
| 1862 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
| 1862 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
| 1863 | 1863 | if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
| 1864 | - //$alldata = array(); |
|
| 1865 | - foreach ($dall as $value) { |
|
| 1866 | - $icao = $value['airport_arrival_icao']; |
|
| 1867 | - $dicao = $value['airline_icao']; |
|
| 1868 | - $find = false; |
|
| 1869 | - foreach ($pall as $pvalue) { |
|
| 1870 | - if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
| 1871 | - $pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 1872 | - $find = true; |
|
| 1873 | - break; |
|
| 1874 | - } |
|
| 1875 | - } |
|
| 1876 | - if ($find === false) { |
|
| 1877 | - $pall[] = $value; |
|
| 1878 | - } |
|
| 1879 | - } |
|
| 1880 | - $alldata = $pall; |
|
| 1881 | - foreach ($alldata as $number) { |
|
| 1864 | + //$alldata = array(); |
|
| 1865 | + foreach ($dall as $value) { |
|
| 1866 | + $icao = $value['airport_arrival_icao']; |
|
| 1867 | + $dicao = $value['airline_icao']; |
|
| 1868 | + $find = false; |
|
| 1869 | + foreach ($pall as $pvalue) { |
|
| 1870 | + if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
| 1871 | + $pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 1872 | + $find = true; |
|
| 1873 | + break; |
|
| 1874 | + } |
|
| 1875 | + } |
|
| 1876 | + if ($find === false) { |
|
| 1877 | + $pall[] = $value; |
|
| 1878 | + } |
|
| 1879 | + } |
|
| 1880 | + $alldata = $pall; |
|
| 1881 | + foreach ($alldata as $number) { |
|
| 1882 | 1882 | if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
| 1883 | 1883 | } |
| 1884 | 1884 | if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
@@ -1911,47 +1911,47 @@ discard block |
||
| 1911 | 1911 | } |
| 1912 | 1912 | if ($globalDebug) echo '...Departure'."\n"; |
| 1913 | 1913 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
| 1914 | - $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
|
| 1915 | - foreach ($dall as $value) { |
|
| 1916 | - $icao = $value['departure_airport_icao']; |
|
| 1917 | - $airline = $value['airline_icao']; |
|
| 1918 | - $ddate = $value['date']; |
|
| 1919 | - $find = false; |
|
| 1920 | - foreach ($pall as $pvalue) { |
|
| 1921 | - if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) { |
|
| 1922 | - $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
| 1923 | - $find = true; |
|
| 1924 | - break; |
|
| 1925 | - } |
|
| 1926 | - } |
|
| 1927 | - if ($find === false) { |
|
| 1928 | - $pall[] = $value; |
|
| 1929 | - } |
|
| 1930 | - } |
|
| 1931 | - $alldata = $pall; |
|
| 1914 | + $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
|
| 1915 | + foreach ($dall as $value) { |
|
| 1916 | + $icao = $value['departure_airport_icao']; |
|
| 1917 | + $airline = $value['airline_icao']; |
|
| 1918 | + $ddate = $value['date']; |
|
| 1919 | + $find = false; |
|
| 1920 | + foreach ($pall as $pvalue) { |
|
| 1921 | + if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) { |
|
| 1922 | + $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
| 1923 | + $find = true; |
|
| 1924 | + break; |
|
| 1925 | + } |
|
| 1926 | + } |
|
| 1927 | + if ($find === false) { |
|
| 1928 | + $pall[] = $value; |
|
| 1929 | + } |
|
| 1930 | + } |
|
| 1931 | + $alldata = $pall; |
|
| 1932 | 1932 | foreach ($alldata as $number) { |
| 1933 | 1933 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']); |
| 1934 | 1934 | } |
| 1935 | 1935 | if ($globalDebug) echo '...Arrival'."\n"; |
| 1936 | 1936 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
| 1937 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
|
| 1938 | - foreach ($dall as $value) { |
|
| 1939 | - $icao = $value['arrival_airport_icao']; |
|
| 1940 | - $airline = $value['airline_icao']; |
|
| 1941 | - $ddate = $value['date']; |
|
| 1942 | - $find = false; |
|
| 1943 | - foreach ($pall as $pvalue) { |
|
| 1944 | - if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) { |
|
| 1945 | - $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
| 1946 | - $find = true; |
|
| 1947 | - break; |
|
| 1948 | - } |
|
| 1949 | - } |
|
| 1950 | - if ($find === false) { |
|
| 1951 | - $pall[] = $value; |
|
| 1952 | - } |
|
| 1953 | - } |
|
| 1954 | - $alldata = $pall; |
|
| 1937 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
|
| 1938 | + foreach ($dall as $value) { |
|
| 1939 | + $icao = $value['arrival_airport_icao']; |
|
| 1940 | + $airline = $value['airline_icao']; |
|
| 1941 | + $ddate = $value['date']; |
|
| 1942 | + $find = false; |
|
| 1943 | + foreach ($pall as $pvalue) { |
|
| 1944 | + if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) { |
|
| 1945 | + $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
| 1946 | + $find = true; |
|
| 1947 | + break; |
|
| 1948 | + } |
|
| 1949 | + } |
|
| 1950 | + if ($find === false) { |
|
| 1951 | + $pall[] = $value; |
|
| 1952 | + } |
|
| 1953 | + } |
|
| 1954 | + $alldata = $pall; |
|
| 1955 | 1955 | foreach ($alldata as $number) { |
| 1956 | 1956 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']); |
| 1957 | 1957 | } |
@@ -2036,44 +2036,44 @@ discard block |
||
| 2036 | 2036 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset); |
| 2037 | 2037 | } |
| 2038 | 2038 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
| 2039 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
| 2040 | - $alldata = array(); |
|
| 2041 | - foreach ($pall as $value) { |
|
| 2042 | - $icao = $value['airport_departure_icao']; |
|
| 2043 | - $alldata[$icao] = $value; |
|
| 2044 | - } |
|
| 2045 | - foreach ($dall as $value) { |
|
| 2046 | - $icao = $value['airport_departure_icao']; |
|
| 2047 | - if (isset($alldata[$icao])) { |
|
| 2048 | - $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 2049 | - } else $alldata[$icao] = $value; |
|
| 2050 | - } |
|
| 2051 | - $count = array(); |
|
| 2052 | - foreach ($alldata as $key => $row) { |
|
| 2053 | - $count[$key] = $row['airport_departure_icao_count']; |
|
| 2054 | - } |
|
| 2039 | + $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
| 2040 | + $alldata = array(); |
|
| 2041 | + foreach ($pall as $value) { |
|
| 2042 | + $icao = $value['airport_departure_icao']; |
|
| 2043 | + $alldata[$icao] = $value; |
|
| 2044 | + } |
|
| 2045 | + foreach ($dall as $value) { |
|
| 2046 | + $icao = $value['airport_departure_icao']; |
|
| 2047 | + if (isset($alldata[$icao])) { |
|
| 2048 | + $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 2049 | + } else $alldata[$icao] = $value; |
|
| 2050 | + } |
|
| 2051 | + $count = array(); |
|
| 2052 | + foreach ($alldata as $key => $row) { |
|
| 2053 | + $count[$key] = $row['airport_departure_icao_count']; |
|
| 2054 | + } |
|
| 2055 | 2055 | array_multisort($count,SORT_DESC,$alldata); |
| 2056 | 2056 | foreach ($alldata as $number) { |
| 2057 | - 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); |
|
| 2057 | + 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); |
|
| 2058 | 2058 | } |
| 2059 | 2059 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter); |
| 2060 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter); |
|
| 2060 | + $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter); |
|
| 2061 | 2061 | $alldata = array(); |
| 2062 | - foreach ($pall as $value) { |
|
| 2063 | - $icao = $value['airport_arrival_icao']; |
|
| 2064 | - $alldata[$icao] = $value; |
|
| 2065 | - } |
|
| 2066 | - foreach ($dall as $value) { |
|
| 2067 | - $icao = $value['airport_arrival_icao']; |
|
| 2068 | - if (isset($alldata[$icao])) { |
|
| 2069 | - $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 2070 | - } else $alldata[$icao] = $value; |
|
| 2071 | - } |
|
| 2072 | - $count = array(); |
|
| 2073 | - foreach ($alldata as $key => $row) { |
|
| 2074 | - $count[$key] = $row['airport_arrival_icao_count']; |
|
| 2075 | - } |
|
| 2076 | - array_multisort($count,SORT_DESC,$alldata); |
|
| 2062 | + foreach ($pall as $value) { |
|
| 2063 | + $icao = $value['airport_arrival_icao']; |
|
| 2064 | + $alldata[$icao] = $value; |
|
| 2065 | + } |
|
| 2066 | + foreach ($dall as $value) { |
|
| 2067 | + $icao = $value['airport_arrival_icao']; |
|
| 2068 | + if (isset($alldata[$icao])) { |
|
| 2069 | + $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 2070 | + } else $alldata[$icao] = $value; |
|
| 2071 | + } |
|
| 2072 | + $count = array(); |
|
| 2073 | + foreach ($alldata as $key => $row) { |
|
| 2074 | + $count[$key] = $row['airport_arrival_icao_count']; |
|
| 2075 | + } |
|
| 2076 | + array_multisort($count,SORT_DESC,$alldata); |
|
| 2077 | 2077 | foreach ($alldata as $number) { |
| 2078 | 2078 | 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); |
| 2079 | 2079 | } |
@@ -2106,45 +2106,45 @@ discard block |
||
| 2106 | 2106 | } |
| 2107 | 2107 | echo '...Departure'."\n"; |
| 2108 | 2108 | $pall = $Spotter->getLast7DaysAirportsDeparture('',$filter); |
| 2109 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
| 2109 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
| 2110 | 2110 | foreach ($dall as $value) { |
| 2111 | - $icao = $value['departure_airport_icao']; |
|
| 2112 | - $ddate = $value['date']; |
|
| 2113 | - $find = false; |
|
| 2114 | - foreach ($pall as $pvalue) { |
|
| 2115 | - if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 2116 | - $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
| 2117 | - $find = true; |
|
| 2118 | - break; |
|
| 2119 | - } |
|
| 2120 | - } |
|
| 2121 | - if ($find === false) { |
|
| 2122 | - $pall[] = $value; |
|
| 2123 | - } |
|
| 2124 | - } |
|
| 2125 | - $alldata = $pall; |
|
| 2111 | + $icao = $value['departure_airport_icao']; |
|
| 2112 | + $ddate = $value['date']; |
|
| 2113 | + $find = false; |
|
| 2114 | + foreach ($pall as $pvalue) { |
|
| 2115 | + if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 2116 | + $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
| 2117 | + $find = true; |
|
| 2118 | + break; |
|
| 2119 | + } |
|
| 2120 | + } |
|
| 2121 | + if ($find === false) { |
|
| 2122 | + $pall[] = $value; |
|
| 2123 | + } |
|
| 2124 | + } |
|
| 2125 | + $alldata = $pall; |
|
| 2126 | 2126 | foreach ($alldata as $number) { |
| 2127 | 2127 | $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); |
| 2128 | 2128 | } |
| 2129 | 2129 | echo '...Arrival'."\n"; |
| 2130 | 2130 | $pall = $Spotter->getLast7DaysAirportsArrival('',$filter); |
| 2131 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
| 2131 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
| 2132 | 2132 | foreach ($dall as $value) { |
| 2133 | 2133 | $icao = $value['arrival_airport_icao']; |
| 2134 | 2134 | $ddate = $value['date']; |
| 2135 | - $find = false; |
|
| 2135 | + $find = false; |
|
| 2136 | 2136 | foreach ($pall as $pvalue) { |
| 2137 | - if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 2138 | - $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
| 2139 | - $find = true; |
|
| 2140 | - break; |
|
| 2141 | - } |
|
| 2142 | - } |
|
| 2143 | - if ($find === false) { |
|
| 2144 | - $pall[] = $value; |
|
| 2145 | - } |
|
| 2146 | - } |
|
| 2147 | - $alldata = $pall; |
|
| 2137 | + if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 2138 | + $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
| 2139 | + $find = true; |
|
| 2140 | + break; |
|
| 2141 | + } |
|
| 2142 | + } |
|
| 2143 | + if ($find === false) { |
|
| 2144 | + $pall[] = $value; |
|
| 2145 | + } |
|
| 2146 | + } |
|
| 2147 | + $alldata = $pall; |
|
| 2148 | 2148 | foreach ($alldata as $number) { |
| 2149 | 2149 | $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); |
| 2150 | 2150 | } |
@@ -18,14 +18,14 @@ discard block |
||
| 18 | 18 | $this->db = $Connection->db(); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function addLastStatsUpdate($type,$stats_date) { |
|
| 21 | + public function addLastStatsUpdate($type, $stats_date) { |
|
| 22 | 22 | $query = "DELETE FROM config WHERE name = :type; |
| 23 | 23 | INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
| 24 | - $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
| 24 | + $query_values = array('type' => $type, ':stats_date' => $stats_date); |
|
| 25 | 25 | try { |
| 26 | 26 | $sth = $this->db->prepare($query); |
| 27 | 27 | $sth->execute($query_values); |
| 28 | - } catch(PDOException $e) { |
|
| 28 | + } catch (PDOException $e) { |
|
| 29 | 29 | return "error : ".$e->getMessage(); |
| 30 | 30 | } |
| 31 | 31 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | try { |
| 36 | 36 | $sth = $this->db->prepare($query); |
| 37 | 37 | $sth->execute(array(':type' => $type)); |
| 38 | - } catch(PDOException $e) { |
|
| 38 | + } catch (PDOException $e) { |
|
| 39 | 39 | echo "error : ".$e->getMessage(); |
| 40 | 40 | } |
| 41 | 41 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | try { |
| 56 | 56 | $sth = $this->db->prepare($query); |
| 57 | 57 | $sth->execute(array(':filter_name' => $filter_name)); |
| 58 | - } catch(PDOException $e) { |
|
| 58 | + } catch (PDOException $e) { |
|
| 59 | 59 | return "error : ".$e->getMessage(); |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | try { |
| 69 | 69 | $sth = $this->db->prepare($query); |
| 70 | 70 | $sth->execute(); |
| 71 | - } catch(PDOException $e) { |
|
| 71 | + } catch (PDOException $e) { |
|
| 72 | 72 | return "error : ".$e->getMessage(); |
| 73 | 73 | } |
| 74 | 74 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | try { |
| 77 | 77 | $sth = $this->db->prepare($query); |
| 78 | 78 | $sth->execute(array(':filter_name' => $filter_name)); |
| 79 | - } catch(PDOException $e) { |
|
| 79 | + } catch (PDOException $e) { |
|
| 80 | 80 | return "error : ".$e->getMessage(); |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -86,69 +86,69 @@ discard block |
||
| 86 | 86 | try { |
| 87 | 87 | $sth = $this->db->prepare($query); |
| 88 | 88 | $sth->execute(array(':filter_name' => $filter_name)); |
| 89 | - } catch(PDOException $e) { |
|
| 89 | + } catch (PDOException $e) { |
|
| 90 | 90 | echo "error : ".$e->getMessage(); |
| 91 | 91 | } |
| 92 | 92 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 93 | 93 | return $all; |
| 94 | 94 | } |
| 95 | - public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
|
| 95 | + public function getAllAircraftTypes($stats_airline = '', $filter_name = '') { |
|
| 96 | 96 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 97 | 97 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
| 98 | 98 | try { |
| 99 | 99 | $sth = $this->db->prepare($query); |
| 100 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 101 | - } catch(PDOException $e) { |
|
| 100 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 101 | + } catch (PDOException $e) { |
|
| 102 | 102 | echo "error : ".$e->getMessage(); |
| 103 | 103 | } |
| 104 | 104 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 105 | 105 | return $all; |
| 106 | 106 | } |
| 107 | - public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
|
| 107 | + public function getAllManufacturers($stats_airline = '', $filter_name = '') { |
|
| 108 | 108 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 109 | 109 | $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC"; |
| 110 | 110 | try { |
| 111 | 111 | $sth = $this->db->prepare($query); |
| 112 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 113 | - } catch(PDOException $e) { |
|
| 112 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 113 | + } catch (PDOException $e) { |
|
| 114 | 114 | echo "error : ".$e->getMessage(); |
| 115 | 115 | } |
| 116 | 116 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 117 | 117 | return $all; |
| 118 | 118 | } |
| 119 | - public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
|
| 119 | + public function getAllAirportNames($stats_airline = '', $filter_name = '') { |
|
| 120 | 120 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 121 | 121 | $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
| 122 | 122 | try { |
| 123 | 123 | $sth = $this->db->prepare($query); |
| 124 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 125 | - } catch(PDOException $e) { |
|
| 124 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 125 | + } catch (PDOException $e) { |
|
| 126 | 126 | echo "error : ".$e->getMessage(); |
| 127 | 127 | } |
| 128 | 128 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 129 | 129 | return $all; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - public function getAllOwnerNames($stats_airline = '',$filter_name = '') { |
|
| 132 | + public function getAllOwnerNames($stats_airline = '', $filter_name = '') { |
|
| 133 | 133 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 134 | 134 | $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC"; |
| 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); |
| 142 | 142 | return $all; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - public function getAllPilotNames($stats_airline = '',$filter_name = '') { |
|
| 145 | + public function getAllPilotNames($stats_airline = '', $filter_name = '') { |
|
| 146 | 146 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 147 | 147 | $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC"; |
| 148 | 148 | try { |
| 149 | 149 | $sth = $this->db->prepare($query); |
| 150 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 151 | - } catch(PDOException $e) { |
|
| 150 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 151 | + } catch (PDOException $e) { |
|
| 152 | 152 | echo "error : ".$e->getMessage(); |
| 153 | 153 | } |
| 154 | 154 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | |
| 159 | - public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
| 159 | + public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 160 | 160 | global $globalStatsFilters; |
| 161 | 161 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 162 | 162 | if ($year == '' && $month == '') { |
@@ -164,24 +164,24 @@ discard block |
||
| 164 | 164 | else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
| 165 | 165 | try { |
| 166 | 166 | $sth = $this->db->prepare($query); |
| 167 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 168 | - } catch(PDOException $e) { |
|
| 167 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 168 | + } catch (PDOException $e) { |
|
| 169 | 169 | echo "error : ".$e->getMessage(); |
| 170 | 170 | } |
| 171 | 171 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 172 | 172 | } else $all = array(); |
| 173 | 173 | if (empty($all)) { |
| 174 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 174 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 175 | 175 | if ($filter_name != '') { |
| 176 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 176 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 177 | 177 | } |
| 178 | 178 | $Spotter = new Spotter($this->db); |
| 179 | 179 | //$all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month); |
| 180 | - $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
| 180 | + $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters); |
|
| 181 | 181 | } |
| 182 | 182 | return $all; |
| 183 | 183 | } |
| 184 | - public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
|
| 184 | + public function countAllAirlineCountries($limit = true, $filter_name = '', $year = '', $month = '') { |
|
| 185 | 185 | global $globalStatsFilters; |
| 186 | 186 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 187 | 187 | if ($year == '' && $month == '') { |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | try { |
| 191 | 191 | $sth = $this->db->prepare($query); |
| 192 | 192 | $sth->execute(array(':filter_name' => $filter_name)); |
| 193 | - } catch(PDOException $e) { |
|
| 193 | + } catch (PDOException $e) { |
|
| 194 | 194 | echo "error : ".$e->getMessage(); |
| 195 | 195 | } |
| 196 | 196 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -198,16 +198,16 @@ discard block |
||
| 198 | 198 | if (empty($all)) { |
| 199 | 199 | $Spotter = new Spotter($this->db); |
| 200 | 200 | $filters = array(); |
| 201 | - $filters = array('year' => $year,'month' => $month); |
|
| 201 | + $filters = array('year' => $year, 'month' => $month); |
|
| 202 | 202 | if ($filter_name != '') { |
| 203 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 203 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 204 | 204 | } |
| 205 | 205 | //$all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month); |
| 206 | - $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
| 206 | + $all = $Spotter->countAllAirlineCountries($limit, $filters); |
|
| 207 | 207 | } |
| 208 | 208 | return $all; |
| 209 | 209 | } |
| 210 | - public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
| 210 | + public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 211 | 211 | global $globalStatsFilters; |
| 212 | 212 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 213 | 213 | if ($year == '' && $month == '') { |
@@ -215,16 +215,16 @@ discard block |
||
| 215 | 215 | else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
| 216 | 216 | try { |
| 217 | 217 | $sth = $this->db->prepare($query); |
| 218 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 219 | - } catch(PDOException $e) { |
|
| 218 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 219 | + } catch (PDOException $e) { |
|
| 220 | 220 | echo "error : ".$e->getMessage(); |
| 221 | 221 | } |
| 222 | 222 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 223 | 223 | } else $all = array(); |
| 224 | 224 | if (empty($all)) { |
| 225 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 225 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 226 | 226 | if ($filter_name != '') { |
| 227 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 227 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 228 | 228 | } |
| 229 | 229 | $Spotter = new Spotter($this->db); |
| 230 | 230 | //$all = $Spotter->countAllAircraftManufacturers($filters,$year,$month); |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | return $all; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
| 236 | + public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 237 | 237 | global $globalStatsFilters; |
| 238 | 238 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 239 | 239 | if ($year == '' && $month == '') { |
@@ -241,20 +241,20 @@ discard block |
||
| 241 | 241 | else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
| 242 | 242 | try { |
| 243 | 243 | $sth = $this->db->prepare($query); |
| 244 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 245 | - } catch(PDOException $e) { |
|
| 244 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 245 | + } catch (PDOException $e) { |
|
| 246 | 246 | echo "error : ".$e->getMessage(); |
| 247 | 247 | } |
| 248 | 248 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 249 | 249 | } else $all = array(); |
| 250 | 250 | if (empty($all)) { |
| 251 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 251 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 252 | 252 | if ($filter_name != '') { |
| 253 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 253 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 254 | 254 | } |
| 255 | 255 | $Spotter = new Spotter($this->db); |
| 256 | 256 | //$all = $Spotter->countAllArrivalCountries($limit,$filters,$year,$month); |
| 257 | - $all = $Spotter->countAllArrivalCountries($limit,$filters); |
|
| 257 | + $all = $Spotter->countAllArrivalCountries($limit, $filters); |
|
| 258 | 258 | } |
| 259 | 259 | return $all; |
| 260 | 260 | } |
@@ -265,15 +265,15 @@ discard block |
||
| 265 | 265 | else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
| 266 | 266 | try { |
| 267 | 267 | $sth = $this->db->prepare($query); |
| 268 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 269 | - } catch(PDOException $e) { |
|
| 268 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 269 | + } catch (PDOException $e) { |
|
| 270 | 270 | echo "error : ".$e->getMessage(); |
| 271 | 271 | } |
| 272 | 272 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 273 | 273 | if (empty($all)) { |
| 274 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 274 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 275 | 275 | if ($filter_name != '') { |
| 276 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 276 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 277 | 277 | } |
| 278 | 278 | $Spotter = new Spotter($this->db); |
| 279 | 279 | //$all = $Spotter->countAllDepartureCountries($filters,$year,$month); |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | return $all; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | - public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
|
| 285 | + public function countAllAirlines($limit = true, $filter_name = '', $year = '', $month = '') { |
|
| 286 | 286 | global $globalStatsFilters, $globalVATSIM, $globalIVAO; |
| 287 | 287 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 288 | 288 | if ($year == '' && $month == '') { |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | if (isset($forsource)) { |
| 292 | 292 | if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
| 293 | 293 | else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC"; |
| 294 | - $query_values = array(':filter_name' => $filter_name,':forsource' => $forsource); |
|
| 294 | + $query_values = array(':filter_name' => $filter_name, ':forsource' => $forsource); |
|
| 295 | 295 | } else { |
| 296 | 296 | if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
| 297 | 297 | else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC"; |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | try { |
| 301 | 301 | $sth = $this->db->prepare($query); |
| 302 | 302 | $sth->execute($query_values); |
| 303 | - } catch(PDOException $e) { |
|
| 303 | + } catch (PDOException $e) { |
|
| 304 | 304 | echo "error : ".$e->getMessage(); |
| 305 | 305 | } |
| 306 | 306 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -308,16 +308,16 @@ discard block |
||
| 308 | 308 | if (empty($all)) { |
| 309 | 309 | $Spotter = new Spotter($this->db); |
| 310 | 310 | $filters = array(); |
| 311 | - $filters = array('year' => $year,'month' => $month); |
|
| 311 | + $filters = array('year' => $year, 'month' => $month); |
|
| 312 | 312 | if ($filter_name != '') { |
| 313 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 313 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 314 | 314 | } |
| 315 | 315 | //$all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month); |
| 316 | - $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
| 316 | + $all = $Spotter->countAllAirlines($limit, 0, '', $filters); |
|
| 317 | 317 | } |
| 318 | 318 | return $all; |
| 319 | 319 | } |
| 320 | - public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
| 320 | + public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 321 | 321 | global $globalStatsFilters; |
| 322 | 322 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 323 | 323 | if ($year == '' && $month == '') { |
@@ -325,24 +325,24 @@ discard block |
||
| 325 | 325 | else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
| 326 | 326 | try { |
| 327 | 327 | $sth = $this->db->prepare($query); |
| 328 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 329 | - } catch(PDOException $e) { |
|
| 328 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 329 | + } catch (PDOException $e) { |
|
| 330 | 330 | echo "error : ".$e->getMessage(); |
| 331 | 331 | } |
| 332 | 332 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 333 | 333 | } else $all = array(); |
| 334 | 334 | if (empty($all)) { |
| 335 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 335 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 336 | 336 | if ($filter_name != '') { |
| 337 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 337 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 338 | 338 | } |
| 339 | 339 | $Spotter = new Spotter($this->db); |
| 340 | 340 | //$all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters,$year,$month); |
| 341 | - $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
| 341 | + $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters); |
|
| 342 | 342 | } |
| 343 | 343 | return $all; |
| 344 | 344 | } |
| 345 | - public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
| 345 | + public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 346 | 346 | global $globalStatsFilters; |
| 347 | 347 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 348 | 348 | if ($year == '' && $month == '') { |
@@ -350,24 +350,24 @@ discard block |
||
| 350 | 350 | else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
| 351 | 351 | try { |
| 352 | 352 | $sth = $this->db->prepare($query); |
| 353 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 354 | - } catch(PDOException $e) { |
|
| 353 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 354 | + } catch (PDOException $e) { |
|
| 355 | 355 | echo "error : ".$e->getMessage(); |
| 356 | 356 | } |
| 357 | 357 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 358 | 358 | } else $all = array(); |
| 359 | 359 | if (empty($all)) { |
| 360 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 360 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 361 | 361 | if ($filter_name != '') { |
| 362 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 362 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 363 | 363 | } |
| 364 | 364 | $Spotter = new Spotter($this->db); |
| 365 | 365 | //$all = $Spotter->countAllCallsigns($limit,0,'',$filters,$year,$month); |
| 366 | - $all = $Spotter->countAllCallsigns($limit,0,'',$filters); |
|
| 366 | + $all = $Spotter->countAllCallsigns($limit, 0, '', $filters); |
|
| 367 | 367 | } |
| 368 | 368 | return $all; |
| 369 | 369 | } |
| 370 | - public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
| 370 | + public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 371 | 371 | $Connection = new Connection(); |
| 372 | 372 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 373 | 373 | if ($Connection->tableExists('countries')) { |
@@ -376,8 +376,8 @@ discard block |
||
| 376 | 376 | else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
| 377 | 377 | try { |
| 378 | 378 | $sth = $this->db->prepare($query); |
| 379 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 380 | - } catch(PDOException $e) { |
|
| 379 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 380 | + } catch (PDOException $e) { |
|
| 381 | 381 | echo "error : ".$e->getMessage(); |
| 382 | 382 | } |
| 383 | 383 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | return array(); |
| 394 | 394 | } |
| 395 | 395 | } |
| 396 | - public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
|
| 396 | + public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 397 | 397 | global $globalStatsFilters; |
| 398 | 398 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 399 | 399 | if ($year == '' && $month == '') { |
@@ -401,25 +401,25 @@ discard block |
||
| 401 | 401 | else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
| 402 | 402 | try { |
| 403 | 403 | $sth = $this->db->prepare($query); |
| 404 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 405 | - } catch(PDOException $e) { |
|
| 404 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 405 | + } catch (PDOException $e) { |
|
| 406 | 406 | echo "error : ".$e->getMessage(); |
| 407 | 407 | } |
| 408 | 408 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 409 | 409 | } else $all = array(); |
| 410 | 410 | if (empty($all)) { |
| 411 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 411 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 412 | 412 | if ($filter_name != '') { |
| 413 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 413 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 414 | 414 | } |
| 415 | 415 | $Spotter = new Spotter($this->db); |
| 416 | 416 | //$all = $Spotter->countAllPilots($limit,0,'',$filters,$year,$month); |
| 417 | - $all = $Spotter->countAllPilots($limit,0,'',$filters); |
|
| 417 | + $all = $Spotter->countAllPilots($limit, 0, '', $filters); |
|
| 418 | 418 | } |
| 419 | 419 | return $all; |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | - public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
| 422 | + public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 423 | 423 | global $globalStatsFilters; |
| 424 | 424 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 425 | 425 | if ($year == '' && $month == '') { |
@@ -427,24 +427,24 @@ discard block |
||
| 427 | 427 | else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
| 428 | 428 | try { |
| 429 | 429 | $sth = $this->db->prepare($query); |
| 430 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 431 | - } catch(PDOException $e) { |
|
| 430 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 431 | + } catch (PDOException $e) { |
|
| 432 | 432 | echo "error : ".$e->getMessage(); |
| 433 | 433 | } |
| 434 | 434 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 435 | 435 | } else $all = array(); |
| 436 | 436 | if (empty($all)) { |
| 437 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 437 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 438 | 438 | if ($filter_name != '') { |
| 439 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 439 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 440 | 440 | } |
| 441 | 441 | $Spotter = new Spotter($this->db); |
| 442 | 442 | //$all = $Spotter->countAllOwners($limit,0,'',$filters,$year,$month); |
| 443 | - $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
| 443 | + $all = $Spotter->countAllOwners($limit, 0, '', $filters); |
|
| 444 | 444 | } |
| 445 | 445 | return $all; |
| 446 | 446 | } |
| 447 | - public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
| 447 | + public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 448 | 448 | global $globalStatsFilters; |
| 449 | 449 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 450 | 450 | if ($year == '' && $month == '') { |
@@ -452,22 +452,22 @@ discard block |
||
| 452 | 452 | else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
| 453 | 453 | try { |
| 454 | 454 | $sth = $this->db->prepare($query); |
| 455 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 456 | - } catch(PDOException $e) { |
|
| 455 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 456 | + } catch (PDOException $e) { |
|
| 457 | 457 | echo "error : ".$e->getMessage(); |
| 458 | 458 | } |
| 459 | 459 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 460 | 460 | } else $all = array(); |
| 461 | 461 | if (empty($all)) { |
| 462 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 462 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 463 | 463 | if ($filter_name != '') { |
| 464 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 464 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 465 | 465 | } |
| 466 | 466 | $Spotter = new Spotter($this->db); |
| 467 | 467 | // $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters,$year,$month); |
| 468 | 468 | // $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters,$year,$month); |
| 469 | - $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
| 470 | - $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
| 469 | + $pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters); |
|
| 470 | + $dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters); |
|
| 471 | 471 | $all = array(); |
| 472 | 472 | foreach ($pall as $value) { |
| 473 | 473 | $icao = $value['airport_departure_icao']; |
@@ -484,11 +484,11 @@ discard block |
||
| 484 | 484 | foreach ($all as $key => $row) { |
| 485 | 485 | $count[$key] = $row['airport_departure_icao_count']; |
| 486 | 486 | } |
| 487 | - array_multisort($count,SORT_DESC,$all); |
|
| 487 | + array_multisort($count, SORT_DESC, $all); |
|
| 488 | 488 | } |
| 489 | 489 | return $all; |
| 490 | 490 | } |
| 491 | - public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
| 491 | + public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 492 | 492 | global $globalStatsFilters; |
| 493 | 493 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 494 | 494 | if ($year == '' && $month == '') { |
@@ -496,22 +496,22 @@ discard block |
||
| 496 | 496 | else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
| 497 | 497 | try { |
| 498 | 498 | $sth = $this->db->prepare($query); |
| 499 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 500 | - } catch(PDOException $e) { |
|
| 499 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 500 | + } catch (PDOException $e) { |
|
| 501 | 501 | echo "error : ".$e->getMessage(); |
| 502 | 502 | } |
| 503 | 503 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 504 | 504 | } else $all = array(); |
| 505 | 505 | if (empty($all)) { |
| 506 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 506 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 507 | 507 | if ($filter_name != '') { |
| 508 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 508 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 509 | 509 | } |
| 510 | 510 | $Spotter = new Spotter($this->db); |
| 511 | 511 | // $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters,$year,$month); |
| 512 | 512 | // $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters,$year,$month); |
| 513 | - $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters); |
|
| 514 | - $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters); |
|
| 513 | + $pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters); |
|
| 514 | + $dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters); |
|
| 515 | 515 | $all = array(); |
| 516 | 516 | foreach ($pall as $value) { |
| 517 | 517 | $icao = $value['airport_arrival_icao']; |
@@ -528,12 +528,12 @@ discard block |
||
| 528 | 528 | foreach ($all as $key => $row) { |
| 529 | 529 | $count[$key] = $row['airport_arrival_icao_count']; |
| 530 | 530 | } |
| 531 | - array_multisort($count,SORT_DESC,$all); |
|
| 531 | + array_multisort($count, SORT_DESC, $all); |
|
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | return $all; |
| 535 | 535 | } |
| 536 | - public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
|
| 536 | + public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') { |
|
| 537 | 537 | global $globalDBdriver, $globalStatsFilters; |
| 538 | 538 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 539 | 539 | if ($globalDBdriver == 'mysql') { |
@@ -543,18 +543,18 @@ discard block |
||
| 543 | 543 | if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 544 | 544 | else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 545 | 545 | } |
| 546 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 546 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 547 | 547 | try { |
| 548 | 548 | $sth = $this->db->prepare($query); |
| 549 | 549 | $sth->execute($query_data); |
| 550 | - } catch(PDOException $e) { |
|
| 550 | + } catch (PDOException $e) { |
|
| 551 | 551 | echo "error : ".$e->getMessage(); |
| 552 | 552 | } |
| 553 | 553 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 554 | 554 | if (empty($all)) { |
| 555 | 555 | $filters = array('airlines' => array($stats_airline)); |
| 556 | 556 | if ($filter_name != '') { |
| 557 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 557 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 558 | 558 | } |
| 559 | 559 | $Spotter = new Spotter($this->db); |
| 560 | 560 | $all = $Spotter->countAllMonthsLastYear($filters); |
@@ -563,29 +563,29 @@ discard block |
||
| 563 | 563 | return $all; |
| 564 | 564 | } |
| 565 | 565 | |
| 566 | - public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
|
| 566 | + public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') { |
|
| 567 | 567 | global $globalStatsFilters; |
| 568 | 568 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 569 | 569 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 570 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 570 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 571 | 571 | try { |
| 572 | 572 | $sth = $this->db->prepare($query); |
| 573 | 573 | $sth->execute($query_data); |
| 574 | - } catch(PDOException $e) { |
|
| 574 | + } catch (PDOException $e) { |
|
| 575 | 575 | echo "error : ".$e->getMessage(); |
| 576 | 576 | } |
| 577 | 577 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 578 | 578 | if (empty($all)) { |
| 579 | 579 | $filters = array('airlines' => array($stats_airline)); |
| 580 | 580 | if ($filter_name != '') { |
| 581 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 581 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 582 | 582 | } |
| 583 | 583 | $Spotter = new Spotter($this->db); |
| 584 | 584 | $all = $Spotter->countAllDatesLastMonth($filters); |
| 585 | 585 | } |
| 586 | 586 | return $all; |
| 587 | 587 | } |
| 588 | - public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
|
| 588 | + public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') { |
|
| 589 | 589 | global $globalDBdriver, $globalStatsFilters; |
| 590 | 590 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 591 | 591 | if ($globalDBdriver == 'mysql') { |
@@ -593,40 +593,40 @@ discard block |
||
| 593 | 593 | } else { |
| 594 | 594 | $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"; |
| 595 | 595 | } |
| 596 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 596 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 597 | 597 | try { |
| 598 | 598 | $sth = $this->db->prepare($query); |
| 599 | 599 | $sth->execute($query_data); |
| 600 | - } catch(PDOException $e) { |
|
| 600 | + } catch (PDOException $e) { |
|
| 601 | 601 | echo "error : ".$e->getMessage(); |
| 602 | 602 | } |
| 603 | 603 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 604 | 604 | if (empty($all)) { |
| 605 | 605 | $filters = array('airlines' => array($stats_airline)); |
| 606 | 606 | if ($filter_name != '') { |
| 607 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 607 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 608 | 608 | } |
| 609 | 609 | $Spotter = new Spotter($this->db); |
| 610 | 610 | $all = $Spotter->countAllDatesLast7Days($filters); |
| 611 | 611 | } |
| 612 | 612 | return $all; |
| 613 | 613 | } |
| 614 | - public function countAllDates($stats_airline = '',$filter_name = '') { |
|
| 614 | + public function countAllDates($stats_airline = '', $filter_name = '') { |
|
| 615 | 615 | global $globalStatsFilters; |
| 616 | 616 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 617 | 617 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 618 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 618 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 619 | 619 | try { |
| 620 | 620 | $sth = $this->db->prepare($query); |
| 621 | 621 | $sth->execute($query_data); |
| 622 | - } catch(PDOException $e) { |
|
| 622 | + } catch (PDOException $e) { |
|
| 623 | 623 | echo "error : ".$e->getMessage(); |
| 624 | 624 | } |
| 625 | 625 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 626 | 626 | if (empty($all)) { |
| 627 | 627 | $filters = array('airlines' => array($stats_airline)); |
| 628 | 628 | if ($filter_name != '') { |
| 629 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 629 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 630 | 630 | } |
| 631 | 631 | $Spotter = new Spotter($this->db); |
| 632 | 632 | $all = $Spotter->countAllDates($filters); |
@@ -641,21 +641,21 @@ discard block |
||
| 641 | 641 | try { |
| 642 | 642 | $sth = $this->db->prepare($query); |
| 643 | 643 | $sth->execute($query_data); |
| 644 | - } catch(PDOException $e) { |
|
| 644 | + } catch (PDOException $e) { |
|
| 645 | 645 | echo "error : ".$e->getMessage(); |
| 646 | 646 | } |
| 647 | 647 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 648 | 648 | if (empty($all)) { |
| 649 | 649 | $filters = array(); |
| 650 | 650 | if ($filter_name != '') { |
| 651 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 651 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 652 | 652 | } |
| 653 | 653 | $Spotter = new Spotter($this->db); |
| 654 | 654 | $all = $Spotter->countAllDatesByAirlines($filters); |
| 655 | 655 | } |
| 656 | 656 | return $all; |
| 657 | 657 | } |
| 658 | - public function countAllMonths($stats_airline = '',$filter_name = '') { |
|
| 658 | + public function countAllMonths($stats_airline = '', $filter_name = '') { |
|
| 659 | 659 | global $globalStatsFilters, $globalDBdriver; |
| 660 | 660 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 661 | 661 | if ($globalDBdriver == 'mysql') { |
@@ -666,7 +666,7 @@ discard block |
||
| 666 | 666 | try { |
| 667 | 667 | $sth = $this->db->prepare($query); |
| 668 | 668 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
| 669 | - } catch(PDOException $e) { |
|
| 669 | + } catch (PDOException $e) { |
|
| 670 | 670 | echo "error : ".$e->getMessage(); |
| 671 | 671 | } |
| 672 | 672 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -674,7 +674,7 @@ discard block |
||
| 674 | 674 | if (empty($all)) { |
| 675 | 675 | $filters = array('airlines' => array($stats_airline)); |
| 676 | 676 | if ($filter_name != '') { |
| 677 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 677 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 678 | 678 | } |
| 679 | 679 | $Spotter = new Spotter($this->db); |
| 680 | 680 | $all = $Spotter->countAllMonths($filters); |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | try { |
| 693 | 693 | $sth = $this->db->prepare($query); |
| 694 | 694 | $sth->execute(); |
| 695 | - } catch(PDOException $e) { |
|
| 695 | + } catch (PDOException $e) { |
|
| 696 | 696 | echo "error : ".$e->getMessage(); |
| 697 | 697 | } |
| 698 | 698 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -713,7 +713,7 @@ discard block |
||
| 713 | 713 | try { |
| 714 | 714 | $sth = $this->db->prepare($query); |
| 715 | 715 | $sth->execute(); |
| 716 | - } catch(PDOException $e) { |
|
| 716 | + } catch (PDOException $e) { |
|
| 717 | 717 | echo "error : ".$e->getMessage(); |
| 718 | 718 | } |
| 719 | 719 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -731,21 +731,21 @@ discard block |
||
| 731 | 731 | try { |
| 732 | 732 | $sth = $this->db->prepare($query); |
| 733 | 733 | $sth->execute(array(':filter_name' => $filter_name)); |
| 734 | - } catch(PDOException $e) { |
|
| 734 | + } catch (PDOException $e) { |
|
| 735 | 735 | echo "error : ".$e->getMessage(); |
| 736 | 736 | } |
| 737 | 737 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 738 | 738 | if (empty($all)) { |
| 739 | 739 | $filters = array(); |
| 740 | 740 | if ($filter_name != '') { |
| 741 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 741 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 742 | 742 | } |
| 743 | 743 | $Spotter = new Spotter($this->db); |
| 744 | 744 | $all = $Spotter->countAllMilitaryMonths($filters); |
| 745 | 745 | } |
| 746 | 746 | return $all; |
| 747 | 747 | } |
| 748 | - public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
|
| 748 | + public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') { |
|
| 749 | 749 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
| 750 | 750 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 751 | 751 | if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -762,30 +762,30 @@ discard block |
||
| 762 | 762 | try { |
| 763 | 763 | $sth = $this->db->prepare($query); |
| 764 | 764 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
| 765 | - } catch(PDOException $e) { |
|
| 765 | + } catch (PDOException $e) { |
|
| 766 | 766 | echo "error : ".$e->getMessage(); |
| 767 | 767 | } |
| 768 | 768 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 769 | 769 | if (empty($all)) { |
| 770 | 770 | $filters = array('airlines' => array($stats_airline)); |
| 771 | 771 | if ($filter_name != '') { |
| 772 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 772 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 773 | 773 | } |
| 774 | 774 | $Spotter = new Spotter($this->db); |
| 775 | - $all = $Spotter->countAllHours($orderby,$filters); |
|
| 775 | + $all = $Spotter->countAllHours($orderby, $filters); |
|
| 776 | 776 | } |
| 777 | 777 | return $all; |
| 778 | 778 | } |
| 779 | 779 | |
| 780 | - public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
| 780 | + public function countOverallFlights($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 781 | 781 | global $globalStatsFilters; |
| 782 | 782 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 783 | 783 | if ($year == '') $year = date('Y'); |
| 784 | - $all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 784 | + $all = $this->getSumStats('flights_bymonth', $year, $stats_airline, $filter_name, $month); |
|
| 785 | 785 | if (empty($all)) { |
| 786 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 786 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 787 | 787 | if ($filter_name != '') { |
| 788 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 788 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 789 | 789 | } |
| 790 | 790 | $Spotter = new Spotter($this->db); |
| 791 | 791 | //$all = $Spotter->countOverallFlights($filters,$year,$month); |
@@ -793,16 +793,16 @@ discard block |
||
| 793 | 793 | } |
| 794 | 794 | return $all; |
| 795 | 795 | } |
| 796 | - public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
|
| 796 | + public function countOverallMilitaryFlights($filter_name = '', $year = '', $month = '') { |
|
| 797 | 797 | global $globalStatsFilters; |
| 798 | 798 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 799 | 799 | if ($year == '') $year = date('Y'); |
| 800 | - $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
|
| 800 | + $all = $this->getSumStats('military_flights_bymonth', $year, '', $filter_name, $month); |
|
| 801 | 801 | if (empty($all)) { |
| 802 | 802 | $filters = array(); |
| 803 | - $filters = array('year' => $year,'month' => $month); |
|
| 803 | + $filters = array('year' => $year, 'month' => $month); |
|
| 804 | 804 | if ($filter_name != '') { |
| 805 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 805 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 806 | 806 | } |
| 807 | 807 | $Spotter = new Spotter($this->db); |
| 808 | 808 | //$all = $Spotter->countOverallMilitaryFlights($filters,$year,$month); |
@@ -810,15 +810,15 @@ discard block |
||
| 810 | 810 | } |
| 811 | 811 | return $all; |
| 812 | 812 | } |
| 813 | - public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
|
| 813 | + public function countOverallArrival($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 814 | 814 | global $globalStatsFilters; |
| 815 | 815 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 816 | 816 | if ($year == '') $year = date('Y'); |
| 817 | - $all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 817 | + $all = $this->getSumStats('realarrivals_bymonth', $year, $stats_airline, $filter_name, $month); |
|
| 818 | 818 | if (empty($all)) { |
| 819 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 819 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 820 | 820 | if ($filter_name != '') { |
| 821 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 821 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 822 | 822 | } |
| 823 | 823 | $Spotter = new Spotter($this->db); |
| 824 | 824 | //$all = $Spotter->countOverallArrival($filters,$year,$month); |
@@ -826,24 +826,24 @@ discard block |
||
| 826 | 826 | } |
| 827 | 827 | return $all; |
| 828 | 828 | } |
| 829 | - public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
| 829 | + public function countOverallAircrafts($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 830 | 830 | global $globalStatsFilters; |
| 831 | 831 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 832 | 832 | if ($year == '' && $month == '') { |
| 833 | 833 | $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 834 | 834 | try { |
| 835 | 835 | $sth = $this->db->prepare($query); |
| 836 | - $sth->execute(array(':filter_name' => $filter_name,':stats_airline' => $stats_airline)); |
|
| 837 | - } catch(PDOException $e) { |
|
| 836 | + $sth->execute(array(':filter_name' => $filter_name, ':stats_airline' => $stats_airline)); |
|
| 837 | + } catch (PDOException $e) { |
|
| 838 | 838 | echo "error : ".$e->getMessage(); |
| 839 | 839 | } |
| 840 | 840 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 841 | 841 | $all = $result[0]['nb']; |
| 842 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 842 | + } else $all = $this->getSumStats('aircrafts_bymonth', $year, $stats_airline, $filter_name, $month); |
|
| 843 | 843 | if (empty($all)) { |
| 844 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 844 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 845 | 845 | if ($filter_name != '') { |
| 846 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 846 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 847 | 847 | } |
| 848 | 848 | $Spotter = new Spotter($this->db); |
| 849 | 849 | //$all = $Spotter->countOverallAircrafts($filters,$year,$month); |
@@ -851,7 +851,7 @@ discard block |
||
| 851 | 851 | } |
| 852 | 852 | return $all; |
| 853 | 853 | } |
| 854 | - public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
|
| 854 | + public function countOverallAirlines($filter_name = '', $year = '', $month = '') { |
|
| 855 | 855 | global $globalStatsFilters; |
| 856 | 856 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 857 | 857 | if ($year == '' && $month == '') { |
@@ -859,17 +859,17 @@ discard block |
||
| 859 | 859 | try { |
| 860 | 860 | $sth = $this->db->prepare($query); |
| 861 | 861 | $sth->execute(array(':filter_name' => $filter_name)); |
| 862 | - } catch(PDOException $e) { |
|
| 862 | + } catch (PDOException $e) { |
|
| 863 | 863 | echo "error : ".$e->getMessage(); |
| 864 | 864 | } |
| 865 | 865 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 866 | 866 | $all = $result[0]['nb_airline']; |
| 867 | - } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
| 867 | + } else $all = $this->getSumStats('airlines_bymonth', $year, '', $filter_name, $month); |
|
| 868 | 868 | if (empty($all)) { |
| 869 | 869 | $filters = array(); |
| 870 | - $filters = array('year' => $year,'month' => $month); |
|
| 870 | + $filters = array('year' => $year, 'month' => $month); |
|
| 871 | 871 | if ($filter_name != '') { |
| 872 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 872 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 873 | 873 | } |
| 874 | 874 | $Spotter = new Spotter($this->db); |
| 875 | 875 | //$all = $Spotter->countOverallAirlines($filters,$year,$month); |
@@ -877,7 +877,7 @@ discard block |
||
| 877 | 877 | } |
| 878 | 878 | return $all; |
| 879 | 879 | } |
| 880 | - public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
| 880 | + public function countOverallOwners($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 881 | 881 | global $globalStatsFilters; |
| 882 | 882 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 883 | 883 | if ($year == '' && $month == '') { |
@@ -886,18 +886,18 @@ discard block |
||
| 886 | 886 | try { |
| 887 | 887 | $sth = $this->db->prepare($query); |
| 888 | 888 | $sth->execute($query_values); |
| 889 | - } catch(PDOException $e) { |
|
| 889 | + } catch (PDOException $e) { |
|
| 890 | 890 | echo "error : ".$e->getMessage(); |
| 891 | 891 | } |
| 892 | 892 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 893 | 893 | $all = $result[0]['nb']; |
| 894 | 894 | } else { |
| 895 | - $all = $this->getSumStats('owners_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 895 | + $all = $this->getSumStats('owners_bymonth', $year, $stats_airline, $filter_name, $month); |
|
| 896 | 896 | } |
| 897 | 897 | if (empty($all)) { |
| 898 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 898 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 899 | 899 | if ($filter_name != '') { |
| 900 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 900 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 901 | 901 | } |
| 902 | 902 | $Spotter = new Spotter($this->db); |
| 903 | 903 | //$all = $Spotter->countOverallOwners($filters,$year,$month); |
@@ -905,7 +905,7 @@ discard block |
||
| 905 | 905 | } |
| 906 | 906 | return $all; |
| 907 | 907 | } |
| 908 | - public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
| 908 | + public function countOverallPilots($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 909 | 909 | global $globalStatsFilters; |
| 910 | 910 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 911 | 911 | //if ($year == '') $year = date('Y'); |
@@ -915,18 +915,18 @@ discard block |
||
| 915 | 915 | try { |
| 916 | 916 | $sth = $this->db->prepare($query); |
| 917 | 917 | $sth->execute($query_values); |
| 918 | - } catch(PDOException $e) { |
|
| 918 | + } catch (PDOException $e) { |
|
| 919 | 919 | echo "error : ".$e->getMessage(); |
| 920 | 920 | } |
| 921 | 921 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 922 | 922 | $all = $result[0]['nb']; |
| 923 | 923 | } else { |
| 924 | - $all = $this->getSumStats('pilots_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 924 | + $all = $this->getSumStats('pilots_bymonth', $year, $stats_airline, $filter_name, $month); |
|
| 925 | 925 | } |
| 926 | 926 | if (empty($all)) { |
| 927 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 927 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 928 | 928 | if ($filter_name != '') { |
| 929 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 929 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 930 | 930 | } |
| 931 | 931 | $Spotter = new Spotter($this->db); |
| 932 | 932 | //$all = $Spotter->countOverallPilots($filters,$year,$month); |
@@ -935,67 +935,67 @@ discard block |
||
| 935 | 935 | return $all; |
| 936 | 936 | } |
| 937 | 937 | |
| 938 | - public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
|
| 938 | + public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') { |
|
| 939 | 939 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 940 | 940 | $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date"; |
| 941 | - $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 941 | + $query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 942 | 942 | try { |
| 943 | 943 | $sth = $this->db->prepare($query); |
| 944 | 944 | $sth->execute($query_values); |
| 945 | - } catch(PDOException $e) { |
|
| 945 | + } catch (PDOException $e) { |
|
| 946 | 946 | echo "error : ".$e->getMessage(); |
| 947 | 947 | } |
| 948 | 948 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 949 | 949 | return $all; |
| 950 | 950 | } |
| 951 | - public function getStats($type,$stats_airline = '', $filter_name = '') { |
|
| 951 | + public function getStats($type, $stats_airline = '', $filter_name = '') { |
|
| 952 | 952 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 953 | 953 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
| 954 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 954 | + $query_values = array(':type' => $type, ':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 | echo "error : ".$e->getMessage(); |
| 960 | 960 | } |
| 961 | 961 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 962 | 962 | return $all; |
| 963 | 963 | } |
| 964 | - public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') { |
|
| 964 | + public function deleteStatsByType($type, $stats_airline = '', $filter_name = '') { |
|
| 965 | 965 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 966 | 966 | $query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 967 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 967 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 968 | 968 | try { |
| 969 | 969 | $sth = $this->db->prepare($query); |
| 970 | 970 | $sth->execute($query_values); |
| 971 | - } catch(PDOException $e) { |
|
| 971 | + } catch (PDOException $e) { |
|
| 972 | 972 | echo "error : ".$e->getMessage(); |
| 973 | 973 | } |
| 974 | 974 | } |
| 975 | - public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
|
| 975 | + public function getSumStats($type, $year, $stats_airline = '', $filter_name = '', $month = '') { |
|
| 976 | 976 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 977 | 977 | global $globalArchiveMonths, $globalDBdriver; |
| 978 | 978 | if ($globalDBdriver == 'mysql') { |
| 979 | 979 | if ($month == '') { |
| 980 | 980 | $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"; |
| 981 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 981 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 982 | 982 | } else { |
| 983 | 983 | $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"; |
| 984 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
|
| 984 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month); |
|
| 985 | 985 | } |
| 986 | 986 | } else { |
| 987 | 987 | if ($month == '') { |
| 988 | 988 | $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"; |
| 989 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 989 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 990 | 990 | } else { |
| 991 | 991 | $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"; |
| 992 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
|
| 992 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month); |
|
| 993 | 993 | } |
| 994 | 994 | } |
| 995 | 995 | try { |
| 996 | 996 | $sth = $this->db->prepare($query); |
| 997 | 997 | $sth->execute($query_values); |
| 998 | - } catch(PDOException $e) { |
|
| 998 | + } catch (PDOException $e) { |
|
| 999 | 999 | echo "error : ".$e->getMessage(); |
| 1000 | 1000 | } |
| 1001 | 1001 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | try { |
| 1014 | 1014 | $sth = $this->db->prepare($query); |
| 1015 | 1015 | $sth->execute($query_values); |
| 1016 | - } catch(PDOException $e) { |
|
| 1016 | + } catch (PDOException $e) { |
|
| 1017 | 1017 | echo "error : ".$e->getMessage(); |
| 1018 | 1018 | } |
| 1019 | 1019 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1030,7 +1030,7 @@ discard block |
||
| 1030 | 1030 | try { |
| 1031 | 1031 | $sth = $this->db->prepare($query); |
| 1032 | 1032 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
| 1033 | - } catch(PDOException $e) { |
|
| 1033 | + } catch (PDOException $e) { |
|
| 1034 | 1034 | echo "error : ".$e->getMessage(); |
| 1035 | 1035 | } |
| 1036 | 1036 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1047,7 +1047,7 @@ discard block |
||
| 1047 | 1047 | try { |
| 1048 | 1048 | $sth = $this->db->prepare($query); |
| 1049 | 1049 | $sth->execute(array(':filter_name' => $filter_name)); |
| 1050 | - } catch(PDOException $e) { |
|
| 1050 | + } catch (PDOException $e) { |
|
| 1051 | 1051 | echo "error : ".$e->getMessage(); |
| 1052 | 1052 | } |
| 1053 | 1053 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1064,20 +1064,20 @@ discard block |
||
| 1064 | 1064 | try { |
| 1065 | 1065 | $sth = $this->db->prepare($query); |
| 1066 | 1066 | $sth->execute(array(':filter_name' => $filter_name)); |
| 1067 | - } catch(PDOException $e) { |
|
| 1067 | + } catch (PDOException $e) { |
|
| 1068 | 1068 | echo "error : ".$e->getMessage(); |
| 1069 | 1069 | } |
| 1070 | 1070 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1071 | 1071 | return $all[0]['total']; |
| 1072 | 1072 | } |
| 1073 | - public function getStatsOwner($owner_name,$filter_name = '') { |
|
| 1073 | + public function getStatsOwner($owner_name, $filter_name = '') { |
|
| 1074 | 1074 | global $globalArchiveMonths, $globalDBdriver; |
| 1075 | 1075 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1076 | 1076 | $query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name"; |
| 1077 | 1077 | try { |
| 1078 | 1078 | $sth = $this->db->prepare($query); |
| 1079 | - $sth->execute(array(':filter_name' => $filter_name,':owner_name' => $owner_name)); |
|
| 1080 | - } catch(PDOException $e) { |
|
| 1079 | + $sth->execute(array(':filter_name' => $filter_name, ':owner_name' => $owner_name)); |
|
| 1080 | + } catch (PDOException $e) { |
|
| 1081 | 1081 | echo "error : ".$e->getMessage(); |
| 1082 | 1082 | } |
| 1083 | 1083 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1095,20 +1095,20 @@ discard block |
||
| 1095 | 1095 | try { |
| 1096 | 1096 | $sth = $this->db->prepare($query); |
| 1097 | 1097 | $sth->execute(array(':filter_name' => $filter_name)); |
| 1098 | - } catch(PDOException $e) { |
|
| 1098 | + } catch (PDOException $e) { |
|
| 1099 | 1099 | echo "error : ".$e->getMessage(); |
| 1100 | 1100 | } |
| 1101 | 1101 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1102 | 1102 | return $all[0]['total']; |
| 1103 | 1103 | } |
| 1104 | - public function getStatsPilot($pilot,$filter_name = '') { |
|
| 1104 | + public function getStatsPilot($pilot, $filter_name = '') { |
|
| 1105 | 1105 | global $globalArchiveMonths, $globalDBdriver; |
| 1106 | 1106 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1107 | 1107 | $query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)"; |
| 1108 | 1108 | try { |
| 1109 | 1109 | $sth = $this->db->prepare($query); |
| 1110 | - $sth->execute(array(':filter_name' => $filter_name,':pilot' => $pilot)); |
|
| 1111 | - } catch(PDOException $e) { |
|
| 1110 | + $sth->execute(array(':filter_name' => $filter_name, ':pilot' => $pilot)); |
|
| 1111 | + } catch (PDOException $e) { |
|
| 1112 | 1112 | echo "error : ".$e->getMessage(); |
| 1113 | 1113 | } |
| 1114 | 1114 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1116,7 +1116,7 @@ discard block |
||
| 1116 | 1116 | else return 0; |
| 1117 | 1117 | } |
| 1118 | 1118 | |
| 1119 | - public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
| 1119 | + public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
| 1120 | 1120 | global $globalDBdriver; |
| 1121 | 1121 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1122 | 1122 | if ($globalDBdriver == 'mysql') { |
@@ -1124,15 +1124,15 @@ discard block |
||
| 1124 | 1124 | } else { |
| 1125 | 1125 | $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);"; |
| 1126 | 1126 | } |
| 1127 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1127 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 1128 | 1128 | try { |
| 1129 | 1129 | $sth = $this->db->prepare($query); |
| 1130 | 1130 | $sth->execute($query_values); |
| 1131 | - } catch(PDOException $e) { |
|
| 1131 | + } catch (PDOException $e) { |
|
| 1132 | 1132 | return "error : ".$e->getMessage(); |
| 1133 | 1133 | } |
| 1134 | 1134 | } |
| 1135 | - public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
| 1135 | + public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
| 1136 | 1136 | global $globalDBdriver; |
| 1137 | 1137 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1138 | 1138 | if ($globalDBdriver == 'mysql') { |
@@ -1141,11 +1141,11 @@ discard block |
||
| 1141 | 1141 | //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
| 1142 | 1142 | $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);"; |
| 1143 | 1143 | } |
| 1144 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1144 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 1145 | 1145 | try { |
| 1146 | 1146 | $sth = $this->db->prepare($query); |
| 1147 | 1147 | $sth->execute($query_values); |
| 1148 | - } catch(PDOException $e) { |
|
| 1148 | + } catch (PDOException $e) { |
|
| 1149 | 1149 | return "error : ".$e->getMessage(); |
| 1150 | 1150 | } |
| 1151 | 1151 | } |
@@ -1169,75 +1169,75 @@ discard block |
||
| 1169 | 1169 | } |
| 1170 | 1170 | */ |
| 1171 | 1171 | |
| 1172 | - public function getStatsSource($stats_type,$year = '',$month = '',$day = '') { |
|
| 1172 | + public function getStatsSource($stats_type, $year = '', $month = '', $day = '') { |
|
| 1173 | 1173 | global $globalDBdriver; |
| 1174 | 1174 | $query = "SELECT * FROM stats_source WHERE stats_type = :stats_type"; |
| 1175 | 1175 | $query_values = array(); |
| 1176 | 1176 | if ($globalDBdriver == 'mysql') { |
| 1177 | 1177 | if ($year != '') { |
| 1178 | 1178 | $query .= ' AND YEAR(stats_date) = :year'; |
| 1179 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1179 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1180 | 1180 | } |
| 1181 | 1181 | if ($month != '') { |
| 1182 | 1182 | $query .= ' AND MONTH(stats_date) = :month'; |
| 1183 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1183 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1184 | 1184 | } |
| 1185 | 1185 | if ($day != '') { |
| 1186 | 1186 | $query .= ' AND DAY(stats_date) = :day'; |
| 1187 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 1187 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 1188 | 1188 | } |
| 1189 | 1189 | } else { |
| 1190 | 1190 | if ($year != '') { |
| 1191 | 1191 | $query .= ' AND EXTRACT(YEAR FROM stats_date) = :year'; |
| 1192 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1192 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1193 | 1193 | } |
| 1194 | 1194 | if ($month != '') { |
| 1195 | 1195 | $query .= ' AND EXTRACT(MONTH FROM stats_date) = :month'; |
| 1196 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1196 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1197 | 1197 | } |
| 1198 | 1198 | if ($day != '') { |
| 1199 | 1199 | $query .= ' AND EXTRACT(DAY FROM stats_date) = :day'; |
| 1200 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 1200 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 1201 | 1201 | } |
| 1202 | 1202 | } |
| 1203 | 1203 | $query .= " ORDER BY source_name"; |
| 1204 | - $query_values = array_merge($query_values,array(':stats_type' => $stats_type)); |
|
| 1204 | + $query_values = array_merge($query_values, array(':stats_type' => $stats_type)); |
|
| 1205 | 1205 | try { |
| 1206 | 1206 | $sth = $this->db->prepare($query); |
| 1207 | 1207 | $sth->execute($query_values); |
| 1208 | - } catch(PDOException $e) { |
|
| 1208 | + } catch (PDOException $e) { |
|
| 1209 | 1209 | echo "error : ".$e->getMessage(); |
| 1210 | 1210 | } |
| 1211 | 1211 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1212 | 1212 | return $all; |
| 1213 | 1213 | } |
| 1214 | 1214 | |
| 1215 | - public function addStatSource($data,$source_name,$stats_type,$date) { |
|
| 1215 | + public function addStatSource($data, $source_name, $stats_type, $date) { |
|
| 1216 | 1216 | global $globalDBdriver; |
| 1217 | 1217 | if ($globalDBdriver == 'mysql') { |
| 1218 | 1218 | $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"; |
| 1219 | 1219 | } else { |
| 1220 | 1220 | $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);"; |
| 1221 | 1221 | } |
| 1222 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
| 1222 | + $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type); |
|
| 1223 | 1223 | try { |
| 1224 | 1224 | $sth = $this->db->prepare($query); |
| 1225 | 1225 | $sth->execute($query_values); |
| 1226 | - } catch(PDOException $e) { |
|
| 1226 | + } catch (PDOException $e) { |
|
| 1227 | 1227 | return "error : ".$e->getMessage(); |
| 1228 | 1228 | } |
| 1229 | 1229 | } |
| 1230 | - public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
|
| 1230 | + public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') { |
|
| 1231 | 1231 | $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
| 1232 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1232 | + $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 1233 | 1233 | try { |
| 1234 | 1234 | $sth = $this->db->prepare($query); |
| 1235 | 1235 | $sth->execute($query_values); |
| 1236 | - } catch(PDOException $e) { |
|
| 1236 | + } catch (PDOException $e) { |
|
| 1237 | 1237 | return "error : ".$e->getMessage(); |
| 1238 | 1238 | } |
| 1239 | 1239 | } |
| 1240 | - public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '',$reset = false) { |
|
| 1240 | + public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
| 1241 | 1241 | global $globalDBdriver; |
| 1242 | 1242 | if ($globalDBdriver == 'mysql') { |
| 1243 | 1243 | if ($reset) { |
@@ -1252,15 +1252,15 @@ discard block |
||
| 1252 | 1252 | $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);"; |
| 1253 | 1253 | } |
| 1254 | 1254 | } |
| 1255 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 1255 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 1256 | 1256 | try { |
| 1257 | 1257 | $sth = $this->db->prepare($query); |
| 1258 | 1258 | $sth->execute($query_values); |
| 1259 | - } catch(PDOException $e) { |
|
| 1259 | + } catch (PDOException $e) { |
|
| 1260 | 1260 | return "error : ".$e->getMessage(); |
| 1261 | 1261 | } |
| 1262 | 1262 | } |
| 1263 | - public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '', $reset = false) { |
|
| 1263 | + public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '', $reset = false) { |
|
| 1264 | 1264 | global $globalDBdriver; |
| 1265 | 1265 | if ($globalDBdriver == 'mysql') { |
| 1266 | 1266 | if ($reset) { |
@@ -1275,15 +1275,15 @@ discard block |
||
| 1275 | 1275 | $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);"; |
| 1276 | 1276 | } |
| 1277 | 1277 | } |
| 1278 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 1278 | + $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 1279 | 1279 | try { |
| 1280 | 1280 | $sth = $this->db->prepare($query); |
| 1281 | 1281 | $sth->execute($query_values); |
| 1282 | - } catch(PDOException $e) { |
|
| 1282 | + } catch (PDOException $e) { |
|
| 1283 | 1283 | return "error : ".$e->getMessage(); |
| 1284 | 1284 | } |
| 1285 | 1285 | } |
| 1286 | - public function addStatCountry($iso2,$iso3,$name,$cnt,$airline_icao = '',$filter_name = '',$reset = false) { |
|
| 1286 | + public function addStatCountry($iso2, $iso3, $name, $cnt, $airline_icao = '', $filter_name = '', $reset = false) { |
|
| 1287 | 1287 | global $globalDBdriver; |
| 1288 | 1288 | if ($globalDBdriver == 'mysql') { |
| 1289 | 1289 | if ($reset) { |
@@ -1298,15 +1298,15 @@ discard block |
||
| 1298 | 1298 | $query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name AND stats_airline = :airline; INSERT INTO stats_country (iso2,iso3,name,cnt,stats_airline,filter_name) SELECT :iso2,:iso3,:name,:cnt,:airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name AND stats_airline = :airline);"; |
| 1299 | 1299 | } |
| 1300 | 1300 | } |
| 1301 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name,':airline' => $airline_icao); |
|
| 1301 | + $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name, ':airline' => $airline_icao); |
|
| 1302 | 1302 | try { |
| 1303 | 1303 | $sth = $this->db->prepare($query); |
| 1304 | 1304 | $sth->execute($query_values); |
| 1305 | - } catch(PDOException $e) { |
|
| 1305 | + } catch (PDOException $e) { |
|
| 1306 | 1306 | return "error : ".$e->getMessage(); |
| 1307 | 1307 | } |
| 1308 | 1308 | } |
| 1309 | - public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
| 1309 | + public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
| 1310 | 1310 | global $globalDBdriver; |
| 1311 | 1311 | if ($globalDBdriver == 'mysql') { |
| 1312 | 1312 | if ($reset) { |
@@ -1321,15 +1321,15 @@ discard block |
||
| 1321 | 1321 | $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);"; |
| 1322 | 1322 | } |
| 1323 | 1323 | } |
| 1324 | - $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); |
|
| 1324 | + $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); |
|
| 1325 | 1325 | try { |
| 1326 | 1326 | $sth = $this->db->prepare($query); |
| 1327 | 1327 | $sth->execute($query_values); |
| 1328 | - } catch(PDOException $e) { |
|
| 1328 | + } catch (PDOException $e) { |
|
| 1329 | 1329 | return "error : ".$e->getMessage(); |
| 1330 | 1330 | } |
| 1331 | 1331 | } |
| 1332 | - public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '', $reset = false) { |
|
| 1332 | + public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '', $reset = false) { |
|
| 1333 | 1333 | global $globalDBdriver; |
| 1334 | 1334 | if ($globalDBdriver == 'mysql') { |
| 1335 | 1335 | if ($reset) { |
@@ -1344,15 +1344,15 @@ discard block |
||
| 1344 | 1344 | $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);"; |
| 1345 | 1345 | } |
| 1346 | 1346 | } |
| 1347 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
| 1347 | + $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 1348 | 1348 | try { |
| 1349 | 1349 | $sth = $this->db->prepare($query); |
| 1350 | 1350 | $sth->execute($query_values); |
| 1351 | - } catch(PDOException $e) { |
|
| 1351 | + } catch (PDOException $e) { |
|
| 1352 | 1352 | return "error : ".$e->getMessage(); |
| 1353 | 1353 | } |
| 1354 | 1354 | } |
| 1355 | - public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '', $reset = false) { |
|
| 1355 | + public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '', $reset = false) { |
|
| 1356 | 1356 | global $globalDBdriver; |
| 1357 | 1357 | if ($globalDBdriver == 'mysql') { |
| 1358 | 1358 | if ($reset) { |
@@ -1367,15 +1367,15 @@ discard block |
||
| 1367 | 1367 | $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);"; |
| 1368 | 1368 | } |
| 1369 | 1369 | } |
| 1370 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1370 | + $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 1371 | 1371 | try { |
| 1372 | 1372 | $sth = $this->db->prepare($query); |
| 1373 | 1373 | $sth->execute($query_values); |
| 1374 | - } catch(PDOException $e) { |
|
| 1374 | + } catch (PDOException $e) { |
|
| 1375 | 1375 | return "error : ".$e->getMessage(); |
| 1376 | 1376 | } |
| 1377 | 1377 | } |
| 1378 | - public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '',$reset = false) { |
|
| 1378 | + public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '', $format_source = '', $reset = false) { |
|
| 1379 | 1379 | global $globalDBdriver; |
| 1380 | 1380 | if ($globalDBdriver == 'mysql') { |
| 1381 | 1381 | if ($reset) { |
@@ -1390,15 +1390,15 @@ discard block |
||
| 1390 | 1390 | $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);"; |
| 1391 | 1391 | } |
| 1392 | 1392 | } |
| 1393 | - $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); |
|
| 1393 | + $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); |
|
| 1394 | 1394 | try { |
| 1395 | 1395 | $sth = $this->db->prepare($query); |
| 1396 | 1396 | $sth->execute($query_values); |
| 1397 | - } catch(PDOException $e) { |
|
| 1397 | + } catch (PDOException $e) { |
|
| 1398 | 1398 | return "error : ".$e->getMessage(); |
| 1399 | 1399 | } |
| 1400 | 1400 | } |
| 1401 | - public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '',$reset = false) { |
|
| 1401 | + public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '', $reset = false) { |
|
| 1402 | 1402 | global $globalDBdriver; |
| 1403 | 1403 | if ($airport_icao != '') { |
| 1404 | 1404 | if ($globalDBdriver == 'mysql') { |
@@ -1414,16 +1414,16 @@ discard block |
||
| 1414 | 1414 | $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);"; |
| 1415 | 1415 | } |
| 1416 | 1416 | } |
| 1417 | - $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); |
|
| 1417 | + $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); |
|
| 1418 | 1418 | try { |
| 1419 | 1419 | $sth = $this->db->prepare($query); |
| 1420 | 1420 | $sth->execute($query_values); |
| 1421 | - } catch(PDOException $e) { |
|
| 1421 | + } catch (PDOException $e) { |
|
| 1422 | 1422 | return "error : ".$e->getMessage(); |
| 1423 | 1423 | } |
| 1424 | 1424 | } |
| 1425 | 1425 | } |
| 1426 | - public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
| 1426 | + public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
|
| 1427 | 1427 | global $globalDBdriver; |
| 1428 | 1428 | if ($airport_icao != '') { |
| 1429 | 1429 | if ($globalDBdriver == 'mysql') { |
@@ -1431,16 +1431,16 @@ discard block |
||
| 1431 | 1431 | } else { |
| 1432 | 1432 | $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);"; |
| 1433 | 1433 | } |
| 1434 | - $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); |
|
| 1434 | + $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); |
|
| 1435 | 1435 | try { |
| 1436 | 1436 | $sth = $this->db->prepare($query); |
| 1437 | 1437 | $sth->execute($query_values); |
| 1438 | - } catch(PDOException $e) { |
|
| 1438 | + } catch (PDOException $e) { |
|
| 1439 | 1439 | return "error : ".$e->getMessage(); |
| 1440 | 1440 | } |
| 1441 | 1441 | } |
| 1442 | 1442 | } |
| 1443 | - public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '',$reset = false) { |
|
| 1443 | + public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '', $reset = false) { |
|
| 1444 | 1444 | global $globalDBdriver; |
| 1445 | 1445 | if ($airport_icao != '') { |
| 1446 | 1446 | if ($globalDBdriver == 'mysql') { |
@@ -1456,16 +1456,16 @@ discard block |
||
| 1456 | 1456 | $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);"; |
| 1457 | 1457 | } |
| 1458 | 1458 | } |
| 1459 | - $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); |
|
| 1459 | + $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); |
|
| 1460 | 1460 | try { |
| 1461 | 1461 | $sth = $this->db->prepare($query); |
| 1462 | 1462 | $sth->execute($query_values); |
| 1463 | - } catch(PDOException $e) { |
|
| 1463 | + } catch (PDOException $e) { |
|
| 1464 | 1464 | return "error : ".$e->getMessage(); |
| 1465 | 1465 | } |
| 1466 | 1466 | } |
| 1467 | 1467 | } |
| 1468 | - public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
| 1468 | + public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
|
| 1469 | 1469 | global $globalDBdriver; |
| 1470 | 1470 | if ($airport_icao != '') { |
| 1471 | 1471 | if ($globalDBdriver == 'mysql') { |
@@ -1473,11 +1473,11 @@ discard block |
||
| 1473 | 1473 | } else { |
| 1474 | 1474 | $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);"; |
| 1475 | 1475 | } |
| 1476 | - $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); |
|
| 1476 | + $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); |
|
| 1477 | 1477 | try { |
| 1478 | 1478 | $sth = $this->db->prepare($query); |
| 1479 | 1479 | $sth->execute($query_values); |
| 1480 | - } catch(PDOException $e) { |
|
| 1480 | + } catch (PDOException $e) { |
|
| 1481 | 1481 | return "error : ".$e->getMessage(); |
| 1482 | 1482 | } |
| 1483 | 1483 | } |
@@ -1489,7 +1489,7 @@ discard block |
||
| 1489 | 1489 | try { |
| 1490 | 1490 | $sth = $this->db->prepare($query); |
| 1491 | 1491 | $sth->execute($query_values); |
| 1492 | - } catch(PDOException $e) { |
|
| 1492 | + } catch (PDOException $e) { |
|
| 1493 | 1493 | return "error : ".$e->getMessage(); |
| 1494 | 1494 | } |
| 1495 | 1495 | } |
@@ -1499,7 +1499,7 @@ discard block |
||
| 1499 | 1499 | try { |
| 1500 | 1500 | $sth = $this->db->prepare($query); |
| 1501 | 1501 | $sth->execute($query_values); |
| 1502 | - } catch(PDOException $e) { |
|
| 1502 | + } catch (PDOException $e) { |
|
| 1503 | 1503 | return "error : ".$e->getMessage(); |
| 1504 | 1504 | } |
| 1505 | 1505 | } |
@@ -1509,13 +1509,13 @@ discard block |
||
| 1509 | 1509 | try { |
| 1510 | 1510 | $sth = $this->db->prepare($query); |
| 1511 | 1511 | $sth->execute($query_values); |
| 1512 | - } catch(PDOException $e) { |
|
| 1512 | + } catch (PDOException $e) { |
|
| 1513 | 1513 | return "error : ".$e->getMessage(); |
| 1514 | 1514 | } |
| 1515 | 1515 | } |
| 1516 | 1516 | |
| 1517 | 1517 | public function addOldStats() { |
| 1518 | - global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear; |
|
| 1518 | + global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters, $globalDeleteLastYearStats, $globalStatsReset, $globalStatsResetYear; |
|
| 1519 | 1519 | $Common = new Common(); |
| 1520 | 1520 | $Connection = new Connection(); |
| 1521 | 1521 | date_default_timezone_set('UTC'); |
@@ -1533,40 +1533,40 @@ discard block |
||
| 1533 | 1533 | $Spotter = new Spotter($this->db); |
| 1534 | 1534 | |
| 1535 | 1535 | if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
| 1536 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
|
| 1536 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day); |
|
| 1537 | 1537 | foreach ($alldata as $number) { |
| 1538 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
|
| 1538 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', '', $reset); |
|
| 1539 | 1539 | } |
| 1540 | 1540 | if ($globalDebug) echo 'Count all airlines...'."\n"; |
| 1541 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
|
| 1541 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day); |
|
| 1542 | 1542 | foreach ($alldata as $number) { |
| 1543 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
|
| 1543 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], '', $reset); |
|
| 1544 | 1544 | } |
| 1545 | 1545 | if ($globalDebug) echo 'Count all registrations...'."\n"; |
| 1546 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
|
| 1546 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day); |
|
| 1547 | 1547 | foreach ($alldata as $number) { |
| 1548 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
|
| 1548 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', '', $reset); |
|
| 1549 | 1549 | } |
| 1550 | 1550 | if ($globalDebug) echo 'Count all callsigns...'."\n"; |
| 1551 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
|
| 1551 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day); |
|
| 1552 | 1552 | foreach ($alldata as $number) { |
| 1553 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
| 1553 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset); |
|
| 1554 | 1554 | } |
| 1555 | 1555 | if ($globalDebug) echo 'Count all owners...'."\n"; |
| 1556 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
|
| 1556 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day); |
|
| 1557 | 1557 | foreach ($alldata as $number) { |
| 1558 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
|
| 1558 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', '', $reset); |
|
| 1559 | 1559 | } |
| 1560 | 1560 | if ($globalDebug) echo 'Count all pilots...'."\n"; |
| 1561 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
|
| 1561 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day); |
|
| 1562 | 1562 | foreach ($alldata as $number) { |
| 1563 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
|
| 1563 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', '', $number['format_source'], $reset); |
|
| 1564 | 1564 | } |
| 1565 | 1565 | |
| 1566 | 1566 | if ($globalDebug) echo 'Count all departure airports...'."\n"; |
| 1567 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
|
| 1567 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day); |
|
| 1568 | 1568 | if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
| 1569 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
| 1569 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day); |
|
| 1570 | 1570 | if ($globalDebug) echo 'Order departure airports...'."\n"; |
| 1571 | 1571 | $alldata = array(); |
| 1572 | 1572 | |
@@ -1584,14 +1584,14 @@ discard block |
||
| 1584 | 1584 | foreach ($alldata as $key => $row) { |
| 1585 | 1585 | $count[$key] = $row['airport_departure_icao_count']; |
| 1586 | 1586 | } |
| 1587 | - array_multisort($count,SORT_DESC,$alldata); |
|
| 1587 | + array_multisort($count, SORT_DESC, $alldata); |
|
| 1588 | 1588 | foreach ($alldata as $number) { |
| 1589 | - 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); |
|
| 1589 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', '', $reset); |
|
| 1590 | 1590 | } |
| 1591 | 1591 | if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
| 1592 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
|
| 1592 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day); |
|
| 1593 | 1593 | if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
| 1594 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
| 1594 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day); |
|
| 1595 | 1595 | if ($globalDebug) echo 'Order arrival airports...'."\n"; |
| 1596 | 1596 | $alldata = array(); |
| 1597 | 1597 | foreach ($pall as $value) { |
@@ -1608,16 +1608,16 @@ discard block |
||
| 1608 | 1608 | foreach ($alldata as $key => $row) { |
| 1609 | 1609 | $count[$key] = $row['airport_arrival_icao_count']; |
| 1610 | 1610 | } |
| 1611 | - array_multisort($count,SORT_DESC,$alldata); |
|
| 1611 | + array_multisort($count, SORT_DESC, $alldata); |
|
| 1612 | 1612 | foreach ($alldata as $number) { |
| 1613 | - 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); |
|
| 1613 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', '', $reset); |
|
| 1614 | 1614 | } |
| 1615 | 1615 | if ($Connection->tableExists('countries')) { |
| 1616 | 1616 | if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
| 1617 | 1617 | $SpotterArchive = new SpotterArchive(); |
| 1618 | - $alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
|
| 1618 | + $alldata = $SpotterArchive->countAllFlightOverCountries(false, 0, $last_update_day); |
|
| 1619 | 1619 | foreach ($alldata as $number) { |
| 1620 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],'','',$reset); |
|
| 1620 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], '', '', $reset); |
|
| 1621 | 1621 | } |
| 1622 | 1622 | } |
| 1623 | 1623 | |
@@ -1626,12 +1626,12 @@ discard block |
||
| 1626 | 1626 | $this->deleteStatsByType('fatalities_byyear'); |
| 1627 | 1627 | $alldata = $Accident->countFatalitiesByYear(); |
| 1628 | 1628 | foreach ($alldata as $number) { |
| 1629 | - $this->addStat('fatalities_byyear',$number['count'],date('Y-m-d H:i:s',mktime(0,0,0,1,1,$number['year']))); |
|
| 1629 | + $this->addStat('fatalities_byyear', $number['count'], date('Y-m-d H:i:s', mktime(0, 0, 0, 1, 1, $number['year']))); |
|
| 1630 | 1630 | } |
| 1631 | 1631 | $this->deleteStatsByType('fatalities_bymonth'); |
| 1632 | 1632 | $alldata = $Accident->countFatalitiesLast12Months(); |
| 1633 | 1633 | foreach ($alldata as $number) { |
| 1634 | - $this->addStat('fatalities_bymonth',$number['count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month'],1,$number['year']))); |
|
| 1634 | + $this->addStat('fatalities_bymonth', $number['count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month'], 1, $number['year']))); |
|
| 1635 | 1635 | } |
| 1636 | 1636 | |
| 1637 | 1637 | |
@@ -1644,37 +1644,37 @@ discard block |
||
| 1644 | 1644 | $lastyear = false; |
| 1645 | 1645 | foreach ($alldata as $number) { |
| 1646 | 1646 | if ($number['year_name'] != date('Y')) $lastyear = true; |
| 1647 | - $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']))); |
|
| 1647 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
| 1648 | 1648 | } |
| 1649 | 1649 | if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
| 1650 | 1650 | $alldata = $Spotter->countAllMilitaryMonths(); |
| 1651 | 1651 | foreach ($alldata as $number) { |
| 1652 | - $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']))); |
|
| 1652 | + $this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
| 1653 | 1653 | } |
| 1654 | 1654 | if ($globalDebug) echo 'Count all owners by months...'."\n"; |
| 1655 | 1655 | $alldata = $Spotter->countAllMonthsOwners(); |
| 1656 | 1656 | foreach ($alldata as $number) { |
| 1657 | - $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']))); |
|
| 1657 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
| 1658 | 1658 | } |
| 1659 | 1659 | if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
| 1660 | 1660 | $alldata = $Spotter->countAllMonthsPilots(); |
| 1661 | 1661 | foreach ($alldata as $number) { |
| 1662 | - $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']))); |
|
| 1662 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
| 1663 | 1663 | } |
| 1664 | 1664 | if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
| 1665 | 1665 | $alldata = $Spotter->countAllMonthsAirlines(); |
| 1666 | 1666 | foreach ($alldata as $number) { |
| 1667 | - $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']))); |
|
| 1667 | + $this->addStat('airlines_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
| 1668 | 1668 | } |
| 1669 | 1669 | if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
| 1670 | 1670 | $alldata = $Spotter->countAllMonthsAircrafts(); |
| 1671 | 1671 | foreach ($alldata as $number) { |
| 1672 | - $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']))); |
|
| 1672 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
| 1673 | 1673 | } |
| 1674 | 1674 | if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
| 1675 | 1675 | $alldata = $Spotter->countAllMonthsRealArrivals(); |
| 1676 | 1676 | foreach ($alldata as $number) { |
| 1677 | - $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']))); |
|
| 1677 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
| 1678 | 1678 | } |
| 1679 | 1679 | if ($globalDebug) echo 'Airports data...'."\n"; |
| 1680 | 1680 | if ($globalDebug) echo '...Departure'."\n"; |
@@ -1719,7 +1719,7 @@ discard block |
||
| 1719 | 1719 | } |
| 1720 | 1720 | $alldata = $pall; |
| 1721 | 1721 | foreach ($alldata as $number) { |
| 1722 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
|
| 1722 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']); |
|
| 1723 | 1723 | } |
| 1724 | 1724 | echo '...Arrival'."\n"; |
| 1725 | 1725 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
@@ -1761,7 +1761,7 @@ discard block |
||
| 1761 | 1761 | } |
| 1762 | 1762 | $alldata = $pall; |
| 1763 | 1763 | foreach ($alldata as $number) { |
| 1764 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
|
| 1764 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']); |
|
| 1765 | 1765 | } |
| 1766 | 1766 | |
| 1767 | 1767 | echo 'Flights data...'."\n"; |
@@ -1769,28 +1769,28 @@ discard block |
||
| 1769 | 1769 | echo '-> countAllDatesLastMonth...'."\n"; |
| 1770 | 1770 | $alldata = $Spotter->countAllDatesLastMonth(); |
| 1771 | 1771 | foreach ($alldata as $number) { |
| 1772 | - $this->addStatFlight('month',$number['date_name'],$number['date_count']); |
|
| 1772 | + $this->addStatFlight('month', $number['date_name'], $number['date_count']); |
|
| 1773 | 1773 | } |
| 1774 | 1774 | echo '-> countAllDates...'."\n"; |
| 1775 | 1775 | $previousdata = $this->countAllDates(); |
| 1776 | 1776 | $previousdatabyairlines = $this->countAllDatesByAirlines(); |
| 1777 | 1777 | $this->deleteStatFlight('date'); |
| 1778 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates()); |
|
| 1778 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates()); |
|
| 1779 | 1779 | $values = array(); |
| 1780 | 1780 | foreach ($alldata as $cnt) { |
| 1781 | 1781 | $values[] = $cnt['date_count']; |
| 1782 | 1782 | } |
| 1783 | - array_multisort($values,SORT_DESC,$alldata); |
|
| 1784 | - array_splice($alldata,11); |
|
| 1783 | + array_multisort($values, SORT_DESC, $alldata); |
|
| 1784 | + array_splice($alldata, 11); |
|
| 1785 | 1785 | foreach ($alldata as $number) { |
| 1786 | - $this->addStatFlight('date',$number['date_name'],$number['date_count']); |
|
| 1786 | + $this->addStatFlight('date', $number['date_name'], $number['date_count']); |
|
| 1787 | 1787 | } |
| 1788 | 1788 | |
| 1789 | 1789 | $this->deleteStatFlight('hour'); |
| 1790 | 1790 | echo '-> countAllHours...'."\n"; |
| 1791 | 1791 | $alldata = $Spotter->countAllHours('hour'); |
| 1792 | 1792 | foreach ($alldata as $number) { |
| 1793 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count']); |
|
| 1793 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count']); |
|
| 1794 | 1794 | } |
| 1795 | 1795 | |
| 1796 | 1796 | |
@@ -1800,41 +1800,41 @@ discard block |
||
| 1800 | 1800 | if ($Connection->tableExists('countries')) { |
| 1801 | 1801 | if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n"; |
| 1802 | 1802 | $SpotterArchive = new SpotterArchive(); |
| 1803 | - $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
|
| 1803 | + $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false, 0, $last_update_day); |
|
| 1804 | 1804 | foreach ($alldata as $number) { |
| 1805 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset); |
|
| 1805 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], $number['airline_icao'], '', $reset); |
|
| 1806 | 1806 | } |
| 1807 | 1807 | } |
| 1808 | 1808 | if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
| 1809 | 1809 | $Spotter = new Spotter($this->db); |
| 1810 | - $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
|
| 1810 | + $alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day); |
|
| 1811 | 1811 | foreach ($alldata as $number) { |
| 1812 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
|
| 1812 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao'], '', $reset); |
|
| 1813 | 1813 | } |
| 1814 | 1814 | if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
| 1815 | - $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
|
| 1815 | + $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day); |
|
| 1816 | 1816 | foreach ($alldata as $number) { |
| 1817 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
|
| 1817 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao'], '', $reset); |
|
| 1818 | 1818 | } |
| 1819 | 1819 | if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
| 1820 | - $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
|
| 1820 | + $alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day); |
|
| 1821 | 1821 | foreach ($alldata as $number) { |
| 1822 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
| 1822 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset); |
|
| 1823 | 1823 | } |
| 1824 | 1824 | if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
| 1825 | - $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
|
| 1825 | + $alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day); |
|
| 1826 | 1826 | foreach ($alldata as $number) { |
| 1827 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
|
| 1827 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao'], '', $reset); |
|
| 1828 | 1828 | } |
| 1829 | 1829 | if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
| 1830 | - $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
|
| 1830 | + $alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day); |
|
| 1831 | 1831 | foreach ($alldata as $number) { |
| 1832 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
|
| 1832 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao'], '', $number['format_source'], $reset); |
|
| 1833 | 1833 | } |
| 1834 | 1834 | if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
| 1835 | - $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
|
| 1835 | + $pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
| 1836 | 1836 | if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
| 1837 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
| 1837 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
| 1838 | 1838 | if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
| 1839 | 1839 | //$alldata = array(); |
| 1840 | 1840 | foreach ($dall as $value) { |
@@ -1854,12 +1854,12 @@ discard block |
||
| 1854 | 1854 | } |
| 1855 | 1855 | $alldata = $pall; |
| 1856 | 1856 | foreach ($alldata as $number) { |
| 1857 | - 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); |
|
| 1857 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], $number['airline_icao'], '', $reset); |
|
| 1858 | 1858 | } |
| 1859 | 1859 | if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
| 1860 | - $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
|
| 1860 | + $pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
| 1861 | 1861 | if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
| 1862 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
| 1862 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
| 1863 | 1863 | if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
| 1864 | 1864 | //$alldata = array(); |
| 1865 | 1865 | foreach ($dall as $value) { |
@@ -1879,7 +1879,7 @@ discard block |
||
| 1879 | 1879 | } |
| 1880 | 1880 | $alldata = $pall; |
| 1881 | 1881 | foreach ($alldata as $number) { |
| 1882 | - if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
| 1882 | + if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], $number['airline_icao'], '', $reset); |
|
| 1883 | 1883 | } |
| 1884 | 1884 | if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
| 1885 | 1885 | $Spotter = new Spotter($this->db); |
@@ -1887,27 +1887,27 @@ discard block |
||
| 1887 | 1887 | $lastyear = false; |
| 1888 | 1888 | foreach ($alldata as $number) { |
| 1889 | 1889 | if ($number['year_name'] != date('Y')) $lastyear = true; |
| 1890 | - $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']); |
|
| 1890 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
| 1891 | 1891 | } |
| 1892 | 1892 | if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
| 1893 | 1893 | $alldata = $Spotter->countAllMonthsOwnersByAirlines(); |
| 1894 | 1894 | foreach ($alldata as $number) { |
| 1895 | - $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']); |
|
| 1895 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
| 1896 | 1896 | } |
| 1897 | 1897 | if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
| 1898 | 1898 | $alldata = $Spotter->countAllMonthsPilotsByAirlines(); |
| 1899 | 1899 | foreach ($alldata as $number) { |
| 1900 | - $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']); |
|
| 1900 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
| 1901 | 1901 | } |
| 1902 | 1902 | if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
| 1903 | 1903 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines(); |
| 1904 | 1904 | foreach ($alldata as $number) { |
| 1905 | - $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']); |
|
| 1905 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
| 1906 | 1906 | } |
| 1907 | 1907 | if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
| 1908 | 1908 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines(); |
| 1909 | 1909 | foreach ($alldata as $number) { |
| 1910 | - $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']); |
|
| 1910 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
| 1911 | 1911 | } |
| 1912 | 1912 | if ($globalDebug) echo '...Departure'."\n"; |
| 1913 | 1913 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
@@ -1930,7 +1930,7 @@ discard block |
||
| 1930 | 1930 | } |
| 1931 | 1931 | $alldata = $pall; |
| 1932 | 1932 | foreach ($alldata as $number) { |
| 1933 | - $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']); |
|
| 1933 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], $number['airline_icao']); |
|
| 1934 | 1934 | } |
| 1935 | 1935 | if ($globalDebug) echo '...Arrival'."\n"; |
| 1936 | 1936 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
@@ -1953,32 +1953,32 @@ discard block |
||
| 1953 | 1953 | } |
| 1954 | 1954 | $alldata = $pall; |
| 1955 | 1955 | foreach ($alldata as $number) { |
| 1956 | - $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']); |
|
| 1956 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], $number['airline_icao']); |
|
| 1957 | 1957 | } |
| 1958 | 1958 | |
| 1959 | 1959 | if ($globalDebug) echo 'Flights data...'."\n"; |
| 1960 | 1960 | if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
| 1961 | 1961 | $alldata = $Spotter->countAllDatesLastMonthByAirlines(); |
| 1962 | 1962 | foreach ($alldata as $number) { |
| 1963 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
|
| 1963 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
| 1964 | 1964 | } |
| 1965 | 1965 | if ($globalDebug) echo '-> countAllDates...'."\n"; |
| 1966 | 1966 | //$previousdata = $this->countAllDatesByAirlines(); |
| 1967 | - $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines()); |
|
| 1967 | + $alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines()); |
|
| 1968 | 1968 | $values = array(); |
| 1969 | 1969 | foreach ($alldata as $cnt) { |
| 1970 | 1970 | $values[] = $cnt['date_count']; |
| 1971 | 1971 | } |
| 1972 | - array_multisort($values,SORT_DESC,$alldata); |
|
| 1973 | - array_splice($alldata,11); |
|
| 1972 | + array_multisort($values, SORT_DESC, $alldata); |
|
| 1973 | + array_splice($alldata, 11); |
|
| 1974 | 1974 | foreach ($alldata as $number) { |
| 1975 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
|
| 1975 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
| 1976 | 1976 | } |
| 1977 | 1977 | |
| 1978 | 1978 | if ($globalDebug) echo '-> countAllHours...'."\n"; |
| 1979 | 1979 | $alldata = $Spotter->countAllHoursByAirlines('hour'); |
| 1980 | 1980 | foreach ($alldata as $number) { |
| 1981 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
|
| 1981 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']); |
|
| 1982 | 1982 | } |
| 1983 | 1983 | |
| 1984 | 1984 | |
@@ -2002,7 +2002,7 @@ discard block |
||
| 2002 | 2002 | $last_update_day = date('Y').'-01-01 00:00:00'; |
| 2003 | 2003 | } |
| 2004 | 2004 | } |
| 2005 | - if (isset($filter['DeleteLastYearStats']) && date('Y',strtotime($last_update_day)) != date('Y')) { |
|
| 2005 | + if (isset($filter['DeleteLastYearStats']) && date('Y', strtotime($last_update_day)) != date('Y')) { |
|
| 2006 | 2006 | $last_update_day = date('Y').'-01-01 00:00:00'; |
| 2007 | 2007 | $reset = true; |
| 2008 | 2008 | } |
@@ -2011,32 +2011,32 @@ discard block |
||
| 2011 | 2011 | // Count by filter |
| 2012 | 2012 | if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
| 2013 | 2013 | $Spotter = new Spotter($this->db); |
| 2014 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
|
| 2014 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter); |
|
| 2015 | 2015 | foreach ($alldata as $number) { |
| 2016 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name,$reset); |
|
| 2016 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name, $reset); |
|
| 2017 | 2017 | } |
| 2018 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter); |
|
| 2018 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter); |
|
| 2019 | 2019 | foreach ($alldata as $number) { |
| 2020 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name,$reset); |
|
| 2020 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name, $reset); |
|
| 2021 | 2021 | } |
| 2022 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter); |
|
| 2022 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter); |
|
| 2023 | 2023 | foreach ($alldata as $number) { |
| 2024 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name,$reset); |
|
| 2024 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name, $reset); |
|
| 2025 | 2025 | } |
| 2026 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter); |
|
| 2026 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter); |
|
| 2027 | 2027 | foreach ($alldata as $number) { |
| 2028 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name,$reset); |
|
| 2028 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name, $reset); |
|
| 2029 | 2029 | } |
| 2030 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter); |
|
| 2030 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter); |
|
| 2031 | 2031 | foreach ($alldata as $number) { |
| 2032 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name,$reset); |
|
| 2032 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name, $reset); |
|
| 2033 | 2033 | } |
| 2034 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter); |
|
| 2034 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter); |
|
| 2035 | 2035 | foreach ($alldata as $number) { |
| 2036 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset); |
|
| 2036 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name, $number['format_source'], $reset); |
|
| 2037 | 2037 | } |
| 2038 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
|
| 2039 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
| 2038 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter); |
|
| 2039 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter); |
|
| 2040 | 2040 | $alldata = array(); |
| 2041 | 2041 | foreach ($pall as $value) { |
| 2042 | 2042 | $icao = $value['airport_departure_icao']; |
@@ -2052,12 +2052,12 @@ discard block |
||
| 2052 | 2052 | foreach ($alldata as $key => $row) { |
| 2053 | 2053 | $count[$key] = $row['airport_departure_icao_count']; |
| 2054 | 2054 | } |
| 2055 | - array_multisort($count,SORT_DESC,$alldata); |
|
| 2055 | + array_multisort($count, SORT_DESC, $alldata); |
|
| 2056 | 2056 | foreach ($alldata as $number) { |
| 2057 | - 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); |
|
| 2057 | + 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); |
|
| 2058 | 2058 | } |
| 2059 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter); |
|
| 2060 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter); |
|
| 2059 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
| 2060 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
| 2061 | 2061 | $alldata = array(); |
| 2062 | 2062 | foreach ($pall as $value) { |
| 2063 | 2063 | $icao = $value['airport_arrival_icao']; |
@@ -2073,40 +2073,40 @@ discard block |
||
| 2073 | 2073 | foreach ($alldata as $key => $row) { |
| 2074 | 2074 | $count[$key] = $row['airport_arrival_icao_count']; |
| 2075 | 2075 | } |
| 2076 | - array_multisort($count,SORT_DESC,$alldata); |
|
| 2076 | + array_multisort($count, SORT_DESC, $alldata); |
|
| 2077 | 2077 | foreach ($alldata as $number) { |
| 2078 | - 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); |
|
| 2078 | + 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); |
|
| 2079 | 2079 | } |
| 2080 | 2080 | $Spotter = new Spotter($this->db); |
| 2081 | 2081 | $alldata = $Spotter->countAllMonths($filter); |
| 2082 | 2082 | $lastyear = false; |
| 2083 | 2083 | foreach ($alldata as $number) { |
| 2084 | 2084 | if ($number['year_name'] != date('Y')) $lastyear = true; |
| 2085 | - $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); |
|
| 2085 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
| 2086 | 2086 | } |
| 2087 | 2087 | $alldata = $Spotter->countAllMonthsOwners($filter); |
| 2088 | 2088 | foreach ($alldata as $number) { |
| 2089 | - $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); |
|
| 2089 | + $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); |
|
| 2090 | 2090 | } |
| 2091 | 2091 | $alldata = $Spotter->countAllMonthsPilots($filter); |
| 2092 | 2092 | foreach ($alldata as $number) { |
| 2093 | - $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); |
|
| 2093 | + $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); |
|
| 2094 | 2094 | } |
| 2095 | 2095 | $alldata = $Spotter->countAllMilitaryMonths($filter); |
| 2096 | 2096 | foreach ($alldata as $number) { |
| 2097 | - $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); |
|
| 2097 | + $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); |
|
| 2098 | 2098 | } |
| 2099 | 2099 | $alldata = $Spotter->countAllMonthsAircrafts($filter); |
| 2100 | 2100 | foreach ($alldata as $number) { |
| 2101 | - $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); |
|
| 2101 | + $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); |
|
| 2102 | 2102 | } |
| 2103 | 2103 | $alldata = $Spotter->countAllMonthsRealArrivals($filter); |
| 2104 | 2104 | foreach ($alldata as $number) { |
| 2105 | - $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); |
|
| 2105 | + $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); |
|
| 2106 | 2106 | } |
| 2107 | 2107 | echo '...Departure'."\n"; |
| 2108 | - $pall = $Spotter->getLast7DaysAirportsDeparture('',$filter); |
|
| 2109 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
| 2108 | + $pall = $Spotter->getLast7DaysAirportsDeparture('', $filter); |
|
| 2109 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter); |
|
| 2110 | 2110 | foreach ($dall as $value) { |
| 2111 | 2111 | $icao = $value['departure_airport_icao']; |
| 2112 | 2112 | $ddate = $value['date']; |
@@ -2124,11 +2124,11 @@ discard block |
||
| 2124 | 2124 | } |
| 2125 | 2125 | $alldata = $pall; |
| 2126 | 2126 | foreach ($alldata as $number) { |
| 2127 | - $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); |
|
| 2127 | + $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); |
|
| 2128 | 2128 | } |
| 2129 | 2129 | echo '...Arrival'."\n"; |
| 2130 | - $pall = $Spotter->getLast7DaysAirportsArrival('',$filter); |
|
| 2131 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
| 2130 | + $pall = $Spotter->getLast7DaysAirportsArrival('', $filter); |
|
| 2131 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter); |
|
| 2132 | 2132 | foreach ($dall as $value) { |
| 2133 | 2133 | $icao = $value['arrival_airport_icao']; |
| 2134 | 2134 | $ddate = $value['date']; |
@@ -2146,40 +2146,40 @@ discard block |
||
| 2146 | 2146 | } |
| 2147 | 2147 | $alldata = $pall; |
| 2148 | 2148 | foreach ($alldata as $number) { |
| 2149 | - $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); |
|
| 2149 | + $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); |
|
| 2150 | 2150 | } |
| 2151 | 2151 | |
| 2152 | 2152 | echo 'Flights data...'."\n"; |
| 2153 | 2153 | echo '-> countAllDatesLastMonth...'."\n"; |
| 2154 | 2154 | $alldata = $Spotter->countAllDatesLastMonth($filter); |
| 2155 | 2155 | foreach ($alldata as $number) { |
| 2156 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name); |
|
| 2156 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name); |
|
| 2157 | 2157 | } |
| 2158 | 2158 | echo '-> countAllDates...'."\n"; |
| 2159 | - $previousdata = $this->countAllDates('',$filter_name); |
|
| 2160 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter)); |
|
| 2159 | + $previousdata = $this->countAllDates('', $filter_name); |
|
| 2160 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter)); |
|
| 2161 | 2161 | $values = array(); |
| 2162 | 2162 | foreach ($alldata as $cnt) { |
| 2163 | 2163 | $values[] = $cnt['date_count']; |
| 2164 | 2164 | } |
| 2165 | - array_multisort($values,SORT_DESC,$alldata); |
|
| 2166 | - array_splice($alldata,11); |
|
| 2165 | + array_multisort($values, SORT_DESC, $alldata); |
|
| 2166 | + array_splice($alldata, 11); |
|
| 2167 | 2167 | foreach ($alldata as $number) { |
| 2168 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name); |
|
| 2168 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name); |
|
| 2169 | 2169 | } |
| 2170 | 2170 | |
| 2171 | 2171 | echo '-> countAllHours...'."\n"; |
| 2172 | - $alldata = $Spotter->countAllHours('hour',$filter); |
|
| 2172 | + $alldata = $Spotter->countAllHours('hour', $filter); |
|
| 2173 | 2173 | foreach ($alldata as $number) { |
| 2174 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name); |
|
| 2174 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name); |
|
| 2175 | 2175 | } |
| 2176 | 2176 | echo 'Insert last stats update date...'."\n"; |
| 2177 | 2177 | date_default_timezone_set('UTC'); |
| 2178 | - $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y-m-d G:i:s')); |
|
| 2178 | + $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y-m-d G:i:s')); |
|
| 2179 | 2179 | if (isset($filter['DeleteLastYearStats']) && $filter['DeleteLastYearStats'] == true) { |
| 2180 | - if (date('Y',strtotime($last_update_day)) != date('Y')) { |
|
| 2180 | + if (date('Y', strtotime($last_update_day)) != date('Y')) { |
|
| 2181 | 2181 | $this->deleteOldStats($filter_name); |
| 2182 | - $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y').'-01-01 00:00:00'); |
|
| 2182 | + $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y').'-01-01 00:00:00'); |
|
| 2183 | 2183 | } |
| 2184 | 2184 | } |
| 2185 | 2185 | |
@@ -2192,16 +2192,16 @@ discard block |
||
| 2192 | 2192 | // SUM all previous month to put as year |
| 2193 | 2193 | $previous_year = date('Y'); |
| 2194 | 2194 | $previous_year--; |
| 2195 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
| 2196 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
| 2197 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
| 2198 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
| 2195 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
| 2196 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
| 2197 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
| 2198 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
| 2199 | 2199 | $allairlines = $this->getAllAirlineNames(); |
| 2200 | 2200 | foreach ($allairlines as $data) { |
| 2201 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
| 2202 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
| 2203 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
| 2204 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
| 2201 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
| 2202 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
| 2203 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
| 2204 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
| 2205 | 2205 | } |
| 2206 | 2206 | |
| 2207 | 2207 | if (isset($globalArchiveYear) && $globalArchiveYear) { |
@@ -2210,7 +2210,7 @@ discard block |
||
| 2210 | 2210 | try { |
| 2211 | 2211 | $sth = $this->db->prepare($query); |
| 2212 | 2212 | $sth->execute(); |
| 2213 | - } catch(PDOException $e) { |
|
| 2213 | + } catch (PDOException $e) { |
|
| 2214 | 2214 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
| 2215 | 2215 | } |
| 2216 | 2216 | } |
@@ -2219,15 +2219,15 @@ discard block |
||
| 2219 | 2219 | try { |
| 2220 | 2220 | $sth = $this->db->prepare($query); |
| 2221 | 2221 | $sth->execute(); |
| 2222 | - } catch(PDOException $e) { |
|
| 2222 | + } catch (PDOException $e) { |
|
| 2223 | 2223 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
| 2224 | 2224 | } |
| 2225 | 2225 | } |
| 2226 | 2226 | if (isset($globalDeleteLastYearStats) && $globalDeleteLastYearStats) { |
| 2227 | 2227 | $last_update = $this->getLastStatsUpdate('last_update_stats'); |
| 2228 | - if (date('Y',strtotime($last_update[0]['value'])) != date('Y')) { |
|
| 2228 | + if (date('Y', strtotime($last_update[0]['value'])) != date('Y')) { |
|
| 2229 | 2229 | $this->deleteOldStats(); |
| 2230 | - $this->addLastStatsUpdate('last_update_stats',date('Y').'-01-01 00:00:00'); |
|
| 2230 | + $this->addLastStatsUpdate('last_update_stats', date('Y').'-01-01 00:00:00'); |
|
| 2231 | 2231 | $lastyearupdate = true; |
| 2232 | 2232 | } |
| 2233 | 2233 | } |
@@ -2249,7 +2249,7 @@ discard block |
||
| 2249 | 2249 | try { |
| 2250 | 2250 | $sth = $this->db->prepare($query); |
| 2251 | 2251 | $sth->execute(); |
| 2252 | - } catch(PDOException $e) { |
|
| 2252 | + } catch (PDOException $e) { |
|
| 2253 | 2253 | return "error : ".$e->getMessage(); |
| 2254 | 2254 | } |
| 2255 | 2255 | } |
@@ -2263,14 +2263,14 @@ discard block |
||
| 2263 | 2263 | try { |
| 2264 | 2264 | $sth = $this->db->prepare($query); |
| 2265 | 2265 | $sth->execute(); |
| 2266 | - } catch(PDOException $e) { |
|
| 2266 | + } catch (PDOException $e) { |
|
| 2267 | 2267 | return "error : ".$e->getMessage(); |
| 2268 | 2268 | } |
| 2269 | 2269 | } |
| 2270 | 2270 | if (!isset($lastyearupdate)) { |
| 2271 | 2271 | echo 'Insert last stats update date...'."\n"; |
| 2272 | 2272 | date_default_timezone_set('UTC'); |
| 2273 | - $this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s')); |
|
| 2273 | + $this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s')); |
|
| 2274 | 2274 | } |
| 2275 | 2275 | if ($globalStatsResetYear) { |
| 2276 | 2276 | require_once(dirname(__FILE__).'/../install/class.settings.php'); |
@@ -13,7 +13,9 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | public function __construct($dbc = null) { |
| 15 | 15 | global $globalFilterName; |
| 16 | - if (isset($globalFilterName)) $this->filter_name = $globalFilterName; |
|
| 16 | + if (isset($globalFilterName)) { |
|
| 17 | + $this->filter_name = $globalFilterName; |
|
| 18 | + } |
|
| 17 | 19 | $Connection = new Connection($dbc); |
| 18 | 20 | $this->db = $Connection->db(); |
| 19 | 21 | } |
@@ -81,7 +83,9 @@ discard block |
||
| 81 | 83 | } |
| 82 | 84 | } |
| 83 | 85 | public function getAllAirlineNames($filter_name = '') { |
| 84 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 86 | + if ($filter_name == '') { |
|
| 87 | + $filter_name = $this->filter_name; |
|
| 88 | + } |
|
| 85 | 89 | $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
| 86 | 90 | try { |
| 87 | 91 | $sth = $this->db->prepare($query); |
@@ -93,7 +97,9 @@ discard block |
||
| 93 | 97 | return $all; |
| 94 | 98 | } |
| 95 | 99 | public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
| 96 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 100 | + if ($filter_name == '') { |
|
| 101 | + $filter_name = $this->filter_name; |
|
| 102 | + } |
|
| 97 | 103 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
| 98 | 104 | try { |
| 99 | 105 | $sth = $this->db->prepare($query); |
@@ -105,7 +111,9 @@ discard block |
||
| 105 | 111 | return $all; |
| 106 | 112 | } |
| 107 | 113 | public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
| 108 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 114 | + if ($filter_name == '') { |
|
| 115 | + $filter_name = $this->filter_name; |
|
| 116 | + } |
|
| 109 | 117 | $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC"; |
| 110 | 118 | try { |
| 111 | 119 | $sth = $this->db->prepare($query); |
@@ -117,7 +125,9 @@ discard block |
||
| 117 | 125 | return $all; |
| 118 | 126 | } |
| 119 | 127 | public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
| 120 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 128 | + if ($filter_name == '') { |
|
| 129 | + $filter_name = $this->filter_name; |
|
| 130 | + } |
|
| 121 | 131 | $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
| 122 | 132 | try { |
| 123 | 133 | $sth = $this->db->prepare($query); |
@@ -130,7 +140,9 @@ discard block |
||
| 130 | 140 | } |
| 131 | 141 | |
| 132 | 142 | public function getAllOwnerNames($stats_airline = '',$filter_name = '') { |
| 133 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 143 | + if ($filter_name == '') { |
|
| 144 | + $filter_name = $this->filter_name; |
|
| 145 | + } |
|
| 134 | 146 | $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC"; |
| 135 | 147 | try { |
| 136 | 148 | $sth = $this->db->prepare($query); |
@@ -143,7 +155,9 @@ discard block |
||
| 143 | 155 | } |
| 144 | 156 | |
| 145 | 157 | public function getAllPilotNames($stats_airline = '',$filter_name = '') { |
| 146 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 158 | + if ($filter_name == '') { |
|
| 159 | + $filter_name = $this->filter_name; |
|
| 160 | + } |
|
| 147 | 161 | $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC"; |
| 148 | 162 | try { |
| 149 | 163 | $sth = $this->db->prepare($query); |
@@ -158,10 +172,15 @@ discard block |
||
| 158 | 172 | |
| 159 | 173 | public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 160 | 174 | global $globalStatsFilters; |
| 161 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 175 | + if ($filter_name == '') { |
|
| 176 | + $filter_name = $this->filter_name; |
|
| 177 | + } |
|
| 162 | 178 | if ($year == '' && $month == '') { |
| 163 | - if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 164 | - else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 179 | + if ($limit) { |
|
| 180 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 181 | + } else { |
|
| 182 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 183 | + } |
|
| 165 | 184 | try { |
| 166 | 185 | $sth = $this->db->prepare($query); |
| 167 | 186 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -169,7 +188,9 @@ discard block |
||
| 169 | 188 | echo "error : ".$e->getMessage(); |
| 170 | 189 | } |
| 171 | 190 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 172 | - } else $all = array(); |
|
| 191 | + } else { |
|
| 192 | + $all = array(); |
|
| 193 | + } |
|
| 173 | 194 | if (empty($all)) { |
| 174 | 195 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 175 | 196 | if ($filter_name != '') { |
@@ -183,10 +204,15 @@ discard block |
||
| 183 | 204 | } |
| 184 | 205 | public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
| 185 | 206 | global $globalStatsFilters; |
| 186 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 207 | + if ($filter_name == '') { |
|
| 208 | + $filter_name = $this->filter_name; |
|
| 209 | + } |
|
| 187 | 210 | if ($year == '' && $month == '') { |
| 188 | - if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 189 | - else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC"; |
|
| 211 | + if ($limit) { |
|
| 212 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 213 | + } else { |
|
| 214 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC"; |
|
| 215 | + } |
|
| 190 | 216 | try { |
| 191 | 217 | $sth = $this->db->prepare($query); |
| 192 | 218 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -194,7 +220,9 @@ discard block |
||
| 194 | 220 | echo "error : ".$e->getMessage(); |
| 195 | 221 | } |
| 196 | 222 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 197 | - } else $all = array(); |
|
| 223 | + } else { |
|
| 224 | + $all = array(); |
|
| 225 | + } |
|
| 198 | 226 | if (empty($all)) { |
| 199 | 227 | $Spotter = new Spotter($this->db); |
| 200 | 228 | $filters = array(); |
@@ -209,10 +237,15 @@ discard block |
||
| 209 | 237 | } |
| 210 | 238 | public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 211 | 239 | global $globalStatsFilters; |
| 212 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 240 | + if ($filter_name == '') { |
|
| 241 | + $filter_name = $this->filter_name; |
|
| 242 | + } |
|
| 213 | 243 | if ($year == '' && $month == '') { |
| 214 | - if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
| 215 | - else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
| 244 | + if ($limit) { |
|
| 245 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
| 246 | + } else { |
|
| 247 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
| 248 | + } |
|
| 216 | 249 | try { |
| 217 | 250 | $sth = $this->db->prepare($query); |
| 218 | 251 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -220,7 +253,9 @@ discard block |
||
| 220 | 253 | echo "error : ".$e->getMessage(); |
| 221 | 254 | } |
| 222 | 255 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 223 | - } else $all = array(); |
|
| 256 | + } else { |
|
| 257 | + $all = array(); |
|
| 258 | + } |
|
| 224 | 259 | if (empty($all)) { |
| 225 | 260 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 226 | 261 | if ($filter_name != '') { |
@@ -235,10 +270,15 @@ discard block |
||
| 235 | 270 | |
| 236 | 271 | public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 237 | 272 | global $globalStatsFilters; |
| 238 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 273 | + if ($filter_name == '') { |
|
| 274 | + $filter_name = $this->filter_name; |
|
| 275 | + } |
|
| 239 | 276 | if ($year == '' && $month == '') { |
| 240 | - if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 241 | - else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
| 277 | + if ($limit) { |
|
| 278 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 279 | + } else { |
|
| 280 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
| 281 | + } |
|
| 242 | 282 | try { |
| 243 | 283 | $sth = $this->db->prepare($query); |
| 244 | 284 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -246,7 +286,9 @@ discard block |
||
| 246 | 286 | echo "error : ".$e->getMessage(); |
| 247 | 287 | } |
| 248 | 288 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 249 | - } else $all = array(); |
|
| 289 | + } else { |
|
| 290 | + $all = array(); |
|
| 291 | + } |
|
| 250 | 292 | if (empty($all)) { |
| 251 | 293 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 252 | 294 | if ($filter_name != '') { |
@@ -260,9 +302,14 @@ discard block |
||
| 260 | 302 | } |
| 261 | 303 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
| 262 | 304 | global $globalStatsFilters; |
| 263 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 264 | - if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 265 | - else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
| 305 | + if ($filter_name == '') { |
|
| 306 | + $filter_name = $this->filter_name; |
|
| 307 | + } |
|
| 308 | + if ($limit) { |
|
| 309 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 310 | + } else { |
|
| 311 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
| 312 | + } |
|
| 266 | 313 | try { |
| 267 | 314 | $sth = $this->db->prepare($query); |
| 268 | 315 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -284,17 +331,29 @@ discard block |
||
| 284 | 331 | |
| 285 | 332 | public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
| 286 | 333 | global $globalStatsFilters, $globalVATSIM, $globalIVAO; |
| 287 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 334 | + if ($filter_name == '') { |
|
| 335 | + $filter_name = $this->filter_name; |
|
| 336 | + } |
|
| 288 | 337 | if ($year == '' && $month == '') { |
| 289 | - if ($globalVATSIM) $forsource = 'vatsim'; |
|
| 290 | - if ($globalIVAO) $forsource = 'ivao'; |
|
| 338 | + if ($globalVATSIM) { |
|
| 339 | + $forsource = 'vatsim'; |
|
| 340 | + } |
|
| 341 | + if ($globalIVAO) { |
|
| 342 | + $forsource = 'ivao'; |
|
| 343 | + } |
|
| 291 | 344 | if (isset($forsource)) { |
| 292 | - if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 293 | - else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC"; |
|
| 345 | + if ($limit) { |
|
| 346 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 347 | + } else { |
|
| 348 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC"; |
|
| 349 | + } |
|
| 294 | 350 | $query_values = array(':filter_name' => $filter_name,':forsource' => $forsource); |
| 295 | 351 | } else { |
| 296 | - if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 297 | - else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC"; |
|
| 352 | + if ($limit) { |
|
| 353 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 354 | + } else { |
|
| 355 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC"; |
|
| 356 | + } |
|
| 298 | 357 | $query_values = array(':filter_name' => $filter_name); |
| 299 | 358 | } |
| 300 | 359 | try { |
@@ -304,7 +363,9 @@ discard block |
||
| 304 | 363 | echo "error : ".$e->getMessage(); |
| 305 | 364 | } |
| 306 | 365 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 307 | - } else $all = array(); |
|
| 366 | + } else { |
|
| 367 | + $all = array(); |
|
| 368 | + } |
|
| 308 | 369 | if (empty($all)) { |
| 309 | 370 | $Spotter = new Spotter($this->db); |
| 310 | 371 | $filters = array(); |
@@ -319,10 +380,15 @@ discard block |
||
| 319 | 380 | } |
| 320 | 381 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 321 | 382 | global $globalStatsFilters; |
| 322 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 383 | + if ($filter_name == '') { |
|
| 384 | + $filter_name = $this->filter_name; |
|
| 385 | + } |
|
| 323 | 386 | if ($year == '' && $month == '') { |
| 324 | - if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
| 325 | - else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
| 387 | + if ($limit) { |
|
| 388 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
| 389 | + } else { |
|
| 390 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
| 391 | + } |
|
| 326 | 392 | try { |
| 327 | 393 | $sth = $this->db->prepare($query); |
| 328 | 394 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -330,7 +396,9 @@ discard block |
||
| 330 | 396 | echo "error : ".$e->getMessage(); |
| 331 | 397 | } |
| 332 | 398 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 333 | - } else $all = array(); |
|
| 399 | + } else { |
|
| 400 | + $all = array(); |
|
| 401 | + } |
|
| 334 | 402 | if (empty($all)) { |
| 335 | 403 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 336 | 404 | if ($filter_name != '') { |
@@ -344,10 +412,15 @@ discard block |
||
| 344 | 412 | } |
| 345 | 413 | public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 346 | 414 | global $globalStatsFilters; |
| 347 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 415 | + if ($filter_name == '') { |
|
| 416 | + $filter_name = $this->filter_name; |
|
| 417 | + } |
|
| 348 | 418 | if ($year == '' && $month == '') { |
| 349 | - if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 350 | - else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
| 419 | + if ($limit) { |
|
| 420 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 421 | + } else { |
|
| 422 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
| 423 | + } |
|
| 351 | 424 | try { |
| 352 | 425 | $sth = $this->db->prepare($query); |
| 353 | 426 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -355,7 +428,9 @@ discard block |
||
| 355 | 428 | echo "error : ".$e->getMessage(); |
| 356 | 429 | } |
| 357 | 430 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 358 | - } else $all = array(); |
|
| 431 | + } else { |
|
| 432 | + $all = array(); |
|
| 433 | + } |
|
| 359 | 434 | if (empty($all)) { |
| 360 | 435 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 361 | 436 | if ($filter_name != '') { |
@@ -369,11 +444,16 @@ discard block |
||
| 369 | 444 | } |
| 370 | 445 | public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 371 | 446 | $Connection = new Connection(); |
| 372 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 447 | + if ($filter_name == '') { |
|
| 448 | + $filter_name = $this->filter_name; |
|
| 449 | + } |
|
| 373 | 450 | if ($Connection->tableExists('countries')) { |
| 374 | 451 | if ($year == '' && $month == '') { |
| 375 | - if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
| 376 | - else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
| 452 | + if ($limit) { |
|
| 453 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
| 454 | + } else { |
|
| 455 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
| 456 | + } |
|
| 377 | 457 | try { |
| 378 | 458 | $sth = $this->db->prepare($query); |
| 379 | 459 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -388,17 +468,24 @@ discard block |
||
| 388 | 468 | } |
| 389 | 469 | */ |
| 390 | 470 | return $all; |
| 391 | - } else return array(); |
|
| 471 | + } else { |
|
| 472 | + return array(); |
|
| 473 | + } |
|
| 392 | 474 | } else { |
| 393 | 475 | return array(); |
| 394 | 476 | } |
| 395 | 477 | } |
| 396 | 478 | public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
| 397 | 479 | global $globalStatsFilters; |
| 398 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 480 | + if ($filter_name == '') { |
|
| 481 | + $filter_name = $this->filter_name; |
|
| 482 | + } |
|
| 399 | 483 | if ($year == '' && $month == '') { |
| 400 | - if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
|
| 401 | - else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
|
| 484 | + if ($limit) { |
|
| 485 | + $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
|
| 486 | + } else { |
|
| 487 | + $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
|
| 488 | + } |
|
| 402 | 489 | try { |
| 403 | 490 | $sth = $this->db->prepare($query); |
| 404 | 491 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -406,7 +493,9 @@ discard block |
||
| 406 | 493 | echo "error : ".$e->getMessage(); |
| 407 | 494 | } |
| 408 | 495 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 409 | - } else $all = array(); |
|
| 496 | + } else { |
|
| 497 | + $all = array(); |
|
| 498 | + } |
|
| 410 | 499 | if (empty($all)) { |
| 411 | 500 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 412 | 501 | if ($filter_name != '') { |
@@ -421,10 +510,15 @@ discard block |
||
| 421 | 510 | |
| 422 | 511 | public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
| 423 | 512 | global $globalStatsFilters; |
| 424 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 513 | + if ($filter_name == '') { |
|
| 514 | + $filter_name = $this->filter_name; |
|
| 515 | + } |
|
| 425 | 516 | if ($year == '' && $month == '') { |
| 426 | - if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
| 427 | - else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
| 517 | + if ($limit) { |
|
| 518 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
| 519 | + } else { |
|
| 520 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
| 521 | + } |
|
| 428 | 522 | try { |
| 429 | 523 | $sth = $this->db->prepare($query); |
| 430 | 524 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -432,7 +526,9 @@ discard block |
||
| 432 | 526 | echo "error : ".$e->getMessage(); |
| 433 | 527 | } |
| 434 | 528 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 435 | - } else $all = array(); |
|
| 529 | + } else { |
|
| 530 | + $all = array(); |
|
| 531 | + } |
|
| 436 | 532 | if (empty($all)) { |
| 437 | 533 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 438 | 534 | if ($filter_name != '') { |
@@ -446,10 +542,15 @@ discard block |
||
| 446 | 542 | } |
| 447 | 543 | public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 448 | 544 | global $globalStatsFilters; |
| 449 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 545 | + if ($filter_name == '') { |
|
| 546 | + $filter_name = $this->filter_name; |
|
| 547 | + } |
|
| 450 | 548 | if ($year == '' && $month == '') { |
| 451 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 452 | - else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
| 549 | + if ($limit) { |
|
| 550 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 551 | + } else { |
|
| 552 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
| 553 | + } |
|
| 453 | 554 | try { |
| 454 | 555 | $sth = $this->db->prepare($query); |
| 455 | 556 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -457,7 +558,9 @@ discard block |
||
| 457 | 558 | echo "error : ".$e->getMessage(); |
| 458 | 559 | } |
| 459 | 560 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 460 | - } else $all = array(); |
|
| 561 | + } else { |
|
| 562 | + $all = array(); |
|
| 563 | + } |
|
| 461 | 564 | if (empty($all)) { |
| 462 | 565 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 463 | 566 | if ($filter_name != '') { |
@@ -478,7 +581,9 @@ discard block |
||
| 478 | 581 | $icao = $value['airport_departure_icao']; |
| 479 | 582 | if (isset($all[$icao])) { |
| 480 | 583 | $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 481 | - } else $all[$icao] = $value; |
|
| 584 | + } else { |
|
| 585 | + $all[$icao] = $value; |
|
| 586 | + } |
|
| 482 | 587 | } |
| 483 | 588 | $count = array(); |
| 484 | 589 | foreach ($all as $key => $row) { |
@@ -490,10 +595,15 @@ discard block |
||
| 490 | 595 | } |
| 491 | 596 | public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 492 | 597 | global $globalStatsFilters; |
| 493 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 598 | + if ($filter_name == '') { |
|
| 599 | + $filter_name = $this->filter_name; |
|
| 600 | + } |
|
| 494 | 601 | if ($year == '' && $month == '') { |
| 495 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 496 | - else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
| 602 | + if ($limit) { |
|
| 603 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 604 | + } else { |
|
| 605 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
| 606 | + } |
|
| 497 | 607 | try { |
| 498 | 608 | $sth = $this->db->prepare($query); |
| 499 | 609 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -501,7 +611,9 @@ discard block |
||
| 501 | 611 | echo "error : ".$e->getMessage(); |
| 502 | 612 | } |
| 503 | 613 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 504 | - } else $all = array(); |
|
| 614 | + } else { |
|
| 615 | + $all = array(); |
|
| 616 | + } |
|
| 505 | 617 | if (empty($all)) { |
| 506 | 618 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 507 | 619 | if ($filter_name != '') { |
@@ -522,7 +634,9 @@ discard block |
||
| 522 | 634 | $icao = $value['airport_arrival_icao']; |
| 523 | 635 | if (isset($all[$icao])) { |
| 524 | 636 | $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 525 | - } else $all[$icao] = $value; |
|
| 637 | + } else { |
|
| 638 | + $all[$icao] = $value; |
|
| 639 | + } |
|
| 526 | 640 | } |
| 527 | 641 | $count = array(); |
| 528 | 642 | foreach ($all as $key => $row) { |
@@ -535,13 +649,21 @@ discard block |
||
| 535 | 649 | } |
| 536 | 650 | public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
| 537 | 651 | global $globalDBdriver, $globalStatsFilters; |
| 538 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 652 | + if ($filter_name == '') { |
|
| 653 | + $filter_name = $this->filter_name; |
|
| 654 | + } |
|
| 539 | 655 | if ($globalDBdriver == 'mysql') { |
| 540 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 541 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 656 | + if ($limit) { |
|
| 657 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 658 | + } else { |
|
| 659 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 660 | + } |
|
| 542 | 661 | } else { |
| 543 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 544 | - else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 662 | + if ($limit) { |
|
| 663 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 664 | + } else { |
|
| 665 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 666 | + } |
|
| 545 | 667 | } |
| 546 | 668 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 547 | 669 | try { |
@@ -565,7 +687,9 @@ discard block |
||
| 565 | 687 | |
| 566 | 688 | public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
| 567 | 689 | global $globalStatsFilters; |
| 568 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 690 | + if ($filter_name == '') { |
|
| 691 | + $filter_name = $this->filter_name; |
|
| 692 | + } |
|
| 569 | 693 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 570 | 694 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 571 | 695 | try { |
@@ -587,7 +711,9 @@ discard block |
||
| 587 | 711 | } |
| 588 | 712 | public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
| 589 | 713 | global $globalDBdriver, $globalStatsFilters; |
| 590 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 714 | + if ($filter_name == '') { |
|
| 715 | + $filter_name = $this->filter_name; |
|
| 716 | + } |
|
| 591 | 717 | if ($globalDBdriver == 'mysql') { |
| 592 | 718 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 593 | 719 | } else { |
@@ -613,7 +739,9 @@ discard block |
||
| 613 | 739 | } |
| 614 | 740 | public function countAllDates($stats_airline = '',$filter_name = '') { |
| 615 | 741 | global $globalStatsFilters; |
| 616 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 742 | + if ($filter_name == '') { |
|
| 743 | + $filter_name = $this->filter_name; |
|
| 744 | + } |
|
| 617 | 745 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 618 | 746 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 619 | 747 | try { |
@@ -635,7 +763,9 @@ discard block |
||
| 635 | 763 | } |
| 636 | 764 | public function countAllDatesByAirlines($filter_name = '') { |
| 637 | 765 | global $globalStatsFilters; |
| 638 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 766 | + if ($filter_name == '') { |
|
| 767 | + $filter_name = $this->filter_name; |
|
| 768 | + } |
|
| 639 | 769 | $query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name"; |
| 640 | 770 | $query_data = array('filter_name' => $filter_name); |
| 641 | 771 | try { |
@@ -657,7 +787,9 @@ discard block |
||
| 657 | 787 | } |
| 658 | 788 | public function countAllMonths($stats_airline = '',$filter_name = '') { |
| 659 | 789 | global $globalStatsFilters, $globalDBdriver; |
| 660 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 790 | + if ($filter_name == '') { |
|
| 791 | + $filter_name = $this->filter_name; |
|
| 792 | + } |
|
| 661 | 793 | if ($globalDBdriver == 'mysql') { |
| 662 | 794 | $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 663 | 795 | } else { |
@@ -726,7 +858,9 @@ discard block |
||
| 726 | 858 | } |
| 727 | 859 | public function countAllMilitaryMonths($filter_name = '') { |
| 728 | 860 | global $globalStatsFilters; |
| 729 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 861 | + if ($filter_name == '') { |
|
| 862 | + $filter_name = $this->filter_name; |
|
| 863 | + } |
|
| 730 | 864 | $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name"; |
| 731 | 865 | try { |
| 732 | 866 | $sth = $this->db->prepare($query); |
@@ -747,9 +881,14 @@ discard block |
||
| 747 | 881 | } |
| 748 | 882 | public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
| 749 | 883 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
| 750 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 751 | - if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 752 | - else $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 884 | + if ($filter_name == '') { |
|
| 885 | + $filter_name = $this->filter_name; |
|
| 886 | + } |
|
| 887 | + if ($limit) { |
|
| 888 | + $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 889 | + } else { |
|
| 890 | + $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 891 | + } |
|
| 753 | 892 | if ($orderby == 'hour') { |
| 754 | 893 | if ($globalDBdriver == 'mysql') { |
| 755 | 894 | //$query .= " ORDER BY flight_date ASC"; |
@@ -758,7 +897,9 @@ discard block |
||
| 758 | 897 | $query .= " ORDER BY CAST(flight_date AS integer) ASC"; |
| 759 | 898 | } |
| 760 | 899 | } |
| 761 | - if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
|
| 900 | + if ($orderby == 'count') { |
|
| 901 | + $query .= " ORDER BY hour_count DESC"; |
|
| 902 | + } |
|
| 762 | 903 | try { |
| 763 | 904 | $sth = $this->db->prepare($query); |
| 764 | 905 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
@@ -779,8 +920,12 @@ discard block |
||
| 779 | 920 | |
| 780 | 921 | public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
| 781 | 922 | global $globalStatsFilters; |
| 782 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 783 | - if ($year == '') $year = date('Y'); |
|
| 923 | + if ($filter_name == '') { |
|
| 924 | + $filter_name = $this->filter_name; |
|
| 925 | + } |
|
| 926 | + if ($year == '') { |
|
| 927 | + $year = date('Y'); |
|
| 928 | + } |
|
| 784 | 929 | $all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
| 785 | 930 | if (empty($all)) { |
| 786 | 931 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
@@ -795,8 +940,12 @@ discard block |
||
| 795 | 940 | } |
| 796 | 941 | public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
| 797 | 942 | global $globalStatsFilters; |
| 798 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 799 | - if ($year == '') $year = date('Y'); |
|
| 943 | + if ($filter_name == '') { |
|
| 944 | + $filter_name = $this->filter_name; |
|
| 945 | + } |
|
| 946 | + if ($year == '') { |
|
| 947 | + $year = date('Y'); |
|
| 948 | + } |
|
| 800 | 949 | $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
| 801 | 950 | if (empty($all)) { |
| 802 | 951 | $filters = array(); |
@@ -812,8 +961,12 @@ discard block |
||
| 812 | 961 | } |
| 813 | 962 | public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
| 814 | 963 | global $globalStatsFilters; |
| 815 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 816 | - if ($year == '') $year = date('Y'); |
|
| 964 | + if ($filter_name == '') { |
|
| 965 | + $filter_name = $this->filter_name; |
|
| 966 | + } |
|
| 967 | + if ($year == '') { |
|
| 968 | + $year = date('Y'); |
|
| 969 | + } |
|
| 817 | 970 | $all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
| 818 | 971 | if (empty($all)) { |
| 819 | 972 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
@@ -828,7 +981,9 @@ discard block |
||
| 828 | 981 | } |
| 829 | 982 | public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
| 830 | 983 | global $globalStatsFilters; |
| 831 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 984 | + if ($filter_name == '') { |
|
| 985 | + $filter_name = $this->filter_name; |
|
| 986 | + } |
|
| 832 | 987 | if ($year == '' && $month == '') { |
| 833 | 988 | $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 834 | 989 | try { |
@@ -839,7 +994,9 @@ discard block |
||
| 839 | 994 | } |
| 840 | 995 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 841 | 996 | $all = $result[0]['nb']; |
| 842 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 997 | + } else { |
|
| 998 | + $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 999 | + } |
|
| 843 | 1000 | if (empty($all)) { |
| 844 | 1001 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 845 | 1002 | if ($filter_name != '') { |
@@ -853,7 +1010,9 @@ discard block |
||
| 853 | 1010 | } |
| 854 | 1011 | public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
| 855 | 1012 | global $globalStatsFilters; |
| 856 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1013 | + if ($filter_name == '') { |
|
| 1014 | + $filter_name = $this->filter_name; |
|
| 1015 | + } |
|
| 857 | 1016 | if ($year == '' && $month == '') { |
| 858 | 1017 | $query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name"; |
| 859 | 1018 | try { |
@@ -864,7 +1023,9 @@ discard block |
||
| 864 | 1023 | } |
| 865 | 1024 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 866 | 1025 | $all = $result[0]['nb_airline']; |
| 867 | - } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
| 1026 | + } else { |
|
| 1027 | + $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
| 1028 | + } |
|
| 868 | 1029 | if (empty($all)) { |
| 869 | 1030 | $filters = array(); |
| 870 | 1031 | $filters = array('year' => $year,'month' => $month); |
@@ -879,7 +1040,9 @@ discard block |
||
| 879 | 1040 | } |
| 880 | 1041 | public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
| 881 | 1042 | global $globalStatsFilters; |
| 882 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1043 | + if ($filter_name == '') { |
|
| 1044 | + $filter_name = $this->filter_name; |
|
| 1045 | + } |
|
| 883 | 1046 | if ($year == '' && $month == '') { |
| 884 | 1047 | $query = "SELECT count(*) as nb FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 885 | 1048 | $query_values = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
@@ -907,7 +1070,9 @@ discard block |
||
| 907 | 1070 | } |
| 908 | 1071 | public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 909 | 1072 | global $globalStatsFilters; |
| 910 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1073 | + if ($filter_name == '') { |
|
| 1074 | + $filter_name = $this->filter_name; |
|
| 1075 | + } |
|
| 911 | 1076 | //if ($year == '') $year = date('Y'); |
| 912 | 1077 | if ($year == '' && $month == '') { |
| 913 | 1078 | $query = "SELECT count(*) as nb FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -936,7 +1101,9 @@ discard block |
||
| 936 | 1101 | } |
| 937 | 1102 | |
| 938 | 1103 | public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
| 939 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1104 | + if ($filter_name == '') { |
|
| 1105 | + $filter_name = $this->filter_name; |
|
| 1106 | + } |
|
| 940 | 1107 | $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date"; |
| 941 | 1108 | $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
| 942 | 1109 | try { |
@@ -949,7 +1116,9 @@ discard block |
||
| 949 | 1116 | return $all; |
| 950 | 1117 | } |
| 951 | 1118 | public function getStats($type,$stats_airline = '', $filter_name = '') { |
| 952 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1119 | + if ($filter_name == '') { |
|
| 1120 | + $filter_name = $this->filter_name; |
|
| 1121 | + } |
|
| 953 | 1122 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
| 954 | 1123 | $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 955 | 1124 | try { |
@@ -962,7 +1131,9 @@ discard block |
||
| 962 | 1131 | return $all; |
| 963 | 1132 | } |
| 964 | 1133 | public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') { |
| 965 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1134 | + if ($filter_name == '') { |
|
| 1135 | + $filter_name = $this->filter_name; |
|
| 1136 | + } |
|
| 966 | 1137 | $query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 967 | 1138 | $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 968 | 1139 | try { |
@@ -973,7 +1144,9 @@ discard block |
||
| 973 | 1144 | } |
| 974 | 1145 | } |
| 975 | 1146 | public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
| 976 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1147 | + if ($filter_name == '') { |
|
| 1148 | + $filter_name = $this->filter_name; |
|
| 1149 | + } |
|
| 977 | 1150 | global $globalArchiveMonths, $globalDBdriver; |
| 978 | 1151 | if ($globalDBdriver == 'mysql') { |
| 979 | 1152 | if ($month == '') { |
@@ -1003,7 +1176,9 @@ discard block |
||
| 1003 | 1176 | } |
| 1004 | 1177 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
| 1005 | 1178 | global $globalArchiveMonths, $globalDBdriver; |
| 1006 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1179 | + if ($filter_name == '') { |
|
| 1180 | + $filter_name = $this->filter_name; |
|
| 1181 | + } |
|
| 1007 | 1182 | if ($globalDBdriver == 'mysql') { |
| 1008 | 1183 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 1009 | 1184 | } else { |
@@ -1021,7 +1196,9 @@ discard block |
||
| 1021 | 1196 | } |
| 1022 | 1197 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
| 1023 | 1198 | global $globalArchiveMonths, $globalDBdriver; |
| 1024 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1199 | + if ($filter_name == '') { |
|
| 1200 | + $filter_name = $this->filter_name; |
|
| 1201 | + } |
|
| 1025 | 1202 | if ($globalDBdriver == 'mysql') { |
| 1026 | 1203 | $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 1027 | 1204 | } else { |
@@ -1038,7 +1215,9 @@ discard block |
||
| 1038 | 1215 | } |
| 1039 | 1216 | public function getStatsAirlineTotal($filter_name = '') { |
| 1040 | 1217 | global $globalArchiveMonths, $globalDBdriver; |
| 1041 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1218 | + if ($filter_name == '') { |
|
| 1219 | + $filter_name = $this->filter_name; |
|
| 1220 | + } |
|
| 1042 | 1221 | if ($globalDBdriver == 'mysql') { |
| 1043 | 1222 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
| 1044 | 1223 | } else { |
@@ -1055,7 +1234,9 @@ discard block |
||
| 1055 | 1234 | } |
| 1056 | 1235 | public function getStatsOwnerTotal($filter_name = '') { |
| 1057 | 1236 | global $globalArchiveMonths, $globalDBdriver; |
| 1058 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1237 | + if ($filter_name == '') { |
|
| 1238 | + $filter_name = $this->filter_name; |
|
| 1239 | + } |
|
| 1059 | 1240 | if ($globalDBdriver == 'mysql') { |
| 1060 | 1241 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
| 1061 | 1242 | } else { |
@@ -1072,7 +1253,9 @@ discard block |
||
| 1072 | 1253 | } |
| 1073 | 1254 | public function getStatsOwner($owner_name,$filter_name = '') { |
| 1074 | 1255 | global $globalArchiveMonths, $globalDBdriver; |
| 1075 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1256 | + if ($filter_name == '') { |
|
| 1257 | + $filter_name = $this->filter_name; |
|
| 1258 | + } |
|
| 1076 | 1259 | $query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name"; |
| 1077 | 1260 | try { |
| 1078 | 1261 | $sth = $this->db->prepare($query); |
@@ -1081,12 +1264,17 @@ discard block |
||
| 1081 | 1264 | echo "error : ".$e->getMessage(); |
| 1082 | 1265 | } |
| 1083 | 1266 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1084 | - if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
| 1085 | - else return 0; |
|
| 1267 | + if (isset($all[0]['cnt'])) { |
|
| 1268 | + return $all[0]['cnt']; |
|
| 1269 | + } else { |
|
| 1270 | + return 0; |
|
| 1271 | + } |
|
| 1086 | 1272 | } |
| 1087 | 1273 | public function getStatsPilotTotal($filter_name = '') { |
| 1088 | 1274 | global $globalArchiveMonths, $globalDBdriver; |
| 1089 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1275 | + if ($filter_name == '') { |
|
| 1276 | + $filter_name = $this->filter_name; |
|
| 1277 | + } |
|
| 1090 | 1278 | if ($globalDBdriver == 'mysql') { |
| 1091 | 1279 | $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
| 1092 | 1280 | } else { |
@@ -1103,7 +1291,9 @@ discard block |
||
| 1103 | 1291 | } |
| 1104 | 1292 | public function getStatsPilot($pilot,$filter_name = '') { |
| 1105 | 1293 | global $globalArchiveMonths, $globalDBdriver; |
| 1106 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1294 | + if ($filter_name == '') { |
|
| 1295 | + $filter_name = $this->filter_name; |
|
| 1296 | + } |
|
| 1107 | 1297 | $query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)"; |
| 1108 | 1298 | try { |
| 1109 | 1299 | $sth = $this->db->prepare($query); |
@@ -1112,13 +1302,18 @@ discard block |
||
| 1112 | 1302 | echo "error : ".$e->getMessage(); |
| 1113 | 1303 | } |
| 1114 | 1304 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1115 | - if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
| 1116 | - else return 0; |
|
| 1305 | + if (isset($all[0]['cnt'])) { |
|
| 1306 | + return $all[0]['cnt']; |
|
| 1307 | + } else { |
|
| 1308 | + return 0; |
|
| 1309 | + } |
|
| 1117 | 1310 | } |
| 1118 | 1311 | |
| 1119 | 1312 | public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 1120 | 1313 | global $globalDBdriver; |
| 1121 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1314 | + if ($filter_name == '') { |
|
| 1315 | + $filter_name = $this->filter_name; |
|
| 1316 | + } |
|
| 1122 | 1317 | if ($globalDBdriver == 'mysql') { |
| 1123 | 1318 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt"; |
| 1124 | 1319 | } else { |
@@ -1134,7 +1329,9 @@ discard block |
||
| 1134 | 1329 | } |
| 1135 | 1330 | public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 1136 | 1331 | global $globalDBdriver; |
| 1137 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1332 | + if ($filter_name == '') { |
|
| 1333 | + $filter_name = $this->filter_name; |
|
| 1334 | + } |
|
| 1138 | 1335 | if ($globalDBdriver == 'mysql') { |
| 1139 | 1336 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
| 1140 | 1337 | } else { |
@@ -1520,10 +1717,14 @@ discard block |
||
| 1520 | 1717 | $Connection = new Connection(); |
| 1521 | 1718 | date_default_timezone_set('UTC'); |
| 1522 | 1719 | $last_update = $this->getLastStatsUpdate('last_update_stats'); |
| 1523 | - if ($globalDebug) echo 'Update stats !'."\n"; |
|
| 1720 | + if ($globalDebug) { |
|
| 1721 | + echo 'Update stats !'."\n"; |
|
| 1722 | + } |
|
| 1524 | 1723 | if (isset($last_update[0]['value'])) { |
| 1525 | 1724 | $last_update_day = $last_update[0]['value']; |
| 1526 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
| 1725 | + } else { |
|
| 1726 | + $last_update_day = '2012-12-12 12:12:12'; |
|
| 1727 | + } |
|
| 1527 | 1728 | $reset = false; |
| 1528 | 1729 | //if ($globalStatsResetYear && date('Y',strtotime($last_update_day)) != date('Y')) { |
| 1529 | 1730 | if ($globalStatsResetYear) { |
@@ -1532,42 +1733,60 @@ discard block |
||
| 1532 | 1733 | } |
| 1533 | 1734 | $Spotter = new Spotter($this->db); |
| 1534 | 1735 | |
| 1535 | - if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
|
| 1736 | + if ($globalDebug) { |
|
| 1737 | + echo 'Count all aircraft types...'."\n"; |
|
| 1738 | + } |
|
| 1536 | 1739 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
| 1537 | 1740 | foreach ($alldata as $number) { |
| 1538 | 1741 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
| 1539 | 1742 | } |
| 1540 | - if ($globalDebug) echo 'Count all airlines...'."\n"; |
|
| 1743 | + if ($globalDebug) { |
|
| 1744 | + echo 'Count all airlines...'."\n"; |
|
| 1745 | + } |
|
| 1541 | 1746 | $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
| 1542 | 1747 | foreach ($alldata as $number) { |
| 1543 | 1748 | $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
| 1544 | 1749 | } |
| 1545 | - if ($globalDebug) echo 'Count all registrations...'."\n"; |
|
| 1750 | + if ($globalDebug) { |
|
| 1751 | + echo 'Count all registrations...'."\n"; |
|
| 1752 | + } |
|
| 1546 | 1753 | $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
| 1547 | 1754 | foreach ($alldata as $number) { |
| 1548 | 1755 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
| 1549 | 1756 | } |
| 1550 | - if ($globalDebug) echo 'Count all callsigns...'."\n"; |
|
| 1757 | + if ($globalDebug) { |
|
| 1758 | + echo 'Count all callsigns...'."\n"; |
|
| 1759 | + } |
|
| 1551 | 1760 | $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
| 1552 | 1761 | foreach ($alldata as $number) { |
| 1553 | 1762 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
| 1554 | 1763 | } |
| 1555 | - if ($globalDebug) echo 'Count all owners...'."\n"; |
|
| 1764 | + if ($globalDebug) { |
|
| 1765 | + echo 'Count all owners...'."\n"; |
|
| 1766 | + } |
|
| 1556 | 1767 | $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
| 1557 | 1768 | foreach ($alldata as $number) { |
| 1558 | 1769 | $this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
| 1559 | 1770 | } |
| 1560 | - if ($globalDebug) echo 'Count all pilots...'."\n"; |
|
| 1771 | + if ($globalDebug) { |
|
| 1772 | + echo 'Count all pilots...'."\n"; |
|
| 1773 | + } |
|
| 1561 | 1774 | $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
| 1562 | 1775 | foreach ($alldata as $number) { |
| 1563 | 1776 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
| 1564 | 1777 | } |
| 1565 | 1778 | |
| 1566 | - if ($globalDebug) echo 'Count all departure airports...'."\n"; |
|
| 1779 | + if ($globalDebug) { |
|
| 1780 | + echo 'Count all departure airports...'."\n"; |
|
| 1781 | + } |
|
| 1567 | 1782 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
| 1568 | - if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
|
| 1783 | + if ($globalDebug) { |
|
| 1784 | + echo 'Count all detected departure airports...'."\n"; |
|
| 1785 | + } |
|
| 1569 | 1786 | $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
| 1570 | - if ($globalDebug) echo 'Order departure airports...'."\n"; |
|
| 1787 | + if ($globalDebug) { |
|
| 1788 | + echo 'Order departure airports...'."\n"; |
|
| 1789 | + } |
|
| 1571 | 1790 | $alldata = array(); |
| 1572 | 1791 | |
| 1573 | 1792 | foreach ($pall as $value) { |
@@ -1578,7 +1797,9 @@ discard block |
||
| 1578 | 1797 | $icao = $value['airport_departure_icao']; |
| 1579 | 1798 | if (isset($alldata[$icao])) { |
| 1580 | 1799 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 1581 | - } else $alldata[$icao] = $value; |
|
| 1800 | + } else { |
|
| 1801 | + $alldata[$icao] = $value; |
|
| 1802 | + } |
|
| 1582 | 1803 | } |
| 1583 | 1804 | $count = array(); |
| 1584 | 1805 | foreach ($alldata as $key => $row) { |
@@ -1588,11 +1809,17 @@ discard block |
||
| 1588 | 1809 | foreach ($alldata as $number) { |
| 1589 | 1810 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset); |
| 1590 | 1811 | } |
| 1591 | - if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
|
| 1812 | + if ($globalDebug) { |
|
| 1813 | + echo 'Count all arrival airports...'."\n"; |
|
| 1814 | + } |
|
| 1592 | 1815 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
| 1593 | - if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
|
| 1816 | + if ($globalDebug) { |
|
| 1817 | + echo 'Count all detected arrival airports...'."\n"; |
|
| 1818 | + } |
|
| 1594 | 1819 | $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
| 1595 | - if ($globalDebug) echo 'Order arrival airports...'."\n"; |
|
| 1820 | + if ($globalDebug) { |
|
| 1821 | + echo 'Order arrival airports...'."\n"; |
|
| 1822 | + } |
|
| 1596 | 1823 | $alldata = array(); |
| 1597 | 1824 | foreach ($pall as $value) { |
| 1598 | 1825 | $icao = $value['airport_arrival_icao']; |
@@ -1602,7 +1829,9 @@ discard block |
||
| 1602 | 1829 | $icao = $value['airport_arrival_icao']; |
| 1603 | 1830 | if (isset($alldata[$icao])) { |
| 1604 | 1831 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 1605 | - } else $alldata[$icao] = $value; |
|
| 1832 | + } else { |
|
| 1833 | + $alldata[$icao] = $value; |
|
| 1834 | + } |
|
| 1606 | 1835 | } |
| 1607 | 1836 | $count = array(); |
| 1608 | 1837 | foreach ($alldata as $key => $row) { |
@@ -1613,7 +1842,9 @@ discard block |
||
| 1613 | 1842 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset); |
| 1614 | 1843 | } |
| 1615 | 1844 | if ($Connection->tableExists('countries')) { |
| 1616 | - if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
|
| 1845 | + if ($globalDebug) { |
|
| 1846 | + echo 'Count all flights by countries...'."\n"; |
|
| 1847 | + } |
|
| 1617 | 1848 | $SpotterArchive = new SpotterArchive(); |
| 1618 | 1849 | $alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
| 1619 | 1850 | foreach ($alldata as $number) { |
@@ -1621,7 +1852,9 @@ discard block |
||
| 1621 | 1852 | } |
| 1622 | 1853 | } |
| 1623 | 1854 | |
| 1624 | - if ($globalDebug) echo 'Count fatalities stats...'."\n"; |
|
| 1855 | + if ($globalDebug) { |
|
| 1856 | + echo 'Count fatalities stats...'."\n"; |
|
| 1857 | + } |
|
| 1625 | 1858 | $Accident = new Accident(); |
| 1626 | 1859 | $this->deleteStatsByType('fatalities_byyear'); |
| 1627 | 1860 | $alldata = $Accident->countFatalitiesByYear(); |
@@ -1638,46 +1871,66 @@ discard block |
||
| 1638 | 1871 | // Add by month using getstat if month finish... |
| 1639 | 1872 | |
| 1640 | 1873 | //if (date('m',strtotime($last_update_day)) != date('m')) { |
| 1641 | - if ($globalDebug) echo 'Count all flights by months...'."\n"; |
|
| 1874 | + if ($globalDebug) { |
|
| 1875 | + echo 'Count all flights by months...'."\n"; |
|
| 1876 | + } |
|
| 1642 | 1877 | $Spotter = new Spotter($this->db); |
| 1643 | 1878 | $alldata = $Spotter->countAllMonths(); |
| 1644 | 1879 | $lastyear = false; |
| 1645 | 1880 | foreach ($alldata as $number) { |
| 1646 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 1881 | + if ($number['year_name'] != date('Y')) { |
|
| 1882 | + $lastyear = true; |
|
| 1883 | + } |
|
| 1647 | 1884 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 1648 | 1885 | } |
| 1649 | - if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
|
| 1886 | + if ($globalDebug) { |
|
| 1887 | + echo 'Count all military flights by months...'."\n"; |
|
| 1888 | + } |
|
| 1650 | 1889 | $alldata = $Spotter->countAllMilitaryMonths(); |
| 1651 | 1890 | foreach ($alldata as $number) { |
| 1652 | 1891 | $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 1653 | 1892 | } |
| 1654 | - if ($globalDebug) echo 'Count all owners by months...'."\n"; |
|
| 1893 | + if ($globalDebug) { |
|
| 1894 | + echo 'Count all owners by months...'."\n"; |
|
| 1895 | + } |
|
| 1655 | 1896 | $alldata = $Spotter->countAllMonthsOwners(); |
| 1656 | 1897 | foreach ($alldata as $number) { |
| 1657 | 1898 | $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 1658 | 1899 | } |
| 1659 | - if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
|
| 1900 | + if ($globalDebug) { |
|
| 1901 | + echo 'Count all pilots by months...'."\n"; |
|
| 1902 | + } |
|
| 1660 | 1903 | $alldata = $Spotter->countAllMonthsPilots(); |
| 1661 | 1904 | foreach ($alldata as $number) { |
| 1662 | 1905 | $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 1663 | 1906 | } |
| 1664 | - if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
|
| 1907 | + if ($globalDebug) { |
|
| 1908 | + echo 'Count all airlines by months...'."\n"; |
|
| 1909 | + } |
|
| 1665 | 1910 | $alldata = $Spotter->countAllMonthsAirlines(); |
| 1666 | 1911 | foreach ($alldata as $number) { |
| 1667 | 1912 | $this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 1668 | 1913 | } |
| 1669 | - if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
|
| 1914 | + if ($globalDebug) { |
|
| 1915 | + echo 'Count all aircrafts by months...'."\n"; |
|
| 1916 | + } |
|
| 1670 | 1917 | $alldata = $Spotter->countAllMonthsAircrafts(); |
| 1671 | 1918 | foreach ($alldata as $number) { |
| 1672 | 1919 | $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 1673 | 1920 | } |
| 1674 | - if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
|
| 1921 | + if ($globalDebug) { |
|
| 1922 | + echo 'Count all real arrivals by months...'."\n"; |
|
| 1923 | + } |
|
| 1675 | 1924 | $alldata = $Spotter->countAllMonthsRealArrivals(); |
| 1676 | 1925 | foreach ($alldata as $number) { |
| 1677 | 1926 | $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 1678 | 1927 | } |
| 1679 | - if ($globalDebug) echo 'Airports data...'."\n"; |
|
| 1680 | - if ($globalDebug) echo '...Departure'."\n"; |
|
| 1928 | + if ($globalDebug) { |
|
| 1929 | + echo 'Airports data...'."\n"; |
|
| 1930 | + } |
|
| 1931 | + if ($globalDebug) { |
|
| 1932 | + echo '...Departure'."\n"; |
|
| 1933 | + } |
|
| 1681 | 1934 | $this->deleteStatAirport('daily'); |
| 1682 | 1935 | // $pall = $Spotter->getLast7DaysAirportsDeparture(); |
| 1683 | 1936 | // $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
@@ -1798,44 +2051,62 @@ discard block |
||
| 1798 | 2051 | // Count by airlines |
| 1799 | 2052 | echo '--- Stats by airlines ---'."\n"; |
| 1800 | 2053 | if ($Connection->tableExists('countries')) { |
| 1801 | - if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n"; |
|
| 2054 | + if ($globalDebug) { |
|
| 2055 | + echo 'Count all flights by countries by airlines...'."\n"; |
|
| 2056 | + } |
|
| 1802 | 2057 | $SpotterArchive = new SpotterArchive(); |
| 1803 | 2058 | $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
| 1804 | 2059 | foreach ($alldata as $number) { |
| 1805 | 2060 | $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset); |
| 1806 | 2061 | } |
| 1807 | 2062 | } |
| 1808 | - if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
|
| 2063 | + if ($globalDebug) { |
|
| 2064 | + echo 'Count all aircraft types by airlines...'."\n"; |
|
| 2065 | + } |
|
| 1809 | 2066 | $Spotter = new Spotter($this->db); |
| 1810 | 2067 | $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
| 1811 | 2068 | foreach ($alldata as $number) { |
| 1812 | 2069 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
| 1813 | 2070 | } |
| 1814 | - if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
|
| 2071 | + if ($globalDebug) { |
|
| 2072 | + echo 'Count all aircraft registrations by airlines...'."\n"; |
|
| 2073 | + } |
|
| 1815 | 2074 | $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
| 1816 | 2075 | foreach ($alldata as $number) { |
| 1817 | 2076 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
| 1818 | 2077 | } |
| 1819 | - if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
|
| 2078 | + if ($globalDebug) { |
|
| 2079 | + echo 'Count all callsigns by airlines...'."\n"; |
|
| 2080 | + } |
|
| 1820 | 2081 | $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
| 1821 | 2082 | foreach ($alldata as $number) { |
| 1822 | 2083 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
| 1823 | 2084 | } |
| 1824 | - if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
|
| 2085 | + if ($globalDebug) { |
|
| 2086 | + echo 'Count all owners by airlines...'."\n"; |
|
| 2087 | + } |
|
| 1825 | 2088 | $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
| 1826 | 2089 | foreach ($alldata as $number) { |
| 1827 | 2090 | $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
| 1828 | 2091 | } |
| 1829 | - if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
|
| 2092 | + if ($globalDebug) { |
|
| 2093 | + echo 'Count all pilots by airlines...'."\n"; |
|
| 2094 | + } |
|
| 1830 | 2095 | $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
| 1831 | 2096 | foreach ($alldata as $number) { |
| 1832 | 2097 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
| 1833 | 2098 | } |
| 1834 | - if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
|
| 2099 | + if ($globalDebug) { |
|
| 2100 | + echo 'Count all departure airports by airlines...'."\n"; |
|
| 2101 | + } |
|
| 1835 | 2102 | $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
| 1836 | - if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
|
| 2103 | + if ($globalDebug) { |
|
| 2104 | + echo 'Count all detected departure airports by airlines...'."\n"; |
|
| 2105 | + } |
|
| 1837 | 2106 | $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
| 1838 | - if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
|
| 2107 | + if ($globalDebug) { |
|
| 2108 | + echo 'Order detected departure airports by airlines...'."\n"; |
|
| 2109 | + } |
|
| 1839 | 2110 | //$alldata = array(); |
| 1840 | 2111 | foreach ($dall as $value) { |
| 1841 | 2112 | $icao = $value['airport_departure_icao']; |
@@ -1856,11 +2127,17 @@ discard block |
||
| 1856 | 2127 | foreach ($alldata as $number) { |
| 1857 | 2128 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset); |
| 1858 | 2129 | } |
| 1859 | - if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
|
| 2130 | + if ($globalDebug) { |
|
| 2131 | + echo 'Count all arrival airports by airlines...'."\n"; |
|
| 2132 | + } |
|
| 1860 | 2133 | $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
| 1861 | - if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
|
| 2134 | + if ($globalDebug) { |
|
| 2135 | + echo 'Count all detected arrival airports by airlines...'."\n"; |
|
| 2136 | + } |
|
| 1862 | 2137 | $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
| 1863 | - if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
|
| 2138 | + if ($globalDebug) { |
|
| 2139 | + echo 'Order arrival airports by airlines...'."\n"; |
|
| 2140 | + } |
|
| 1864 | 2141 | //$alldata = array(); |
| 1865 | 2142 | foreach ($dall as $value) { |
| 1866 | 2143 | $icao = $value['airport_arrival_icao']; |
@@ -1879,37 +2156,53 @@ discard block |
||
| 1879 | 2156 | } |
| 1880 | 2157 | $alldata = $pall; |
| 1881 | 2158 | foreach ($alldata as $number) { |
| 1882 | - if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
| 2159 | + if ($number['airline_icao'] != '') { |
|
| 2160 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
| 2161 | + } |
|
| 2162 | + } |
|
| 2163 | + if ($globalDebug) { |
|
| 2164 | + echo 'Count all flights by months by airlines...'."\n"; |
|
| 1883 | 2165 | } |
| 1884 | - if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
|
| 1885 | 2166 | $Spotter = new Spotter($this->db); |
| 1886 | 2167 | $alldata = $Spotter->countAllMonthsByAirlines(); |
| 1887 | 2168 | $lastyear = false; |
| 1888 | 2169 | foreach ($alldata as $number) { |
| 1889 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 2170 | + if ($number['year_name'] != date('Y')) { |
|
| 2171 | + $lastyear = true; |
|
| 2172 | + } |
|
| 1890 | 2173 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
| 1891 | 2174 | } |
| 1892 | - if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
|
| 2175 | + if ($globalDebug) { |
|
| 2176 | + echo 'Count all owners by months by airlines...'."\n"; |
|
| 2177 | + } |
|
| 1893 | 2178 | $alldata = $Spotter->countAllMonthsOwnersByAirlines(); |
| 1894 | 2179 | foreach ($alldata as $number) { |
| 1895 | 2180 | $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
| 1896 | 2181 | } |
| 1897 | - if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
|
| 2182 | + if ($globalDebug) { |
|
| 2183 | + echo 'Count all pilots by months by airlines...'."\n"; |
|
| 2184 | + } |
|
| 1898 | 2185 | $alldata = $Spotter->countAllMonthsPilotsByAirlines(); |
| 1899 | 2186 | foreach ($alldata as $number) { |
| 1900 | 2187 | $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
| 1901 | 2188 | } |
| 1902 | - if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
|
| 2189 | + if ($globalDebug) { |
|
| 2190 | + echo 'Count all aircrafts by months by airlines...'."\n"; |
|
| 2191 | + } |
|
| 1903 | 2192 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines(); |
| 1904 | 2193 | foreach ($alldata as $number) { |
| 1905 | 2194 | $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
| 1906 | 2195 | } |
| 1907 | - if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
|
| 2196 | + if ($globalDebug) { |
|
| 2197 | + echo 'Count all real arrivals by months by airlines...'."\n"; |
|
| 2198 | + } |
|
| 1908 | 2199 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines(); |
| 1909 | 2200 | foreach ($alldata as $number) { |
| 1910 | 2201 | $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
| 1911 | 2202 | } |
| 1912 | - if ($globalDebug) echo '...Departure'."\n"; |
|
| 2203 | + if ($globalDebug) { |
|
| 2204 | + echo '...Departure'."\n"; |
|
| 2205 | + } |
|
| 1913 | 2206 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
| 1914 | 2207 | $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
| 1915 | 2208 | foreach ($dall as $value) { |
@@ -1932,7 +2225,9 @@ discard block |
||
| 1932 | 2225 | foreach ($alldata as $number) { |
| 1933 | 2226 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']); |
| 1934 | 2227 | } |
| 1935 | - if ($globalDebug) echo '...Arrival'."\n"; |
|
| 2228 | + if ($globalDebug) { |
|
| 2229 | + echo '...Arrival'."\n"; |
|
| 2230 | + } |
|
| 1936 | 2231 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
| 1937 | 2232 | $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
| 1938 | 2233 | foreach ($dall as $value) { |
@@ -1956,13 +2251,19 @@ discard block |
||
| 1956 | 2251 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']); |
| 1957 | 2252 | } |
| 1958 | 2253 | |
| 1959 | - if ($globalDebug) echo 'Flights data...'."\n"; |
|
| 1960 | - if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
|
| 2254 | + if ($globalDebug) { |
|
| 2255 | + echo 'Flights data...'."\n"; |
|
| 2256 | + } |
|
| 2257 | + if ($globalDebug) { |
|
| 2258 | + echo '-> countAllDatesLastMonth...'."\n"; |
|
| 2259 | + } |
|
| 1961 | 2260 | $alldata = $Spotter->countAllDatesLastMonthByAirlines(); |
| 1962 | 2261 | foreach ($alldata as $number) { |
| 1963 | 2262 | $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
| 1964 | 2263 | } |
| 1965 | - if ($globalDebug) echo '-> countAllDates...'."\n"; |
|
| 2264 | + if ($globalDebug) { |
|
| 2265 | + echo '-> countAllDates...'."\n"; |
|
| 2266 | + } |
|
| 1966 | 2267 | //$previousdata = $this->countAllDatesByAirlines(); |
| 1967 | 2268 | $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines()); |
| 1968 | 2269 | $values = array(); |
@@ -1975,7 +2276,9 @@ discard block |
||
| 1975 | 2276 | $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
| 1976 | 2277 | } |
| 1977 | 2278 | |
| 1978 | - if ($globalDebug) echo '-> countAllHours...'."\n"; |
|
| 2279 | + if ($globalDebug) { |
|
| 2280 | + echo '-> countAllHours...'."\n"; |
|
| 2281 | + } |
|
| 1979 | 2282 | $alldata = $Spotter->countAllHoursByAirlines('hour'); |
| 1980 | 2283 | foreach ($alldata as $number) { |
| 1981 | 2284 | $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
@@ -1983,14 +2286,18 @@ discard block |
||
| 1983 | 2286 | |
| 1984 | 2287 | |
| 1985 | 2288 | // Stats by filters |
| 1986 | - if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array(); |
|
| 2289 | + if (!isset($globalStatsFilters) || $globalStatsFilters == '') { |
|
| 2290 | + $globalStatsFilters = array(); |
|
| 2291 | + } |
|
| 1987 | 2292 | foreach ($globalStatsFilters as $name => $filter) { |
| 1988 | 2293 | //$filter_name = $filter['name']; |
| 1989 | 2294 | $filter_name = $name; |
| 1990 | 2295 | $reset = false; |
| 1991 | 2296 | $last_update = $this->getLastStatsUpdate('last_update_stats_'.$filter_name); |
| 1992 | 2297 | if (isset($filter['resetall']) && isset($last_update[0]['value']) && strtotime($filter['resetall']) > strtotime($last_update[0]['value'])) { |
| 1993 | - if ($globalDebug) echo '!!! Delete stats for filter '.$filter_name.' !!!'."\n"; |
|
| 2298 | + if ($globalDebug) { |
|
| 2299 | + echo '!!! Delete stats for filter '.$filter_name.' !!!'."\n"; |
|
| 2300 | + } |
|
| 1994 | 2301 | $this->deleteOldStats($filter_name); |
| 1995 | 2302 | unset($last_update); |
| 1996 | 2303 | } |
@@ -2009,7 +2316,9 @@ discard block |
||
| 2009 | 2316 | |
| 2010 | 2317 | |
| 2011 | 2318 | // Count by filter |
| 2012 | - if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
| 2319 | + if ($globalDebug) { |
|
| 2320 | + echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
| 2321 | + } |
|
| 2013 | 2322 | $Spotter = new Spotter($this->db); |
| 2014 | 2323 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
| 2015 | 2324 | foreach ($alldata as $number) { |
@@ -2046,7 +2355,9 @@ discard block |
||
| 2046 | 2355 | $icao = $value['airport_departure_icao']; |
| 2047 | 2356 | if (isset($alldata[$icao])) { |
| 2048 | 2357 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 2049 | - } else $alldata[$icao] = $value; |
|
| 2358 | + } else { |
|
| 2359 | + $alldata[$icao] = $value; |
|
| 2360 | + } |
|
| 2050 | 2361 | } |
| 2051 | 2362 | $count = array(); |
| 2052 | 2363 | foreach ($alldata as $key => $row) { |
@@ -2067,7 +2378,9 @@ discard block |
||
| 2067 | 2378 | $icao = $value['airport_arrival_icao']; |
| 2068 | 2379 | if (isset($alldata[$icao])) { |
| 2069 | 2380 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 2070 | - } else $alldata[$icao] = $value; |
|
| 2381 | + } else { |
|
| 2382 | + $alldata[$icao] = $value; |
|
| 2383 | + } |
|
| 2071 | 2384 | } |
| 2072 | 2385 | $count = array(); |
| 2073 | 2386 | foreach ($alldata as $key => $row) { |
@@ -2081,7 +2394,9 @@ discard block |
||
| 2081 | 2394 | $alldata = $Spotter->countAllMonths($filter); |
| 2082 | 2395 | $lastyear = false; |
| 2083 | 2396 | foreach ($alldata as $number) { |
| 2084 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 2397 | + if ($number['year_name'] != date('Y')) { |
|
| 2398 | + $lastyear = true; |
|
| 2399 | + } |
|
| 2085 | 2400 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
| 2086 | 2401 | } |
| 2087 | 2402 | $alldata = $Spotter->countAllMonthsOwners($filter); |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | - * Get SQL query part for filter used |
|
| 59 | - * @param Array $filter the filter |
|
| 60 | - * @return Array the SQL part |
|
| 61 | - */ |
|
| 58 | + * Get SQL query part for filter used |
|
| 59 | + * @param Array $filter the filter |
|
| 60 | + * @return Array the SQL part |
|
| 61 | + */ |
|
| 62 | 62 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 63 | 63 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 64 | 64 | $filters = array(); |
@@ -166,14 +166,14 @@ discard block |
||
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /** |
| 169 | - * Executes the SQL statements to get the spotter information |
|
| 170 | - * |
|
| 171 | - * @param String $query the SQL query |
|
| 172 | - * @param Array $params parameter of the query |
|
| 173 | - * @param String $limitQuery the limit query |
|
| 174 | - * @return Array the spotter information |
|
| 175 | - * |
|
| 176 | - */ |
|
| 169 | + * Executes the SQL statements to get the spotter information |
|
| 170 | + * |
|
| 171 | + * @param String $query the SQL query |
|
| 172 | + * @param Array $params parameter of the query |
|
| 173 | + * @param String $limitQuery the limit query |
|
| 174 | + * @return Array the spotter information |
|
| 175 | + * |
|
| 176 | + */ |
|
| 177 | 177 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
| 178 | 178 | { |
| 179 | 179 | global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM; |
@@ -342,11 +342,11 @@ discard block |
||
| 342 | 342 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
| 343 | 343 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
| 344 | 344 | } else $temp_array['aircraft_shadow'] = 'default.png'; |
| 345 | - } else { |
|
| 346 | - $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 345 | + } else { |
|
| 346 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 347 | 347 | $temp_array['aircraft_name'] = 'N/A'; |
| 348 | 348 | $temp_array['aircraft_manufacturer'] = 'N/A'; |
| 349 | - } |
|
| 349 | + } |
|
| 350 | 350 | } |
| 351 | 351 | $fromsource = NULL; |
| 352 | 352 | if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
@@ -542,11 +542,11 @@ discard block |
||
| 542 | 542 | |
| 543 | 543 | |
| 544 | 544 | /** |
| 545 | - * Gets all the spotter information |
|
| 546 | - * |
|
| 547 | - * @return Array the spotter information |
|
| 548 | - * |
|
| 549 | - */ |
|
| 545 | + * Gets all the spotter information |
|
| 546 | + * |
|
| 547 | + * @return Array the spotter information |
|
| 548 | + * |
|
| 549 | + */ |
|
| 550 | 550 | 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()) |
| 551 | 551 | { |
| 552 | 552 | global $globalTimezone, $globalDBdriver; |
@@ -893,11 +893,11 @@ discard block |
||
| 893 | 893 | |
| 894 | 894 | |
| 895 | 895 | /** |
| 896 | - * Gets all the spotter information based on the latest data entry |
|
| 897 | - * |
|
| 898 | - * @return Array the spotter information |
|
| 899 | - * |
|
| 900 | - */ |
|
| 896 | + * Gets all the spotter information based on the latest data entry |
|
| 897 | + * |
|
| 898 | + * @return Array the spotter information |
|
| 899 | + * |
|
| 900 | + */ |
|
| 901 | 901 | public function getLatestSpotterData($limit = '', $sort = '', $filter = array()) |
| 902 | 902 | { |
| 903 | 903 | global $global_query; |
@@ -936,12 +936,12 @@ discard block |
||
| 936 | 936 | } |
| 937 | 937 | |
| 938 | 938 | |
| 939 | - /** |
|
| 940 | - * Gets all the spotter information based on a user's latitude and longitude |
|
| 941 | - * |
|
| 942 | - * @return Array the spotter information |
|
| 943 | - * |
|
| 944 | - */ |
|
| 939 | + /** |
|
| 940 | + * Gets all the spotter information based on a user's latitude and longitude |
|
| 941 | + * |
|
| 942 | + * @return Array the spotter information |
|
| 943 | + * |
|
| 944 | + */ |
|
| 945 | 945 | public function getLatestSpotterForLayar($lat, $lng, $radius, $interval) |
| 946 | 946 | { |
| 947 | 947 | date_default_timezone_set('UTC'); |
@@ -969,7 +969,7 @@ discard block |
||
| 969 | 969 | return false; |
| 970 | 970 | } |
| 971 | 971 | } |
| 972 | - $additional_query = ''; |
|
| 972 | + $additional_query = ''; |
|
| 973 | 973 | if ($interval != "") |
| 974 | 974 | { |
| 975 | 975 | if (!is_string($interval)) |
@@ -1009,12 +1009,12 @@ discard block |
||
| 1009 | 1009 | } |
| 1010 | 1010 | |
| 1011 | 1011 | |
| 1012 | - /** |
|
| 1013 | - * Gets all the spotter information sorted by the newest aircraft type |
|
| 1014 | - * |
|
| 1015 | - * @return Array the spotter information |
|
| 1016 | - * |
|
| 1017 | - */ |
|
| 1012 | + /** |
|
| 1013 | + * Gets all the spotter information sorted by the newest aircraft type |
|
| 1014 | + * |
|
| 1015 | + * @return Array the spotter information |
|
| 1016 | + * |
|
| 1017 | + */ |
|
| 1018 | 1018 | public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array()) |
| 1019 | 1019 | { |
| 1020 | 1020 | global $global_query; |
@@ -1055,11 +1055,11 @@ discard block |
||
| 1055 | 1055 | |
| 1056 | 1056 | |
| 1057 | 1057 | /** |
| 1058 | - * Gets all the spotter information sorted by the newest aircraft registration |
|
| 1059 | - * |
|
| 1060 | - * @return Array the spotter information |
|
| 1061 | - * |
|
| 1062 | - */ |
|
| 1058 | + * Gets all the spotter information sorted by the newest aircraft registration |
|
| 1059 | + * |
|
| 1060 | + * @return Array the spotter information |
|
| 1061 | + * |
|
| 1062 | + */ |
|
| 1063 | 1063 | public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array()) |
| 1064 | 1064 | { |
| 1065 | 1065 | global $global_query; |
@@ -1099,11 +1099,11 @@ discard block |
||
| 1099 | 1099 | |
| 1100 | 1100 | |
| 1101 | 1101 | /** |
| 1102 | - * Gets all the spotter information sorted by the newest airline |
|
| 1103 | - * |
|
| 1104 | - * @return Array the spotter information |
|
| 1105 | - * |
|
| 1106 | - */ |
|
| 1102 | + * Gets all the spotter information sorted by the newest airline |
|
| 1103 | + * |
|
| 1104 | + * @return Array the spotter information |
|
| 1105 | + * |
|
| 1106 | + */ |
|
| 1107 | 1107 | public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array()) |
| 1108 | 1108 | { |
| 1109 | 1109 | global $global_query; |
@@ -1142,12 +1142,12 @@ discard block |
||
| 1142 | 1142 | } |
| 1143 | 1143 | |
| 1144 | 1144 | |
| 1145 | - /** |
|
| 1146 | - * Gets all the spotter information sorted by the newest departure airport |
|
| 1147 | - * |
|
| 1148 | - * @return Array the spotter information |
|
| 1149 | - * |
|
| 1150 | - */ |
|
| 1145 | + /** |
|
| 1146 | + * Gets all the spotter information sorted by the newest departure airport |
|
| 1147 | + * |
|
| 1148 | + * @return Array the spotter information |
|
| 1149 | + * |
|
| 1150 | + */ |
|
| 1151 | 1151 | public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array()) |
| 1152 | 1152 | { |
| 1153 | 1153 | global $global_query; |
@@ -1189,11 +1189,11 @@ discard block |
||
| 1189 | 1189 | |
| 1190 | 1190 | |
| 1191 | 1191 | /** |
| 1192 | - * Gets all the spotter information sorted by the newest arrival airport |
|
| 1193 | - * |
|
| 1194 | - * @return Array the spotter information |
|
| 1195 | - * |
|
| 1196 | - */ |
|
| 1192 | + * Gets all the spotter information sorted by the newest arrival airport |
|
| 1193 | + * |
|
| 1194 | + * @return Array the spotter information |
|
| 1195 | + * |
|
| 1196 | + */ |
|
| 1197 | 1197 | public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array()) |
| 1198 | 1198 | { |
| 1199 | 1199 | global $global_query; |
@@ -1232,11 +1232,11 @@ discard block |
||
| 1232 | 1232 | |
| 1233 | 1233 | |
| 1234 | 1234 | /** |
| 1235 | - * Gets all the spotter information based on the spotter id |
|
| 1236 | - * |
|
| 1237 | - * @return Array the spotter information |
|
| 1238 | - * |
|
| 1239 | - */ |
|
| 1235 | + * Gets all the spotter information based on the spotter id |
|
| 1236 | + * |
|
| 1237 | + * @return Array the spotter information |
|
| 1238 | + * |
|
| 1239 | + */ |
|
| 1240 | 1240 | public function getSpotterDataByID($id = '') |
| 1241 | 1241 | { |
| 1242 | 1242 | global $global_query; |
@@ -1258,11 +1258,11 @@ discard block |
||
| 1258 | 1258 | |
| 1259 | 1259 | |
| 1260 | 1260 | /** |
| 1261 | - * Gets all the spotter information based on the callsign |
|
| 1262 | - * |
|
| 1263 | - * @return Array the spotter information |
|
| 1264 | - * |
|
| 1265 | - */ |
|
| 1261 | + * Gets all the spotter information based on the callsign |
|
| 1262 | + * |
|
| 1263 | + * @return Array the spotter information |
|
| 1264 | + * |
|
| 1265 | + */ |
|
| 1266 | 1266 | public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '', $filter = array()) |
| 1267 | 1267 | { |
| 1268 | 1268 | global $global_query; |
@@ -1314,11 +1314,11 @@ discard block |
||
| 1314 | 1314 | } |
| 1315 | 1315 | |
| 1316 | 1316 | /** |
| 1317 | - * Gets all the spotter information based on the owner |
|
| 1318 | - * |
|
| 1319 | - * @return Array the spotter information |
|
| 1320 | - * |
|
| 1321 | - */ |
|
| 1317 | + * Gets all the spotter information based on the owner |
|
| 1318 | + * |
|
| 1319 | + * @return Array the spotter information |
|
| 1320 | + * |
|
| 1321 | + */ |
|
| 1322 | 1322 | public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '', $filter = array()) |
| 1323 | 1323 | { |
| 1324 | 1324 | global $global_query; |
@@ -1371,11 +1371,11 @@ discard block |
||
| 1371 | 1371 | } |
| 1372 | 1372 | |
| 1373 | 1373 | /** |
| 1374 | - * Gets all the spotter information based on the pilot |
|
| 1375 | - * |
|
| 1376 | - * @return Array the spotter information |
|
| 1377 | - * |
|
| 1378 | - */ |
|
| 1374 | + * Gets all the spotter information based on the pilot |
|
| 1375 | + * |
|
| 1376 | + * @return Array the spotter information |
|
| 1377 | + * |
|
| 1378 | + */ |
|
| 1379 | 1379 | public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array()) |
| 1380 | 1380 | { |
| 1381 | 1381 | global $global_query; |
@@ -1424,11 +1424,11 @@ discard block |
||
| 1424 | 1424 | |
| 1425 | 1425 | |
| 1426 | 1426 | /** |
| 1427 | - * Gets all the spotter information based on the aircraft type |
|
| 1428 | - * |
|
| 1429 | - * @return Array the spotter information |
|
| 1430 | - * |
|
| 1431 | - */ |
|
| 1427 | + * Gets all the spotter information based on the aircraft type |
|
| 1428 | + * |
|
| 1429 | + * @return Array the spotter information |
|
| 1430 | + * |
|
| 1431 | + */ |
|
| 1432 | 1432 | public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array()) |
| 1433 | 1433 | { |
| 1434 | 1434 | global $global_query; |
@@ -1482,11 +1482,11 @@ discard block |
||
| 1482 | 1482 | |
| 1483 | 1483 | |
| 1484 | 1484 | /** |
| 1485 | - * Gets all the spotter information based on the aircraft registration |
|
| 1486 | - * |
|
| 1487 | - * @return Array the spotter information |
|
| 1488 | - * |
|
| 1489 | - */ |
|
| 1485 | + * Gets all the spotter information based on the aircraft registration |
|
| 1486 | + * |
|
| 1487 | + * @return Array the spotter information |
|
| 1488 | + * |
|
| 1489 | + */ |
|
| 1490 | 1490 | public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array()) |
| 1491 | 1491 | { |
| 1492 | 1492 | global $global_query; |
@@ -1543,11 +1543,11 @@ discard block |
||
| 1543 | 1543 | |
| 1544 | 1544 | |
| 1545 | 1545 | /** |
| 1546 | - * Gets all the spotter information based on the airline |
|
| 1547 | - * |
|
| 1548 | - * @return Array the spotter information |
|
| 1549 | - * |
|
| 1550 | - */ |
|
| 1546 | + * Gets all the spotter information based on the airline |
|
| 1547 | + * |
|
| 1548 | + * @return Array the spotter information |
|
| 1549 | + * |
|
| 1550 | + */ |
|
| 1551 | 1551 | public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array()) |
| 1552 | 1552 | { |
| 1553 | 1553 | global $global_query; |
@@ -1600,11 +1600,11 @@ discard block |
||
| 1600 | 1600 | |
| 1601 | 1601 | |
| 1602 | 1602 | /** |
| 1603 | - * Gets all the spotter information based on the airport |
|
| 1604 | - * |
|
| 1605 | - * @return Array the spotter information |
|
| 1606 | - * |
|
| 1607 | - */ |
|
| 1603 | + * Gets all the spotter information based on the airport |
|
| 1604 | + * |
|
| 1605 | + * @return Array the spotter information |
|
| 1606 | + * |
|
| 1607 | + */ |
|
| 1608 | 1608 | public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
| 1609 | 1609 | { |
| 1610 | 1610 | global $global_query; |
@@ -1658,11 +1658,11 @@ discard block |
||
| 1658 | 1658 | |
| 1659 | 1659 | |
| 1660 | 1660 | /** |
| 1661 | - * Gets all the spotter information based on the date |
|
| 1662 | - * |
|
| 1663 | - * @return Array the spotter information |
|
| 1664 | - * |
|
| 1665 | - */ |
|
| 1661 | + * Gets all the spotter information based on the date |
|
| 1662 | + * |
|
| 1663 | + * @return Array the spotter information |
|
| 1664 | + * |
|
| 1665 | + */ |
|
| 1666 | 1666 | public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
| 1667 | 1667 | { |
| 1668 | 1668 | global $global_query, $globalTimezone, $globalDBdriver; |
@@ -1726,11 +1726,11 @@ discard block |
||
| 1726 | 1726 | |
| 1727 | 1727 | |
| 1728 | 1728 | /** |
| 1729 | - * Gets all the spotter information based on the country name |
|
| 1730 | - * |
|
| 1731 | - * @return Array the spotter information |
|
| 1732 | - * |
|
| 1733 | - */ |
|
| 1729 | + * Gets all the spotter information based on the country name |
|
| 1730 | + * |
|
| 1731 | + * @return Array the spotter information |
|
| 1732 | + * |
|
| 1733 | + */ |
|
| 1734 | 1734 | public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array()) |
| 1735 | 1735 | { |
| 1736 | 1736 | global $global_query; |
@@ -1784,11 +1784,11 @@ discard block |
||
| 1784 | 1784 | |
| 1785 | 1785 | |
| 1786 | 1786 | /** |
| 1787 | - * Gets all the spotter information based on the manufacturer name |
|
| 1788 | - * |
|
| 1789 | - * @return Array the spotter information |
|
| 1790 | - * |
|
| 1791 | - */ |
|
| 1787 | + * Gets all the spotter information based on the manufacturer name |
|
| 1788 | + * |
|
| 1789 | + * @return Array the spotter information |
|
| 1790 | + * |
|
| 1791 | + */ |
|
| 1792 | 1792 | public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array()) |
| 1793 | 1793 | { |
| 1794 | 1794 | global $global_query; |
@@ -1844,13 +1844,13 @@ discard block |
||
| 1844 | 1844 | |
| 1845 | 1845 | |
| 1846 | 1846 | /** |
| 1847 | - * Gets a list of all aircraft that take a route |
|
| 1848 | - * |
|
| 1849 | - * @param String $departure_airport_icao ICAO code of departure airport |
|
| 1850 | - * @param String $arrival_airport_icao ICAO code of arrival airport |
|
| 1851 | - * @return Array the spotter information |
|
| 1852 | - * |
|
| 1853 | - */ |
|
| 1847 | + * Gets a list of all aircraft that take a route |
|
| 1848 | + * |
|
| 1849 | + * @param String $departure_airport_icao ICAO code of departure airport |
|
| 1850 | + * @param String $arrival_airport_icao ICAO code of arrival airport |
|
| 1851 | + * @return Array the spotter information |
|
| 1852 | + * |
|
| 1853 | + */ |
|
| 1854 | 1854 | public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array()) |
| 1855 | 1855 | { |
| 1856 | 1856 | global $global_query; |
@@ -1919,11 +1919,11 @@ discard block |
||
| 1919 | 1919 | |
| 1920 | 1920 | |
| 1921 | 1921 | /** |
| 1922 | - * Gets all the spotter information based on the special column in the table |
|
| 1923 | - * |
|
| 1924 | - * @return Array the spotter information |
|
| 1925 | - * |
|
| 1926 | - */ |
|
| 1922 | + * Gets all the spotter information based on the special column in the table |
|
| 1923 | + * |
|
| 1924 | + * @return Array the spotter information |
|
| 1925 | + * |
|
| 1926 | + */ |
|
| 1927 | 1927 | public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array()) |
| 1928 | 1928 | { |
| 1929 | 1929 | global $global_query; |
@@ -1962,11 +1962,11 @@ discard block |
||
| 1962 | 1962 | } |
| 1963 | 1963 | |
| 1964 | 1964 | /** |
| 1965 | - * Gets all the highlight based on a aircraft registration |
|
| 1966 | - * |
|
| 1967 | - * @return String the highlight text |
|
| 1968 | - * |
|
| 1969 | - */ |
|
| 1965 | + * Gets all the highlight based on a aircraft registration |
|
| 1966 | + * |
|
| 1967 | + * @return String the highlight text |
|
| 1968 | + * |
|
| 1969 | + */ |
|
| 1970 | 1970 | public function getHighlightByRegistration($registration,$filter = array()) |
| 1971 | 1971 | { |
| 1972 | 1972 | global $global_query; |
@@ -1988,13 +1988,13 @@ discard block |
||
| 1988 | 1988 | |
| 1989 | 1989 | |
| 1990 | 1990 | /** |
| 1991 | - * Gets the squawk usage from squawk code |
|
| 1992 | - * |
|
| 1993 | - * @param String $squawk squawk code |
|
| 1994 | - * @param String $country country |
|
| 1995 | - * @return String usage |
|
| 1996 | - * |
|
| 1997 | - */ |
|
| 1991 | + * Gets the squawk usage from squawk code |
|
| 1992 | + * |
|
| 1993 | + * @param String $squawk squawk code |
|
| 1994 | + * @param String $country country |
|
| 1995 | + * @return String usage |
|
| 1996 | + * |
|
| 1997 | + */ |
|
| 1998 | 1998 | public function getSquawkUsage($squawk = '',$country = 'FR') |
| 1999 | 1999 | { |
| 2000 | 2000 | |
@@ -2015,12 +2015,12 @@ discard block |
||
| 2015 | 2015 | } |
| 2016 | 2016 | |
| 2017 | 2017 | /** |
| 2018 | - * Gets the airport icao from the iata |
|
| 2019 | - * |
|
| 2020 | - * @param String $airport_iata the iata code of the airport |
|
| 2021 | - * @return String airport iata |
|
| 2022 | - * |
|
| 2023 | - */ |
|
| 2018 | + * Gets the airport icao from the iata |
|
| 2019 | + * |
|
| 2020 | + * @param String $airport_iata the iata code of the airport |
|
| 2021 | + * @return String airport iata |
|
| 2022 | + * |
|
| 2023 | + */ |
|
| 2024 | 2024 | public function getAirportIcao($airport_iata = '') |
| 2025 | 2025 | { |
| 2026 | 2026 | |
@@ -2040,14 +2040,14 @@ discard block |
||
| 2040 | 2040 | } |
| 2041 | 2041 | |
| 2042 | 2042 | /** |
| 2043 | - * Gets the airport distance |
|
| 2044 | - * |
|
| 2045 | - * @param String $airport_icao the icao code of the airport |
|
| 2046 | - * @param Float $latitude the latitude |
|
| 2047 | - * @param Float $longitude the longitude |
|
| 2048 | - * @return Float distance to the airport |
|
| 2049 | - * |
|
| 2050 | - */ |
|
| 2043 | + * Gets the airport distance |
|
| 2044 | + * |
|
| 2045 | + * @param String $airport_icao the icao code of the airport |
|
| 2046 | + * @param Float $latitude the latitude |
|
| 2047 | + * @param Float $longitude the longitude |
|
| 2048 | + * @return Float distance to the airport |
|
| 2049 | + * |
|
| 2050 | + */ |
|
| 2051 | 2051 | public function getAirportDistance($airport_icao,$latitude,$longitude) |
| 2052 | 2052 | { |
| 2053 | 2053 | |
@@ -2068,12 +2068,12 @@ discard block |
||
| 2068 | 2068 | } |
| 2069 | 2069 | |
| 2070 | 2070 | /** |
| 2071 | - * Gets the airport info based on the icao |
|
| 2072 | - * |
|
| 2073 | - * @param String $airport the icao code of the airport |
|
| 2074 | - * @return Array airport information |
|
| 2075 | - * |
|
| 2076 | - */ |
|
| 2071 | + * Gets the airport info based on the icao |
|
| 2072 | + * |
|
| 2073 | + * @param String $airport the icao code of the airport |
|
| 2074 | + * @return Array airport information |
|
| 2075 | + * |
|
| 2076 | + */ |
|
| 2077 | 2077 | public function getAllAirportInfo($airport = '') |
| 2078 | 2078 | { |
| 2079 | 2079 | |
@@ -2119,12 +2119,12 @@ discard block |
||
| 2119 | 2119 | } |
| 2120 | 2120 | |
| 2121 | 2121 | /** |
| 2122 | - * Gets the airport info based on the country |
|
| 2123 | - * |
|
| 2124 | - * @param Array $countries Airports countries |
|
| 2125 | - * @return Array airport information |
|
| 2126 | - * |
|
| 2127 | - */ |
|
| 2122 | + * Gets the airport info based on the country |
|
| 2123 | + * |
|
| 2124 | + * @param Array $countries Airports countries |
|
| 2125 | + * @return Array airport information |
|
| 2126 | + * |
|
| 2127 | + */ |
|
| 2128 | 2128 | public function getAllAirportInfobyCountry($countries) |
| 2129 | 2129 | { |
| 2130 | 2130 | $lst_countries = ''; |
@@ -2162,12 +2162,12 @@ discard block |
||
| 2162 | 2162 | } |
| 2163 | 2163 | |
| 2164 | 2164 | /** |
| 2165 | - * Gets airports info based on the coord |
|
| 2166 | - * |
|
| 2167 | - * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max |
|
| 2168 | - * @return Array airport information |
|
| 2169 | - * |
|
| 2170 | - */ |
|
| 2165 | + * Gets airports info based on the coord |
|
| 2166 | + * |
|
| 2167 | + * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max |
|
| 2168 | + * @return Array airport information |
|
| 2169 | + * |
|
| 2170 | + */ |
|
| 2171 | 2171 | public function getAllAirportInfobyCoord($coord) |
| 2172 | 2172 | { |
| 2173 | 2173 | global $globalDBdriver; |
@@ -2198,12 +2198,12 @@ discard block |
||
| 2198 | 2198 | } |
| 2199 | 2199 | |
| 2200 | 2200 | /** |
| 2201 | - * Gets waypoints info based on the coord |
|
| 2202 | - * |
|
| 2203 | - * @param Array $coord waypoints coord |
|
| 2204 | - * @return Array airport information |
|
| 2205 | - * |
|
| 2206 | - */ |
|
| 2201 | + * Gets waypoints info based on the coord |
|
| 2202 | + * |
|
| 2203 | + * @param Array $coord waypoints coord |
|
| 2204 | + * @return Array airport information |
|
| 2205 | + * |
|
| 2206 | + */ |
|
| 2207 | 2207 | public function getAllWaypointsInfobyCoord($coord) |
| 2208 | 2208 | { |
| 2209 | 2209 | if (is_array($coord)) { |
@@ -2237,12 +2237,12 @@ discard block |
||
| 2237 | 2237 | |
| 2238 | 2238 | |
| 2239 | 2239 | /** |
| 2240 | - * Gets the airline info based on the icao code or iata code |
|
| 2241 | - * |
|
| 2242 | - * @param String $airline_icao the iata code of the airport |
|
| 2243 | - * @return Array airport information |
|
| 2244 | - * |
|
| 2245 | - */ |
|
| 2240 | + * Gets the airline info based on the icao code or iata code |
|
| 2241 | + * |
|
| 2242 | + * @param String $airline_icao the iata code of the airport |
|
| 2243 | + * @return Array airport information |
|
| 2244 | + * |
|
| 2245 | + */ |
|
| 2246 | 2246 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
| 2247 | 2247 | { |
| 2248 | 2248 | global $globalUseRealAirlines; |
@@ -2273,7 +2273,7 @@ discard block |
||
| 2273 | 2273 | } else { |
| 2274 | 2274 | $sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource)); |
| 2275 | 2275 | } |
| 2276 | - /* |
|
| 2276 | + /* |
|
| 2277 | 2277 | $airline_array = array(); |
| 2278 | 2278 | $temp_array = array(); |
| 2279 | 2279 | |
@@ -2306,12 +2306,12 @@ discard block |
||
| 2306 | 2306 | } |
| 2307 | 2307 | |
| 2308 | 2308 | /** |
| 2309 | - * Gets the airline info based on the airline name |
|
| 2310 | - * |
|
| 2311 | - * @param String $airline_name the name of the airline |
|
| 2312 | - * @return Array airline information |
|
| 2313 | - * |
|
| 2314 | - */ |
|
| 2309 | + * Gets the airline info based on the airline name |
|
| 2310 | + * |
|
| 2311 | + * @param String $airline_name the name of the airline |
|
| 2312 | + * @return Array airline information |
|
| 2313 | + * |
|
| 2314 | + */ |
|
| 2315 | 2315 | public function getAllAirlineInfoByName($airline_name, $fromsource = NULL) |
| 2316 | 2316 | { |
| 2317 | 2317 | global $globalUseRealAirlines; |
@@ -2339,12 +2339,12 @@ discard block |
||
| 2339 | 2339 | |
| 2340 | 2340 | |
| 2341 | 2341 | /** |
| 2342 | - * Gets the aircraft info based on the aircraft type |
|
| 2343 | - * |
|
| 2344 | - * @param String $aircraft_type the aircraft type |
|
| 2345 | - * @return Array aircraft information |
|
| 2346 | - * |
|
| 2347 | - */ |
|
| 2342 | + * Gets the aircraft info based on the aircraft type |
|
| 2343 | + * |
|
| 2344 | + * @param String $aircraft_type the aircraft type |
|
| 2345 | + * @return Array aircraft information |
|
| 2346 | + * |
|
| 2347 | + */ |
|
| 2348 | 2348 | public function getAllAircraftInfo($aircraft_type) |
| 2349 | 2349 | { |
| 2350 | 2350 | $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
@@ -2376,12 +2376,12 @@ discard block |
||
| 2376 | 2376 | } |
| 2377 | 2377 | |
| 2378 | 2378 | /** |
| 2379 | - * Gets the aircraft icao based on the aircraft name/type |
|
| 2380 | - * |
|
| 2381 | - * @param String $aircraft_type the aircraft type |
|
| 2382 | - * @return String aircraft information |
|
| 2383 | - * |
|
| 2384 | - */ |
|
| 2379 | + * Gets the aircraft icao based on the aircraft name/type |
|
| 2380 | + * |
|
| 2381 | + * @param String $aircraft_type the aircraft type |
|
| 2382 | + * @return String aircraft information |
|
| 2383 | + * |
|
| 2384 | + */ |
|
| 2385 | 2385 | public function getAircraftIcao($aircraft_type) |
| 2386 | 2386 | { |
| 2387 | 2387 | $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
@@ -2406,12 +2406,12 @@ discard block |
||
| 2406 | 2406 | } |
| 2407 | 2407 | |
| 2408 | 2408 | /** |
| 2409 | - * Gets the aircraft info based on the aircraft modes |
|
| 2410 | - * |
|
| 2411 | - * @param String $aircraft_modes the aircraft ident (hex) |
|
| 2412 | - * @return String aircraft type |
|
| 2413 | - * |
|
| 2414 | - */ |
|
| 2409 | + * Gets the aircraft info based on the aircraft modes |
|
| 2410 | + * |
|
| 2411 | + * @param String $aircraft_modes the aircraft ident (hex) |
|
| 2412 | + * @return String aircraft type |
|
| 2413 | + * |
|
| 2414 | + */ |
|
| 2415 | 2415 | public function getAllAircraftType($aircraft_modes,$source_type = '') |
| 2416 | 2416 | { |
| 2417 | 2417 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -2438,12 +2438,12 @@ discard block |
||
| 2438 | 2438 | } |
| 2439 | 2439 | |
| 2440 | 2440 | /** |
| 2441 | - * Gets the aircraft info based on the aircraft registration |
|
| 2442 | - * |
|
| 2443 | - * @param String $registration the aircraft registration |
|
| 2444 | - * @return String aircraft type |
|
| 2445 | - * |
|
| 2446 | - */ |
|
| 2441 | + * Gets the aircraft info based on the aircraft registration |
|
| 2442 | + * |
|
| 2443 | + * @param String $registration the aircraft registration |
|
| 2444 | + * @return String aircraft type |
|
| 2445 | + * |
|
| 2446 | + */ |
|
| 2447 | 2447 | public function getAllAircraftTypeByRegistration($registration) |
| 2448 | 2448 | { |
| 2449 | 2449 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2461,12 +2461,12 @@ discard block |
||
| 2461 | 2461 | } |
| 2462 | 2462 | |
| 2463 | 2463 | /** |
| 2464 | - * Gets the spotter_id and flightaware_id based on the aircraft registration |
|
| 2465 | - * |
|
| 2466 | - * @param String $registration the aircraft registration |
|
| 2467 | - * @return Array spotter_id and flightaware_id |
|
| 2468 | - * |
|
| 2469 | - */ |
|
| 2464 | + * Gets the spotter_id and flightaware_id based on the aircraft registration |
|
| 2465 | + * |
|
| 2466 | + * @param String $registration the aircraft registration |
|
| 2467 | + * @return Array spotter_id and flightaware_id |
|
| 2468 | + * |
|
| 2469 | + */ |
|
| 2470 | 2470 | public function getAllIDByRegistration($registration) |
| 2471 | 2471 | { |
| 2472 | 2472 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2485,12 +2485,12 @@ discard block |
||
| 2485 | 2485 | } |
| 2486 | 2486 | |
| 2487 | 2487 | /** |
| 2488 | - * Gets correct aircraft operator code |
|
| 2489 | - * |
|
| 2490 | - * @param String $operator the aircraft operator code (callsign) |
|
| 2491 | - * @return String aircraft operator code |
|
| 2492 | - * |
|
| 2493 | - */ |
|
| 2488 | + * Gets correct aircraft operator code |
|
| 2489 | + * |
|
| 2490 | + * @param String $operator the aircraft operator code (callsign) |
|
| 2491 | + * @return String aircraft operator code |
|
| 2492 | + * |
|
| 2493 | + */ |
|
| 2494 | 2494 | public function getOperator($operator) |
| 2495 | 2495 | { |
| 2496 | 2496 | $operator = filter_var($operator,FILTER_SANITIZE_STRING); |
@@ -2507,16 +2507,16 @@ discard block |
||
| 2507 | 2507 | } |
| 2508 | 2508 | |
| 2509 | 2509 | /** |
| 2510 | - * Gets the aircraft route based on the aircraft callsign |
|
| 2511 | - * |
|
| 2512 | - * @param String $callsign the aircraft callsign |
|
| 2513 | - * @return Array aircraft type |
|
| 2514 | - * |
|
| 2515 | - */ |
|
| 2510 | + * Gets the aircraft route based on the aircraft callsign |
|
| 2511 | + * |
|
| 2512 | + * @param String $callsign the aircraft callsign |
|
| 2513 | + * @return Array aircraft type |
|
| 2514 | + * |
|
| 2515 | + */ |
|
| 2516 | 2516 | public function getRouteInfo($callsign) |
| 2517 | 2517 | { |
| 2518 | 2518 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
| 2519 | - if ($callsign == '') return array(); |
|
| 2519 | + if ($callsign == '') return array(); |
|
| 2520 | 2520 | $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
| 2521 | 2521 | |
| 2522 | 2522 | $sth = $this->db->prepare($query); |
@@ -2530,12 +2530,12 @@ discard block |
||
| 2530 | 2530 | } |
| 2531 | 2531 | |
| 2532 | 2532 | /** |
| 2533 | - * Gets the aircraft info based on the aircraft registration |
|
| 2534 | - * |
|
| 2535 | - * @param String $registration the aircraft registration |
|
| 2536 | - * @return Array aircraft information |
|
| 2537 | - * |
|
| 2538 | - */ |
|
| 2533 | + * Gets the aircraft info based on the aircraft registration |
|
| 2534 | + * |
|
| 2535 | + * @param String $registration the aircraft registration |
|
| 2536 | + * @return Array aircraft information |
|
| 2537 | + * |
|
| 2538 | + */ |
|
| 2539 | 2539 | public function getAircraftInfoByRegistration($registration) |
| 2540 | 2540 | { |
| 2541 | 2541 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2562,12 +2562,12 @@ discard block |
||
| 2562 | 2562 | } |
| 2563 | 2563 | |
| 2564 | 2564 | /** |
| 2565 | - * Gets the aircraft owner & base based on the aircraft registration |
|
| 2566 | - * |
|
| 2567 | - * @param String $registration the aircraft registration |
|
| 2568 | - * @return Array aircraft information |
|
| 2569 | - * |
|
| 2570 | - */ |
|
| 2565 | + * Gets the aircraft owner & base based on the aircraft registration |
|
| 2566 | + * |
|
| 2567 | + * @param String $registration the aircraft registration |
|
| 2568 | + * @return Array aircraft information |
|
| 2569 | + * |
|
| 2570 | + */ |
|
| 2571 | 2571 | public function getAircraftOwnerByRegistration($registration) |
| 2572 | 2572 | { |
| 2573 | 2573 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2584,11 +2584,11 @@ discard block |
||
| 2584 | 2584 | |
| 2585 | 2585 | |
| 2586 | 2586 | /** |
| 2587 | - * Gets all flights (but with only little info) |
|
| 2588 | - * |
|
| 2589 | - * @return Array basic flight information |
|
| 2590 | - * |
|
| 2591 | - */ |
|
| 2587 | + * Gets all flights (but with only little info) |
|
| 2588 | + * |
|
| 2589 | + * @return Array basic flight information |
|
| 2590 | + * |
|
| 2591 | + */ |
|
| 2592 | 2592 | public function getAllFlightsforSitemap() |
| 2593 | 2593 | { |
| 2594 | 2594 | //$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 "; |
@@ -2596,7 +2596,7 @@ discard block |
||
| 2596 | 2596 | |
| 2597 | 2597 | $sth = $this->db->prepare($query); |
| 2598 | 2598 | $sth->execute(); |
| 2599 | - /* |
|
| 2599 | + /* |
|
| 2600 | 2600 | $flight_array = array(); |
| 2601 | 2601 | $temp_array = array(); |
| 2602 | 2602 | |
@@ -2618,11 +2618,11 @@ discard block |
||
| 2618 | 2618 | } |
| 2619 | 2619 | |
| 2620 | 2620 | /** |
| 2621 | - * Gets a list of all aircraft manufacturers |
|
| 2622 | - * |
|
| 2623 | - * @return Array list of aircraft types |
|
| 2624 | - * |
|
| 2625 | - */ |
|
| 2621 | + * Gets a list of all aircraft manufacturers |
|
| 2622 | + * |
|
| 2623 | + * @return Array list of aircraft types |
|
| 2624 | + * |
|
| 2625 | + */ |
|
| 2626 | 2626 | public function getAllManufacturers() |
| 2627 | 2627 | { |
| 2628 | 2628 | /* |
@@ -2651,11 +2651,11 @@ discard block |
||
| 2651 | 2651 | |
| 2652 | 2652 | |
| 2653 | 2653 | /** |
| 2654 | - * Gets a list of all aircraft types |
|
| 2655 | - * |
|
| 2656 | - * @return Array list of aircraft types |
|
| 2657 | - * |
|
| 2658 | - */ |
|
| 2654 | + * Gets a list of all aircraft types |
|
| 2655 | + * |
|
| 2656 | + * @return Array list of aircraft types |
|
| 2657 | + * |
|
| 2658 | + */ |
|
| 2659 | 2659 | public function getAllAircraftTypes($filters = array()) |
| 2660 | 2660 | { |
| 2661 | 2661 | /* |
@@ -2690,11 +2690,11 @@ discard block |
||
| 2690 | 2690 | |
| 2691 | 2691 | |
| 2692 | 2692 | /** |
| 2693 | - * Gets a list of all aircraft registrations |
|
| 2694 | - * |
|
| 2695 | - * @return Array list of aircraft registrations |
|
| 2696 | - * |
|
| 2697 | - */ |
|
| 2693 | + * Gets a list of all aircraft registrations |
|
| 2694 | + * |
|
| 2695 | + * @return Array list of aircraft registrations |
|
| 2696 | + * |
|
| 2697 | + */ |
|
| 2698 | 2698 | public function getAllAircraftRegistrations($filters = array()) |
| 2699 | 2699 | { |
| 2700 | 2700 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2719,12 +2719,12 @@ discard block |
||
| 2719 | 2719 | } |
| 2720 | 2720 | |
| 2721 | 2721 | /** |
| 2722 | - * Gets all source name |
|
| 2723 | - * |
|
| 2724 | - * @param String type format of source |
|
| 2725 | - * @return Array list of source name |
|
| 2726 | - * |
|
| 2727 | - */ |
|
| 2722 | + * Gets all source name |
|
| 2723 | + * |
|
| 2724 | + * @param String type format of source |
|
| 2725 | + * @return Array list of source name |
|
| 2726 | + * |
|
| 2727 | + */ |
|
| 2728 | 2728 | public function getAllSourceName($type = '',$filters = array()) |
| 2729 | 2729 | { |
| 2730 | 2730 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2755,11 +2755,11 @@ discard block |
||
| 2755 | 2755 | |
| 2756 | 2756 | |
| 2757 | 2757 | /** |
| 2758 | - * Gets a list of all airline names |
|
| 2759 | - * |
|
| 2760 | - * @return Array list of airline names |
|
| 2761 | - * |
|
| 2762 | - */ |
|
| 2758 | + * Gets a list of all airline names |
|
| 2759 | + * |
|
| 2760 | + * @return Array list of airline names |
|
| 2761 | + * |
|
| 2762 | + */ |
|
| 2763 | 2763 | public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array()) |
| 2764 | 2764 | { |
| 2765 | 2765 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
@@ -2808,11 +2808,11 @@ discard block |
||
| 2808 | 2808 | } |
| 2809 | 2809 | |
| 2810 | 2810 | /** |
| 2811 | - * Gets a list of all alliance names |
|
| 2812 | - * |
|
| 2813 | - * @return Array list of alliance names |
|
| 2814 | - * |
|
| 2815 | - */ |
|
| 2811 | + * Gets a list of all alliance names |
|
| 2812 | + * |
|
| 2813 | + * @return Array list of alliance names |
|
| 2814 | + * |
|
| 2815 | + */ |
|
| 2816 | 2816 | public function getAllAllianceNames($forsource = NULL,$filters = array()) |
| 2817 | 2817 | { |
| 2818 | 2818 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
@@ -2837,11 +2837,11 @@ discard block |
||
| 2837 | 2837 | } |
| 2838 | 2838 | |
| 2839 | 2839 | /** |
| 2840 | - * Gets a list of all airline countries |
|
| 2841 | - * |
|
| 2842 | - * @return Array list of airline countries |
|
| 2843 | - * |
|
| 2844 | - */ |
|
| 2840 | + * Gets a list of all airline countries |
|
| 2841 | + * |
|
| 2842 | + * @return Array list of airline countries |
|
| 2843 | + * |
|
| 2844 | + */ |
|
| 2845 | 2845 | public function getAllAirlineCountries($filters = array()) |
| 2846 | 2846 | { |
| 2847 | 2847 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2869,11 +2869,11 @@ discard block |
||
| 2869 | 2869 | |
| 2870 | 2870 | |
| 2871 | 2871 | /** |
| 2872 | - * Gets a list of all departure & arrival names |
|
| 2873 | - * |
|
| 2874 | - * @return Array list of airport names |
|
| 2875 | - * |
|
| 2876 | - */ |
|
| 2872 | + * Gets a list of all departure & arrival names |
|
| 2873 | + * |
|
| 2874 | + * @return Array list of airport names |
|
| 2875 | + * |
|
| 2876 | + */ |
|
| 2877 | 2877 | public function getAllAirportNames($filters = array()) |
| 2878 | 2878 | { |
| 2879 | 2879 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2921,11 +2921,11 @@ discard block |
||
| 2921 | 2921 | } |
| 2922 | 2922 | |
| 2923 | 2923 | /** |
| 2924 | - * Gets a list of all owner names |
|
| 2925 | - * |
|
| 2926 | - * @return Array list of owner names |
|
| 2927 | - * |
|
| 2928 | - */ |
|
| 2924 | + * Gets a list of all owner names |
|
| 2925 | + * |
|
| 2926 | + * @return Array list of owner names |
|
| 2927 | + * |
|
| 2928 | + */ |
|
| 2929 | 2929 | public function getAllOwnerNames($filters = array()) |
| 2930 | 2930 | { |
| 2931 | 2931 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2939,11 +2939,11 @@ discard block |
||
| 2939 | 2939 | } |
| 2940 | 2940 | |
| 2941 | 2941 | /** |
| 2942 | - * Gets a list of all pilot names and pilot ids |
|
| 2943 | - * |
|
| 2944 | - * @return Array list of pilot names and pilot ids |
|
| 2945 | - * |
|
| 2946 | - */ |
|
| 2942 | + * Gets a list of all pilot names and pilot ids |
|
| 2943 | + * |
|
| 2944 | + * @return Array list of pilot names and pilot ids |
|
| 2945 | + * |
|
| 2946 | + */ |
|
| 2947 | 2947 | public function getAllPilotNames($filters = array()) |
| 2948 | 2948 | { |
| 2949 | 2949 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2958,11 +2958,11 @@ discard block |
||
| 2958 | 2958 | |
| 2959 | 2959 | |
| 2960 | 2960 | /** |
| 2961 | - * Gets a list of all departure & arrival airport countries |
|
| 2962 | - * |
|
| 2963 | - * @return Array list of airport countries |
|
| 2964 | - * |
|
| 2965 | - */ |
|
| 2961 | + * Gets a list of all departure & arrival airport countries |
|
| 2962 | + * |
|
| 2963 | + * @return Array list of airport countries |
|
| 2964 | + * |
|
| 2965 | + */ |
|
| 2966 | 2966 | public function getAllAirportCountries($filters = array()) |
| 2967 | 2967 | { |
| 2968 | 2968 | $airport_array = array(); |
@@ -3010,11 +3010,11 @@ discard block |
||
| 3010 | 3010 | |
| 3011 | 3011 | |
| 3012 | 3012 | /** |
| 3013 | - * Gets a list of all countries (airline, departure airport & arrival airport) |
|
| 3014 | - * |
|
| 3015 | - * @return Array list of countries |
|
| 3016 | - * |
|
| 3017 | - */ |
|
| 3013 | + * Gets a list of all countries (airline, departure airport & arrival airport) |
|
| 3014 | + * |
|
| 3015 | + * @return Array list of countries |
|
| 3016 | + * |
|
| 3017 | + */ |
|
| 3018 | 3018 | public function getAllCountries($filters = array()) |
| 3019 | 3019 | { |
| 3020 | 3020 | $Connection= new Connection($this->db); |
@@ -3091,11 +3091,11 @@ discard block |
||
| 3091 | 3091 | |
| 3092 | 3092 | |
| 3093 | 3093 | /** |
| 3094 | - * Gets a list of all idents/callsigns |
|
| 3095 | - * |
|
| 3096 | - * @return Array list of ident/callsign names |
|
| 3097 | - * |
|
| 3098 | - */ |
|
| 3094 | + * Gets a list of all idents/callsigns |
|
| 3095 | + * |
|
| 3096 | + * @return Array list of ident/callsign names |
|
| 3097 | + * |
|
| 3098 | + */ |
|
| 3099 | 3099 | public function getAllIdents($filters = array()) |
| 3100 | 3100 | { |
| 3101 | 3101 | $filter_query = $this->getFilter($filters,true,true); |
@@ -3119,9 +3119,9 @@ discard block |
||
| 3119 | 3119 | } |
| 3120 | 3120 | |
| 3121 | 3121 | /** |
| 3122 | - * Get a list of flights from airport since 7 days |
|
| 3123 | - * @return Array number, icao, name and city of airports |
|
| 3124 | - */ |
|
| 3122 | + * Get a list of flights from airport since 7 days |
|
| 3123 | + * @return Array number, icao, name and city of airports |
|
| 3124 | + */ |
|
| 3125 | 3125 | |
| 3126 | 3126 | public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) { |
| 3127 | 3127 | global $globalTimezone, $globalDBdriver; |
@@ -3152,9 +3152,9 @@ discard block |
||
| 3152 | 3152 | } |
| 3153 | 3153 | |
| 3154 | 3154 | /** |
| 3155 | - * Get a list of flights from airport since 7 days |
|
| 3156 | - * @return Array number, icao, name and city of airports |
|
| 3157 | - */ |
|
| 3155 | + * Get a list of flights from airport since 7 days |
|
| 3156 | + * @return Array number, icao, name and city of airports |
|
| 3157 | + */ |
|
| 3158 | 3158 | |
| 3159 | 3159 | public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') { |
| 3160 | 3160 | global $globalTimezone, $globalDBdriver; |
@@ -3184,9 +3184,9 @@ discard block |
||
| 3184 | 3184 | } |
| 3185 | 3185 | |
| 3186 | 3186 | /** |
| 3187 | - * Get a list of flights from detected airport since 7 days |
|
| 3188 | - * @return Array number, icao, name and city of airports |
|
| 3189 | - */ |
|
| 3187 | + * Get a list of flights from detected airport since 7 days |
|
| 3188 | + * @return Array number, icao, name and city of airports |
|
| 3189 | + */ |
|
| 3190 | 3190 | |
| 3191 | 3191 | public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) { |
| 3192 | 3192 | global $globalTimezone, $globalDBdriver; |
@@ -3224,9 +3224,9 @@ discard block |
||
| 3224 | 3224 | } |
| 3225 | 3225 | |
| 3226 | 3226 | /** |
| 3227 | - * Get a list of flights from detected airport since 7 days |
|
| 3228 | - * @return Array number, icao, name and city of airports |
|
| 3229 | - */ |
|
| 3227 | + * Get a list of flights from detected airport since 7 days |
|
| 3228 | + * @return Array number, icao, name and city of airports |
|
| 3229 | + */ |
|
| 3230 | 3230 | |
| 3231 | 3231 | public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') { |
| 3232 | 3232 | global $globalTimezone, $globalDBdriver; |
@@ -3268,9 +3268,9 @@ discard block |
||
| 3268 | 3268 | |
| 3269 | 3269 | |
| 3270 | 3270 | /** |
| 3271 | - * Get a list of flights to airport since 7 days |
|
| 3272 | - * @return Array number, icao, name and city of airports |
|
| 3273 | - */ |
|
| 3271 | + * Get a list of flights to airport since 7 days |
|
| 3272 | + * @return Array number, icao, name and city of airports |
|
| 3273 | + */ |
|
| 3274 | 3274 | |
| 3275 | 3275 | public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) { |
| 3276 | 3276 | global $globalTimezone, $globalDBdriver; |
@@ -3303,9 +3303,9 @@ discard block |
||
| 3303 | 3303 | |
| 3304 | 3304 | |
| 3305 | 3305 | /** |
| 3306 | - * Get a list of flights detected to airport since 7 days |
|
| 3307 | - * @return Array number, icao, name and city of airports |
|
| 3308 | - */ |
|
| 3306 | + * Get a list of flights detected to airport since 7 days |
|
| 3307 | + * @return Array number, icao, name and city of airports |
|
| 3308 | + */ |
|
| 3309 | 3309 | |
| 3310 | 3310 | public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) { |
| 3311 | 3311 | global $globalTimezone, $globalDBdriver; |
@@ -3346,9 +3346,9 @@ discard block |
||
| 3346 | 3346 | |
| 3347 | 3347 | |
| 3348 | 3348 | /** |
| 3349 | - * Get a list of flights to airport since 7 days |
|
| 3350 | - * @return Array number, icao, name and city of airports |
|
| 3351 | - */ |
|
| 3349 | + * Get a list of flights to airport since 7 days |
|
| 3350 | + * @return Array number, icao, name and city of airports |
|
| 3351 | + */ |
|
| 3352 | 3352 | |
| 3353 | 3353 | public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') { |
| 3354 | 3354 | global $globalTimezone, $globalDBdriver; |
@@ -3380,9 +3380,9 @@ discard block |
||
| 3380 | 3380 | |
| 3381 | 3381 | |
| 3382 | 3382 | /** |
| 3383 | - * Get a list of flights detected to airport since 7 days |
|
| 3384 | - * @return Array number, icao, name and city of airports |
|
| 3385 | - */ |
|
| 3383 | + * Get a list of flights detected to airport since 7 days |
|
| 3384 | + * @return Array number, icao, name and city of airports |
|
| 3385 | + */ |
|
| 3386 | 3386 | |
| 3387 | 3387 | public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') { |
| 3388 | 3388 | global $globalTimezone, $globalDBdriver; |
@@ -3426,11 +3426,11 @@ discard block |
||
| 3426 | 3426 | |
| 3427 | 3427 | |
| 3428 | 3428 | /** |
| 3429 | - * Gets a list of all dates |
|
| 3430 | - * |
|
| 3431 | - * @return Array list of date names |
|
| 3432 | - * |
|
| 3433 | - */ |
|
| 3429 | + * Gets a list of all dates |
|
| 3430 | + * |
|
| 3431 | + * @return Array list of date names |
|
| 3432 | + * |
|
| 3433 | + */ |
|
| 3434 | 3434 | public function getAllDates() |
| 3435 | 3435 | { |
| 3436 | 3436 | global $globalTimezone, $globalDBdriver; |
@@ -3471,11 +3471,11 @@ discard block |
||
| 3471 | 3471 | |
| 3472 | 3472 | |
| 3473 | 3473 | /** |
| 3474 | - * Gets all route combinations |
|
| 3475 | - * |
|
| 3476 | - * @return Array the route list |
|
| 3477 | - * |
|
| 3478 | - */ |
|
| 3474 | + * Gets all route combinations |
|
| 3475 | + * |
|
| 3476 | + * @return Array the route list |
|
| 3477 | + * |
|
| 3478 | + */ |
|
| 3479 | 3479 | public function getAllRoutes() |
| 3480 | 3480 | { |
| 3481 | 3481 | $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 |
@@ -3501,13 +3501,13 @@ discard block |
||
| 3501 | 3501 | } |
| 3502 | 3502 | |
| 3503 | 3503 | /** |
| 3504 | - * Update ident spotter data |
|
| 3505 | - * |
|
| 3506 | - * @param String $flightaware_id the ID from flightaware |
|
| 3507 | - * @param String $ident the flight ident |
|
| 3508 | - * @return String success or false |
|
| 3509 | - * |
|
| 3510 | - */ |
|
| 3504 | + * Update ident spotter data |
|
| 3505 | + * |
|
| 3506 | + * @param String $flightaware_id the ID from flightaware |
|
| 3507 | + * @param String $ident the flight ident |
|
| 3508 | + * @return String success or false |
|
| 3509 | + * |
|
| 3510 | + */ |
|
| 3511 | 3511 | public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL) |
| 3512 | 3512 | { |
| 3513 | 3513 | if (!is_numeric(substr($ident, 0, 3))) |
@@ -3528,14 +3528,14 @@ discard block |
||
| 3528 | 3528 | } else { |
| 3529 | 3529 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3530 | 3530 | } |
| 3531 | - $airline_name = $airline_array[0]['name']; |
|
| 3532 | - $airline_icao = $airline_array[0]['icao']; |
|
| 3533 | - $airline_country = $airline_array[0]['country']; |
|
| 3534 | - $airline_type = $airline_array[0]['type']; |
|
| 3531 | + $airline_name = $airline_array[0]['name']; |
|
| 3532 | + $airline_icao = $airline_array[0]['icao']; |
|
| 3533 | + $airline_country = $airline_array[0]['country']; |
|
| 3534 | + $airline_type = $airline_array[0]['type']; |
|
| 3535 | 3535 | |
| 3536 | 3536 | |
| 3537 | 3537 | $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'; |
| 3538 | - $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); |
|
| 3538 | + $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); |
|
| 3539 | 3539 | |
| 3540 | 3540 | try { |
| 3541 | 3541 | $sth = $this->db->prepare($query); |
@@ -3548,19 +3548,19 @@ discard block |
||
| 3548 | 3548 | |
| 3549 | 3549 | } |
| 3550 | 3550 | /** |
| 3551 | - * Update latest spotter data |
|
| 3552 | - * |
|
| 3553 | - * @param String $flightaware_id the ID from flightaware |
|
| 3554 | - * @param String $ident the flight ident |
|
| 3555 | - * @param String $arrival_airport_icao the arrival airport |
|
| 3556 | - * @return String success or false |
|
| 3557 | - * |
|
| 3558 | - */ |
|
| 3551 | + * Update latest spotter data |
|
| 3552 | + * |
|
| 3553 | + * @param String $flightaware_id the ID from flightaware |
|
| 3554 | + * @param String $ident the flight ident |
|
| 3555 | + * @param String $arrival_airport_icao the arrival airport |
|
| 3556 | + * @return String success or false |
|
| 3557 | + * |
|
| 3558 | + */ |
|
| 3559 | 3559 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
| 3560 | 3560 | { |
| 3561 | 3561 | if ($groundspeed == '') $groundspeed = NULL; |
| 3562 | 3562 | $query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id'; |
| 3563 | - $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); |
|
| 3563 | + $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
| 3564 | 3564 | |
| 3565 | 3565 | try { |
| 3566 | 3566 | $sth = $this->db->prepare($query); |
@@ -3574,32 +3574,32 @@ discard block |
||
| 3574 | 3574 | } |
| 3575 | 3575 | |
| 3576 | 3576 | /** |
| 3577 | - * Adds a new spotter data |
|
| 3578 | - * |
|
| 3579 | - * @param String $flightaware_id the ID from flightaware |
|
| 3580 | - * @param String $ident the flight ident |
|
| 3581 | - * @param String $aircraft_icao the aircraft type |
|
| 3582 | - * @param String $departure_airport_icao the departure airport |
|
| 3583 | - * @param String $arrival_airport_icao the arrival airport |
|
| 3584 | - * @param String $latitude latitude of flight |
|
| 3585 | - * @param String $longitude latitude of flight |
|
| 3586 | - * @param String $waypoints waypoints of flight |
|
| 3587 | - * @param String $altitude altitude of flight |
|
| 3588 | - * @param String $heading heading of flight |
|
| 3589 | - * @param String $groundspeed speed of flight |
|
| 3590 | - * @param String $date date of flight |
|
| 3591 | - * @param String $departure_airport_time departure time of flight |
|
| 3592 | - * @param String $arrival_airport_time arrival time of flight |
|
| 3593 | - * @param String $squawk squawk code of flight |
|
| 3594 | - * @param String $route_stop route stop of flight |
|
| 3595 | - * @param String $highlight highlight or not |
|
| 3596 | - * @param String $ModeS ModesS code of flight |
|
| 3597 | - * @param String $registration registration code of flight |
|
| 3598 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 3599 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 3600 | - * @param String $verticalrate vertival rate of flight |
|
| 3601 | - * @return String success or false |
|
| 3602 | - */ |
|
| 3577 | + * Adds a new spotter data |
|
| 3578 | + * |
|
| 3579 | + * @param String $flightaware_id the ID from flightaware |
|
| 3580 | + * @param String $ident the flight ident |
|
| 3581 | + * @param String $aircraft_icao the aircraft type |
|
| 3582 | + * @param String $departure_airport_icao the departure airport |
|
| 3583 | + * @param String $arrival_airport_icao the arrival airport |
|
| 3584 | + * @param String $latitude latitude of flight |
|
| 3585 | + * @param String $longitude latitude of flight |
|
| 3586 | + * @param String $waypoints waypoints of flight |
|
| 3587 | + * @param String $altitude altitude of flight |
|
| 3588 | + * @param String $heading heading of flight |
|
| 3589 | + * @param String $groundspeed speed of flight |
|
| 3590 | + * @param String $date date of flight |
|
| 3591 | + * @param String $departure_airport_time departure time of flight |
|
| 3592 | + * @param String $arrival_airport_time arrival time of flight |
|
| 3593 | + * @param String $squawk squawk code of flight |
|
| 3594 | + * @param String $route_stop route stop of flight |
|
| 3595 | + * @param String $highlight highlight or not |
|
| 3596 | + * @param String $ModeS ModesS code of flight |
|
| 3597 | + * @param String $registration registration code of flight |
|
| 3598 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 3599 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 3600 | + * @param String $verticalrate vertival rate of flight |
|
| 3601 | + * @return String success or false |
|
| 3602 | + */ |
|
| 3603 | 3603 | public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$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 = '',$source_type = '') |
| 3604 | 3604 | { |
| 3605 | 3605 | global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM; |
@@ -3814,8 +3814,8 @@ discard block |
||
| 3814 | 3814 | |
| 3815 | 3815 | if ($globalIVAO && $aircraft_icao != '') |
| 3816 | 3816 | { |
| 3817 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3818 | - else $airline_icao = ''; |
|
| 3817 | + if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3818 | + else $airline_icao = ''; |
|
| 3819 | 3819 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
| 3820 | 3820 | if (!isset($image_array[0]['registration'])) |
| 3821 | 3821 | { |
@@ -3846,53 +3846,53 @@ discard block |
||
| 3846 | 3846 | |
| 3847 | 3847 | if (count($airline_array) == 0) |
| 3848 | 3848 | { |
| 3849 | - $airline_array = $this->getAllAirlineInfo('NA'); |
|
| 3850 | - } |
|
| 3851 | - if (count($aircraft_array) == 0) |
|
| 3852 | - { |
|
| 3853 | - $aircraft_array = $this->getAllAircraftInfo('NA'); |
|
| 3854 | - } |
|
| 3855 | - if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') |
|
| 3856 | - { |
|
| 3857 | - $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3858 | - } |
|
| 3859 | - if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') |
|
| 3860 | - { |
|
| 3861 | - $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3862 | - } |
|
| 3863 | - if ($registration == '') $registration = 'NA'; |
|
| 3864 | - if ($latitude == '' && $longitude == '') { |
|
| 3865 | - $latitude = 0; |
|
| 3866 | - $longitude = 0; |
|
| 3867 | - } |
|
| 3868 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3869 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3870 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3871 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3872 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 3873 | - $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) |
|
| 3849 | + $airline_array = $this->getAllAirlineInfo('NA'); |
|
| 3850 | + } |
|
| 3851 | + if (count($aircraft_array) == 0) |
|
| 3852 | + { |
|
| 3853 | + $aircraft_array = $this->getAllAircraftInfo('NA'); |
|
| 3854 | + } |
|
| 3855 | + if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') |
|
| 3856 | + { |
|
| 3857 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3858 | + } |
|
| 3859 | + if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') |
|
| 3860 | + { |
|
| 3861 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3862 | + } |
|
| 3863 | + if ($registration == '') $registration = 'NA'; |
|
| 3864 | + if ($latitude == '' && $longitude == '') { |
|
| 3865 | + $latitude = 0; |
|
| 3866 | + $longitude = 0; |
|
| 3867 | + } |
|
| 3868 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3869 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3870 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3871 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3872 | + if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 3873 | + $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
| 3874 | 3874 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)"; |
| 3875 | 3875 | |
| 3876 | - $airline_name = $airline_array[0]['name']; |
|
| 3877 | - $airline_icao = $airline_array[0]['icao']; |
|
| 3878 | - $airline_country = $airline_array[0]['country']; |
|
| 3879 | - $airline_type = $airline_array[0]['type']; |
|
| 3876 | + $airline_name = $airline_array[0]['name']; |
|
| 3877 | + $airline_icao = $airline_array[0]['icao']; |
|
| 3878 | + $airline_country = $airline_array[0]['country']; |
|
| 3879 | + $airline_type = $airline_array[0]['type']; |
|
| 3880 | 3880 | if ($airline_type == '') { |
| 3881 | 3881 | $timeelapsed = microtime(true); |
| 3882 | 3882 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3883 | 3883 | if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 3884 | 3884 | } |
| 3885 | 3885 | if ($airline_type == null) $airline_type = ''; |
| 3886 | - $aircraft_type = $aircraft_array[0]['type']; |
|
| 3887 | - $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
|
| 3888 | - $departure_airport_name = $departure_airport_array[0]['name']; |
|
| 3889 | - $departure_airport_city = $departure_airport_array[0]['city']; |
|
| 3890 | - $departure_airport_country = $departure_airport_array[0]['country']; |
|
| 3886 | + $aircraft_type = $aircraft_array[0]['type']; |
|
| 3887 | + $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
|
| 3888 | + $departure_airport_name = $departure_airport_array[0]['name']; |
|
| 3889 | + $departure_airport_city = $departure_airport_array[0]['city']; |
|
| 3890 | + $departure_airport_country = $departure_airport_array[0]['country']; |
|
| 3891 | 3891 | |
| 3892 | - $arrival_airport_name = $arrival_airport_array[0]['name']; |
|
| 3893 | - $arrival_airport_city = $arrival_airport_array[0]['city']; |
|
| 3894 | - $arrival_airport_country = $arrival_airport_array[0]['country']; |
|
| 3895 | - $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); |
|
| 3892 | + $arrival_airport_name = $arrival_airport_array[0]['name']; |
|
| 3893 | + $arrival_airport_city = $arrival_airport_array[0]['city']; |
|
| 3894 | + $arrival_airport_country = $arrival_airport_array[0]['country']; |
|
| 3895 | + $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); |
|
| 3896 | 3896 | |
| 3897 | 3897 | try { |
| 3898 | 3898 | |
@@ -3900,7 +3900,7 @@ discard block |
||
| 3900 | 3900 | $sth->execute($query_values); |
| 3901 | 3901 | $this->db = null; |
| 3902 | 3902 | } catch (PDOException $e) { |
| 3903 | - return "error : ".$e->getMessage(); |
|
| 3903 | + return "error : ".$e->getMessage(); |
|
| 3904 | 3904 | } |
| 3905 | 3905 | |
| 3906 | 3906 | return "success"; |
@@ -3909,11 +3909,11 @@ discard block |
||
| 3909 | 3909 | |
| 3910 | 3910 | |
| 3911 | 3911 | /** |
| 3912 | - * Gets the aircraft ident within the last hour |
|
| 3913 | - * |
|
| 3914 | - * @return String the ident |
|
| 3915 | - * |
|
| 3916 | - */ |
|
| 3912 | + * Gets the aircraft ident within the last hour |
|
| 3913 | + * |
|
| 3914 | + * @return String the ident |
|
| 3915 | + * |
|
| 3916 | + */ |
|
| 3917 | 3917 | public function getIdentFromLastHour($ident) |
| 3918 | 3918 | { |
| 3919 | 3919 | global $globalDBdriver, $globalTimezone; |
@@ -3929,11 +3929,11 @@ discard block |
||
| 3929 | 3929 | AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 3930 | 3930 | AND spotter_output.date < now() AT TIME ZONE 'UTC'"; |
| 3931 | 3931 | $query_data = array(':ident' => $ident); |
| 3932 | - } |
|
| 3932 | + } |
|
| 3933 | 3933 | |
| 3934 | 3934 | $sth = $this->db->prepare($query); |
| 3935 | 3935 | $sth->execute($query_data); |
| 3936 | - $ident_result=''; |
|
| 3936 | + $ident_result=''; |
|
| 3937 | 3937 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 3938 | 3938 | { |
| 3939 | 3939 | $ident_result = $row['ident']; |
@@ -3944,11 +3944,11 @@ discard block |
||
| 3944 | 3944 | |
| 3945 | 3945 | |
| 3946 | 3946 | /** |
| 3947 | - * Gets the aircraft data from the last 20 seconds |
|
| 3948 | - * |
|
| 3949 | - * @return Array the spotter data |
|
| 3950 | - * |
|
| 3951 | - */ |
|
| 3947 | + * Gets the aircraft data from the last 20 seconds |
|
| 3948 | + * |
|
| 3949 | + * @return Array the spotter data |
|
| 3950 | + * |
|
| 3951 | + */ |
|
| 3952 | 3952 | public function getRealTimeData($q = '') |
| 3953 | 3953 | { |
| 3954 | 3954 | global $globalDBdriver; |
@@ -3992,11 +3992,11 @@ discard block |
||
| 3992 | 3992 | |
| 3993 | 3993 | |
| 3994 | 3994 | /** |
| 3995 | - * Gets all airlines that have flown over |
|
| 3996 | - * |
|
| 3997 | - * @return Array the airline list |
|
| 3998 | - * |
|
| 3999 | - */ |
|
| 3995 | + * Gets all airlines that have flown over |
|
| 3996 | + * |
|
| 3997 | + * @return Array the airline list |
|
| 3998 | + * |
|
| 3999 | + */ |
|
| 4000 | 4000 | public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '') |
| 4001 | 4001 | { |
| 4002 | 4002 | global $globalDBdriver; |
@@ -4010,7 +4010,7 @@ discard block |
||
| 4010 | 4010 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 4011 | 4011 | } |
| 4012 | 4012 | } |
| 4013 | - if ($sincedate != '') { |
|
| 4013 | + if ($sincedate != '') { |
|
| 4014 | 4014 | if ($globalDBdriver == 'mysql') { |
| 4015 | 4015 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 4016 | 4016 | } else { |
@@ -4064,26 +4064,26 @@ discard block |
||
| 4064 | 4064 | } |
| 4065 | 4065 | |
| 4066 | 4066 | /** |
| 4067 | - * Gets all pilots that have flown over |
|
| 4068 | - * |
|
| 4069 | - * @return Array the pilots list |
|
| 4070 | - * |
|
| 4071 | - */ |
|
| 4067 | + * Gets all pilots that have flown over |
|
| 4068 | + * |
|
| 4069 | + * @return Array the pilots list |
|
| 4070 | + * |
|
| 4071 | + */ |
|
| 4072 | 4072 | public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '') |
| 4073 | 4073 | { |
| 4074 | 4074 | global $globalDBdriver; |
| 4075 | 4075 | $filter_query = $this->getFilter($filters,true,true); |
| 4076 | 4076 | $query = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
| 4077 | 4077 | FROM spotter_output LEFT JOIN (SELECT DISTINCT pilot_id, pilot_name, max(date) as date FROM spotter_output GROUP BY pilot_id, pilot_name) s ON s.pilot_id = spotter_output.pilot_id".$filter_query." spotter_output.pilot_id <> ''"; |
| 4078 | - if ($olderthanmonths > 0) { |
|
| 4079 | - if ($globalDBdriver == 'mysql') { |
|
| 4078 | + if ($olderthanmonths > 0) { |
|
| 4079 | + if ($globalDBdriver == 'mysql') { |
|
| 4080 | 4080 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 4081 | 4081 | } else { |
| 4082 | 4082 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 4083 | 4083 | } |
| 4084 | 4084 | } |
| 4085 | - if ($sincedate != '') { |
|
| 4086 | - if ($globalDBdriver == 'mysql') { |
|
| 4085 | + if ($sincedate != '') { |
|
| 4086 | + if ($globalDBdriver == 'mysql') { |
|
| 4087 | 4087 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 4088 | 4088 | } else { |
| 4089 | 4089 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4138,25 +4138,25 @@ discard block |
||
| 4138 | 4138 | } |
| 4139 | 4139 | |
| 4140 | 4140 | /** |
| 4141 | - * Gets all pilots that have flown over |
|
| 4142 | - * |
|
| 4143 | - * @return Array the pilots list |
|
| 4144 | - * |
|
| 4145 | - */ |
|
| 4141 | + * Gets all pilots that have flown over |
|
| 4142 | + * |
|
| 4143 | + * @return Array the pilots list |
|
| 4144 | + * |
|
| 4145 | + */ |
|
| 4146 | 4146 | public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
| 4147 | 4147 | { |
| 4148 | 4148 | global $globalDBdriver; |
| 4149 | 4149 | $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 |
| 4150 | 4150 | FROM spotter_output WHERE spotter_output.pilot_id <> '' "; |
| 4151 | - if ($olderthanmonths > 0) { |
|
| 4152 | - if ($globalDBdriver == 'mysql') { |
|
| 4151 | + if ($olderthanmonths > 0) { |
|
| 4152 | + if ($globalDBdriver == 'mysql') { |
|
| 4153 | 4153 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 4154 | 4154 | } else { |
| 4155 | 4155 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 4156 | 4156 | } |
| 4157 | 4157 | } |
| 4158 | - if ($sincedate != '') { |
|
| 4159 | - if ($globalDBdriver == 'mysql') { |
|
| 4158 | + if ($sincedate != '') { |
|
| 4159 | + if ($globalDBdriver == 'mysql') { |
|
| 4160 | 4160 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 4161 | 4161 | } else { |
| 4162 | 4162 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4185,26 +4185,26 @@ discard block |
||
| 4185 | 4185 | } |
| 4186 | 4186 | |
| 4187 | 4187 | /** |
| 4188 | - * Gets all owner that have flown over |
|
| 4189 | - * |
|
| 4190 | - * @return Array the pilots list |
|
| 4191 | - * |
|
| 4192 | - */ |
|
| 4188 | + * Gets all owner that have flown over |
|
| 4189 | + * |
|
| 4190 | + * @return Array the pilots list |
|
| 4191 | + * |
|
| 4192 | + */ |
|
| 4193 | 4193 | public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 4194 | 4194 | { |
| 4195 | 4195 | global $globalDBdriver; |
| 4196 | 4196 | $filter_query = $this->getFilter($filters,true,true); |
| 4197 | 4197 | $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
| 4198 | 4198 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL"; |
| 4199 | - if ($olderthanmonths > 0) { |
|
| 4200 | - if ($globalDBdriver == 'mysql') { |
|
| 4199 | + if ($olderthanmonths > 0) { |
|
| 4200 | + if ($globalDBdriver == 'mysql') { |
|
| 4201 | 4201 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 4202 | 4202 | } else { |
| 4203 | 4203 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 4204 | 4204 | } |
| 4205 | 4205 | } |
| 4206 | - if ($sincedate != '') { |
|
| 4207 | - if ($globalDBdriver == 'mysql') { |
|
| 4206 | + if ($sincedate != '') { |
|
| 4207 | + if ($globalDBdriver == 'mysql') { |
|
| 4208 | 4208 | $query .= " AND spotter_output.date > '".$sincedate."' "; |
| 4209 | 4209 | } else { |
| 4210 | 4210 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4255,26 +4255,26 @@ discard block |
||
| 4255 | 4255 | } |
| 4256 | 4256 | |
| 4257 | 4257 | /** |
| 4258 | - * Gets all owner that have flown over |
|
| 4259 | - * |
|
| 4260 | - * @return Array the pilots list |
|
| 4261 | - * |
|
| 4262 | - */ |
|
| 4258 | + * Gets all owner that have flown over |
|
| 4259 | + * |
|
| 4260 | + * @return Array the pilots list |
|
| 4261 | + * |
|
| 4262 | + */ |
|
| 4263 | 4263 | public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 4264 | 4264 | { |
| 4265 | 4265 | global $globalDBdriver; |
| 4266 | 4266 | $filter_query = $this->getFilter($filters,true,true); |
| 4267 | 4267 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
| 4268 | 4268 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
| 4269 | - if ($olderthanmonths > 0) { |
|
| 4270 | - if ($globalDBdriver == 'mysql') { |
|
| 4269 | + if ($olderthanmonths > 0) { |
|
| 4270 | + if ($globalDBdriver == 'mysql') { |
|
| 4271 | 4271 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 4272 | 4272 | } else { |
| 4273 | 4273 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 4274 | 4274 | } |
| 4275 | 4275 | } |
| 4276 | - if ($sincedate != '') { |
|
| 4277 | - if ($globalDBdriver == 'mysql') { |
|
| 4276 | + if ($sincedate != '') { |
|
| 4277 | + if ($globalDBdriver == 'mysql') { |
|
| 4278 | 4278 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 4279 | 4279 | } else { |
| 4280 | 4280 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4301,11 +4301,11 @@ discard block |
||
| 4301 | 4301 | } |
| 4302 | 4302 | |
| 4303 | 4303 | /** |
| 4304 | - * Gets all airlines that have flown over by aircraft |
|
| 4305 | - * |
|
| 4306 | - * @return Array the airline list |
|
| 4307 | - * |
|
| 4308 | - */ |
|
| 4304 | + * Gets all airlines that have flown over by aircraft |
|
| 4305 | + * |
|
| 4306 | + * @return Array the airline list |
|
| 4307 | + * |
|
| 4308 | + */ |
|
| 4309 | 4309 | public function countAllAirlinesByAircraft($aircraft_icao,$filters = array()) |
| 4310 | 4310 | { |
| 4311 | 4311 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
@@ -4337,11 +4337,11 @@ discard block |
||
| 4337 | 4337 | |
| 4338 | 4338 | |
| 4339 | 4339 | /** |
| 4340 | - * Gets all airline countries that have flown over by aircraft |
|
| 4341 | - * |
|
| 4342 | - * @return Array the airline country list |
|
| 4343 | - * |
|
| 4344 | - */ |
|
| 4340 | + * Gets all airline countries that have flown over by aircraft |
|
| 4341 | + * |
|
| 4342 | + * @return Array the airline country list |
|
| 4343 | + * |
|
| 4344 | + */ |
|
| 4345 | 4345 | public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array()) |
| 4346 | 4346 | { |
| 4347 | 4347 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
@@ -4373,11 +4373,11 @@ discard block |
||
| 4373 | 4373 | |
| 4374 | 4374 | |
| 4375 | 4375 | /** |
| 4376 | - * Gets all airlines that have flown over by airport |
|
| 4377 | - * |
|
| 4378 | - * @return Array the airline list |
|
| 4379 | - * |
|
| 4380 | - */ |
|
| 4376 | + * Gets all airlines that have flown over by airport |
|
| 4377 | + * |
|
| 4378 | + * @return Array the airline list |
|
| 4379 | + * |
|
| 4380 | + */ |
|
| 4381 | 4381 | public function countAllAirlinesByAirport($airport_icao,$filters = array()) |
| 4382 | 4382 | { |
| 4383 | 4383 | $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
@@ -4408,11 +4408,11 @@ discard block |
||
| 4408 | 4408 | |
| 4409 | 4409 | |
| 4410 | 4410 | /** |
| 4411 | - * Gets all airline countries that have flown over by airport icao |
|
| 4412 | - * |
|
| 4413 | - * @return Array the airline country list |
|
| 4414 | - * |
|
| 4415 | - */ |
|
| 4411 | + * Gets all airline countries that have flown over by airport icao |
|
| 4412 | + * |
|
| 4413 | + * @return Array the airline country list |
|
| 4414 | + * |
|
| 4415 | + */ |
|
| 4416 | 4416 | public function countAllAirlineCountriesByAirport($airport_icao,$filters = array()) |
| 4417 | 4417 | { |
| 4418 | 4418 | $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
@@ -4442,11 +4442,11 @@ discard block |
||
| 4442 | 4442 | |
| 4443 | 4443 | |
| 4444 | 4444 | /** |
| 4445 | - * Gets all airlines that have flown over by aircraft manufacturer |
|
| 4446 | - * |
|
| 4447 | - * @return Array the airline list |
|
| 4448 | - * |
|
| 4449 | - */ |
|
| 4445 | + * Gets all airlines that have flown over by aircraft manufacturer |
|
| 4446 | + * |
|
| 4447 | + * @return Array the airline list |
|
| 4448 | + * |
|
| 4449 | + */ |
|
| 4450 | 4450 | public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 4451 | 4451 | { |
| 4452 | 4452 | $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
@@ -4477,11 +4477,11 @@ discard block |
||
| 4477 | 4477 | |
| 4478 | 4478 | |
| 4479 | 4479 | /** |
| 4480 | - * Gets all airline countries that have flown over by aircraft manufacturer |
|
| 4481 | - * |
|
| 4482 | - * @return Array the airline country list |
|
| 4483 | - * |
|
| 4484 | - */ |
|
| 4480 | + * Gets all airline countries that have flown over by aircraft manufacturer |
|
| 4481 | + * |
|
| 4482 | + * @return Array the airline country list |
|
| 4483 | + * |
|
| 4484 | + */ |
|
| 4485 | 4485 | public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 4486 | 4486 | { |
| 4487 | 4487 | $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
@@ -4510,11 +4510,11 @@ discard block |
||
| 4510 | 4510 | |
| 4511 | 4511 | |
| 4512 | 4512 | /** |
| 4513 | - * Gets all airlines that have flown over by date |
|
| 4514 | - * |
|
| 4515 | - * @return Array the airline list |
|
| 4516 | - * |
|
| 4517 | - */ |
|
| 4513 | + * Gets all airlines that have flown over by date |
|
| 4514 | + * |
|
| 4515 | + * @return Array the airline list |
|
| 4516 | + * |
|
| 4517 | + */ |
|
| 4518 | 4518 | public function countAllAirlinesByDate($date,$filters = array()) |
| 4519 | 4519 | { |
| 4520 | 4520 | global $globalTimezone, $globalDBdriver; |
@@ -4558,11 +4558,11 @@ discard block |
||
| 4558 | 4558 | |
| 4559 | 4559 | |
| 4560 | 4560 | /** |
| 4561 | - * Gets all airline countries that have flown over by date |
|
| 4562 | - * |
|
| 4563 | - * @return Array the airline country list |
|
| 4564 | - * |
|
| 4565 | - */ |
|
| 4561 | + * Gets all airline countries that have flown over by date |
|
| 4562 | + * |
|
| 4563 | + * @return Array the airline country list |
|
| 4564 | + * |
|
| 4565 | + */ |
|
| 4566 | 4566 | public function countAllAirlineCountriesByDate($date,$filters = array()) |
| 4567 | 4567 | { |
| 4568 | 4568 | global $globalTimezone, $globalDBdriver; |
@@ -4605,11 +4605,11 @@ discard block |
||
| 4605 | 4605 | |
| 4606 | 4606 | |
| 4607 | 4607 | /** |
| 4608 | - * Gets all airlines that have flown over by ident/callsign |
|
| 4609 | - * |
|
| 4610 | - * @return Array the airline list |
|
| 4611 | - * |
|
| 4612 | - */ |
|
| 4608 | + * Gets all airlines that have flown over by ident/callsign |
|
| 4609 | + * |
|
| 4610 | + * @return Array the airline list |
|
| 4611 | + * |
|
| 4612 | + */ |
|
| 4613 | 4613 | public function countAllAirlinesByIdent($ident,$filters = array()) |
| 4614 | 4614 | { |
| 4615 | 4615 | $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
@@ -4626,11 +4626,11 @@ discard block |
||
| 4626 | 4626 | } |
| 4627 | 4627 | |
| 4628 | 4628 | /** |
| 4629 | - * Gets all airlines by owner |
|
| 4630 | - * |
|
| 4631 | - * @return Array the airline list |
|
| 4632 | - * |
|
| 4633 | - */ |
|
| 4629 | + * Gets all airlines by owner |
|
| 4630 | + * |
|
| 4631 | + * @return Array the airline list |
|
| 4632 | + * |
|
| 4633 | + */ |
|
| 4634 | 4634 | public function countAllAirlinesByOwner($owner,$filters = array()) |
| 4635 | 4635 | { |
| 4636 | 4636 | $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
@@ -4647,11 +4647,11 @@ discard block |
||
| 4647 | 4647 | } |
| 4648 | 4648 | |
| 4649 | 4649 | /** |
| 4650 | - * Gets flight duration by owner |
|
| 4651 | - * |
|
| 4652 | - * @return String Duration of all flights |
|
| 4653 | - * |
|
| 4654 | - */ |
|
| 4650 | + * Gets flight duration by owner |
|
| 4651 | + * |
|
| 4652 | + * @return String Duration of all flights |
|
| 4653 | + * |
|
| 4654 | + */ |
|
| 4655 | 4655 | public function getFlightDurationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '') |
| 4656 | 4656 | { |
| 4657 | 4657 | global $globalDBdriver; |
@@ -4698,11 +4698,11 @@ discard block |
||
| 4698 | 4698 | } |
| 4699 | 4699 | |
| 4700 | 4700 | /** |
| 4701 | - * Count flights by owner |
|
| 4702 | - * |
|
| 4703 | - * @return String Duration of all flights |
|
| 4704 | - * |
|
| 4705 | - */ |
|
| 4701 | + * Count flights by owner |
|
| 4702 | + * |
|
| 4703 | + * @return String Duration of all flights |
|
| 4704 | + * |
|
| 4705 | + */ |
|
| 4706 | 4706 | public function countFlightsByOwner($owner,$filters = array()) |
| 4707 | 4707 | { |
| 4708 | 4708 | $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
@@ -4718,11 +4718,11 @@ discard block |
||
| 4718 | 4718 | } |
| 4719 | 4719 | |
| 4720 | 4720 | /** |
| 4721 | - * Count flights by pilot |
|
| 4722 | - * |
|
| 4723 | - * @return String Duration of all flights |
|
| 4724 | - * |
|
| 4725 | - */ |
|
| 4721 | + * Count flights by pilot |
|
| 4722 | + * |
|
| 4723 | + * @return String Duration of all flights |
|
| 4724 | + * |
|
| 4725 | + */ |
|
| 4726 | 4726 | public function countFlightsByPilot($pilot,$filters = array()) |
| 4727 | 4727 | { |
| 4728 | 4728 | $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
@@ -4738,11 +4738,11 @@ discard block |
||
| 4738 | 4738 | } |
| 4739 | 4739 | |
| 4740 | 4740 | /** |
| 4741 | - * Gets flight duration by pilot |
|
| 4742 | - * |
|
| 4743 | - * @return String Duration of all flights |
|
| 4744 | - * |
|
| 4745 | - */ |
|
| 4741 | + * Gets flight duration by pilot |
|
| 4742 | + * |
|
| 4743 | + * @return String Duration of all flights |
|
| 4744 | + * |
|
| 4745 | + */ |
|
| 4746 | 4746 | public function getFlightDurationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '') |
| 4747 | 4747 | { |
| 4748 | 4748 | global $globalDBdriver; |
@@ -4788,11 +4788,11 @@ discard block |
||
| 4788 | 4788 | } |
| 4789 | 4789 | |
| 4790 | 4790 | /** |
| 4791 | - * Gets all airlines used by pilot |
|
| 4792 | - * |
|
| 4793 | - * @return Array the airline list |
|
| 4794 | - * |
|
| 4795 | - */ |
|
| 4791 | + * Gets all airlines used by pilot |
|
| 4792 | + * |
|
| 4793 | + * @return Array the airline list |
|
| 4794 | + * |
|
| 4795 | + */ |
|
| 4796 | 4796 | public function countAllAirlinesByPilot($pilot,$filters = array()) |
| 4797 | 4797 | { |
| 4798 | 4798 | $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
@@ -4809,11 +4809,11 @@ discard block |
||
| 4809 | 4809 | } |
| 4810 | 4810 | |
| 4811 | 4811 | /** |
| 4812 | - * Gets all airlines that have flown over by route |
|
| 4813 | - * |
|
| 4814 | - * @return Array the airline list |
|
| 4815 | - * |
|
| 4816 | - */ |
|
| 4812 | + * Gets all airlines that have flown over by route |
|
| 4813 | + * |
|
| 4814 | + * @return Array the airline list |
|
| 4815 | + * |
|
| 4816 | + */ |
|
| 4817 | 4817 | public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 4818 | 4818 | { |
| 4819 | 4819 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4845,11 +4845,11 @@ discard block |
||
| 4845 | 4845 | } |
| 4846 | 4846 | |
| 4847 | 4847 | /** |
| 4848 | - * Gets all airline countries that have flown over by route |
|
| 4849 | - * |
|
| 4850 | - * @return Array the airline country list |
|
| 4851 | - * |
|
| 4852 | - */ |
|
| 4848 | + * Gets all airline countries that have flown over by route |
|
| 4849 | + * |
|
| 4850 | + * @return Array the airline country list |
|
| 4851 | + * |
|
| 4852 | + */ |
|
| 4853 | 4853 | public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array()) |
| 4854 | 4854 | { |
| 4855 | 4855 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4881,11 +4881,11 @@ discard block |
||
| 4881 | 4881 | |
| 4882 | 4882 | |
| 4883 | 4883 | /** |
| 4884 | - * Gets all airlines that have flown over by country |
|
| 4885 | - * |
|
| 4886 | - * @return Array the airline list |
|
| 4887 | - * |
|
| 4888 | - */ |
|
| 4884 | + * Gets all airlines that have flown over by country |
|
| 4885 | + * |
|
| 4886 | + * @return Array the airline list |
|
| 4887 | + * |
|
| 4888 | + */ |
|
| 4889 | 4889 | public function countAllAirlinesByCountry($country,$filters = array()) |
| 4890 | 4890 | { |
| 4891 | 4891 | $country = filter_var($country,FILTER_SANITIZE_STRING); |
@@ -4915,11 +4915,11 @@ discard block |
||
| 4915 | 4915 | |
| 4916 | 4916 | |
| 4917 | 4917 | /** |
| 4918 | - * Gets all airline countries that have flown over by country |
|
| 4919 | - * |
|
| 4920 | - * @return Array the airline country list |
|
| 4921 | - * |
|
| 4922 | - */ |
|
| 4918 | + * Gets all airline countries that have flown over by country |
|
| 4919 | + * |
|
| 4920 | + * @return Array the airline country list |
|
| 4921 | + * |
|
| 4922 | + */ |
|
| 4923 | 4923 | public function countAllAirlineCountriesByCountry($country,$filters = array()) |
| 4924 | 4924 | { |
| 4925 | 4925 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4948,11 +4948,11 @@ discard block |
||
| 4948 | 4948 | |
| 4949 | 4949 | |
| 4950 | 4950 | /** |
| 4951 | - * Gets all airlines countries |
|
| 4952 | - * |
|
| 4953 | - * @return Array the airline country list |
|
| 4954 | - * |
|
| 4955 | - */ |
|
| 4951 | + * Gets all airlines countries |
|
| 4952 | + * |
|
| 4953 | + * @return Array the airline country list |
|
| 4954 | + * |
|
| 4955 | + */ |
|
| 4956 | 4956 | public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '') |
| 4957 | 4957 | { |
| 4958 | 4958 | global $globalDBdriver; |
@@ -5008,11 +5008,11 @@ discard block |
||
| 5008 | 5008 | } |
| 5009 | 5009 | |
| 5010 | 5010 | /** |
| 5011 | - * Gets all number of flight over countries |
|
| 5012 | - * |
|
| 5013 | - * @return Array the airline country list |
|
| 5014 | - * |
|
| 5015 | - */ |
|
| 5011 | + * Gets all number of flight over countries |
|
| 5012 | + * |
|
| 5013 | + * @return Array the airline country list |
|
| 5014 | + * |
|
| 5015 | + */ |
|
| 5016 | 5016 | public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 5017 | 5017 | { |
| 5018 | 5018 | global $globalDBdriver; |
@@ -5034,15 +5034,15 @@ discard block |
||
| 5034 | 5034 | $SpotterLive = new SpotterLive(); |
| 5035 | 5035 | $filter_query = $SpotterLive->getFilter($filters,true,true); |
| 5036 | 5036 | $filter_query .= ' over_country IS NOT NULL'; |
| 5037 | - if ($olderthanmonths > 0) { |
|
| 5037 | + if ($olderthanmonths > 0) { |
|
| 5038 | 5038 | if ($globalDBdriver == 'mysql') { |
| 5039 | 5039 | $filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5040 | 5040 | } else { |
| 5041 | 5041 | $filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 5042 | 5042 | } |
| 5043 | 5043 | } |
| 5044 | - if ($sincedate != '') { |
|
| 5045 | - if ($globalDBdriver == 'mysql') { |
|
| 5044 | + if ($sincedate != '') { |
|
| 5045 | + if ($globalDBdriver == 'mysql') { |
|
| 5046 | 5046 | $filter_query .= " AND spotter_live.date > '".$sincedate."' "; |
| 5047 | 5047 | } else { |
| 5048 | 5048 | $filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -5072,11 +5072,11 @@ discard block |
||
| 5072 | 5072 | |
| 5073 | 5073 | |
| 5074 | 5074 | /** |
| 5075 | - * Gets all aircraft types that have flown over |
|
| 5076 | - * |
|
| 5077 | - * @return Array the aircraft list |
|
| 5078 | - * |
|
| 5079 | - */ |
|
| 5075 | + * Gets all aircraft types that have flown over |
|
| 5076 | + * |
|
| 5077 | + * @return Array the aircraft list |
|
| 5078 | + * |
|
| 5079 | + */ |
|
| 5080 | 5080 | public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 5081 | 5081 | { |
| 5082 | 5082 | global $globalDBdriver; |
@@ -5146,11 +5146,11 @@ discard block |
||
| 5146 | 5146 | } |
| 5147 | 5147 | |
| 5148 | 5148 | /** |
| 5149 | - * Gets all aircraft types that have flown over by airline |
|
| 5150 | - * |
|
| 5151 | - * @return Array the aircraft list |
|
| 5152 | - * |
|
| 5153 | - */ |
|
| 5149 | + * Gets all aircraft types that have flown over by airline |
|
| 5150 | + * |
|
| 5151 | + * @return Array the aircraft list |
|
| 5152 | + * |
|
| 5153 | + */ |
|
| 5154 | 5154 | public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '') |
| 5155 | 5155 | { |
| 5156 | 5156 | global $globalDBdriver; |
@@ -5221,11 +5221,11 @@ discard block |
||
| 5221 | 5221 | } |
| 5222 | 5222 | |
| 5223 | 5223 | /** |
| 5224 | - * Gets all aircraft types that have flown over by months |
|
| 5225 | - * |
|
| 5226 | - * @return Array the aircraft list |
|
| 5227 | - * |
|
| 5228 | - */ |
|
| 5224 | + * Gets all aircraft types that have flown over by months |
|
| 5225 | + * |
|
| 5226 | + * @return Array the aircraft list |
|
| 5227 | + * |
|
| 5228 | + */ |
|
| 5229 | 5229 | public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 5230 | 5230 | { |
| 5231 | 5231 | global $globalDBdriver; |
@@ -5269,11 +5269,11 @@ discard block |
||
| 5269 | 5269 | |
| 5270 | 5270 | |
| 5271 | 5271 | /** |
| 5272 | - * Gets all aircraft registration that have flown over by aircaft icao |
|
| 5273 | - * |
|
| 5274 | - * @return Array the aircraft list |
|
| 5275 | - * |
|
| 5276 | - */ |
|
| 5272 | + * Gets all aircraft registration that have flown over by aircaft icao |
|
| 5273 | + * |
|
| 5274 | + * @return Array the aircraft list |
|
| 5275 | + * |
|
| 5276 | + */ |
|
| 5277 | 5277 | public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array()) |
| 5278 | 5278 | { |
| 5279 | 5279 | $Image = new Image($this->db); |
@@ -5312,11 +5312,11 @@ discard block |
||
| 5312 | 5312 | |
| 5313 | 5313 | |
| 5314 | 5314 | /** |
| 5315 | - * Gets all aircraft types that have flown over by airline icao |
|
| 5316 | - * |
|
| 5317 | - * @return Array the aircraft list |
|
| 5318 | - * |
|
| 5319 | - */ |
|
| 5315 | + * Gets all aircraft types that have flown over by airline icao |
|
| 5316 | + * |
|
| 5317 | + * @return Array the aircraft list |
|
| 5318 | + * |
|
| 5319 | + */ |
|
| 5320 | 5320 | public function countAllAircraftTypesByAirline($airline_icao,$filters = array()) |
| 5321 | 5321 | { |
| 5322 | 5322 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5345,11 +5345,11 @@ discard block |
||
| 5345 | 5345 | |
| 5346 | 5346 | |
| 5347 | 5347 | /** |
| 5348 | - * Gets all aircraft registration that have flown over by airline icao |
|
| 5349 | - * |
|
| 5350 | - * @return Array the aircraft list |
|
| 5351 | - * |
|
| 5352 | - */ |
|
| 5348 | + * Gets all aircraft registration that have flown over by airline icao |
|
| 5349 | + * |
|
| 5350 | + * @return Array the aircraft list |
|
| 5351 | + * |
|
| 5352 | + */ |
|
| 5353 | 5353 | public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array()) |
| 5354 | 5354 | { |
| 5355 | 5355 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5387,11 +5387,11 @@ discard block |
||
| 5387 | 5387 | |
| 5388 | 5388 | |
| 5389 | 5389 | /** |
| 5390 | - * Gets all aircraft manufacturer that have flown over by airline icao |
|
| 5391 | - * |
|
| 5392 | - * @return Array the aircraft list |
|
| 5393 | - * |
|
| 5394 | - */ |
|
| 5390 | + * Gets all aircraft manufacturer that have flown over by airline icao |
|
| 5391 | + * |
|
| 5392 | + * @return Array the aircraft list |
|
| 5393 | + * |
|
| 5394 | + */ |
|
| 5395 | 5395 | public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array()) |
| 5396 | 5396 | { |
| 5397 | 5397 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5419,11 +5419,11 @@ discard block |
||
| 5419 | 5419 | |
| 5420 | 5420 | |
| 5421 | 5421 | /** |
| 5422 | - * Gets all aircraft types that have flown over by airline icao |
|
| 5423 | - * |
|
| 5424 | - * @return Array the aircraft list |
|
| 5425 | - * |
|
| 5426 | - */ |
|
| 5422 | + * Gets all aircraft types that have flown over by airline icao |
|
| 5423 | + * |
|
| 5424 | + * @return Array the aircraft list |
|
| 5425 | + * |
|
| 5426 | + */ |
|
| 5427 | 5427 | public function countAllAircraftTypesByAirport($airport_icao,$filters = array()) |
| 5428 | 5428 | { |
| 5429 | 5429 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5452,11 +5452,11 @@ discard block |
||
| 5452 | 5452 | |
| 5453 | 5453 | |
| 5454 | 5454 | /** |
| 5455 | - * Gets all aircraft registration that have flown over by airport icao |
|
| 5456 | - * |
|
| 5457 | - * @return Array the aircraft list |
|
| 5458 | - * |
|
| 5459 | - */ |
|
| 5455 | + * Gets all aircraft registration that have flown over by airport icao |
|
| 5456 | + * |
|
| 5457 | + * @return Array the aircraft list |
|
| 5458 | + * |
|
| 5459 | + */ |
|
| 5460 | 5460 | public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array()) |
| 5461 | 5461 | { |
| 5462 | 5462 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5493,11 +5493,11 @@ discard block |
||
| 5493 | 5493 | |
| 5494 | 5494 | |
| 5495 | 5495 | /** |
| 5496 | - * Gets all aircraft manufacturer that have flown over by airport icao |
|
| 5497 | - * |
|
| 5498 | - * @return Array the aircraft list |
|
| 5499 | - * |
|
| 5500 | - */ |
|
| 5496 | + * Gets all aircraft manufacturer that have flown over by airport icao |
|
| 5497 | + * |
|
| 5498 | + * @return Array the aircraft list |
|
| 5499 | + * |
|
| 5500 | + */ |
|
| 5501 | 5501 | public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array()) |
| 5502 | 5502 | { |
| 5503 | 5503 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5523,11 +5523,11 @@ discard block |
||
| 5523 | 5523 | } |
| 5524 | 5524 | |
| 5525 | 5525 | /** |
| 5526 | - * Gets all aircraft types that have flown over by aircraft manufacturer |
|
| 5527 | - * |
|
| 5528 | - * @return Array the aircraft list |
|
| 5529 | - * |
|
| 5530 | - */ |
|
| 5526 | + * Gets all aircraft types that have flown over by aircraft manufacturer |
|
| 5527 | + * |
|
| 5528 | + * @return Array the aircraft list |
|
| 5529 | + * |
|
| 5530 | + */ |
|
| 5531 | 5531 | public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 5532 | 5532 | { |
| 5533 | 5533 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5554,11 +5554,11 @@ discard block |
||
| 5554 | 5554 | |
| 5555 | 5555 | |
| 5556 | 5556 | /** |
| 5557 | - * Gets all aircraft registration that have flown over by aircaft manufacturer |
|
| 5558 | - * |
|
| 5559 | - * @return Array the aircraft list |
|
| 5560 | - * |
|
| 5561 | - */ |
|
| 5557 | + * Gets all aircraft registration that have flown over by aircaft manufacturer |
|
| 5558 | + * |
|
| 5559 | + * @return Array the aircraft list |
|
| 5560 | + * |
|
| 5561 | + */ |
|
| 5562 | 5562 | public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array()) |
| 5563 | 5563 | { |
| 5564 | 5564 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5594,11 +5594,11 @@ discard block |
||
| 5594 | 5594 | } |
| 5595 | 5595 | |
| 5596 | 5596 | /** |
| 5597 | - * Gets all aircraft types that have flown over by date |
|
| 5598 | - * |
|
| 5599 | - * @return Array the aircraft list |
|
| 5600 | - * |
|
| 5601 | - */ |
|
| 5597 | + * Gets all aircraft types that have flown over by date |
|
| 5598 | + * |
|
| 5599 | + * @return Array the aircraft list |
|
| 5600 | + * |
|
| 5601 | + */ |
|
| 5602 | 5602 | public function countAllAircraftTypesByDate($date,$filters = array()) |
| 5603 | 5603 | { |
| 5604 | 5604 | global $globalTimezone, $globalDBdriver; |
@@ -5640,11 +5640,11 @@ discard block |
||
| 5640 | 5640 | |
| 5641 | 5641 | |
| 5642 | 5642 | /** |
| 5643 | - * Gets all aircraft registration that have flown over by date |
|
| 5644 | - * |
|
| 5645 | - * @return Array the aircraft list |
|
| 5646 | - * |
|
| 5647 | - */ |
|
| 5643 | + * Gets all aircraft registration that have flown over by date |
|
| 5644 | + * |
|
| 5645 | + * @return Array the aircraft list |
|
| 5646 | + * |
|
| 5647 | + */ |
|
| 5648 | 5648 | public function countAllAircraftRegistrationByDate($date,$filters = array()) |
| 5649 | 5649 | { |
| 5650 | 5650 | global $globalTimezone, $globalDBdriver; |
@@ -5695,11 +5695,11 @@ discard block |
||
| 5695 | 5695 | |
| 5696 | 5696 | |
| 5697 | 5697 | /** |
| 5698 | - * Gets all aircraft manufacturer that have flown over by date |
|
| 5699 | - * |
|
| 5700 | - * @return Array the aircraft manufacturer list |
|
| 5701 | - * |
|
| 5702 | - */ |
|
| 5698 | + * Gets all aircraft manufacturer that have flown over by date |
|
| 5699 | + * |
|
| 5700 | + * @return Array the aircraft manufacturer list |
|
| 5701 | + * |
|
| 5702 | + */ |
|
| 5703 | 5703 | public function countAllAircraftManufacturerByDate($date,$filters = array()) |
| 5704 | 5704 | { |
| 5705 | 5705 | global $globalTimezone, $globalDBdriver; |
@@ -5741,11 +5741,11 @@ discard block |
||
| 5741 | 5741 | |
| 5742 | 5742 | |
| 5743 | 5743 | /** |
| 5744 | - * Gets all aircraft types that have flown over by ident/callsign |
|
| 5745 | - * |
|
| 5746 | - * @return Array the aircraft list |
|
| 5747 | - * |
|
| 5748 | - */ |
|
| 5744 | + * Gets all aircraft types that have flown over by ident/callsign |
|
| 5745 | + * |
|
| 5746 | + * @return Array the aircraft list |
|
| 5747 | + * |
|
| 5748 | + */ |
|
| 5749 | 5749 | public function countAllAircraftTypesByIdent($ident,$filters = array()) |
| 5750 | 5750 | { |
| 5751 | 5751 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5773,11 +5773,11 @@ discard block |
||
| 5773 | 5773 | } |
| 5774 | 5774 | |
| 5775 | 5775 | /** |
| 5776 | - * Gets all aircraft types that have flown over by pilot |
|
| 5777 | - * |
|
| 5778 | - * @return Array the aircraft list |
|
| 5779 | - * |
|
| 5780 | - */ |
|
| 5776 | + * Gets all aircraft types that have flown over by pilot |
|
| 5777 | + * |
|
| 5778 | + * @return Array the aircraft list |
|
| 5779 | + * |
|
| 5780 | + */ |
|
| 5781 | 5781 | public function countAllAircraftTypesByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '') |
| 5782 | 5782 | { |
| 5783 | 5783 | global $globalDBdriver; |
@@ -5823,11 +5823,11 @@ discard block |
||
| 5823 | 5823 | } |
| 5824 | 5824 | |
| 5825 | 5825 | /** |
| 5826 | - * Gets all aircraft types that have flown over by owner |
|
| 5827 | - * |
|
| 5828 | - * @return Array the aircraft list |
|
| 5829 | - * |
|
| 5830 | - */ |
|
| 5826 | + * Gets all aircraft types that have flown over by owner |
|
| 5827 | + * |
|
| 5828 | + * @return Array the aircraft list |
|
| 5829 | + * |
|
| 5830 | + */ |
|
| 5831 | 5831 | public function countAllAircraftTypesByOwner($owner,$filters = array(),$year = '',$month = '',$day = '') |
| 5832 | 5832 | { |
| 5833 | 5833 | global $globalDBdriver; |
@@ -5872,11 +5872,11 @@ discard block |
||
| 5872 | 5872 | } |
| 5873 | 5873 | |
| 5874 | 5874 | /** |
| 5875 | - * Gets all aircraft registration that have flown over by ident/callsign |
|
| 5876 | - * |
|
| 5877 | - * @return Array the aircraft list |
|
| 5878 | - * |
|
| 5879 | - */ |
|
| 5875 | + * Gets all aircraft registration that have flown over by ident/callsign |
|
| 5876 | + * |
|
| 5877 | + * @return Array the aircraft list |
|
| 5878 | + * |
|
| 5879 | + */ |
|
| 5880 | 5880 | public function countAllAircraftRegistrationByIdent($ident,$filters = array()) |
| 5881 | 5881 | { |
| 5882 | 5882 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5915,11 +5915,11 @@ discard block |
||
| 5915 | 5915 | } |
| 5916 | 5916 | |
| 5917 | 5917 | /** |
| 5918 | - * Gets all aircraft registration that have flown over by owner |
|
| 5919 | - * |
|
| 5920 | - * @return Array the aircraft list |
|
| 5921 | - * |
|
| 5922 | - */ |
|
| 5918 | + * Gets all aircraft registration that have flown over by owner |
|
| 5919 | + * |
|
| 5920 | + * @return Array the aircraft list |
|
| 5921 | + * |
|
| 5922 | + */ |
|
| 5923 | 5923 | public function countAllAircraftRegistrationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '') |
| 5924 | 5924 | { |
| 5925 | 5925 | global $globalDBdriver; |
@@ -5990,11 +5990,11 @@ discard block |
||
| 5990 | 5990 | } |
| 5991 | 5991 | |
| 5992 | 5992 | /** |
| 5993 | - * Gets all aircraft registration that have flown over by pilot |
|
| 5994 | - * |
|
| 5995 | - * @return Array the aircraft list |
|
| 5996 | - * |
|
| 5997 | - */ |
|
| 5993 | + * Gets all aircraft registration that have flown over by pilot |
|
| 5994 | + * |
|
| 5995 | + * @return Array the aircraft list |
|
| 5996 | + * |
|
| 5997 | + */ |
|
| 5998 | 5998 | public function countAllAircraftRegistrationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '') |
| 5999 | 5999 | { |
| 6000 | 6000 | global $globalDBdriver; |
@@ -6066,11 +6066,11 @@ discard block |
||
| 6066 | 6066 | |
| 6067 | 6067 | |
| 6068 | 6068 | /** |
| 6069 | - * Gets all aircraft manufacturer that have flown over by ident/callsign |
|
| 6070 | - * |
|
| 6071 | - * @return Array the aircraft manufacturer list |
|
| 6072 | - * |
|
| 6073 | - */ |
|
| 6069 | + * Gets all aircraft manufacturer that have flown over by ident/callsign |
|
| 6070 | + * |
|
| 6071 | + * @return Array the aircraft manufacturer list |
|
| 6072 | + * |
|
| 6073 | + */ |
|
| 6074 | 6074 | public function countAllAircraftManufacturerByIdent($ident,$filters = array()) |
| 6075 | 6075 | { |
| 6076 | 6076 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6095,11 +6095,11 @@ discard block |
||
| 6095 | 6095 | } |
| 6096 | 6096 | |
| 6097 | 6097 | /** |
| 6098 | - * Gets all aircraft manufacturer that have flown over by owner |
|
| 6099 | - * |
|
| 6100 | - * @return Array the aircraft manufacturer list |
|
| 6101 | - * |
|
| 6102 | - */ |
|
| 6098 | + * Gets all aircraft manufacturer that have flown over by owner |
|
| 6099 | + * |
|
| 6100 | + * @return Array the aircraft manufacturer list |
|
| 6101 | + * |
|
| 6102 | + */ |
|
| 6103 | 6103 | public function countAllAircraftManufacturerByOwner($owner,$filters = array(),$year = '',$month = '',$day = '') |
| 6104 | 6104 | { |
| 6105 | 6105 | global $globalDBdriver; |
@@ -6147,11 +6147,11 @@ discard block |
||
| 6147 | 6147 | } |
| 6148 | 6148 | |
| 6149 | 6149 | /** |
| 6150 | - * Gets all aircraft manufacturer that have flown over by pilot |
|
| 6151 | - * |
|
| 6152 | - * @return Array the aircraft manufacturer list |
|
| 6153 | - * |
|
| 6154 | - */ |
|
| 6150 | + * Gets all aircraft manufacturer that have flown over by pilot |
|
| 6151 | + * |
|
| 6152 | + * @return Array the aircraft manufacturer list |
|
| 6153 | + * |
|
| 6154 | + */ |
|
| 6155 | 6155 | public function countAllAircraftManufacturerByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '') |
| 6156 | 6156 | { |
| 6157 | 6157 | global $globalDBdriver; |
@@ -6200,11 +6200,11 @@ discard block |
||
| 6200 | 6200 | |
| 6201 | 6201 | |
| 6202 | 6202 | /** |
| 6203 | - * Gets all aircraft types that have flown over by route |
|
| 6204 | - * |
|
| 6205 | - * @return Array the aircraft list |
|
| 6206 | - * |
|
| 6207 | - */ |
|
| 6203 | + * Gets all aircraft types that have flown over by route |
|
| 6204 | + * |
|
| 6205 | + * @return Array the aircraft list |
|
| 6206 | + * |
|
| 6207 | + */ |
|
| 6208 | 6208 | public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 6209 | 6209 | { |
| 6210 | 6210 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6233,11 +6233,11 @@ discard block |
||
| 6233 | 6233 | } |
| 6234 | 6234 | |
| 6235 | 6235 | /** |
| 6236 | - * Gets all aircraft registration that have flown over by route |
|
| 6237 | - * |
|
| 6238 | - * @return Array the aircraft list |
|
| 6239 | - * |
|
| 6240 | - */ |
|
| 6236 | + * Gets all aircraft registration that have flown over by route |
|
| 6237 | + * |
|
| 6238 | + * @return Array the aircraft list |
|
| 6239 | + * |
|
| 6240 | + */ |
|
| 6241 | 6241 | public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 6242 | 6242 | { |
| 6243 | 6243 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6279,11 +6279,11 @@ discard block |
||
| 6279 | 6279 | |
| 6280 | 6280 | |
| 6281 | 6281 | /** |
| 6282 | - * Gets all aircraft manufacturer that have flown over by route |
|
| 6283 | - * |
|
| 6284 | - * @return Array the aircraft manufacturer list |
|
| 6285 | - * |
|
| 6286 | - */ |
|
| 6282 | + * Gets all aircraft manufacturer that have flown over by route |
|
| 6283 | + * |
|
| 6284 | + * @return Array the aircraft manufacturer list |
|
| 6285 | + * |
|
| 6286 | + */ |
|
| 6287 | 6287 | public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 6288 | 6288 | { |
| 6289 | 6289 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6317,11 +6317,11 @@ discard block |
||
| 6317 | 6317 | |
| 6318 | 6318 | |
| 6319 | 6319 | /** |
| 6320 | - * Gets all aircraft types that have flown over by country |
|
| 6321 | - * |
|
| 6322 | - * @return Array the aircraft list |
|
| 6323 | - * |
|
| 6324 | - */ |
|
| 6320 | + * Gets all aircraft types that have flown over by country |
|
| 6321 | + * |
|
| 6322 | + * @return Array the aircraft list |
|
| 6323 | + * |
|
| 6324 | + */ |
|
| 6325 | 6325 | public function countAllAircraftTypesByCountry($country,$filters = array()) |
| 6326 | 6326 | { |
| 6327 | 6327 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6352,11 +6352,11 @@ discard block |
||
| 6352 | 6352 | |
| 6353 | 6353 | |
| 6354 | 6354 | /** |
| 6355 | - * Gets all aircraft registration that have flown over by country |
|
| 6356 | - * |
|
| 6357 | - * @return Array the aircraft list |
|
| 6358 | - * |
|
| 6359 | - */ |
|
| 6355 | + * Gets all aircraft registration that have flown over by country |
|
| 6356 | + * |
|
| 6357 | + * @return Array the aircraft list |
|
| 6358 | + * |
|
| 6359 | + */ |
|
| 6360 | 6360 | public function countAllAircraftRegistrationByCountry($country,$filters = array()) |
| 6361 | 6361 | { |
| 6362 | 6362 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6396,11 +6396,11 @@ discard block |
||
| 6396 | 6396 | |
| 6397 | 6397 | |
| 6398 | 6398 | /** |
| 6399 | - * Gets all aircraft manufacturer that have flown over by country |
|
| 6400 | - * |
|
| 6401 | - * @return Array the aircraft manufacturer list |
|
| 6402 | - * |
|
| 6403 | - */ |
|
| 6399 | + * Gets all aircraft manufacturer that have flown over by country |
|
| 6400 | + * |
|
| 6401 | + * @return Array the aircraft manufacturer list |
|
| 6402 | + * |
|
| 6403 | + */ |
|
| 6404 | 6404 | public function countAllAircraftManufacturerByCountry($country,$filters = array()) |
| 6405 | 6405 | { |
| 6406 | 6406 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6431,18 +6431,18 @@ discard block |
||
| 6431 | 6431 | |
| 6432 | 6432 | |
| 6433 | 6433 | /** |
| 6434 | - * Gets all aircraft manufacturers that have flown over |
|
| 6435 | - * |
|
| 6436 | - * @return Array the aircraft list |
|
| 6437 | - * |
|
| 6438 | - */ |
|
| 6434 | + * Gets all aircraft manufacturers that have flown over |
|
| 6435 | + * |
|
| 6436 | + * @return Array the aircraft list |
|
| 6437 | + * |
|
| 6438 | + */ |
|
| 6439 | 6439 | public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '') |
| 6440 | 6440 | { |
| 6441 | 6441 | global $globalDBdriver; |
| 6442 | 6442 | $filter_query = $this->getFilter($filters,true,true); |
| 6443 | 6443 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
| 6444 | 6444 | FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'"; |
| 6445 | - $query_values = array(); |
|
| 6445 | + $query_values = array(); |
|
| 6446 | 6446 | if ($year != '') { |
| 6447 | 6447 | if ($globalDBdriver == 'mysql') { |
| 6448 | 6448 | $query .= " AND YEAR(spotter_output.date) = :year"; |
@@ -6495,11 +6495,11 @@ discard block |
||
| 6495 | 6495 | |
| 6496 | 6496 | |
| 6497 | 6497 | /** |
| 6498 | - * Gets all aircraft registrations that have flown over |
|
| 6499 | - * |
|
| 6500 | - * @return Array the aircraft list |
|
| 6501 | - * |
|
| 6502 | - */ |
|
| 6498 | + * Gets all aircraft registrations that have flown over |
|
| 6499 | + * |
|
| 6500 | + * @return Array the aircraft list |
|
| 6501 | + * |
|
| 6502 | + */ |
|
| 6503 | 6503 | public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
| 6504 | 6504 | { |
| 6505 | 6505 | global $globalDBdriver; |
@@ -6507,15 +6507,15 @@ discard block |
||
| 6507 | 6507 | $filter_query = $this->getFilter($filters,true,true); |
| 6508 | 6508 | $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 |
| 6509 | 6509 | FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'"; |
| 6510 | - if ($olderthanmonths > 0) { |
|
| 6511 | - if ($globalDBdriver == 'mysql') { |
|
| 6510 | + if ($olderthanmonths > 0) { |
|
| 6511 | + if ($globalDBdriver == 'mysql') { |
|
| 6512 | 6512 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 6513 | 6513 | } else { |
| 6514 | 6514 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 6515 | 6515 | } |
| 6516 | 6516 | } |
| 6517 | - if ($sincedate != '') { |
|
| 6518 | - if ($globalDBdriver == 'mysql') { |
|
| 6517 | + if ($sincedate != '') { |
|
| 6518 | + if ($globalDBdriver == 'mysql') { |
|
| 6519 | 6519 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6520 | 6520 | } else { |
| 6521 | 6521 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -6580,11 +6580,11 @@ discard block |
||
| 6580 | 6580 | |
| 6581 | 6581 | |
| 6582 | 6582 | /** |
| 6583 | - * Gets all aircraft registrations that have flown over |
|
| 6584 | - * |
|
| 6585 | - * @return Array the aircraft list |
|
| 6586 | - * |
|
| 6587 | - */ |
|
| 6583 | + * Gets all aircraft registrations that have flown over |
|
| 6584 | + * |
|
| 6585 | + * @return Array the aircraft list |
|
| 6586 | + * |
|
| 6587 | + */ |
|
| 6588 | 6588 | public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 6589 | 6589 | { |
| 6590 | 6590 | global $globalDBdriver; |
@@ -6592,15 +6592,15 @@ discard block |
||
| 6592 | 6592 | $Image = new Image($this->db); |
| 6593 | 6593 | $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 |
| 6594 | 6594 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' "; |
| 6595 | - if ($olderthanmonths > 0) { |
|
| 6596 | - if ($globalDBdriver == 'mysql') { |
|
| 6595 | + if ($olderthanmonths > 0) { |
|
| 6596 | + if ($globalDBdriver == 'mysql') { |
|
| 6597 | 6597 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6598 | 6598 | } else { |
| 6599 | 6599 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 6600 | 6600 | } |
| 6601 | 6601 | } |
| 6602 | - if ($sincedate != '') { |
|
| 6603 | - if ($globalDBdriver == 'mysql') { |
|
| 6602 | + if ($sincedate != '') { |
|
| 6603 | + if ($globalDBdriver == 'mysql') { |
|
| 6604 | 6604 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6605 | 6605 | } else { |
| 6606 | 6606 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -6609,7 +6609,7 @@ discard block |
||
| 6609 | 6609 | |
| 6610 | 6610 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6611 | 6611 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6612 | - $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"; |
|
| 6612 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
| 6613 | 6613 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6614 | 6614 | |
| 6615 | 6615 | $sth = $this->db->prepare($query); |
@@ -6641,26 +6641,26 @@ discard block |
||
| 6641 | 6641 | |
| 6642 | 6642 | |
| 6643 | 6643 | /** |
| 6644 | - * Gets all departure airports of the airplanes that have flown over |
|
| 6645 | - * |
|
| 6646 | - * @return Array the airport list |
|
| 6647 | - * |
|
| 6648 | - */ |
|
| 6644 | + * Gets all departure airports of the airplanes that have flown over |
|
| 6645 | + * |
|
| 6646 | + * @return Array the airport list |
|
| 6647 | + * |
|
| 6648 | + */ |
|
| 6649 | 6649 | public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 6650 | 6650 | { |
| 6651 | 6651 | global $globalDBdriver; |
| 6652 | 6652 | $filter_query = $this->getFilter($filters,true,true); |
| 6653 | 6653 | $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, airport.latitude, airport.longitude |
| 6654 | 6654 | FROM airport, spotter_output".$filter_query." airport.icao = spotter_output.departure_airport_icao AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''"; |
| 6655 | - if ($olderthanmonths > 0) { |
|
| 6656 | - if ($globalDBdriver == 'mysql') { |
|
| 6655 | + if ($olderthanmonths > 0) { |
|
| 6656 | + if ($globalDBdriver == 'mysql') { |
|
| 6657 | 6657 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 6658 | 6658 | } else { |
| 6659 | 6659 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 6660 | 6660 | } |
| 6661 | - } |
|
| 6662 | - if ($sincedate != '') { |
|
| 6663 | - if ($globalDBdriver == 'mysql') { |
|
| 6661 | + } |
|
| 6662 | + if ($sincedate != '') { |
|
| 6663 | + if ($globalDBdriver == 'mysql') { |
|
| 6664 | 6664 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6665 | 6665 | } else { |
| 6666 | 6666 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -6694,7 +6694,7 @@ discard block |
||
| 6694 | 6694 | $query_values = array_merge($query_values,array(':day' => $day)); |
| 6695 | 6695 | } |
| 6696 | 6696 | } |
| 6697 | - $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, airport.latitude, airport.longitude |
|
| 6697 | + $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, airport.latitude, airport.longitude |
|
| 6698 | 6698 | ORDER BY airport_departure_icao_count DESC"; |
| 6699 | 6699 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6700 | 6700 | |
@@ -6718,35 +6718,35 @@ discard block |
||
| 6718 | 6718 | } |
| 6719 | 6719 | |
| 6720 | 6720 | /** |
| 6721 | - * Gets all departure airports of the airplanes that have flown over |
|
| 6722 | - * |
|
| 6723 | - * @return Array the airport list |
|
| 6724 | - * |
|
| 6725 | - */ |
|
| 6721 | + * Gets all departure airports of the airplanes that have flown over |
|
| 6722 | + * |
|
| 6723 | + * @return Array the airport list |
|
| 6724 | + * |
|
| 6725 | + */ |
|
| 6726 | 6726 | public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 6727 | 6727 | { |
| 6728 | 6728 | global $globalDBdriver; |
| 6729 | 6729 | $filter_query = $this->getFilter($filters,true,true); |
| 6730 | 6730 | $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 |
| 6731 | 6731 | 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 <> '' "; |
| 6732 | - if ($olderthanmonths > 0) { |
|
| 6733 | - if ($globalDBdriver == 'mysql') { |
|
| 6732 | + if ($olderthanmonths > 0) { |
|
| 6733 | + if ($globalDBdriver == 'mysql') { |
|
| 6734 | 6734 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6735 | 6735 | } else { |
| 6736 | 6736 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 6737 | 6737 | } |
| 6738 | - } |
|
| 6739 | - if ($sincedate != '') { |
|
| 6740 | - if ($globalDBdriver == 'mysql') { |
|
| 6738 | + } |
|
| 6739 | + if ($sincedate != '') { |
|
| 6740 | + if ($globalDBdriver == 'mysql') { |
|
| 6741 | 6741 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6742 | 6742 | } else { |
| 6743 | 6743 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6744 | 6744 | } |
| 6745 | 6745 | } |
| 6746 | 6746 | |
| 6747 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6748 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6749 | - $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 |
|
| 6747 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6748 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6749 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6750 | 6750 | ORDER BY airport_departure_icao_count DESC"; |
| 6751 | 6751 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6752 | 6752 | |
@@ -6771,26 +6771,26 @@ discard block |
||
| 6771 | 6771 | } |
| 6772 | 6772 | |
| 6773 | 6773 | /** |
| 6774 | - * Gets all detected departure airports of the airplanes that have flown over |
|
| 6775 | - * |
|
| 6776 | - * @return Array the airport list |
|
| 6777 | - * |
|
| 6778 | - */ |
|
| 6774 | + * Gets all detected departure airports of the airplanes that have flown over |
|
| 6775 | + * |
|
| 6776 | + * @return Array the airport list |
|
| 6777 | + * |
|
| 6778 | + */ |
|
| 6779 | 6779 | public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 6780 | 6780 | { |
| 6781 | 6781 | global $globalDBdriver; |
| 6782 | 6782 | $filter_query = $this->getFilter($filters,true,true); |
| 6783 | 6783 | $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, airport.latitude as departure_airport_latitude, airport.longitude as departure_airport.longitude |
| 6784 | 6784 | 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"; |
| 6785 | - if ($olderthanmonths > 0) { |
|
| 6786 | - if ($globalDBdriver == 'mysql') { |
|
| 6785 | + if ($olderthanmonths > 0) { |
|
| 6786 | + if ($globalDBdriver == 'mysql') { |
|
| 6787 | 6787 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 6788 | 6788 | } else { |
| 6789 | 6789 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 6790 | 6790 | } |
| 6791 | - } |
|
| 6792 | - if ($sincedate != '') { |
|
| 6793 | - if ($globalDBdriver == 'mysql') { |
|
| 6791 | + } |
|
| 6792 | + if ($sincedate != '') { |
|
| 6793 | + if ($globalDBdriver == 'mysql') { |
|
| 6794 | 6794 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6795 | 6795 | } else { |
| 6796 | 6796 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -6824,10 +6824,10 @@ discard block |
||
| 6824 | 6824 | $query_values = array_merge($query_values,array(':day' => $day)); |
| 6825 | 6825 | } |
| 6826 | 6826 | } |
| 6827 | - $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude |
|
| 6827 | + $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude |
|
| 6828 | 6828 | ORDER BY airport_departure_icao_count DESC"; |
| 6829 | 6829 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6830 | - //echo $query; |
|
| 6830 | + //echo $query; |
|
| 6831 | 6831 | $sth = $this->db->prepare($query); |
| 6832 | 6832 | $sth->execute($query_values); |
| 6833 | 6833 | |
@@ -6850,35 +6850,35 @@ discard block |
||
| 6850 | 6850 | } |
| 6851 | 6851 | |
| 6852 | 6852 | /** |
| 6853 | - * Gets all detected departure airports of the airplanes that have flown over |
|
| 6854 | - * |
|
| 6855 | - * @return Array the airport list |
|
| 6856 | - * |
|
| 6857 | - */ |
|
| 6853 | + * Gets all detected departure airports of the airplanes that have flown over |
|
| 6854 | + * |
|
| 6855 | + * @return Array the airport list |
|
| 6856 | + * |
|
| 6857 | + */ |
|
| 6858 | 6858 | public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 6859 | 6859 | { |
| 6860 | 6860 | global $globalDBdriver; |
| 6861 | 6861 | $filter_query = $this->getFilter($filters,true,true); |
| 6862 | 6862 | $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 |
| 6863 | 6863 | 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 "; |
| 6864 | - if ($olderthanmonths > 0) { |
|
| 6865 | - if ($globalDBdriver == 'mysql') { |
|
| 6864 | + if ($olderthanmonths > 0) { |
|
| 6865 | + if ($globalDBdriver == 'mysql') { |
|
| 6866 | 6866 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6867 | 6867 | } else { |
| 6868 | 6868 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 6869 | 6869 | } |
| 6870 | - } |
|
| 6871 | - if ($sincedate != '') { |
|
| 6872 | - if ($globalDBdriver == 'mysql') { |
|
| 6870 | + } |
|
| 6871 | + if ($sincedate != '') { |
|
| 6872 | + if ($globalDBdriver == 'mysql') { |
|
| 6873 | 6873 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6874 | 6874 | } else { |
| 6875 | 6875 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
| 6876 | 6876 | } |
| 6877 | 6877 | } |
| 6878 | 6878 | |
| 6879 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6880 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6881 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 6879 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6880 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6881 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 6882 | 6882 | ORDER BY airport_departure_icao_count DESC"; |
| 6883 | 6883 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6884 | 6884 | |
@@ -6903,11 +6903,11 @@ discard block |
||
| 6903 | 6903 | } |
| 6904 | 6904 | |
| 6905 | 6905 | /** |
| 6906 | - * Gets all departure airports of the airplanes that have flown over based on an airline icao |
|
| 6907 | - * |
|
| 6908 | - * @return Array the airport list |
|
| 6909 | - * |
|
| 6910 | - */ |
|
| 6906 | + * Gets all departure airports of the airplanes that have flown over based on an airline icao |
|
| 6907 | + * |
|
| 6908 | + * @return Array the airport list |
|
| 6909 | + * |
|
| 6910 | + */ |
|
| 6911 | 6911 | public function countAllDepartureAirportsByAirline($airline_icao,$filters = array()) |
| 6912 | 6912 | { |
| 6913 | 6913 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6941,11 +6941,11 @@ discard block |
||
| 6941 | 6941 | |
| 6942 | 6942 | |
| 6943 | 6943 | /** |
| 6944 | - * Gets all departure airports by country of the airplanes that have flown over based on an airline icao |
|
| 6945 | - * |
|
| 6946 | - * @return Array the airport list |
|
| 6947 | - * |
|
| 6948 | - */ |
|
| 6944 | + * Gets all departure airports by country of the airplanes that have flown over based on an airline icao |
|
| 6945 | + * |
|
| 6946 | + * @return Array the airport list |
|
| 6947 | + * |
|
| 6948 | + */ |
|
| 6949 | 6949 | public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array()) |
| 6950 | 6950 | { |
| 6951 | 6951 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6976,11 +6976,11 @@ discard block |
||
| 6976 | 6976 | |
| 6977 | 6977 | |
| 6978 | 6978 | /** |
| 6979 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft icao |
|
| 6980 | - * |
|
| 6981 | - * @return Array the airport list |
|
| 6982 | - * |
|
| 6983 | - */ |
|
| 6979 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft icao |
|
| 6980 | + * |
|
| 6981 | + * @return Array the airport list |
|
| 6982 | + * |
|
| 6983 | + */ |
|
| 6984 | 6984 | public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array()) |
| 6985 | 6985 | { |
| 6986 | 6986 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7013,11 +7013,11 @@ discard block |
||
| 7013 | 7013 | |
| 7014 | 7014 | |
| 7015 | 7015 | /** |
| 7016 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 7017 | - * |
|
| 7018 | - * @return Array the airport list |
|
| 7019 | - * |
|
| 7020 | - */ |
|
| 7016 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 7017 | + * |
|
| 7018 | + * @return Array the airport list |
|
| 7019 | + * |
|
| 7020 | + */ |
|
| 7021 | 7021 | public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
| 7022 | 7022 | { |
| 7023 | 7023 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7047,11 +7047,11 @@ discard block |
||
| 7047 | 7047 | |
| 7048 | 7048 | |
| 7049 | 7049 | /** |
| 7050 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft registration |
|
| 7051 | - * |
|
| 7052 | - * @return Array the airport list |
|
| 7053 | - * |
|
| 7054 | - */ |
|
| 7050 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft registration |
|
| 7051 | + * |
|
| 7052 | + * @return Array the airport list |
|
| 7053 | + * |
|
| 7054 | + */ |
|
| 7055 | 7055 | public function countAllDepartureAirportsByRegistration($registration,$filters = array()) |
| 7056 | 7056 | { |
| 7057 | 7057 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7084,11 +7084,11 @@ discard block |
||
| 7084 | 7084 | |
| 7085 | 7085 | |
| 7086 | 7086 | /** |
| 7087 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 7088 | - * |
|
| 7089 | - * @return Array the airport list |
|
| 7090 | - * |
|
| 7091 | - */ |
|
| 7087 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 7088 | + * |
|
| 7089 | + * @return Array the airport list |
|
| 7090 | + * |
|
| 7091 | + */ |
|
| 7092 | 7092 | public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array()) |
| 7093 | 7093 | { |
| 7094 | 7094 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7118,11 +7118,11 @@ discard block |
||
| 7118 | 7118 | |
| 7119 | 7119 | |
| 7120 | 7120 | /** |
| 7121 | - * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao |
|
| 7122 | - * |
|
| 7123 | - * @return Array the airport list |
|
| 7124 | - * |
|
| 7125 | - */ |
|
| 7121 | + * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao |
|
| 7122 | + * |
|
| 7123 | + * @return Array the airport list |
|
| 7124 | + * |
|
| 7125 | + */ |
|
| 7126 | 7126 | public function countAllDepartureAirportsByAirport($airport_icao,$filters = array()) |
| 7127 | 7127 | { |
| 7128 | 7128 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7155,11 +7155,11 @@ discard block |
||
| 7155 | 7155 | |
| 7156 | 7156 | |
| 7157 | 7157 | /** |
| 7158 | - * Gets all departure airports by country of the airplanes that have flown over based on an airport icao |
|
| 7159 | - * |
|
| 7160 | - * @return Array the airport list |
|
| 7161 | - * |
|
| 7162 | - */ |
|
| 7158 | + * Gets all departure airports by country of the airplanes that have flown over based on an airport icao |
|
| 7159 | + * |
|
| 7160 | + * @return Array the airport list |
|
| 7161 | + * |
|
| 7162 | + */ |
|
| 7163 | 7163 | public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array()) |
| 7164 | 7164 | { |
| 7165 | 7165 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7190,11 +7190,11 @@ discard block |
||
| 7190 | 7190 | |
| 7191 | 7191 | |
| 7192 | 7192 | /** |
| 7193 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer |
|
| 7194 | - * |
|
| 7195 | - * @return Array the airport list |
|
| 7196 | - * |
|
| 7197 | - */ |
|
| 7193 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer |
|
| 7194 | + * |
|
| 7195 | + * @return Array the airport list |
|
| 7196 | + * |
|
| 7197 | + */ |
|
| 7198 | 7198 | public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
| 7199 | 7199 | { |
| 7200 | 7200 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7227,11 +7227,11 @@ discard block |
||
| 7227 | 7227 | |
| 7228 | 7228 | |
| 7229 | 7229 | /** |
| 7230 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer |
|
| 7231 | - * |
|
| 7232 | - * @return Array the airport list |
|
| 7233 | - * |
|
| 7234 | - */ |
|
| 7230 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer |
|
| 7231 | + * |
|
| 7232 | + * @return Array the airport list |
|
| 7233 | + * |
|
| 7234 | + */ |
|
| 7235 | 7235 | public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 7236 | 7236 | { |
| 7237 | 7237 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7261,11 +7261,11 @@ discard block |
||
| 7261 | 7261 | |
| 7262 | 7262 | |
| 7263 | 7263 | /** |
| 7264 | - * Gets all departure airports of the airplanes that have flown over based on a date |
|
| 7265 | - * |
|
| 7266 | - * @return Array the airport list |
|
| 7267 | - * |
|
| 7268 | - */ |
|
| 7264 | + * Gets all departure airports of the airplanes that have flown over based on a date |
|
| 7265 | + * |
|
| 7266 | + * @return Array the airport list |
|
| 7267 | + * |
|
| 7268 | + */ |
|
| 7269 | 7269 | public function countAllDepartureAirportsByDate($date,$filters = array()) |
| 7270 | 7270 | { |
| 7271 | 7271 | global $globalTimezone, $globalDBdriver; |
@@ -7311,11 +7311,11 @@ discard block |
||
| 7311 | 7311 | |
| 7312 | 7312 | |
| 7313 | 7313 | /** |
| 7314 | - * Gets all departure airports by country of the airplanes that have flown over based on a date |
|
| 7315 | - * |
|
| 7316 | - * @return Array the airport list |
|
| 7317 | - * |
|
| 7318 | - */ |
|
| 7314 | + * Gets all departure airports by country of the airplanes that have flown over based on a date |
|
| 7315 | + * |
|
| 7316 | + * @return Array the airport list |
|
| 7317 | + * |
|
| 7318 | + */ |
|
| 7319 | 7319 | public function countAllDepartureAirportCountriesByDate($date,$filters = array()) |
| 7320 | 7320 | { |
| 7321 | 7321 | global $globalTimezone, $globalDBdriver; |
@@ -7358,11 +7358,11 @@ discard block |
||
| 7358 | 7358 | |
| 7359 | 7359 | |
| 7360 | 7360 | /** |
| 7361 | - * Gets all departure airports of the airplanes that have flown over based on a ident/callsign |
|
| 7362 | - * |
|
| 7363 | - * @return Array the airport list |
|
| 7364 | - * |
|
| 7365 | - */ |
|
| 7361 | + * Gets all departure airports of the airplanes that have flown over based on a ident/callsign |
|
| 7362 | + * |
|
| 7363 | + * @return Array the airport list |
|
| 7364 | + * |
|
| 7365 | + */ |
|
| 7366 | 7366 | public function countAllDepartureAirportsByIdent($ident,$filters = array()) |
| 7367 | 7367 | { |
| 7368 | 7368 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7394,11 +7394,11 @@ discard block |
||
| 7394 | 7394 | } |
| 7395 | 7395 | |
| 7396 | 7396 | /** |
| 7397 | - * Gets all departure airports of the airplanes that have flown over based on a owner |
|
| 7398 | - * |
|
| 7399 | - * @return Array the airport list |
|
| 7400 | - * |
|
| 7401 | - */ |
|
| 7397 | + * Gets all departure airports of the airplanes that have flown over based on a owner |
|
| 7398 | + * |
|
| 7399 | + * @return Array the airport list |
|
| 7400 | + * |
|
| 7401 | + */ |
|
| 7402 | 7402 | public function countAllDepartureAirportsByOwner($owner,$filters = array()) |
| 7403 | 7403 | { |
| 7404 | 7404 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7430,11 +7430,11 @@ discard block |
||
| 7430 | 7430 | } |
| 7431 | 7431 | |
| 7432 | 7432 | /** |
| 7433 | - * Gets all departure airports of the airplanes that have flown over based on a pilot |
|
| 7434 | - * |
|
| 7435 | - * @return Array the airport list |
|
| 7436 | - * |
|
| 7437 | - */ |
|
| 7433 | + * Gets all departure airports of the airplanes that have flown over based on a pilot |
|
| 7434 | + * |
|
| 7435 | + * @return Array the airport list |
|
| 7436 | + * |
|
| 7437 | + */ |
|
| 7438 | 7438 | public function countAllDepartureAirportsByPilot($pilot,$filters = array()) |
| 7439 | 7439 | { |
| 7440 | 7440 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7467,11 +7467,11 @@ discard block |
||
| 7467 | 7467 | |
| 7468 | 7468 | |
| 7469 | 7469 | /** |
| 7470 | - * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 7471 | - * |
|
| 7472 | - * @return Array the airport list |
|
| 7473 | - * |
|
| 7474 | - */ |
|
| 7470 | + * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 7471 | + * |
|
| 7472 | + * @return Array the airport list |
|
| 7473 | + * |
|
| 7474 | + */ |
|
| 7475 | 7475 | public function countAllDepartureAirportCountriesByIdent($ident,$filters = array()) |
| 7476 | 7476 | { |
| 7477 | 7477 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7500,11 +7500,11 @@ discard block |
||
| 7500 | 7500 | } |
| 7501 | 7501 | |
| 7502 | 7502 | /** |
| 7503 | - * Gets all departure airports by country of the airplanes that have flown over based on owner |
|
| 7504 | - * |
|
| 7505 | - * @return Array the airport list |
|
| 7506 | - * |
|
| 7507 | - */ |
|
| 7503 | + * Gets all departure airports by country of the airplanes that have flown over based on owner |
|
| 7504 | + * |
|
| 7505 | + * @return Array the airport list |
|
| 7506 | + * |
|
| 7507 | + */ |
|
| 7508 | 7508 | public function countAllDepartureAirportCountriesByOwner($owner,$filters = array()) |
| 7509 | 7509 | { |
| 7510 | 7510 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7520,11 +7520,11 @@ discard block |
||
| 7520 | 7520 | } |
| 7521 | 7521 | |
| 7522 | 7522 | /** |
| 7523 | - * Gets all departure airports by country of the airplanes that have flown over based on pilot |
|
| 7524 | - * |
|
| 7525 | - * @return Array the airport list |
|
| 7526 | - * |
|
| 7527 | - */ |
|
| 7523 | + * Gets all departure airports by country of the airplanes that have flown over based on pilot |
|
| 7524 | + * |
|
| 7525 | + * @return Array the airport list |
|
| 7526 | + * |
|
| 7527 | + */ |
|
| 7528 | 7528 | public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array()) |
| 7529 | 7529 | { |
| 7530 | 7530 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7542,11 +7542,11 @@ discard block |
||
| 7542 | 7542 | |
| 7543 | 7543 | |
| 7544 | 7544 | /** |
| 7545 | - * Gets all departure airports of the airplanes that have flown over based on a country |
|
| 7546 | - * |
|
| 7547 | - * @return Array the airport list |
|
| 7548 | - * |
|
| 7549 | - */ |
|
| 7545 | + * Gets all departure airports of the airplanes that have flown over based on a country |
|
| 7546 | + * |
|
| 7547 | + * @return Array the airport list |
|
| 7548 | + * |
|
| 7549 | + */ |
|
| 7550 | 7550 | public function countAllDepartureAirportsByCountry($country,$filters = array()) |
| 7551 | 7551 | { |
| 7552 | 7552 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7580,11 +7580,11 @@ discard block |
||
| 7580 | 7580 | |
| 7581 | 7581 | |
| 7582 | 7582 | /** |
| 7583 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 7584 | - * |
|
| 7585 | - * @return Array the airport list |
|
| 7586 | - * |
|
| 7587 | - */ |
|
| 7583 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 7584 | + * |
|
| 7585 | + * @return Array the airport list |
|
| 7586 | + * |
|
| 7587 | + */ |
|
| 7588 | 7588 | public function countAllDepartureAirportCountriesByCountry($country,$filters = array()) |
| 7589 | 7589 | { |
| 7590 | 7590 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7614,31 +7614,31 @@ discard block |
||
| 7614 | 7614 | |
| 7615 | 7615 | |
| 7616 | 7616 | /** |
| 7617 | - * Gets all arrival airports of the airplanes that have flown over |
|
| 7618 | - * |
|
| 7619 | - * @param Boolean $limit Limit result to 10 or not |
|
| 7620 | - * @param Integer $olderthanmonths Only show result older than x months |
|
| 7621 | - * @param String $sincedate Only show result since x date |
|
| 7622 | - * @param Boolean $icaoaskey Show result by ICAO |
|
| 7623 | - * @param Array $filters Filter used here |
|
| 7624 | - * @return Array the airport list |
|
| 7625 | - * |
|
| 7626 | - */ |
|
| 7617 | + * Gets all arrival airports of the airplanes that have flown over |
|
| 7618 | + * |
|
| 7619 | + * @param Boolean $limit Limit result to 10 or not |
|
| 7620 | + * @param Integer $olderthanmonths Only show result older than x months |
|
| 7621 | + * @param String $sincedate Only show result since x date |
|
| 7622 | + * @param Boolean $icaoaskey Show result by ICAO |
|
| 7623 | + * @param Array $filters Filter used here |
|
| 7624 | + * @return Array the airport list |
|
| 7625 | + * |
|
| 7626 | + */ |
|
| 7627 | 7627 | public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '') |
| 7628 | 7628 | { |
| 7629 | 7629 | global $globalDBdriver; |
| 7630 | 7630 | $filter_query = $this->getFilter($filters,true,true); |
| 7631 | 7631 | $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, airport.latitude as arrival_airport_latitude, airport.longitude as arrival_airport_longitude |
| 7632 | 7632 | FROM airport, spotter_output".$filter_query." airport.icao = spotter_output.arrival_airport_icao AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''"; |
| 7633 | - if ($olderthanmonths > 0) { |
|
| 7634 | - if ($globalDBdriver == 'mysql') { |
|
| 7633 | + if ($olderthanmonths > 0) { |
|
| 7634 | + if ($globalDBdriver == 'mysql') { |
|
| 7635 | 7635 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 7636 | 7636 | } else { |
| 7637 | 7637 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 7638 | 7638 | } |
| 7639 | 7639 | } |
| 7640 | - if ($sincedate != '') { |
|
| 7641 | - if ($globalDBdriver == 'mysql') { |
|
| 7640 | + if ($sincedate != '') { |
|
| 7641 | + if ($globalDBdriver == 'mysql') { |
|
| 7642 | 7642 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 7643 | 7643 | } else { |
| 7644 | 7644 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -7672,7 +7672,7 @@ discard block |
||
| 7672 | 7672 | $query_values = array_merge($query_values,array(':day' => $day)); |
| 7673 | 7673 | } |
| 7674 | 7674 | } |
| 7675 | - $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, airport.latitude, airport.longitude |
|
| 7675 | + $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, airport.latitude, airport.longitude |
|
| 7676 | 7676 | ORDER BY airport_arrival_icao_count DESC"; |
| 7677 | 7677 | if ($limit) $query .= " LIMIT 10"; |
| 7678 | 7678 | |
@@ -7703,35 +7703,35 @@ discard block |
||
| 7703 | 7703 | } |
| 7704 | 7704 | |
| 7705 | 7705 | /** |
| 7706 | - * Gets all arrival airports of the airplanes that have flown over |
|
| 7707 | - * |
|
| 7708 | - * @return Array the airport list |
|
| 7709 | - * |
|
| 7710 | - */ |
|
| 7706 | + * Gets all arrival airports of the airplanes that have flown over |
|
| 7707 | + * |
|
| 7708 | + * @return Array the airport list |
|
| 7709 | + * |
|
| 7710 | + */ |
|
| 7711 | 7711 | public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
| 7712 | 7712 | { |
| 7713 | 7713 | global $globalDBdriver; |
| 7714 | 7714 | $filter_query = $this->getFilter($filters,true,true); |
| 7715 | 7715 | $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 |
| 7716 | 7716 | 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 <> '' "; |
| 7717 | - if ($olderthanmonths > 0) { |
|
| 7718 | - if ($globalDBdriver == 'mysql') { |
|
| 7717 | + if ($olderthanmonths > 0) { |
|
| 7718 | + if ($globalDBdriver == 'mysql') { |
|
| 7719 | 7719 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 7720 | 7720 | } else { |
| 7721 | 7721 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 7722 | 7722 | } |
| 7723 | 7723 | } |
| 7724 | - if ($sincedate != '') { |
|
| 7725 | - if ($globalDBdriver == 'mysql') { |
|
| 7724 | + if ($sincedate != '') { |
|
| 7725 | + if ($globalDBdriver == 'mysql') { |
|
| 7726 | 7726 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 7727 | 7727 | } else { |
| 7728 | 7728 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 7729 | 7729 | } |
| 7730 | 7730 | } |
| 7731 | 7731 | |
| 7732 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 7733 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 7734 | - $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 |
|
| 7732 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 7733 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 7734 | + $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7735 | 7735 | ORDER BY airport_arrival_icao_count DESC"; |
| 7736 | 7736 | if ($limit) $query .= " LIMIT 10"; |
| 7737 | 7737 | |
@@ -7762,26 +7762,26 @@ discard block |
||
| 7762 | 7762 | |
| 7763 | 7763 | |
| 7764 | 7764 | /** |
| 7765 | - * Gets all detected arrival airports of the airplanes that have flown over |
|
| 7766 | - * |
|
| 7767 | - * @return Array the airport list |
|
| 7768 | - * |
|
| 7769 | - */ |
|
| 7765 | + * Gets all detected arrival airports of the airplanes that have flown over |
|
| 7766 | + * |
|
| 7767 | + * @return Array the airport list |
|
| 7768 | + * |
|
| 7769 | + */ |
|
| 7770 | 7770 | public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '') |
| 7771 | 7771 | { |
| 7772 | 7772 | global $globalDBdriver; |
| 7773 | 7773 | $filter_query = $this->getFilter($filters,true,true); |
| 7774 | 7774 | $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, airport.latitude AS arrival_airport_latitude, airport.longitude AS arrival_airport_longitude |
| 7775 | 7775 | 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"; |
| 7776 | - if ($olderthanmonths > 0) { |
|
| 7777 | - if ($globalDBdriver == 'mysql') { |
|
| 7776 | + if ($olderthanmonths > 0) { |
|
| 7777 | + if ($globalDBdriver == 'mysql') { |
|
| 7778 | 7778 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 7779 | 7779 | } else { |
| 7780 | 7780 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 7781 | 7781 | } |
| 7782 | 7782 | } |
| 7783 | - if ($sincedate != '') { |
|
| 7784 | - if ($globalDBdriver == 'mysql') { |
|
| 7783 | + if ($sincedate != '') { |
|
| 7784 | + if ($globalDBdriver == 'mysql') { |
|
| 7785 | 7785 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 7786 | 7786 | } else { |
| 7787 | 7787 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -7843,35 +7843,35 @@ discard block |
||
| 7843 | 7843 | } |
| 7844 | 7844 | |
| 7845 | 7845 | /** |
| 7846 | - * Gets all detected arrival airports of the airplanes that have flown over |
|
| 7847 | - * |
|
| 7848 | - * @return Array the airport list |
|
| 7849 | - * |
|
| 7850 | - */ |
|
| 7846 | + * Gets all detected arrival airports of the airplanes that have flown over |
|
| 7847 | + * |
|
| 7848 | + * @return Array the airport list |
|
| 7849 | + * |
|
| 7850 | + */ |
|
| 7851 | 7851 | public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
| 7852 | 7852 | { |
| 7853 | 7853 | global $globalDBdriver; |
| 7854 | 7854 | $filter_query = $this->getFilter($filters,true,true); |
| 7855 | 7855 | $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 |
| 7856 | 7856 | 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 "; |
| 7857 | - if ($olderthanmonths > 0) { |
|
| 7858 | - if ($globalDBdriver == 'mysql') { |
|
| 7857 | + if ($olderthanmonths > 0) { |
|
| 7858 | + if ($globalDBdriver == 'mysql') { |
|
| 7859 | 7859 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 7860 | 7860 | } else { |
| 7861 | 7861 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 7862 | 7862 | } |
| 7863 | 7863 | } |
| 7864 | - if ($sincedate != '') { |
|
| 7865 | - if ($globalDBdriver == 'mysql') { |
|
| 7864 | + if ($sincedate != '') { |
|
| 7865 | + if ($globalDBdriver == 'mysql') { |
|
| 7866 | 7866 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 7867 | 7867 | } else { |
| 7868 | 7868 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 7869 | 7869 | } |
| 7870 | 7870 | } |
| 7871 | 7871 | |
| 7872 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 7873 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 7874 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 7872 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 7873 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 7874 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 7875 | 7875 | ORDER BY airport_arrival_icao_count DESC"; |
| 7876 | 7876 | if ($limit) $query .= " LIMIT 10"; |
| 7877 | 7877 | |
@@ -7901,11 +7901,11 @@ discard block |
||
| 7901 | 7901 | } |
| 7902 | 7902 | |
| 7903 | 7903 | /** |
| 7904 | - * Gets all arrival airports of the airplanes that have flown over based on an airline icao |
|
| 7905 | - * |
|
| 7906 | - * @return Array the airport list |
|
| 7907 | - * |
|
| 7908 | - */ |
|
| 7904 | + * Gets all arrival airports of the airplanes that have flown over based on an airline icao |
|
| 7905 | + * |
|
| 7906 | + * @return Array the airport list |
|
| 7907 | + * |
|
| 7908 | + */ |
|
| 7909 | 7909 | public function countAllArrivalAirportsByAirline($airline_icao, $filters = array()) |
| 7910 | 7910 | { |
| 7911 | 7911 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7937,11 +7937,11 @@ discard block |
||
| 7937 | 7937 | |
| 7938 | 7938 | |
| 7939 | 7939 | /** |
| 7940 | - * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao |
|
| 7941 | - * |
|
| 7942 | - * @return Array the airport list |
|
| 7943 | - * |
|
| 7944 | - */ |
|
| 7940 | + * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao |
|
| 7941 | + * |
|
| 7942 | + * @return Array the airport list |
|
| 7943 | + * |
|
| 7944 | + */ |
|
| 7945 | 7945 | public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array()) |
| 7946 | 7946 | { |
| 7947 | 7947 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7972,11 +7972,11 @@ discard block |
||
| 7972 | 7972 | |
| 7973 | 7973 | |
| 7974 | 7974 | /** |
| 7975 | - * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao |
|
| 7976 | - * |
|
| 7977 | - * @return Array the airport list |
|
| 7978 | - * |
|
| 7979 | - */ |
|
| 7975 | + * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao |
|
| 7976 | + * |
|
| 7977 | + * @return Array the airport list |
|
| 7978 | + * |
|
| 7979 | + */ |
|
| 7980 | 7980 | public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array()) |
| 7981 | 7981 | { |
| 7982 | 7982 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8010,11 +8010,11 @@ discard block |
||
| 8010 | 8010 | |
| 8011 | 8011 | |
| 8012 | 8012 | /** |
| 8013 | - * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 8014 | - * |
|
| 8015 | - * @return Array the airport list |
|
| 8016 | - * |
|
| 8017 | - */ |
|
| 8013 | + * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 8014 | + * |
|
| 8015 | + * @return Array the airport list |
|
| 8016 | + * |
|
| 8017 | + */ |
|
| 8018 | 8018 | public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
| 8019 | 8019 | { |
| 8020 | 8020 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8044,11 +8044,11 @@ discard block |
||
| 8044 | 8044 | |
| 8045 | 8045 | |
| 8046 | 8046 | /** |
| 8047 | - * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration |
|
| 8048 | - * |
|
| 8049 | - * @return Array the airport list |
|
| 8050 | - * |
|
| 8051 | - */ |
|
| 8047 | + * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration |
|
| 8048 | + * |
|
| 8049 | + * @return Array the airport list |
|
| 8050 | + * |
|
| 8051 | + */ |
|
| 8052 | 8052 | public function countAllArrivalAirportsByRegistration($registration,$filters = array()) |
| 8053 | 8053 | { |
| 8054 | 8054 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8082,11 +8082,11 @@ discard block |
||
| 8082 | 8082 | |
| 8083 | 8083 | |
| 8084 | 8084 | /** |
| 8085 | - * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 8086 | - * |
|
| 8087 | - * @return Array the airport list |
|
| 8088 | - * |
|
| 8089 | - */ |
|
| 8085 | + * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 8086 | + * |
|
| 8087 | + * @return Array the airport list |
|
| 8088 | + * |
|
| 8089 | + */ |
|
| 8090 | 8090 | public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array()) |
| 8091 | 8091 | { |
| 8092 | 8092 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8117,11 +8117,11 @@ discard block |
||
| 8117 | 8117 | |
| 8118 | 8118 | |
| 8119 | 8119 | /** |
| 8120 | - * Gets all arrival airports of the airplanes that have flown over based on an departure airport |
|
| 8121 | - * |
|
| 8122 | - * @return Array the airport list |
|
| 8123 | - * |
|
| 8124 | - */ |
|
| 8120 | + * Gets all arrival airports of the airplanes that have flown over based on an departure airport |
|
| 8121 | + * |
|
| 8122 | + * @return Array the airport list |
|
| 8123 | + * |
|
| 8124 | + */ |
|
| 8125 | 8125 | public function countAllArrivalAirportsByAirport($airport_icao,$filters = array()) |
| 8126 | 8126 | { |
| 8127 | 8127 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8154,11 +8154,11 @@ discard block |
||
| 8154 | 8154 | |
| 8155 | 8155 | |
| 8156 | 8156 | /** |
| 8157 | - * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao |
|
| 8158 | - * |
|
| 8159 | - * @return Array the airport list |
|
| 8160 | - * |
|
| 8161 | - */ |
|
| 8157 | + * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao |
|
| 8158 | + * |
|
| 8159 | + * @return Array the airport list |
|
| 8160 | + * |
|
| 8161 | + */ |
|
| 8162 | 8162 | public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array()) |
| 8163 | 8163 | { |
| 8164 | 8164 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8188,11 +8188,11 @@ discard block |
||
| 8188 | 8188 | |
| 8189 | 8189 | |
| 8190 | 8190 | /** |
| 8191 | - * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer |
|
| 8192 | - * |
|
| 8193 | - * @return Array the airport list |
|
| 8194 | - * |
|
| 8195 | - */ |
|
| 8191 | + * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer |
|
| 8192 | + * |
|
| 8193 | + * @return Array the airport list |
|
| 8194 | + * |
|
| 8195 | + */ |
|
| 8196 | 8196 | public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
| 8197 | 8197 | { |
| 8198 | 8198 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8226,11 +8226,11 @@ discard block |
||
| 8226 | 8226 | |
| 8227 | 8227 | |
| 8228 | 8228 | /** |
| 8229 | - * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer |
|
| 8230 | - * |
|
| 8231 | - * @return Array the airport list |
|
| 8232 | - * |
|
| 8233 | - */ |
|
| 8229 | + * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer |
|
| 8230 | + * |
|
| 8231 | + * @return Array the airport list |
|
| 8232 | + * |
|
| 8233 | + */ |
|
| 8234 | 8234 | public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 8235 | 8235 | { |
| 8236 | 8236 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8261,11 +8261,11 @@ discard block |
||
| 8261 | 8261 | |
| 8262 | 8262 | |
| 8263 | 8263 | /** |
| 8264 | - * Gets all arrival airports of the airplanes that have flown over based on a date |
|
| 8265 | - * |
|
| 8266 | - * @return Array the airport list |
|
| 8267 | - * |
|
| 8268 | - */ |
|
| 8264 | + * Gets all arrival airports of the airplanes that have flown over based on a date |
|
| 8265 | + * |
|
| 8266 | + * @return Array the airport list |
|
| 8267 | + * |
|
| 8268 | + */ |
|
| 8269 | 8269 | public function countAllArrivalAirportsByDate($date,$filters = array()) |
| 8270 | 8270 | { |
| 8271 | 8271 | global $globalTimezone, $globalDBdriver; |
@@ -8311,11 +8311,11 @@ discard block |
||
| 8311 | 8311 | |
| 8312 | 8312 | |
| 8313 | 8313 | /** |
| 8314 | - * Gets all arrival airports by country of the airplanes that have flown over based on a date |
|
| 8315 | - * |
|
| 8316 | - * @return Array the airport list |
|
| 8317 | - * |
|
| 8318 | - */ |
|
| 8314 | + * Gets all arrival airports by country of the airplanes that have flown over based on a date |
|
| 8315 | + * |
|
| 8316 | + * @return Array the airport list |
|
| 8317 | + * |
|
| 8318 | + */ |
|
| 8319 | 8319 | public function countAllArrivalAirportCountriesByDate($date, $filters = array()) |
| 8320 | 8320 | { |
| 8321 | 8321 | global $globalTimezone, $globalDBdriver; |
@@ -8358,11 +8358,11 @@ discard block |
||
| 8358 | 8358 | |
| 8359 | 8359 | |
| 8360 | 8360 | /** |
| 8361 | - * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign |
|
| 8362 | - * |
|
| 8363 | - * @return Array the airport list |
|
| 8364 | - * |
|
| 8365 | - */ |
|
| 8361 | + * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign |
|
| 8362 | + * |
|
| 8363 | + * @return Array the airport list |
|
| 8364 | + * |
|
| 8365 | + */ |
|
| 8366 | 8366 | public function countAllArrivalAirportsByIdent($ident,$filters = array()) |
| 8367 | 8367 | { |
| 8368 | 8368 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8394,11 +8394,11 @@ discard block |
||
| 8394 | 8394 | } |
| 8395 | 8395 | |
| 8396 | 8396 | /** |
| 8397 | - * Gets all arrival airports of the airplanes that have flown over based on a owner |
|
| 8398 | - * |
|
| 8399 | - * @return Array the airport list |
|
| 8400 | - * |
|
| 8401 | - */ |
|
| 8397 | + * Gets all arrival airports of the airplanes that have flown over based on a owner |
|
| 8398 | + * |
|
| 8399 | + * @return Array the airport list |
|
| 8400 | + * |
|
| 8401 | + */ |
|
| 8402 | 8402 | public function countAllArrivalAirportsByOwner($owner,$filters = array()) |
| 8403 | 8403 | { |
| 8404 | 8404 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8429,11 +8429,11 @@ discard block |
||
| 8429 | 8429 | } |
| 8430 | 8430 | |
| 8431 | 8431 | /** |
| 8432 | - * Gets all arrival airports of the airplanes that have flown over based on a pilot |
|
| 8433 | - * |
|
| 8434 | - * @return Array the airport list |
|
| 8435 | - * |
|
| 8436 | - */ |
|
| 8432 | + * Gets all arrival airports of the airplanes that have flown over based on a pilot |
|
| 8433 | + * |
|
| 8434 | + * @return Array the airport list |
|
| 8435 | + * |
|
| 8436 | + */ |
|
| 8437 | 8437 | public function countAllArrivalAirportsByPilot($pilot,$filters = array()) |
| 8438 | 8438 | { |
| 8439 | 8439 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8464,11 +8464,11 @@ discard block |
||
| 8464 | 8464 | } |
| 8465 | 8465 | |
| 8466 | 8466 | /** |
| 8467 | - * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 8468 | - * |
|
| 8469 | - * @return Array the airport list |
|
| 8470 | - * |
|
| 8471 | - */ |
|
| 8467 | + * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 8468 | + * |
|
| 8469 | + * @return Array the airport list |
|
| 8470 | + * |
|
| 8471 | + */ |
|
| 8472 | 8472 | public function countAllArrivalAirportCountriesByIdent($ident, $filters = array()) |
| 8473 | 8473 | { |
| 8474 | 8474 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8497,11 +8497,11 @@ discard block |
||
| 8497 | 8497 | } |
| 8498 | 8498 | |
| 8499 | 8499 | /** |
| 8500 | - * Gets all arrival airports by country of the airplanes that have flown over based on a owner |
|
| 8501 | - * |
|
| 8502 | - * @return Array the airport list |
|
| 8503 | - * |
|
| 8504 | - */ |
|
| 8500 | + * Gets all arrival airports by country of the airplanes that have flown over based on a owner |
|
| 8501 | + * |
|
| 8502 | + * @return Array the airport list |
|
| 8503 | + * |
|
| 8504 | + */ |
|
| 8505 | 8505 | public function countAllArrivalAirportCountriesByOwner($owner, $filters = array()) |
| 8506 | 8506 | { |
| 8507 | 8507 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8517,11 +8517,11 @@ discard block |
||
| 8517 | 8517 | } |
| 8518 | 8518 | |
| 8519 | 8519 | /** |
| 8520 | - * Gets all arrival airports by country of the airplanes that have flown over based on a pilot |
|
| 8521 | - * |
|
| 8522 | - * @return Array the airport list |
|
| 8523 | - * |
|
| 8524 | - */ |
|
| 8520 | + * Gets all arrival airports by country of the airplanes that have flown over based on a pilot |
|
| 8521 | + * |
|
| 8522 | + * @return Array the airport list |
|
| 8523 | + * |
|
| 8524 | + */ |
|
| 8525 | 8525 | public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array()) |
| 8526 | 8526 | { |
| 8527 | 8527 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8539,11 +8539,11 @@ discard block |
||
| 8539 | 8539 | |
| 8540 | 8540 | |
| 8541 | 8541 | /** |
| 8542 | - * Gets all arrival airports of the airplanes that have flown over based on a country |
|
| 8543 | - * |
|
| 8544 | - * @return Array the airport list |
|
| 8545 | - * |
|
| 8546 | - */ |
|
| 8542 | + * Gets all arrival airports of the airplanes that have flown over based on a country |
|
| 8543 | + * |
|
| 8544 | + * @return Array the airport list |
|
| 8545 | + * |
|
| 8546 | + */ |
|
| 8547 | 8547 | public function countAllArrivalAirportsByCountry($country,$filters = array()) |
| 8548 | 8548 | { |
| 8549 | 8549 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8576,11 +8576,11 @@ discard block |
||
| 8576 | 8576 | |
| 8577 | 8577 | |
| 8578 | 8578 | /** |
| 8579 | - * Gets all arrival airports by country of the airplanes that have flown over based on a country |
|
| 8580 | - * |
|
| 8581 | - * @return Array the airport list |
|
| 8582 | - * |
|
| 8583 | - */ |
|
| 8579 | + * Gets all arrival airports by country of the airplanes that have flown over based on a country |
|
| 8580 | + * |
|
| 8581 | + * @return Array the airport list |
|
| 8582 | + * |
|
| 8583 | + */ |
|
| 8584 | 8584 | public function countAllArrivalAirportCountriesByCountry($country,$filters = array()) |
| 8585 | 8585 | { |
| 8586 | 8586 | global $globalDBdriver; |
@@ -8612,11 +8612,11 @@ discard block |
||
| 8612 | 8612 | |
| 8613 | 8613 | |
| 8614 | 8614 | /** |
| 8615 | - * Counts all airport departure countries |
|
| 8616 | - * |
|
| 8617 | - * @return Array the airport departure list |
|
| 8618 | - * |
|
| 8619 | - */ |
|
| 8615 | + * Counts all airport departure countries |
|
| 8616 | + * |
|
| 8617 | + * @return Array the airport departure list |
|
| 8618 | + * |
|
| 8619 | + */ |
|
| 8620 | 8620 | public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '') |
| 8621 | 8621 | { |
| 8622 | 8622 | global $globalDBdriver; |
@@ -8675,11 +8675,11 @@ discard block |
||
| 8675 | 8675 | |
| 8676 | 8676 | |
| 8677 | 8677 | /** |
| 8678 | - * Counts all airport arrival countries |
|
| 8679 | - * |
|
| 8680 | - * @return Array the airport arrival list |
|
| 8681 | - * |
|
| 8682 | - */ |
|
| 8678 | + * Counts all airport arrival countries |
|
| 8679 | + * |
|
| 8680 | + * @return Array the airport arrival list |
|
| 8681 | + * |
|
| 8682 | + */ |
|
| 8683 | 8683 | public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '') |
| 8684 | 8684 | { |
| 8685 | 8685 | global $globalDBdriver; |
@@ -8742,11 +8742,11 @@ discard block |
||
| 8742 | 8742 | |
| 8743 | 8743 | |
| 8744 | 8744 | /** |
| 8745 | - * Gets all route combinations |
|
| 8746 | - * |
|
| 8747 | - * @return Array the route list |
|
| 8748 | - * |
|
| 8749 | - */ |
|
| 8745 | + * Gets all route combinations |
|
| 8746 | + * |
|
| 8747 | + * @return Array the route list |
|
| 8748 | + * |
|
| 8749 | + */ |
|
| 8750 | 8750 | public function countAllRoutes($filters = array()) |
| 8751 | 8751 | { |
| 8752 | 8752 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8785,11 +8785,11 @@ discard block |
||
| 8785 | 8785 | |
| 8786 | 8786 | |
| 8787 | 8787 | /** |
| 8788 | - * Gets all route combinations based on an aircraft |
|
| 8789 | - * |
|
| 8790 | - * @return Array the route list |
|
| 8791 | - * |
|
| 8792 | - */ |
|
| 8788 | + * Gets all route combinations based on an aircraft |
|
| 8789 | + * |
|
| 8790 | + * @return Array the route list |
|
| 8791 | + * |
|
| 8792 | + */ |
|
| 8793 | 8793 | public function countAllRoutesByAircraft($aircraft_icao,$filters = array()) |
| 8794 | 8794 | { |
| 8795 | 8795 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8825,11 +8825,11 @@ discard block |
||
| 8825 | 8825 | |
| 8826 | 8826 | |
| 8827 | 8827 | /** |
| 8828 | - * Gets all route combinations based on an aircraft registration |
|
| 8829 | - * |
|
| 8830 | - * @return Array the route list |
|
| 8831 | - * |
|
| 8832 | - */ |
|
| 8828 | + * Gets all route combinations based on an aircraft registration |
|
| 8829 | + * |
|
| 8830 | + * @return Array the route list |
|
| 8831 | + * |
|
| 8832 | + */ |
|
| 8833 | 8833 | public function countAllRoutesByRegistration($registration, $filters = array()) |
| 8834 | 8834 | { |
| 8835 | 8835 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8867,11 +8867,11 @@ discard block |
||
| 8867 | 8867 | |
| 8868 | 8868 | |
| 8869 | 8869 | /** |
| 8870 | - * Gets all route combinations based on an airline |
|
| 8871 | - * |
|
| 8872 | - * @return Array the route list |
|
| 8873 | - * |
|
| 8874 | - */ |
|
| 8870 | + * Gets all route combinations based on an airline |
|
| 8871 | + * |
|
| 8872 | + * @return Array the route list |
|
| 8873 | + * |
|
| 8874 | + */ |
|
| 8875 | 8875 | public function countAllRoutesByAirline($airline_icao, $filters = array()) |
| 8876 | 8876 | { |
| 8877 | 8877 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8909,11 +8909,11 @@ discard block |
||
| 8909 | 8909 | |
| 8910 | 8910 | |
| 8911 | 8911 | /** |
| 8912 | - * Gets all route combinations based on an airport |
|
| 8913 | - * |
|
| 8914 | - * @return Array the route list |
|
| 8915 | - * |
|
| 8916 | - */ |
|
| 8912 | + * Gets all route combinations based on an airport |
|
| 8913 | + * |
|
| 8914 | + * @return Array the route list |
|
| 8915 | + * |
|
| 8916 | + */ |
|
| 8917 | 8917 | public function countAllRoutesByAirport($airport_icao, $filters = array()) |
| 8918 | 8918 | { |
| 8919 | 8919 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8950,11 +8950,11 @@ discard block |
||
| 8950 | 8950 | |
| 8951 | 8951 | |
| 8952 | 8952 | /** |
| 8953 | - * Gets all route combinations based on an country |
|
| 8954 | - * |
|
| 8955 | - * @return Array the route list |
|
| 8956 | - * |
|
| 8957 | - */ |
|
| 8953 | + * Gets all route combinations based on an country |
|
| 8954 | + * |
|
| 8955 | + * @return Array the route list |
|
| 8956 | + * |
|
| 8957 | + */ |
|
| 8958 | 8958 | public function countAllRoutesByCountry($country, $filters = array()) |
| 8959 | 8959 | { |
| 8960 | 8960 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8990,11 +8990,11 @@ discard block |
||
| 8990 | 8990 | |
| 8991 | 8991 | |
| 8992 | 8992 | /** |
| 8993 | - * Gets all route combinations based on an date |
|
| 8994 | - * |
|
| 8995 | - * @return Array the route list |
|
| 8996 | - * |
|
| 8997 | - */ |
|
| 8993 | + * Gets all route combinations based on an date |
|
| 8994 | + * |
|
| 8995 | + * @return Array the route list |
|
| 8996 | + * |
|
| 8997 | + */ |
|
| 8998 | 8998 | public function countAllRoutesByDate($date, $filters = array()) |
| 8999 | 8999 | { |
| 9000 | 9000 | global $globalTimezone, $globalDBdriver; |
@@ -9044,11 +9044,11 @@ discard block |
||
| 9044 | 9044 | |
| 9045 | 9045 | |
| 9046 | 9046 | /** |
| 9047 | - * Gets all route combinations based on an ident/callsign |
|
| 9048 | - * |
|
| 9049 | - * @return Array the route list |
|
| 9050 | - * |
|
| 9051 | - */ |
|
| 9047 | + * Gets all route combinations based on an ident/callsign |
|
| 9048 | + * |
|
| 9049 | + * @return Array the route list |
|
| 9050 | + * |
|
| 9051 | + */ |
|
| 9052 | 9052 | public function countAllRoutesByIdent($ident, $filters = array()) |
| 9053 | 9053 | { |
| 9054 | 9054 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9084,11 +9084,11 @@ discard block |
||
| 9084 | 9084 | } |
| 9085 | 9085 | |
| 9086 | 9086 | /** |
| 9087 | - * Gets all route combinations based on an owner |
|
| 9088 | - * |
|
| 9089 | - * @return Array the route list |
|
| 9090 | - * |
|
| 9091 | - */ |
|
| 9087 | + * Gets all route combinations based on an owner |
|
| 9088 | + * |
|
| 9089 | + * @return Array the route list |
|
| 9090 | + * |
|
| 9091 | + */ |
|
| 9092 | 9092 | public function countAllRoutesByOwner($owner,$filters = array()) |
| 9093 | 9093 | { |
| 9094 | 9094 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9124,11 +9124,11 @@ discard block |
||
| 9124 | 9124 | } |
| 9125 | 9125 | |
| 9126 | 9126 | /** |
| 9127 | - * Gets all route combinations based on a pilot |
|
| 9128 | - * |
|
| 9129 | - * @return Array the route list |
|
| 9130 | - * |
|
| 9131 | - */ |
|
| 9127 | + * Gets all route combinations based on a pilot |
|
| 9128 | + * |
|
| 9129 | + * @return Array the route list |
|
| 9130 | + * |
|
| 9131 | + */ |
|
| 9132 | 9132 | public function countAllRoutesByPilot($pilot,$filters = array()) |
| 9133 | 9133 | { |
| 9134 | 9134 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9165,11 +9165,11 @@ discard block |
||
| 9165 | 9165 | |
| 9166 | 9166 | |
| 9167 | 9167 | /** |
| 9168 | - * Gets all route combinations based on an manufacturer |
|
| 9169 | - * |
|
| 9170 | - * @return Array the route list |
|
| 9171 | - * |
|
| 9172 | - */ |
|
| 9168 | + * Gets all route combinations based on an manufacturer |
|
| 9169 | + * |
|
| 9170 | + * @return Array the route list |
|
| 9171 | + * |
|
| 9172 | + */ |
|
| 9173 | 9173 | public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array()) |
| 9174 | 9174 | { |
| 9175 | 9175 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9207,11 +9207,11 @@ discard block |
||
| 9207 | 9207 | |
| 9208 | 9208 | |
| 9209 | 9209 | /** |
| 9210 | - * Gets all route combinations with waypoints |
|
| 9211 | - * |
|
| 9212 | - * @return Array the route list |
|
| 9213 | - * |
|
| 9214 | - */ |
|
| 9210 | + * Gets all route combinations with waypoints |
|
| 9211 | + * |
|
| 9212 | + * @return Array the route list |
|
| 9213 | + * |
|
| 9214 | + */ |
|
| 9215 | 9215 | public function countAllRoutesWithWaypoints($filters = array()) |
| 9216 | 9216 | { |
| 9217 | 9217 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9248,11 +9248,11 @@ discard block |
||
| 9248 | 9248 | } |
| 9249 | 9249 | |
| 9250 | 9250 | /** |
| 9251 | - * Gets all callsigns that have flown over |
|
| 9252 | - * |
|
| 9253 | - * @return Array the callsign list |
|
| 9254 | - * |
|
| 9255 | - */ |
|
| 9251 | + * Gets all callsigns that have flown over |
|
| 9252 | + * |
|
| 9253 | + * @return Array the callsign list |
|
| 9254 | + * |
|
| 9255 | + */ |
|
| 9256 | 9256 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
| 9257 | 9257 | { |
| 9258 | 9258 | global $globalDBdriver; |
@@ -9318,11 +9318,11 @@ discard block |
||
| 9318 | 9318 | } |
| 9319 | 9319 | |
| 9320 | 9320 | /** |
| 9321 | - * Gets all callsigns that have flown over |
|
| 9322 | - * |
|
| 9323 | - * @return Array the callsign list |
|
| 9324 | - * |
|
| 9325 | - */ |
|
| 9321 | + * Gets all callsigns that have flown over |
|
| 9322 | + * |
|
| 9323 | + * @return Array the callsign list |
|
| 9324 | + * |
|
| 9325 | + */ |
|
| 9326 | 9326 | public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
| 9327 | 9327 | { |
| 9328 | 9328 | global $globalDBdriver; |
@@ -9363,11 +9363,11 @@ discard block |
||
| 9363 | 9363 | |
| 9364 | 9364 | |
| 9365 | 9365 | /** |
| 9366 | - * Counts all dates |
|
| 9367 | - * |
|
| 9368 | - * @return Array the date list |
|
| 9369 | - * |
|
| 9370 | - */ |
|
| 9366 | + * Counts all dates |
|
| 9367 | + * |
|
| 9368 | + * @return Array the date list |
|
| 9369 | + * |
|
| 9370 | + */ |
|
| 9371 | 9371 | public function countAllDates($filters = array()) |
| 9372 | 9372 | { |
| 9373 | 9373 | global $globalTimezone, $globalDBdriver; |
@@ -9412,11 +9412,11 @@ discard block |
||
| 9412 | 9412 | } |
| 9413 | 9413 | |
| 9414 | 9414 | /** |
| 9415 | - * Counts all dates |
|
| 9416 | - * |
|
| 9417 | - * @return Array the date list |
|
| 9418 | - * |
|
| 9419 | - */ |
|
| 9415 | + * Counts all dates |
|
| 9416 | + * |
|
| 9417 | + * @return Array the date list |
|
| 9418 | + * |
|
| 9419 | + */ |
|
| 9420 | 9420 | public function countAllDatesByAirlines($filters = array()) |
| 9421 | 9421 | { |
| 9422 | 9422 | global $globalTimezone, $globalDBdriver; |
@@ -9461,11 +9461,11 @@ discard block |
||
| 9461 | 9461 | } |
| 9462 | 9462 | |
| 9463 | 9463 | /** |
| 9464 | - * Counts all dates during the last 7 days |
|
| 9465 | - * |
|
| 9466 | - * @return Array the date list |
|
| 9467 | - * |
|
| 9468 | - */ |
|
| 9464 | + * Counts all dates during the last 7 days |
|
| 9465 | + * |
|
| 9466 | + * @return Array the date list |
|
| 9467 | + * |
|
| 9468 | + */ |
|
| 9469 | 9469 | public function countAllDatesLast7Days($filters = array()) |
| 9470 | 9470 | { |
| 9471 | 9471 | global $globalTimezone, $globalDBdriver; |
@@ -9487,7 +9487,7 @@ discard block |
||
| 9487 | 9487 | $query .= " GROUP BY date_name |
| 9488 | 9488 | ORDER BY date_name ASC"; |
| 9489 | 9489 | $query_data = array(':offset' => $offset); |
| 9490 | - } |
|
| 9490 | + } |
|
| 9491 | 9491 | |
| 9492 | 9492 | $sth = $this->db->prepare($query); |
| 9493 | 9493 | $sth->execute($query_data); |
@@ -9507,11 +9507,11 @@ discard block |
||
| 9507 | 9507 | } |
| 9508 | 9508 | |
| 9509 | 9509 | /** |
| 9510 | - * Counts all dates during the last month |
|
| 9511 | - * |
|
| 9512 | - * @return Array the date list |
|
| 9513 | - * |
|
| 9514 | - */ |
|
| 9510 | + * Counts all dates during the last month |
|
| 9511 | + * |
|
| 9512 | + * @return Array the date list |
|
| 9513 | + * |
|
| 9514 | + */ |
|
| 9515 | 9515 | public function countAllDatesLastMonth($filters = array()) |
| 9516 | 9516 | { |
| 9517 | 9517 | global $globalTimezone, $globalDBdriver; |
@@ -9533,7 +9533,7 @@ discard block |
||
| 9533 | 9533 | $query .= " GROUP BY date_name |
| 9534 | 9534 | ORDER BY date_name ASC"; |
| 9535 | 9535 | $query_data = array(':offset' => $offset); |
| 9536 | - } |
|
| 9536 | + } |
|
| 9537 | 9537 | |
| 9538 | 9538 | $sth = $this->db->prepare($query); |
| 9539 | 9539 | $sth->execute($query_data); |
@@ -9554,11 +9554,11 @@ discard block |
||
| 9554 | 9554 | |
| 9555 | 9555 | |
| 9556 | 9556 | /** |
| 9557 | - * Counts all dates during the last month |
|
| 9558 | - * |
|
| 9559 | - * @return Array the date list |
|
| 9560 | - * |
|
| 9561 | - */ |
|
| 9557 | + * Counts all dates during the last month |
|
| 9558 | + * |
|
| 9559 | + * @return Array the date list |
|
| 9560 | + * |
|
| 9561 | + */ |
|
| 9562 | 9562 | public function countAllDatesLastMonthByAirlines($filters = array()) |
| 9563 | 9563 | { |
| 9564 | 9564 | global $globalTimezone, $globalDBdriver; |
@@ -9581,7 +9581,7 @@ discard block |
||
| 9581 | 9581 | GROUP BY spotter_output.airline_icao, date_name |
| 9582 | 9582 | ORDER BY date_name ASC"; |
| 9583 | 9583 | $query_data = array(':offset' => $offset); |
| 9584 | - } |
|
| 9584 | + } |
|
| 9585 | 9585 | |
| 9586 | 9586 | $sth = $this->db->prepare($query); |
| 9587 | 9587 | $sth->execute($query_data); |
@@ -9603,11 +9603,11 @@ discard block |
||
| 9603 | 9603 | |
| 9604 | 9604 | |
| 9605 | 9605 | /** |
| 9606 | - * Counts all month |
|
| 9607 | - * |
|
| 9608 | - * @return Array the month list |
|
| 9609 | - * |
|
| 9610 | - */ |
|
| 9606 | + * Counts all month |
|
| 9607 | + * |
|
| 9608 | + * @return Array the month list |
|
| 9609 | + * |
|
| 9610 | + */ |
|
| 9611 | 9611 | public function countAllMonths($filters = array()) |
| 9612 | 9612 | { |
| 9613 | 9613 | global $globalTimezone, $globalDBdriver; |
@@ -9649,11 +9649,11 @@ discard block |
||
| 9649 | 9649 | } |
| 9650 | 9650 | |
| 9651 | 9651 | /** |
| 9652 | - * Counts all month |
|
| 9653 | - * |
|
| 9654 | - * @return Array the month list |
|
| 9655 | - * |
|
| 9656 | - */ |
|
| 9652 | + * Counts all month |
|
| 9653 | + * |
|
| 9654 | + * @return Array the month list |
|
| 9655 | + * |
|
| 9656 | + */ |
|
| 9657 | 9657 | public function countAllMonthsByAirlines($filters = array()) |
| 9658 | 9658 | { |
| 9659 | 9659 | global $globalTimezone, $globalDBdriver; |
@@ -9698,11 +9698,11 @@ discard block |
||
| 9698 | 9698 | } |
| 9699 | 9699 | |
| 9700 | 9700 | /** |
| 9701 | - * Counts all military month |
|
| 9702 | - * |
|
| 9703 | - * @return Array the month list |
|
| 9704 | - * |
|
| 9705 | - */ |
|
| 9701 | + * Counts all military month |
|
| 9702 | + * |
|
| 9703 | + * @return Array the month list |
|
| 9704 | + * |
|
| 9705 | + */ |
|
| 9706 | 9706 | public function countAllMilitaryMonths($filters = array()) |
| 9707 | 9707 | { |
| 9708 | 9708 | global $globalTimezone, $globalDBdriver; |
@@ -9743,11 +9743,11 @@ discard block |
||
| 9743 | 9743 | } |
| 9744 | 9744 | |
| 9745 | 9745 | /** |
| 9746 | - * Counts all month owners |
|
| 9747 | - * |
|
| 9748 | - * @return Array the month list |
|
| 9749 | - * |
|
| 9750 | - */ |
|
| 9746 | + * Counts all month owners |
|
| 9747 | + * |
|
| 9748 | + * @return Array the month list |
|
| 9749 | + * |
|
| 9750 | + */ |
|
| 9751 | 9751 | public function countAllMonthsOwners($filters = array()) |
| 9752 | 9752 | { |
| 9753 | 9753 | global $globalTimezone, $globalDBdriver; |
@@ -9789,11 +9789,11 @@ discard block |
||
| 9789 | 9789 | } |
| 9790 | 9790 | |
| 9791 | 9791 | /** |
| 9792 | - * Counts all month owners |
|
| 9793 | - * |
|
| 9794 | - * @return Array the month list |
|
| 9795 | - * |
|
| 9796 | - */ |
|
| 9792 | + * Counts all month owners |
|
| 9793 | + * |
|
| 9794 | + * @return Array the month list |
|
| 9795 | + * |
|
| 9796 | + */ |
|
| 9797 | 9797 | public function countAllMonthsOwnersByAirlines($filters = array()) |
| 9798 | 9798 | { |
| 9799 | 9799 | global $globalTimezone, $globalDBdriver; |
@@ -9836,11 +9836,11 @@ discard block |
||
| 9836 | 9836 | } |
| 9837 | 9837 | |
| 9838 | 9838 | /** |
| 9839 | - * Counts all month pilot |
|
| 9840 | - * |
|
| 9841 | - * @return Array the month list |
|
| 9842 | - * |
|
| 9843 | - */ |
|
| 9839 | + * Counts all month pilot |
|
| 9840 | + * |
|
| 9841 | + * @return Array the month list |
|
| 9842 | + * |
|
| 9843 | + */ |
|
| 9844 | 9844 | public function countAllMonthsPilots($filters = array()) |
| 9845 | 9845 | { |
| 9846 | 9846 | global $globalTimezone, $globalDBdriver; |
@@ -9882,11 +9882,11 @@ discard block |
||
| 9882 | 9882 | } |
| 9883 | 9883 | |
| 9884 | 9884 | /** |
| 9885 | - * Counts all month pilot |
|
| 9886 | - * |
|
| 9887 | - * @return Array the month list |
|
| 9888 | - * |
|
| 9889 | - */ |
|
| 9885 | + * Counts all month pilot |
|
| 9886 | + * |
|
| 9887 | + * @return Array the month list |
|
| 9888 | + * |
|
| 9889 | + */ |
|
| 9890 | 9890 | public function countAllMonthsPilotsByAirlines($filters = array()) |
| 9891 | 9891 | { |
| 9892 | 9892 | global $globalTimezone, $globalDBdriver; |
@@ -9929,11 +9929,11 @@ discard block |
||
| 9929 | 9929 | } |
| 9930 | 9930 | |
| 9931 | 9931 | /** |
| 9932 | - * Counts all month airline |
|
| 9933 | - * |
|
| 9934 | - * @return Array the month list |
|
| 9935 | - * |
|
| 9936 | - */ |
|
| 9932 | + * Counts all month airline |
|
| 9933 | + * |
|
| 9934 | + * @return Array the month list |
|
| 9935 | + * |
|
| 9936 | + */ |
|
| 9937 | 9937 | public function countAllMonthsAirlines($filters = array()) |
| 9938 | 9938 | { |
| 9939 | 9939 | global $globalTimezone, $globalDBdriver; |
@@ -9975,11 +9975,11 @@ discard block |
||
| 9975 | 9975 | } |
| 9976 | 9976 | |
| 9977 | 9977 | /** |
| 9978 | - * Counts all month aircraft |
|
| 9979 | - * |
|
| 9980 | - * @return Array the month list |
|
| 9981 | - * |
|
| 9982 | - */ |
|
| 9978 | + * Counts all month aircraft |
|
| 9979 | + * |
|
| 9980 | + * @return Array the month list |
|
| 9981 | + * |
|
| 9982 | + */ |
|
| 9983 | 9983 | public function countAllMonthsAircrafts($filters = array()) |
| 9984 | 9984 | { |
| 9985 | 9985 | global $globalTimezone, $globalDBdriver; |
@@ -10022,11 +10022,11 @@ discard block |
||
| 10022 | 10022 | |
| 10023 | 10023 | |
| 10024 | 10024 | /** |
| 10025 | - * Counts all month aircraft |
|
| 10026 | - * |
|
| 10027 | - * @return Array the month list |
|
| 10028 | - * |
|
| 10029 | - */ |
|
| 10025 | + * Counts all month aircraft |
|
| 10026 | + * |
|
| 10027 | + * @return Array the month list |
|
| 10028 | + * |
|
| 10029 | + */ |
|
| 10030 | 10030 | public function countAllMonthsAircraftsByAirlines($filters = array()) |
| 10031 | 10031 | { |
| 10032 | 10032 | global $globalTimezone, $globalDBdriver; |
@@ -10069,11 +10069,11 @@ discard block |
||
| 10069 | 10069 | } |
| 10070 | 10070 | |
| 10071 | 10071 | /** |
| 10072 | - * Counts all month real arrival |
|
| 10073 | - * |
|
| 10074 | - * @return Array the month list |
|
| 10075 | - * |
|
| 10076 | - */ |
|
| 10072 | + * Counts all month real arrival |
|
| 10073 | + * |
|
| 10074 | + * @return Array the month list |
|
| 10075 | + * |
|
| 10076 | + */ |
|
| 10077 | 10077 | public function countAllMonthsRealArrivals($filters = array()) |
| 10078 | 10078 | { |
| 10079 | 10079 | global $globalTimezone, $globalDBdriver; |
@@ -10116,11 +10116,11 @@ discard block |
||
| 10116 | 10116 | |
| 10117 | 10117 | |
| 10118 | 10118 | /** |
| 10119 | - * Counts all month real arrival |
|
| 10120 | - * |
|
| 10121 | - * @return Array the month list |
|
| 10122 | - * |
|
| 10123 | - */ |
|
| 10119 | + * Counts all month real arrival |
|
| 10120 | + * |
|
| 10121 | + * @return Array the month list |
|
| 10122 | + * |
|
| 10123 | + */ |
|
| 10124 | 10124 | public function countAllMonthsRealArrivalsByAirlines($filters = array()) |
| 10125 | 10125 | { |
| 10126 | 10126 | global $globalTimezone, $globalDBdriver; |
@@ -10164,11 +10164,11 @@ discard block |
||
| 10164 | 10164 | |
| 10165 | 10165 | |
| 10166 | 10166 | /** |
| 10167 | - * Counts all dates during the last year |
|
| 10168 | - * |
|
| 10169 | - * @return Array the date list |
|
| 10170 | - * |
|
| 10171 | - */ |
|
| 10167 | + * Counts all dates during the last year |
|
| 10168 | + * |
|
| 10169 | + * @return Array the date list |
|
| 10170 | + * |
|
| 10171 | + */ |
|
| 10172 | 10172 | public function countAllMonthsLastYear($filters) |
| 10173 | 10173 | { |
| 10174 | 10174 | global $globalTimezone, $globalDBdriver; |
@@ -10190,7 +10190,7 @@ discard block |
||
| 10190 | 10190 | $query .= " GROUP BY year_name, month_name |
| 10191 | 10191 | ORDER BY year_name, month_name ASC"; |
| 10192 | 10192 | $query_data = array(':offset' => $offset); |
| 10193 | - } |
|
| 10193 | + } |
|
| 10194 | 10194 | |
| 10195 | 10195 | $sth = $this->db->prepare($query); |
| 10196 | 10196 | $sth->execute($query_data); |
@@ -10213,11 +10213,11 @@ discard block |
||
| 10213 | 10213 | |
| 10214 | 10214 | |
| 10215 | 10215 | /** |
| 10216 | - * Counts all hours |
|
| 10217 | - * |
|
| 10218 | - * @return Array the hour list |
|
| 10219 | - * |
|
| 10220 | - */ |
|
| 10216 | + * Counts all hours |
|
| 10217 | + * |
|
| 10218 | + * @return Array the hour list |
|
| 10219 | + * |
|
| 10220 | + */ |
|
| 10221 | 10221 | public function countAllHours($orderby,$filters = array()) |
| 10222 | 10222 | { |
| 10223 | 10223 | global $globalTimezone, $globalDBdriver; |
@@ -10278,11 +10278,11 @@ discard block |
||
| 10278 | 10278 | } |
| 10279 | 10279 | |
| 10280 | 10280 | /** |
| 10281 | - * Counts all hours |
|
| 10282 | - * |
|
| 10283 | - * @return Array the hour list |
|
| 10284 | - * |
|
| 10285 | - */ |
|
| 10281 | + * Counts all hours |
|
| 10282 | + * |
|
| 10283 | + * @return Array the hour list |
|
| 10284 | + * |
|
| 10285 | + */ |
|
| 10286 | 10286 | public function countAllHoursByAirlines($orderby, $filters = array()) |
| 10287 | 10287 | { |
| 10288 | 10288 | global $globalTimezone, $globalDBdriver; |
@@ -10345,11 +10345,11 @@ discard block |
||
| 10345 | 10345 | |
| 10346 | 10346 | |
| 10347 | 10347 | /** |
| 10348 | - * Counts all hours by airline |
|
| 10349 | - * |
|
| 10350 | - * @return Array the hour list |
|
| 10351 | - * |
|
| 10352 | - */ |
|
| 10348 | + * Counts all hours by airline |
|
| 10349 | + * |
|
| 10350 | + * @return Array the hour list |
|
| 10351 | + * |
|
| 10352 | + */ |
|
| 10353 | 10353 | public function countAllHoursByAirline($airline_icao, $filters = array()) |
| 10354 | 10354 | { |
| 10355 | 10355 | global $globalTimezone, $globalDBdriver; |
@@ -10395,11 +10395,11 @@ discard block |
||
| 10395 | 10395 | |
| 10396 | 10396 | |
| 10397 | 10397 | /** |
| 10398 | - * Counts all hours by aircraft |
|
| 10399 | - * |
|
| 10400 | - * @return Array the hour list |
|
| 10401 | - * |
|
| 10402 | - */ |
|
| 10398 | + * Counts all hours by aircraft |
|
| 10399 | + * |
|
| 10400 | + * @return Array the hour list |
|
| 10401 | + * |
|
| 10402 | + */ |
|
| 10403 | 10403 | public function countAllHoursByAircraft($aircraft_icao, $filters = array()) |
| 10404 | 10404 | { |
| 10405 | 10405 | global $globalTimezone, $globalDBdriver; |
@@ -10442,11 +10442,11 @@ discard block |
||
| 10442 | 10442 | |
| 10443 | 10443 | |
| 10444 | 10444 | /** |
| 10445 | - * Counts all hours by aircraft registration |
|
| 10446 | - * |
|
| 10447 | - * @return Array the hour list |
|
| 10448 | - * |
|
| 10449 | - */ |
|
| 10445 | + * Counts all hours by aircraft registration |
|
| 10446 | + * |
|
| 10447 | + * @return Array the hour list |
|
| 10448 | + * |
|
| 10449 | + */ |
|
| 10450 | 10450 | public function countAllHoursByRegistration($registration, $filters = array()) |
| 10451 | 10451 | { |
| 10452 | 10452 | global $globalTimezone, $globalDBdriver; |
@@ -10489,11 +10489,11 @@ discard block |
||
| 10489 | 10489 | |
| 10490 | 10490 | |
| 10491 | 10491 | /** |
| 10492 | - * Counts all hours by airport |
|
| 10493 | - * |
|
| 10494 | - * @return Array the hour list |
|
| 10495 | - * |
|
| 10496 | - */ |
|
| 10492 | + * Counts all hours by airport |
|
| 10493 | + * |
|
| 10494 | + * @return Array the hour list |
|
| 10495 | + * |
|
| 10496 | + */ |
|
| 10497 | 10497 | public function countAllHoursByAirport($airport_icao, $filters = array()) |
| 10498 | 10498 | { |
| 10499 | 10499 | global $globalTimezone, $globalDBdriver; |
@@ -10537,11 +10537,11 @@ discard block |
||
| 10537 | 10537 | |
| 10538 | 10538 | |
| 10539 | 10539 | /** |
| 10540 | - * Counts all hours by manufacturer |
|
| 10541 | - * |
|
| 10542 | - * @return Array the hour list |
|
| 10543 | - * |
|
| 10544 | - */ |
|
| 10540 | + * Counts all hours by manufacturer |
|
| 10541 | + * |
|
| 10542 | + * @return Array the hour list |
|
| 10543 | + * |
|
| 10544 | + */ |
|
| 10545 | 10545 | public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array()) |
| 10546 | 10546 | { |
| 10547 | 10547 | global $globalTimezone, $globalDBdriver; |
@@ -10585,11 +10585,11 @@ discard block |
||
| 10585 | 10585 | |
| 10586 | 10586 | |
| 10587 | 10587 | /** |
| 10588 | - * Counts all hours by date |
|
| 10589 | - * |
|
| 10590 | - * @return Array the hour list |
|
| 10591 | - * |
|
| 10592 | - */ |
|
| 10588 | + * Counts all hours by date |
|
| 10589 | + * |
|
| 10590 | + * @return Array the hour list |
|
| 10591 | + * |
|
| 10592 | + */ |
|
| 10593 | 10593 | public function countAllHoursByDate($date, $filters = array()) |
| 10594 | 10594 | { |
| 10595 | 10595 | global $globalTimezone, $globalDBdriver; |
@@ -10633,11 +10633,11 @@ discard block |
||
| 10633 | 10633 | |
| 10634 | 10634 | |
| 10635 | 10635 | /** |
| 10636 | - * Counts all hours by a ident/callsign |
|
| 10637 | - * |
|
| 10638 | - * @return Array the hour list |
|
| 10639 | - * |
|
| 10640 | - */ |
|
| 10636 | + * Counts all hours by a ident/callsign |
|
| 10637 | + * |
|
| 10638 | + * @return Array the hour list |
|
| 10639 | + * |
|
| 10640 | + */ |
|
| 10641 | 10641 | public function countAllHoursByIdent($ident, $filters = array()) |
| 10642 | 10642 | { |
| 10643 | 10643 | global $globalTimezone, $globalDBdriver; |
@@ -10680,11 +10680,11 @@ discard block |
||
| 10680 | 10680 | } |
| 10681 | 10681 | |
| 10682 | 10682 | /** |
| 10683 | - * Counts all hours by a owner |
|
| 10684 | - * |
|
| 10685 | - * @return Array the hour list |
|
| 10686 | - * |
|
| 10687 | - */ |
|
| 10683 | + * Counts all hours by a owner |
|
| 10684 | + * |
|
| 10685 | + * @return Array the hour list |
|
| 10686 | + * |
|
| 10687 | + */ |
|
| 10688 | 10688 | public function countAllHoursByOwner($owner, $filters = array()) |
| 10689 | 10689 | { |
| 10690 | 10690 | global $globalTimezone, $globalDBdriver; |
@@ -10727,11 +10727,11 @@ discard block |
||
| 10727 | 10727 | } |
| 10728 | 10728 | |
| 10729 | 10729 | /** |
| 10730 | - * Counts all hours by a pilot |
|
| 10731 | - * |
|
| 10732 | - * @return Array the hour list |
|
| 10733 | - * |
|
| 10734 | - */ |
|
| 10730 | + * Counts all hours by a pilot |
|
| 10731 | + * |
|
| 10732 | + * @return Array the hour list |
|
| 10733 | + * |
|
| 10734 | + */ |
|
| 10735 | 10735 | public function countAllHoursByPilot($pilot, $filters = array()) |
| 10736 | 10736 | { |
| 10737 | 10737 | global $globalTimezone, $globalDBdriver; |
@@ -10776,11 +10776,11 @@ discard block |
||
| 10776 | 10776 | |
| 10777 | 10777 | |
| 10778 | 10778 | /** |
| 10779 | - * Counts all hours by route |
|
| 10780 | - * |
|
| 10781 | - * @return Array the hour list |
|
| 10782 | - * |
|
| 10783 | - */ |
|
| 10779 | + * Counts all hours by route |
|
| 10780 | + * |
|
| 10781 | + * @return Array the hour list |
|
| 10782 | + * |
|
| 10783 | + */ |
|
| 10784 | 10784 | public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array()) |
| 10785 | 10785 | { |
| 10786 | 10786 | global $globalTimezone, $globalDBdriver; |
@@ -10824,11 +10824,11 @@ discard block |
||
| 10824 | 10824 | |
| 10825 | 10825 | |
| 10826 | 10826 | /** |
| 10827 | - * Counts all hours by country |
|
| 10828 | - * |
|
| 10829 | - * @return Array the hour list |
|
| 10830 | - * |
|
| 10831 | - */ |
|
| 10827 | + * Counts all hours by country |
|
| 10828 | + * |
|
| 10829 | + * @return Array the hour list |
|
| 10830 | + * |
|
| 10831 | + */ |
|
| 10832 | 10832 | public function countAllHoursByCountry($country, $filters = array()) |
| 10833 | 10833 | { |
| 10834 | 10834 | global $globalTimezone, $globalDBdriver; |
@@ -10873,11 +10873,11 @@ discard block |
||
| 10873 | 10873 | |
| 10874 | 10874 | |
| 10875 | 10875 | /** |
| 10876 | - * Counts all aircraft that have flown over |
|
| 10877 | - * |
|
| 10878 | - * @return Integer the number of aircrafts |
|
| 10879 | - * |
|
| 10880 | - */ |
|
| 10876 | + * Counts all aircraft that have flown over |
|
| 10877 | + * |
|
| 10878 | + * @return Integer the number of aircrafts |
|
| 10879 | + * |
|
| 10880 | + */ |
|
| 10881 | 10881 | public function countOverallAircrafts($filters = array(),$year = '',$month = '') |
| 10882 | 10882 | { |
| 10883 | 10883 | global $globalDBdriver; |
@@ -10910,11 +10910,11 @@ discard block |
||
| 10910 | 10910 | } |
| 10911 | 10911 | |
| 10912 | 10912 | /** |
| 10913 | - * Counts all flight that really arrival |
|
| 10914 | - * |
|
| 10915 | - * @return Integer the number of aircrafts |
|
| 10916 | - * |
|
| 10917 | - */ |
|
| 10913 | + * Counts all flight that really arrival |
|
| 10914 | + * |
|
| 10915 | + * @return Integer the number of aircrafts |
|
| 10916 | + * |
|
| 10917 | + */ |
|
| 10918 | 10918 | public function countOverallArrival($filters = array(),$year = '',$month = '') |
| 10919 | 10919 | { |
| 10920 | 10920 | global $globalDBdriver; |
@@ -10947,11 +10947,11 @@ discard block |
||
| 10947 | 10947 | } |
| 10948 | 10948 | |
| 10949 | 10949 | /** |
| 10950 | - * Counts all pilots that have flown over |
|
| 10951 | - * |
|
| 10952 | - * @return Integer the number of pilots |
|
| 10953 | - * |
|
| 10954 | - */ |
|
| 10950 | + * Counts all pilots that have flown over |
|
| 10951 | + * |
|
| 10952 | + * @return Integer the number of pilots |
|
| 10953 | + * |
|
| 10954 | + */ |
|
| 10955 | 10955 | public function countOverallPilots($filters = array(),$year = '',$month = '') |
| 10956 | 10956 | { |
| 10957 | 10957 | global $globalDBdriver; |
@@ -10983,11 +10983,11 @@ discard block |
||
| 10983 | 10983 | } |
| 10984 | 10984 | |
| 10985 | 10985 | /** |
| 10986 | - * Counts all owners that have flown over |
|
| 10987 | - * |
|
| 10988 | - * @return Integer the number of owners |
|
| 10989 | - * |
|
| 10990 | - */ |
|
| 10986 | + * Counts all owners that have flown over |
|
| 10987 | + * |
|
| 10988 | + * @return Integer the number of owners |
|
| 10989 | + * |
|
| 10990 | + */ |
|
| 10991 | 10991 | public function countOverallOwners($filters = array(),$year = '',$month = '') |
| 10992 | 10992 | { |
| 10993 | 10993 | global $globalDBdriver; |
@@ -11020,11 +11020,11 @@ discard block |
||
| 11020 | 11020 | |
| 11021 | 11021 | |
| 11022 | 11022 | /** |
| 11023 | - * Counts all flights that have flown over |
|
| 11024 | - * |
|
| 11025 | - * @return Integer the number of flights |
|
| 11026 | - * |
|
| 11027 | - */ |
|
| 11023 | + * Counts all flights that have flown over |
|
| 11024 | + * |
|
| 11025 | + * @return Integer the number of flights |
|
| 11026 | + * |
|
| 11027 | + */ |
|
| 11028 | 11028 | public function countOverallFlights($filters = array(),$year = '',$month = '') |
| 11029 | 11029 | { |
| 11030 | 11030 | global $globalDBdriver; |
@@ -11058,11 +11058,11 @@ discard block |
||
| 11058 | 11058 | } |
| 11059 | 11059 | |
| 11060 | 11060 | /** |
| 11061 | - * Counts all military flights that have flown over |
|
| 11062 | - * |
|
| 11063 | - * @return Integer the number of flights |
|
| 11064 | - * |
|
| 11065 | - */ |
|
| 11061 | + * Counts all military flights that have flown over |
|
| 11062 | + * |
|
| 11063 | + * @return Integer the number of flights |
|
| 11064 | + * |
|
| 11065 | + */ |
|
| 11066 | 11066 | public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '') |
| 11067 | 11067 | { |
| 11068 | 11068 | global $globalDBdriver; |
@@ -11097,11 +11097,11 @@ discard block |
||
| 11097 | 11097 | |
| 11098 | 11098 | |
| 11099 | 11099 | /** |
| 11100 | - * Counts all airlines that have flown over |
|
| 11101 | - * |
|
| 11102 | - * @return Integer the number of airlines |
|
| 11103 | - * |
|
| 11104 | - */ |
|
| 11100 | + * Counts all airlines that have flown over |
|
| 11101 | + * |
|
| 11102 | + * @return Integer the number of airlines |
|
| 11103 | + * |
|
| 11104 | + */ |
|
| 11105 | 11105 | public function countOverallAirlines($filters = array(),$year = '',$month = '') |
| 11106 | 11106 | { |
| 11107 | 11107 | global $globalDBdriver; |
@@ -11128,8 +11128,8 @@ discard block |
||
| 11128 | 11128 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 11129 | 11129 | } |
| 11130 | 11130 | } |
| 11131 | - if ($query == '') $queryi .= $this->getFilter($filters); |
|
| 11132 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11131 | + if ($query == '') $queryi .= $this->getFilter($filters); |
|
| 11132 | + else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11133 | 11133 | |
| 11134 | 11134 | |
| 11135 | 11135 | $sth = $this->db->prepare($queryi); |
@@ -11139,11 +11139,11 @@ discard block |
||
| 11139 | 11139 | |
| 11140 | 11140 | |
| 11141 | 11141 | /** |
| 11142 | - * Counts all hours of today |
|
| 11143 | - * |
|
| 11144 | - * @return Array the hour list |
|
| 11145 | - * |
|
| 11146 | - */ |
|
| 11142 | + * Counts all hours of today |
|
| 11143 | + * |
|
| 11144 | + * @return Array the hour list |
|
| 11145 | + * |
|
| 11146 | + */ |
|
| 11147 | 11147 | public function countAllHoursFromToday($filters = array()) |
| 11148 | 11148 | { |
| 11149 | 11149 | global $globalTimezone, $globalDBdriver; |
@@ -11183,11 +11183,11 @@ discard block |
||
| 11183 | 11183 | } |
| 11184 | 11184 | |
| 11185 | 11185 | /** |
| 11186 | - * Gets all the spotter information based on calculated upcoming flights |
|
| 11187 | - * |
|
| 11188 | - * @return Array the spotter information |
|
| 11189 | - * |
|
| 11190 | - */ |
|
| 11186 | + * Gets all the spotter information based on calculated upcoming flights |
|
| 11187 | + * |
|
| 11188 | + * @return Array the spotter information |
|
| 11189 | + * |
|
| 11190 | + */ |
|
| 11191 | 11191 | public function getUpcomingFlights($limit = '', $sort = '', $filters = array()) |
| 11192 | 11192 | { |
| 11193 | 11193 | global $global_query, $globalDBdriver, $globalTimezone; |
@@ -11262,12 +11262,12 @@ discard block |
||
| 11262 | 11262 | } |
| 11263 | 11263 | |
| 11264 | 11264 | |
| 11265 | - /** |
|
| 11266 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 11267 | - * |
|
| 11268 | - * @return Integer the Barrie Spotter ID |
|
| 11265 | + /** |
|
| 11266 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 11267 | + * |
|
| 11268 | + * @return Integer the Barrie Spotter ID |
|
| 11269 | 11269 | q * |
| 11270 | - */ |
|
| 11270 | + */ |
|
| 11271 | 11271 | public function getSpotterIDBasedOnFlightAwareID($flightaware_id) |
| 11272 | 11272 | { |
| 11273 | 11273 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -11288,13 +11288,13 @@ discard block |
||
| 11288 | 11288 | |
| 11289 | 11289 | |
| 11290 | 11290 | /** |
| 11291 | - * Parses a date string |
|
| 11292 | - * |
|
| 11293 | - * @param String $dateString the date string |
|
| 11294 | - * @param String $timezone the timezone of a user |
|
| 11295 | - * @return Array the time information |
|
| 11296 | - * |
|
| 11297 | - */ |
|
| 11291 | + * Parses a date string |
|
| 11292 | + * |
|
| 11293 | + * @param String $dateString the date string |
|
| 11294 | + * @param String $timezone the timezone of a user |
|
| 11295 | + * @return Array the time information |
|
| 11296 | + * |
|
| 11297 | + */ |
|
| 11298 | 11298 | public function parseDateString($dateString, $timezone = '') |
| 11299 | 11299 | { |
| 11300 | 11300 | $time_array = array(); |
@@ -11330,12 +11330,12 @@ discard block |
||
| 11330 | 11330 | |
| 11331 | 11331 | |
| 11332 | 11332 | /** |
| 11333 | - * Parses the direction degrees to working |
|
| 11334 | - * |
|
| 11335 | - * @param Float $direction the direction in degrees |
|
| 11336 | - * @return Array the direction information |
|
| 11337 | - * |
|
| 11338 | - */ |
|
| 11333 | + * Parses the direction degrees to working |
|
| 11334 | + * |
|
| 11335 | + * @param Float $direction the direction in degrees |
|
| 11336 | + * @return Array the direction information |
|
| 11337 | + * |
|
| 11338 | + */ |
|
| 11339 | 11339 | public function parseDirection($direction = 0) |
| 11340 | 11340 | { |
| 11341 | 11341 | if ($direction == '') $direction = 0; |
@@ -11414,12 +11414,12 @@ discard block |
||
| 11414 | 11414 | |
| 11415 | 11415 | |
| 11416 | 11416 | /** |
| 11417 | - * Gets the aircraft registration |
|
| 11418 | - * |
|
| 11419 | - * @param String $flightaware_id the flight aware id |
|
| 11420 | - * @return String the aircraft registration |
|
| 11421 | - * |
|
| 11422 | - */ |
|
| 11417 | + * Gets the aircraft registration |
|
| 11418 | + * |
|
| 11419 | + * @param String $flightaware_id the flight aware id |
|
| 11420 | + * @return String the aircraft registration |
|
| 11421 | + * |
|
| 11422 | + */ |
|
| 11423 | 11423 | |
| 11424 | 11424 | public function getAircraftRegistration($flightaware_id) |
| 11425 | 11425 | { |
@@ -11448,12 +11448,12 @@ discard block |
||
| 11448 | 11448 | |
| 11449 | 11449 | |
| 11450 | 11450 | /** |
| 11451 | - * Gets the aircraft registration from ModeS |
|
| 11452 | - * |
|
| 11453 | - * @param String $aircraft_modes the flight ModeS in hex |
|
| 11454 | - * @return String the aircraft registration |
|
| 11455 | - * |
|
| 11456 | - */ |
|
| 11451 | + * Gets the aircraft registration from ModeS |
|
| 11452 | + * |
|
| 11453 | + * @param String $aircraft_modes the flight ModeS in hex |
|
| 11454 | + * @return String the aircraft registration |
|
| 11455 | + * |
|
| 11456 | + */ |
|
| 11457 | 11457 | public function getAircraftRegistrationBymodeS($aircraft_modes, $source_type = '') |
| 11458 | 11458 | { |
| 11459 | 11459 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -11469,8 +11469,8 @@ discard block |
||
| 11469 | 11469 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 11470 | 11470 | $sth->closeCursor(); |
| 11471 | 11471 | if (count($row) > 0) { |
| 11472 | - //return $row['Registration']; |
|
| 11473 | - return $row['registration']; |
|
| 11472 | + //return $row['Registration']; |
|
| 11473 | + return $row['registration']; |
|
| 11474 | 11474 | } elseif ($source_type == 'flarm') { |
| 11475 | 11475 | return $this->getAircraftRegistrationBymodeS($aircraft_modes); |
| 11476 | 11476 | } else return ''; |
@@ -11478,12 +11478,12 @@ discard block |
||
| 11478 | 11478 | } |
| 11479 | 11479 | |
| 11480 | 11480 | /** |
| 11481 | - * Gets the aircraft type from ModeS |
|
| 11482 | - * |
|
| 11483 | - * @param String $aircraft_modes the flight ModeS in hex |
|
| 11484 | - * @return String the aircraft type |
|
| 11485 | - * |
|
| 11486 | - */ |
|
| 11481 | + * Gets the aircraft type from ModeS |
|
| 11482 | + * |
|
| 11483 | + * @param String $aircraft_modes the flight ModeS in hex |
|
| 11484 | + * @return String the aircraft type |
|
| 11485 | + * |
|
| 11486 | + */ |
|
| 11487 | 11487 | public function getAircraftTypeBymodeS($aircraft_modes,$source_type = '') |
| 11488 | 11488 | { |
| 11489 | 11489 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -11509,12 +11509,12 @@ discard block |
||
| 11509 | 11509 | } |
| 11510 | 11510 | |
| 11511 | 11511 | /** |
| 11512 | - * Gets Country from latitude/longitude |
|
| 11513 | - * |
|
| 11514 | - * @param Float $latitude latitute of the flight |
|
| 11515 | - * @param Float $longitude longitute of the flight |
|
| 11516 | - * @return String the countrie |
|
| 11517 | - */ |
|
| 11512 | + * Gets Country from latitude/longitude |
|
| 11513 | + * |
|
| 11514 | + * @param Float $latitude latitute of the flight |
|
| 11515 | + * @param Float $longitude longitute of the flight |
|
| 11516 | + * @return String the countrie |
|
| 11517 | + */ |
|
| 11518 | 11518 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
| 11519 | 11519 | { |
| 11520 | 11520 | global $globalDBdriver, $globalDebug; |
@@ -11551,11 +11551,11 @@ discard block |
||
| 11551 | 11551 | } |
| 11552 | 11552 | |
| 11553 | 11553 | /** |
| 11554 | - * Gets Country from iso2 |
|
| 11555 | - * |
|
| 11556 | - * @param String $iso2 ISO2 country code |
|
| 11557 | - * @return String the countrie |
|
| 11558 | - */ |
|
| 11554 | + * Gets Country from iso2 |
|
| 11555 | + * |
|
| 11556 | + * @param String $iso2 ISO2 country code |
|
| 11557 | + * @return String the countrie |
|
| 11558 | + */ |
|
| 11559 | 11559 | public function getCountryFromISO2($iso2) |
| 11560 | 11560 | { |
| 11561 | 11561 | global $globalDBdriver, $globalDebug; |
@@ -11583,12 +11583,12 @@ discard block |
||
| 11583 | 11583 | } |
| 11584 | 11584 | |
| 11585 | 11585 | /** |
| 11586 | - * converts the registration code using the country prefix |
|
| 11587 | - * |
|
| 11588 | - * @param String $registration the aircraft registration |
|
| 11589 | - * @return String the aircraft registration |
|
| 11590 | - * |
|
| 11591 | - */ |
|
| 11586 | + * converts the registration code using the country prefix |
|
| 11587 | + * |
|
| 11588 | + * @param String $registration the aircraft registration |
|
| 11589 | + * @return String the aircraft registration |
|
| 11590 | + * |
|
| 11591 | + */ |
|
| 11592 | 11592 | public function convertAircraftRegistration($registration) |
| 11593 | 11593 | { |
| 11594 | 11594 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -11640,12 +11640,12 @@ discard block |
||
| 11640 | 11640 | } |
| 11641 | 11641 | |
| 11642 | 11642 | /** |
| 11643 | - * Country from the registration code |
|
| 11644 | - * |
|
| 11645 | - * @param String $registration the aircraft registration |
|
| 11646 | - * @return String the country |
|
| 11647 | - * |
|
| 11648 | - */ |
|
| 11643 | + * Country from the registration code |
|
| 11644 | + * |
|
| 11645 | + * @param String $registration the aircraft registration |
|
| 11646 | + * @return String the country |
|
| 11647 | + * |
|
| 11648 | + */ |
|
| 11649 | 11649 | public function countryFromAircraftRegistration($registration) |
| 11650 | 11650 | { |
| 11651 | 11651 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -11664,8 +11664,8 @@ discard block |
||
| 11664 | 11664 | $country = $row['country']; |
| 11665 | 11665 | } |
| 11666 | 11666 | } else { |
| 11667 | - $registration_1 = substr($registration, 0, 1); |
|
| 11668 | - $registration_2 = substr($registration, 0, 2); |
|
| 11667 | + $registration_1 = substr($registration, 0, 1); |
|
| 11668 | + $registration_2 = substr($registration, 0, 2); |
|
| 11669 | 11669 | |
| 11670 | 11670 | $country = ''; |
| 11671 | 11671 | //first get the prefix based on two characters |
@@ -11701,12 +11701,12 @@ discard block |
||
| 11701 | 11701 | } |
| 11702 | 11702 | |
| 11703 | 11703 | /** |
| 11704 | - * Registration prefix from the registration code |
|
| 11705 | - * |
|
| 11706 | - * @param String $registration the aircraft registration |
|
| 11707 | - * @return String the registration prefix |
|
| 11708 | - * |
|
| 11709 | - */ |
|
| 11704 | + * Registration prefix from the registration code |
|
| 11705 | + * |
|
| 11706 | + * @param String $registration the aircraft registration |
|
| 11707 | + * @return String the registration prefix |
|
| 11708 | + * |
|
| 11709 | + */ |
|
| 11710 | 11710 | public function registrationPrefixFromAircraftRegistration($registration) |
| 11711 | 11711 | { |
| 11712 | 11712 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -11725,8 +11725,8 @@ discard block |
||
| 11725 | 11725 | //$country = $row['country']; |
| 11726 | 11726 | } |
| 11727 | 11727 | } else { |
| 11728 | - $registration_1 = substr($registration, 0, 1); |
|
| 11729 | - $registration_2 = substr($registration, 0, 2); |
|
| 11728 | + $registration_1 = substr($registration, 0, 1); |
|
| 11729 | + $registration_2 = substr($registration, 0, 2); |
|
| 11730 | 11730 | |
| 11731 | 11731 | //first get the prefix based on two characters |
| 11732 | 11732 | $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
@@ -11762,12 +11762,12 @@ discard block |
||
| 11762 | 11762 | |
| 11763 | 11763 | |
| 11764 | 11764 | /** |
| 11765 | - * Country from the registration code |
|
| 11766 | - * |
|
| 11767 | - * @param String $registration the aircraft registration |
|
| 11768 | - * @return String the country |
|
| 11769 | - * |
|
| 11770 | - */ |
|
| 11765 | + * Country from the registration code |
|
| 11766 | + * |
|
| 11767 | + * @param String $registration the aircraft registration |
|
| 11768 | + * @return String the country |
|
| 11769 | + * |
|
| 11770 | + */ |
|
| 11771 | 11771 | public function countryFromAircraftRegistrationCode($registration) |
| 11772 | 11772 | { |
| 11773 | 11773 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -11784,11 +11784,11 @@ discard block |
||
| 11784 | 11784 | } |
| 11785 | 11785 | |
| 11786 | 11786 | /** |
| 11787 | - * Set a new highlight value for a flight |
|
| 11788 | - * |
|
| 11789 | - * @param String $flightaware_id flightaware_id from spotter_output table |
|
| 11790 | - * @param String $highlight New highlight value |
|
| 11791 | - */ |
|
| 11787 | + * Set a new highlight value for a flight |
|
| 11788 | + * |
|
| 11789 | + * @param String $flightaware_id flightaware_id from spotter_output table |
|
| 11790 | + * @param String $highlight New highlight value |
|
| 11791 | + */ |
|
| 11792 | 11792 | public function setHighlightFlight($flightaware_id,$highlight) { |
| 11793 | 11793 | |
| 11794 | 11794 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
@@ -11797,12 +11797,12 @@ discard block |
||
| 11797 | 11797 | } |
| 11798 | 11798 | |
| 11799 | 11799 | /** |
| 11800 | - * Set a new highlight value for a flight by Registration |
|
| 11801 | - * |
|
| 11802 | - * @param String $registration Registration of the aircraft |
|
| 11803 | - * @param String $date Date of spotted aircraft |
|
| 11804 | - * @param String $highlight New highlight value |
|
| 11805 | - */ |
|
| 11800 | + * Set a new highlight value for a flight by Registration |
|
| 11801 | + * |
|
| 11802 | + * @param String $registration Registration of the aircraft |
|
| 11803 | + * @param String $date Date of spotted aircraft |
|
| 11804 | + * @param String $highlight New highlight value |
|
| 11805 | + */ |
|
| 11806 | 11806 | public function setHighlightFlightByRegistration($registration,$highlight, $date = '') { |
| 11807 | 11807 | if ($date == '') { |
| 11808 | 11808 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)"; |
@@ -11816,12 +11816,12 @@ discard block |
||
| 11816 | 11816 | } |
| 11817 | 11817 | |
| 11818 | 11818 | /** |
| 11819 | - * Gets the short url from bit.ly |
|
| 11820 | - * |
|
| 11821 | - * @param String $url the full url |
|
| 11822 | - * @return String the bit.ly url |
|
| 11823 | - * |
|
| 11824 | - */ |
|
| 11819 | + * Gets the short url from bit.ly |
|
| 11820 | + * |
|
| 11821 | + * @param String $url the full url |
|
| 11822 | + * @return String the bit.ly url |
|
| 11823 | + * |
|
| 11824 | + */ |
|
| 11825 | 11825 | public function getBitlyURL($url) |
| 11826 | 11826 | { |
| 11827 | 11827 | global $globalBitlyAccessToken; |
@@ -12110,11 +12110,11 @@ discard block |
||
| 12110 | 12110 | $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 |
| 12111 | 12111 | 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)) |
| 12112 | 12112 | 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;"; |
| 12113 | - } else { |
|
| 12113 | + } else { |
|
| 12114 | 12114 | $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 |
| 12115 | 12115 | 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)) |
| 12116 | 12116 | 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;"; |
| 12117 | - } |
|
| 12117 | + } |
|
| 12118 | 12118 | $sth = $this->db->prepare($query); |
| 12119 | 12119 | $sth->execute(); |
| 12120 | 12120 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -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,62 +59,62 @@ 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, $globalDBdriver; |
| 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 | 72 | if (isset($filter[0]['source'])) { |
| 73 | - $filters = array_merge($filters,$filter); |
|
| 73 | + $filters = array_merge($filters, $filter); |
|
| 74 | 74 | } |
| 75 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 75 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 76 | 76 | $filter_query_join = ''; |
| 77 | 77 | $filter_query_where = ''; |
| 78 | - foreach($filters as $flt) { |
|
| 78 | + foreach ($filters as $flt) { |
|
| 79 | 79 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
| 80 | 80 | if ($flt['airlines'][0] != '') { |
| 81 | 81 | if (isset($flt['source'])) { |
| 82 | - $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'])."')) saf ON saf.flightaware_id = spotter_output.flightaware_id"; |
|
| 82 | + $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'])."')) saf ON saf.flightaware_id = spotter_output.flightaware_id"; |
|
| 83 | 83 | } else { |
| 84 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_output.flightaware_id"; |
|
| 84 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_output.flightaware_id"; |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
| 89 | 89 | if (isset($flt['source'])) { |
| 90 | - $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'])."')) spf ON spf.flightaware_id = spotter_output.flightaware_id"; |
|
| 90 | + $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'])."')) spf ON spf.flightaware_id = spotter_output.flightaware_id"; |
|
| 91 | 91 | } else { |
| 92 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spf ON spf.flightaware_id = spotter_output.flightaware_id"; |
|
| 92 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spf ON spf.flightaware_id = spotter_output.flightaware_id"; |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
| 96 | 96 | if (isset($flt['source'])) { |
| 97 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.flightaware_id = spotter_output.flightaware_id"; |
|
| 97 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.flightaware_id = spotter_output.flightaware_id"; |
|
| 98 | 98 | } else { |
| 99 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.flightaware_id = spotter_output.flightaware_id"; |
|
| 99 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.flightaware_id = spotter_output.flightaware_id"; |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
| 103 | 103 | if (isset($flt['source'])) { |
| 104 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_output.flightaware_id"; |
|
| 104 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_output.flightaware_id"; |
|
| 105 | 105 | } else { |
| 106 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_output.flightaware_id"; |
|
| 106 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_output.flightaware_id"; |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents']) && isset($flt['registrations']) && empty($flt['registrations'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
| 110 | 110 | if (isset($flt['source'])) { |
| 111 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sf ON sf.flightaware_id = spotter_output.flightaware_id"; |
|
| 111 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sf ON sf.flightaware_id = spotter_output.flightaware_id"; |
|
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 116 | 116 | if ($filter['airlines'][0] != '') { |
| 117 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sof ON sof.flightaware_id = spotter_output.flightaware_id"; |
|
| 117 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sof ON sof.flightaware_id = spotter_output.flightaware_id"; |
|
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
@@ -124,16 +124,16 @@ discard block |
||
| 124 | 124 | $filter_query_join .= " INNER JOIN (SELECT icao FROM airlines WHERE alliance = '".$filter['alliance']."') sal ON sal.icao = spotter_output.airline_icao "; |
| 125 | 125 | } |
| 126 | 126 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
| 127 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) spid ON spid.flightaware_id = spotter_output.flightaware_id"; |
|
| 127 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) spid ON spid.flightaware_id = spotter_output.flightaware_id"; |
|
| 128 | 128 | } |
| 129 | 129 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 130 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 130 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 131 | 131 | } |
| 132 | 132 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 133 | 133 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
| 134 | 134 | } |
| 135 | 135 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 136 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 136 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 137 | 137 | } |
| 138 | 138 | if (isset($filter['year']) && $filter['year'] != '') { |
| 139 | 139 | if ($globalDBdriver == 'mysql') { |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
| 160 | 160 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
| 161 | 161 | if ($filter_query_where != '') { |
| 162 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
| 162 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
| 163 | 163 | } |
| 164 | 164 | $filter_query = $filter_query_join.$filter_query_where; |
| 165 | 165 | return $filter_query; |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | * @return Array the spotter information |
| 175 | 175 | * |
| 176 | 176 | */ |
| 177 | - public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
|
| 177 | + public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false) |
|
| 178 | 178 | { |
| 179 | 179 | global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM; |
| 180 | 180 | $Image = new Image($this->db); |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | $sth = $this->db->prepare($query.$limitQuery); |
| 205 | 205 | $sth->execute($params); |
| 206 | 206 | } catch (PDOException $e) { |
| 207 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
| 207 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
| 208 | 208 | exit(); |
| 209 | 209 | } |
| 210 | 210 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $spotter_array = array(); |
| 215 | 215 | |
| 216 | 216 | |
| 217 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 217 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 218 | 218 | { |
| 219 | 219 | $num_rows++; |
| 220 | 220 | $temp_array = array(); |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
| 259 | 259 | if (isset($row['route_stop']) && $row['route_stop'] != '') { |
| 260 | 260 | $temp_array['route_stop'] = $row['route_stop']; |
| 261 | - $allroute = explode(' ',$row['route_stop']); |
|
| 261 | + $allroute = explode(' ', $row['route_stop']); |
|
| 262 | 262 | foreach ($allroute as $route) { |
| 263 | 263 | $route_airport_array = $this->getAllAirportInfo($route); |
| 264 | 264 | if (isset($route_airport_array[0]['name'])) { |
@@ -311,17 +311,17 @@ discard block |
||
| 311 | 311 | { |
| 312 | 312 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
| 313 | 313 | } else { |
| 314 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
| 314 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
| 315 | 315 | } |
| 316 | 316 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
| 317 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
| 318 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
| 317 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
| 318 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
| 319 | 319 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
| 320 | 320 | if (isset($row['last_seen']) && $row['last_seen'] != '') { |
| 321 | 321 | if (strtotime($row['last_seen']) > strtotime($row['date'])) { |
| 322 | 322 | $temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']); |
| 323 | - $temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC")); |
|
| 324 | - $temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC")); |
|
| 323 | + $temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC")); |
|
| 324 | + $temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC")); |
|
| 325 | 325 | $temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC"); |
| 326 | 326 | } |
| 327 | 327 | } |
@@ -357,9 +357,9 @@ discard block |
||
| 357 | 357 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
| 358 | 358 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
| 359 | 359 | if (is_numeric(substr($row['ident'], 2, 1))) { |
| 360 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource); |
|
| 360 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource); |
|
| 361 | 361 | } elseif (is_numeric(substr($row['ident'], 3, 1))) { |
| 362 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
|
| 362 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource); |
|
| 363 | 363 | } else { |
| 364 | 364 | $airline_array = $this->getAllAirlineInfo('NA'); |
| 365 | 365 | } |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | } |
| 397 | 397 | } |
| 398 | 398 | if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') { |
| 399 | - $acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3)); |
|
| 399 | + $acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3)); |
|
| 400 | 400 | //$acars_array = ACARS->getLiveAcarsData('BA40YL'); |
| 401 | 401 | if (count($acars_array) > 0) { |
| 402 | 402 | $temp_array['acars'] = $acars_array; |
@@ -413,11 +413,11 @@ discard block |
||
| 413 | 413 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | - if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
|
| 416 | + if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
|
| 417 | 417 | { |
| 418 | 418 | if ($globalIVAO) { |
| 419 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 420 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 419 | + if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']); |
|
| 420 | + else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']); |
|
| 421 | 421 | } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
| 422 | 422 | if (count($image_array) > 0) { |
| 423 | 423 | $temp_array['image'] = $image_array[0]['image']; |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | - if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
| 444 | + if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
| 445 | 445 | if ($schedules === true) { |
| 446 | 446 | $schedule_array = $Schedule->getSchedule($temp_array['ident']); |
| 447 | 447 | //print_r($schedule_array); |
@@ -523,12 +523,12 @@ discard block |
||
| 523 | 523 | if (isset($row['squawk'])) { |
| 524 | 524 | $temp_array['squawk'] = $row['squawk']; |
| 525 | 525 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
| 526 | - $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
|
| 527 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 526 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']); |
|
| 527 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
| 528 | 528 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
| 529 | - $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
|
| 530 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 531 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 529 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']); |
|
| 530 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
| 531 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | $temp_array['query_number_rows'] = $num_rows; |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | * @return Array the spotter information |
| 548 | 548 | * |
| 549 | 549 | */ |
| 550 | - 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()) |
|
| 550 | + 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()) |
|
| 551 | 551 | { |
| 552 | 552 | global $globalTimezone, $globalDBdriver; |
| 553 | 553 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | |
| 558 | 558 | $query_values = array(); |
| 559 | 559 | $additional_query = ''; |
| 560 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 560 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 561 | 561 | if ($q != "") |
| 562 | 562 | { |
| 563 | 563 | if (!is_string($q)) |
@@ -565,8 +565,8 @@ discard block |
||
| 565 | 565 | return false; |
| 566 | 566 | } else { |
| 567 | 567 | $q_array = explode(" ", $q); |
| 568 | - foreach ($q_array as $q_item){ |
|
| 569 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 568 | + foreach ($q_array as $q_item) { |
|
| 569 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 570 | 570 | $additional_query .= " AND ("; |
| 571 | 571 | if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
| 572 | 572 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -598,37 +598,37 @@ discard block |
||
| 598 | 598 | |
| 599 | 599 | if ($registration != "") |
| 600 | 600 | { |
| 601 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 601 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 602 | 602 | if (!is_string($registration)) |
| 603 | 603 | { |
| 604 | 604 | return false; |
| 605 | 605 | } else { |
| 606 | 606 | $additional_query .= " AND spotter_output.registration = :registration"; |
| 607 | - $query_values = array_merge($query_values,array(':registration' => $registration)); |
|
| 607 | + $query_values = array_merge($query_values, array(':registration' => $registration)); |
|
| 608 | 608 | } |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | if ($aircraft_icao != "") |
| 612 | 612 | { |
| 613 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 613 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 614 | 614 | if (!is_string($aircraft_icao)) |
| 615 | 615 | { |
| 616 | 616 | return false; |
| 617 | 617 | } else { |
| 618 | 618 | $additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao"; |
| 619 | - $query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao)); |
|
| 619 | + $query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao)); |
|
| 620 | 620 | } |
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | if ($aircraft_manufacturer != "") |
| 624 | 624 | { |
| 625 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 625 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 626 | 626 | if (!is_string($aircraft_manufacturer)) |
| 627 | 627 | { |
| 628 | 628 | return false; |
| 629 | 629 | } else { |
| 630 | 630 | $additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer"; |
| 631 | - $query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
|
| 631 | + $query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
|
| 632 | 632 | } |
| 633 | 633 | } |
| 634 | 634 | |
@@ -644,25 +644,25 @@ discard block |
||
| 644 | 644 | |
| 645 | 645 | if ($airline_icao != "") |
| 646 | 646 | { |
| 647 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 647 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 648 | 648 | if (!is_string($airline_icao)) |
| 649 | 649 | { |
| 650 | 650 | return false; |
| 651 | 651 | } else { |
| 652 | 652 | $additional_query .= " AND spotter_output.airline_icao = :airline_icao"; |
| 653 | - $query_values = array_merge($query_values,array(':airline_icao' => $airline_icao)); |
|
| 653 | + $query_values = array_merge($query_values, array(':airline_icao' => $airline_icao)); |
|
| 654 | 654 | } |
| 655 | 655 | } |
| 656 | 656 | |
| 657 | 657 | if ($airline_country != "") |
| 658 | 658 | { |
| 659 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
| 659 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
| 660 | 660 | if (!is_string($airline_country)) |
| 661 | 661 | { |
| 662 | 662 | return false; |
| 663 | 663 | } else { |
| 664 | 664 | $additional_query .= " AND spotter_output.airline_country = :airline_country"; |
| 665 | - $query_values = array_merge($query_values,array(':airline_country' => $airline_country)); |
|
| 665 | + $query_values = array_merge($query_values, array(':airline_country' => $airline_country)); |
|
| 666 | 666 | } |
| 667 | 667 | } |
| 668 | 668 | |
@@ -689,31 +689,31 @@ discard block |
||
| 689 | 689 | |
| 690 | 690 | if ($airport != "") |
| 691 | 691 | { |
| 692 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
| 692 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
| 693 | 693 | if (!is_string($airport)) |
| 694 | 694 | { |
| 695 | 695 | return false; |
| 696 | 696 | } else { |
| 697 | 697 | $additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)"; |
| 698 | - $query_values = array_merge($query_values,array(':airport' => $airport)); |
|
| 698 | + $query_values = array_merge($query_values, array(':airport' => $airport)); |
|
| 699 | 699 | } |
| 700 | 700 | } |
| 701 | 701 | |
| 702 | 702 | if ($airport_country != "") |
| 703 | 703 | { |
| 704 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
| 704 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
| 705 | 705 | if (!is_string($airport_country)) |
| 706 | 706 | { |
| 707 | 707 | return false; |
| 708 | 708 | } else { |
| 709 | 709 | $additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)"; |
| 710 | - $query_values = array_merge($query_values,array(':airport_country' => $airport_country)); |
|
| 710 | + $query_values = array_merge($query_values, array(':airport_country' => $airport_country)); |
|
| 711 | 711 | } |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | 714 | if ($callsign != "") |
| 715 | 715 | { |
| 716 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 716 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 717 | 717 | if (!is_string($callsign)) |
| 718 | 718 | { |
| 719 | 719 | return false; |
@@ -721,79 +721,79 @@ discard block |
||
| 721 | 721 | $translate = $Translation->ident2icao($callsign); |
| 722 | 722 | if ($translate != $callsign) { |
| 723 | 723 | $additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)"; |
| 724 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
| 724 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
| 725 | 725 | } else { |
| 726 | 726 | $additional_query .= " AND spotter_output.ident = :callsign"; |
| 727 | - $query_values = array_merge($query_values,array(':callsign' => $callsign)); |
|
| 727 | + $query_values = array_merge($query_values, array(':callsign' => $callsign)); |
|
| 728 | 728 | } |
| 729 | 729 | } |
| 730 | 730 | } |
| 731 | 731 | |
| 732 | 732 | if ($owner != "") |
| 733 | 733 | { |
| 734 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 734 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 735 | 735 | if (!is_string($owner)) |
| 736 | 736 | { |
| 737 | 737 | return false; |
| 738 | 738 | } else { |
| 739 | 739 | $additional_query .= " AND spotter_output.owner_name = :owner"; |
| 740 | - $query_values = array_merge($query_values,array(':owner' => $owner)); |
|
| 740 | + $query_values = array_merge($query_values, array(':owner' => $owner)); |
|
| 741 | 741 | } |
| 742 | 742 | } |
| 743 | 743 | |
| 744 | 744 | if ($pilot_name != "") |
| 745 | 745 | { |
| 746 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 746 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 747 | 747 | if (!is_string($pilot_name)) |
| 748 | 748 | { |
| 749 | 749 | return false; |
| 750 | 750 | } else { |
| 751 | 751 | $additional_query .= " AND spotter_output.pilot_name = :pilot_name"; |
| 752 | - $query_values = array_merge($query_values,array(':pilot_name' => $pilot_name)); |
|
| 752 | + $query_values = array_merge($query_values, array(':pilot_name' => $pilot_name)); |
|
| 753 | 753 | } |
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | if ($pilot_id != "") |
| 757 | 757 | { |
| 758 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
| 758 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
| 759 | 759 | if (!is_string($pilot_id)) |
| 760 | 760 | { |
| 761 | 761 | return false; |
| 762 | 762 | } else { |
| 763 | 763 | $additional_query .= " AND spotter_output.pilot_id = :pilot_id"; |
| 764 | - $query_values = array_merge($query_values,array(':pilot_id' => $pilot_id)); |
|
| 764 | + $query_values = array_merge($query_values, array(':pilot_id' => $pilot_id)); |
|
| 765 | 765 | } |
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | if ($departure_airport_route != "") |
| 769 | 769 | { |
| 770 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
| 770 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
| 771 | 771 | if (!is_string($departure_airport_route)) |
| 772 | 772 | { |
| 773 | 773 | return false; |
| 774 | 774 | } else { |
| 775 | 775 | $additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route"; |
| 776 | - $query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route)); |
|
| 776 | + $query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route)); |
|
| 777 | 777 | } |
| 778 | 778 | } |
| 779 | 779 | |
| 780 | 780 | if ($arrival_airport_route != "") |
| 781 | 781 | { |
| 782 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
| 782 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
| 783 | 783 | if (!is_string($arrival_airport_route)) |
| 784 | 784 | { |
| 785 | 785 | return false; |
| 786 | 786 | } else { |
| 787 | 787 | $additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route"; |
| 788 | - $query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route)); |
|
| 788 | + $query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route)); |
|
| 789 | 789 | } |
| 790 | 790 | } |
| 791 | 791 | |
| 792 | 792 | if ($altitude != "") |
| 793 | 793 | { |
| 794 | 794 | $altitude_array = explode(",", $altitude); |
| 795 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 796 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 795 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 796 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 797 | 797 | |
| 798 | 798 | if ($altitude_array[1] != "") |
| 799 | 799 | { |
@@ -809,8 +809,8 @@ discard block |
||
| 809 | 809 | if ($date_posted != "") |
| 810 | 810 | { |
| 811 | 811 | $date_array = explode(",", $date_posted); |
| 812 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
| 813 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
| 812 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
| 813 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
| 814 | 814 | |
| 815 | 815 | if ($globalTimezone != '') { |
| 816 | 816 | date_default_timezone_set($globalTimezone); |
@@ -841,8 +841,8 @@ discard block |
||
| 841 | 841 | { |
| 842 | 842 | $limit_array = explode(",", $limit); |
| 843 | 843 | |
| 844 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 845 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 844 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 845 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 846 | 846 | |
| 847 | 847 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 848 | 848 | { |
@@ -871,23 +871,23 @@ discard block |
||
| 871 | 871 | |
| 872 | 872 | |
| 873 | 873 | if ($origLat != "" && $origLon != "" && $dist != "") { |
| 874 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
| 874 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
| 875 | 875 | |
| 876 | 876 | if ($globalDBdriver == 'mysql') { |
| 877 | - $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 |
|
| 877 | + $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 |
|
| 878 | 878 | 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)) |
| 879 | 879 | 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; |
| 880 | 880 | } else { |
| 881 | - $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 |
|
| 881 | + $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 |
|
| 882 | 882 | 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)) |
| 883 | 883 | 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; |
| 884 | 884 | } |
| 885 | 885 | } else { |
| 886 | - $query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' |
|
| 886 | + $query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' |
|
| 887 | 887 | ".$additional_query." |
| 888 | 888 | ".$orderby_query; |
| 889 | 889 | } |
| 890 | - $spotter_array = $this->getDataFromDB($query, $query_values,$limit_query); |
|
| 890 | + $spotter_array = $this->getDataFromDB($query, $query_values, $limit_query); |
|
| 891 | 891 | return $spotter_array; |
| 892 | 892 | } |
| 893 | 893 | |
@@ -910,8 +910,8 @@ discard block |
||
| 910 | 910 | { |
| 911 | 911 | $limit_array = explode(",", $limit); |
| 912 | 912 | |
| 913 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 914 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 913 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 914 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 915 | 915 | |
| 916 | 916 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 917 | 917 | { |
@@ -928,9 +928,9 @@ discard block |
||
| 928 | 928 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 929 | 929 | } |
| 930 | 930 | |
| 931 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
| 931 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
| 932 | 932 | |
| 933 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
| 933 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
| 934 | 934 | |
| 935 | 935 | return $spotter_array; |
| 936 | 936 | } |
@@ -976,34 +976,34 @@ discard block |
||
| 976 | 976 | { |
| 977 | 977 | return false; |
| 978 | 978 | } else { |
| 979 | - if ($interval == "30m"){ |
|
| 979 | + if ($interval == "30m") { |
|
| 980 | 980 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date '; |
| 981 | - } else if ($interval == "1h"){ |
|
| 981 | + } else if ($interval == "1h") { |
|
| 982 | 982 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date '; |
| 983 | - } else if ($interval == "3h"){ |
|
| 983 | + } else if ($interval == "3h") { |
|
| 984 | 984 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date '; |
| 985 | - } else if ($interval == "6h"){ |
|
| 985 | + } else if ($interval == "6h") { |
|
| 986 | 986 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date '; |
| 987 | - } else if ($interval == "12h"){ |
|
| 987 | + } else if ($interval == "12h") { |
|
| 988 | 988 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date '; |
| 989 | - } else if ($interval == "24h"){ |
|
| 989 | + } else if ($interval == "24h") { |
|
| 990 | 990 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date '; |
| 991 | - } else if ($interval == "7d"){ |
|
| 991 | + } else if ($interval == "7d") { |
|
| 992 | 992 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date '; |
| 993 | - } else if ($interval == "30d"){ |
|
| 993 | + } else if ($interval == "30d") { |
|
| 994 | 994 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date '; |
| 995 | 995 | } |
| 996 | 996 | } |
| 997 | 997 | } |
| 998 | 998 | |
| 999 | - $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 |
|
| 999 | + $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 |
|
| 1000 | 1000 | WHERE spotter_output.latitude <> '' |
| 1001 | 1001 | AND spotter_output.longitude <> '' |
| 1002 | 1002 | ".$additional_query." |
| 1003 | 1003 | HAVING distance < :radius |
| 1004 | 1004 | ORDER BY distance"; |
| 1005 | 1005 | |
| 1006 | - $spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query); |
|
| 1006 | + $spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query); |
|
| 1007 | 1007 | |
| 1008 | 1008 | return $spotter_array; |
| 1009 | 1009 | } |
@@ -1015,21 +1015,21 @@ discard block |
||
| 1015 | 1015 | * @return Array the spotter information |
| 1016 | 1016 | * |
| 1017 | 1017 | */ |
| 1018 | - public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array()) |
|
| 1018 | + public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array()) |
|
| 1019 | 1019 | { |
| 1020 | 1020 | global $global_query; |
| 1021 | 1021 | |
| 1022 | 1022 | date_default_timezone_set('UTC'); |
| 1023 | 1023 | |
| 1024 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1024 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1025 | 1025 | |
| 1026 | 1026 | $limit_query = ''; |
| 1027 | 1027 | if ($limit != "") |
| 1028 | 1028 | { |
| 1029 | 1029 | $limit_array = explode(",", $limit); |
| 1030 | 1030 | |
| 1031 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1032 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1031 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1032 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1033 | 1033 | |
| 1034 | 1034 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1035 | 1035 | { |
@@ -1046,7 +1046,7 @@ discard block |
||
| 1046 | 1046 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | - $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; |
|
| 1049 | + $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; |
|
| 1050 | 1050 | |
| 1051 | 1051 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1052 | 1052 | |
@@ -1065,15 +1065,15 @@ discard block |
||
| 1065 | 1065 | global $global_query; |
| 1066 | 1066 | |
| 1067 | 1067 | date_default_timezone_set('UTC'); |
| 1068 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1068 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1069 | 1069 | |
| 1070 | 1070 | $limit_query = ''; |
| 1071 | 1071 | if ($limit != "") |
| 1072 | 1072 | { |
| 1073 | 1073 | $limit_array = explode(",", $limit); |
| 1074 | 1074 | |
| 1075 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1076 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1075 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1076 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1077 | 1077 | |
| 1078 | 1078 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1079 | 1079 | { |
@@ -1090,7 +1090,7 @@ discard block |
||
| 1090 | 1090 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1091 | 1091 | } |
| 1092 | 1092 | |
| 1093 | - $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; |
|
| 1093 | + $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; |
|
| 1094 | 1094 | |
| 1095 | 1095 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1096 | 1096 | |
@@ -1104,20 +1104,20 @@ discard block |
||
| 1104 | 1104 | * @return Array the spotter information |
| 1105 | 1105 | * |
| 1106 | 1106 | */ |
| 1107 | - public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array()) |
|
| 1107 | + public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array()) |
|
| 1108 | 1108 | { |
| 1109 | 1109 | global $global_query; |
| 1110 | 1110 | |
| 1111 | 1111 | date_default_timezone_set('UTC'); |
| 1112 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1112 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1113 | 1113 | |
| 1114 | 1114 | $limit_query = ''; |
| 1115 | 1115 | if ($limit != "") |
| 1116 | 1116 | { |
| 1117 | 1117 | $limit_array = explode(",", $limit); |
| 1118 | 1118 | |
| 1119 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1120 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1119 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1120 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1121 | 1121 | |
| 1122 | 1122 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1123 | 1123 | { |
@@ -1134,7 +1134,7 @@ discard block |
||
| 1134 | 1134 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | - $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; |
|
| 1137 | + $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; |
|
| 1138 | 1138 | |
| 1139 | 1139 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1140 | 1140 | |
@@ -1154,7 +1154,7 @@ discard block |
||
| 1154 | 1154 | |
| 1155 | 1155 | date_default_timezone_set('UTC'); |
| 1156 | 1156 | |
| 1157 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1157 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1158 | 1158 | |
| 1159 | 1159 | $limit_query = ''; |
| 1160 | 1160 | |
@@ -1162,8 +1162,8 @@ discard block |
||
| 1162 | 1162 | { |
| 1163 | 1163 | $limit_array = explode(",", $limit); |
| 1164 | 1164 | |
| 1165 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1166 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1165 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1166 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1167 | 1167 | |
| 1168 | 1168 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1169 | 1169 | { |
@@ -1180,7 +1180,7 @@ discard block |
||
| 1180 | 1180 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1181 | 1181 | } |
| 1182 | 1182 | |
| 1183 | - $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; |
|
| 1183 | + $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; |
|
| 1184 | 1184 | |
| 1185 | 1185 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1186 | 1186 | |
@@ -1199,14 +1199,14 @@ discard block |
||
| 1199 | 1199 | global $global_query; |
| 1200 | 1200 | |
| 1201 | 1201 | date_default_timezone_set('UTC'); |
| 1202 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1202 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1203 | 1203 | $limit_query = ''; |
| 1204 | 1204 | if ($limit != "") |
| 1205 | 1205 | { |
| 1206 | 1206 | $limit_array = explode(",", $limit); |
| 1207 | 1207 | |
| 1208 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1209 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1208 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1209 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1210 | 1210 | |
| 1211 | 1211 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1212 | 1212 | { |
@@ -1223,7 +1223,7 @@ discard block |
||
| 1223 | 1223 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1224 | 1224 | } |
| 1225 | 1225 | |
| 1226 | - $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; |
|
| 1226 | + $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; |
|
| 1227 | 1227 | |
| 1228 | 1228 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1229 | 1229 | |
@@ -1247,9 +1247,9 @@ discard block |
||
| 1247 | 1247 | $query_values = array(':id' => $id); |
| 1248 | 1248 | |
| 1249 | 1249 | //$query = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." "; |
| 1250 | - $query = $global_query." WHERE ".$additional_query." "; |
|
| 1250 | + $query = $global_query." WHERE ".$additional_query." "; |
|
| 1251 | 1251 | |
| 1252 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
| 1252 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
| 1253 | 1253 | |
| 1254 | 1254 | return $spotter_array; |
| 1255 | 1255 | } |
@@ -1272,7 +1272,7 @@ discard block |
||
| 1272 | 1272 | $query_values = array(); |
| 1273 | 1273 | $limit_query = ''; |
| 1274 | 1274 | $additional_query = ''; |
| 1275 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1275 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1276 | 1276 | if ($ident != "") |
| 1277 | 1277 | { |
| 1278 | 1278 | if (!is_string($ident)) |
@@ -1288,8 +1288,8 @@ discard block |
||
| 1288 | 1288 | { |
| 1289 | 1289 | $limit_array = explode(",", $limit); |
| 1290 | 1290 | |
| 1291 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1292 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1291 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1292 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1293 | 1293 | |
| 1294 | 1294 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1295 | 1295 | { |
@@ -1328,7 +1328,7 @@ discard block |
||
| 1328 | 1328 | $query_values = array(); |
| 1329 | 1329 | $limit_query = ''; |
| 1330 | 1330 | $additional_query = ''; |
| 1331 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1331 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1332 | 1332 | if ($owner != "") |
| 1333 | 1333 | { |
| 1334 | 1334 | if (!is_string($owner)) |
@@ -1344,8 +1344,8 @@ discard block |
||
| 1344 | 1344 | { |
| 1345 | 1345 | $limit_array = explode(",", $limit); |
| 1346 | 1346 | |
| 1347 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1348 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1347 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1348 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1349 | 1349 | |
| 1350 | 1350 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1351 | 1351 | { |
@@ -1385,7 +1385,7 @@ discard block |
||
| 1385 | 1385 | $query_values = array(); |
| 1386 | 1386 | $limit_query = ''; |
| 1387 | 1387 | $additional_query = ''; |
| 1388 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1388 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1389 | 1389 | if ($pilot != "") |
| 1390 | 1390 | { |
| 1391 | 1391 | $additional_query = " AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)"; |
@@ -1396,8 +1396,8 @@ discard block |
||
| 1396 | 1396 | { |
| 1397 | 1397 | $limit_array = explode(",", $limit); |
| 1398 | 1398 | |
| 1399 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1400 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1399 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1400 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1401 | 1401 | |
| 1402 | 1402 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1403 | 1403 | { |
@@ -1438,7 +1438,7 @@ discard block |
||
| 1438 | 1438 | $query_values = array(); |
| 1439 | 1439 | $limit_query = ''; |
| 1440 | 1440 | $additional_query = ''; |
| 1441 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1441 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1442 | 1442 | |
| 1443 | 1443 | if ($aircraft_type != "") |
| 1444 | 1444 | { |
@@ -1455,8 +1455,8 @@ discard block |
||
| 1455 | 1455 | { |
| 1456 | 1456 | $limit_array = explode(",", $limit); |
| 1457 | 1457 | |
| 1458 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1459 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1458 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1459 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1460 | 1460 | |
| 1461 | 1461 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1462 | 1462 | { |
@@ -1512,8 +1512,8 @@ discard block |
||
| 1512 | 1512 | { |
| 1513 | 1513 | $limit_array = explode(",", $limit); |
| 1514 | 1514 | |
| 1515 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1516 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1515 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1516 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1517 | 1517 | |
| 1518 | 1518 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1519 | 1519 | { |
@@ -1529,7 +1529,7 @@ discard block |
||
| 1529 | 1529 | } else { |
| 1530 | 1530 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 1531 | 1531 | } |
| 1532 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1532 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1533 | 1533 | |
| 1534 | 1534 | //$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query; |
| 1535 | 1535 | $query = $global_query.$filter_query." ".$additional_query." ".$orderby_query; |
@@ -1548,7 +1548,7 @@ discard block |
||
| 1548 | 1548 | * @return Array the spotter information |
| 1549 | 1549 | * |
| 1550 | 1550 | */ |
| 1551 | - public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array()) |
|
| 1551 | + public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array()) |
|
| 1552 | 1552 | { |
| 1553 | 1553 | global $global_query; |
| 1554 | 1554 | |
@@ -1557,7 +1557,7 @@ discard block |
||
| 1557 | 1557 | $query_values = array(); |
| 1558 | 1558 | $limit_query = ''; |
| 1559 | 1559 | $additional_query = ''; |
| 1560 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1560 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1561 | 1561 | |
| 1562 | 1562 | if ($airline != "") |
| 1563 | 1563 | { |
@@ -1574,8 +1574,8 @@ discard block |
||
| 1574 | 1574 | { |
| 1575 | 1575 | $limit_array = explode(",", $limit); |
| 1576 | 1576 | |
| 1577 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1578 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1577 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1578 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1579 | 1579 | |
| 1580 | 1580 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1581 | 1581 | { |
@@ -1605,7 +1605,7 @@ discard block |
||
| 1605 | 1605 | * @return Array the spotter information |
| 1606 | 1606 | * |
| 1607 | 1607 | */ |
| 1608 | - public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
| 1608 | + public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
| 1609 | 1609 | { |
| 1610 | 1610 | global $global_query; |
| 1611 | 1611 | |
@@ -1613,7 +1613,7 @@ discard block |
||
| 1613 | 1613 | $query_values = array(); |
| 1614 | 1614 | $limit_query = ''; |
| 1615 | 1615 | $additional_query = ''; |
| 1616 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1616 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1617 | 1617 | |
| 1618 | 1618 | if ($airport != "") |
| 1619 | 1619 | { |
@@ -1630,8 +1630,8 @@ discard block |
||
| 1630 | 1630 | { |
| 1631 | 1631 | $limit_array = explode(",", $limit); |
| 1632 | 1632 | |
| 1633 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1634 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1633 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1634 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1635 | 1635 | |
| 1636 | 1636 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1637 | 1637 | { |
@@ -1663,7 +1663,7 @@ discard block |
||
| 1663 | 1663 | * @return Array the spotter information |
| 1664 | 1664 | * |
| 1665 | 1665 | */ |
| 1666 | - public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
| 1666 | + public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
| 1667 | 1667 | { |
| 1668 | 1668 | global $global_query, $globalTimezone, $globalDBdriver; |
| 1669 | 1669 | |
@@ -1671,7 +1671,7 @@ discard block |
||
| 1671 | 1671 | $limit_query = ''; |
| 1672 | 1672 | $additional_query = ''; |
| 1673 | 1673 | |
| 1674 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1674 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1675 | 1675 | |
| 1676 | 1676 | if ($date != "") |
| 1677 | 1677 | { |
@@ -1700,8 +1700,8 @@ discard block |
||
| 1700 | 1700 | { |
| 1701 | 1701 | $limit_array = explode(",", $limit); |
| 1702 | 1702 | |
| 1703 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1704 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1703 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1704 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1705 | 1705 | |
| 1706 | 1706 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1707 | 1707 | { |
@@ -1731,7 +1731,7 @@ discard block |
||
| 1731 | 1731 | * @return Array the spotter information |
| 1732 | 1732 | * |
| 1733 | 1733 | */ |
| 1734 | - public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array()) |
|
| 1734 | + public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array()) |
|
| 1735 | 1735 | { |
| 1736 | 1736 | global $global_query; |
| 1737 | 1737 | |
@@ -1740,7 +1740,7 @@ discard block |
||
| 1740 | 1740 | $query_values = array(); |
| 1741 | 1741 | $limit_query = ''; |
| 1742 | 1742 | $additional_query = ''; |
| 1743 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1743 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1744 | 1744 | if ($country != "") |
| 1745 | 1745 | { |
| 1746 | 1746 | if (!is_string($country)) |
@@ -1757,8 +1757,8 @@ discard block |
||
| 1757 | 1757 | { |
| 1758 | 1758 | $limit_array = explode(",", $limit); |
| 1759 | 1759 | |
| 1760 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1761 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1760 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1761 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1762 | 1762 | |
| 1763 | 1763 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1764 | 1764 | { |
@@ -1798,7 +1798,7 @@ discard block |
||
| 1798 | 1798 | $query_values = array(); |
| 1799 | 1799 | $additional_query = ''; |
| 1800 | 1800 | $limit_query = ''; |
| 1801 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1801 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1802 | 1802 | |
| 1803 | 1803 | if ($aircraft_manufacturer != "") |
| 1804 | 1804 | { |
@@ -1815,8 +1815,8 @@ discard block |
||
| 1815 | 1815 | { |
| 1816 | 1816 | $limit_array = explode(",", $limit); |
| 1817 | 1817 | |
| 1818 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1819 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1818 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1819 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1820 | 1820 | |
| 1821 | 1821 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1822 | 1822 | { |
@@ -1858,14 +1858,14 @@ discard block |
||
| 1858 | 1858 | $query_values = array(); |
| 1859 | 1859 | $additional_query = ''; |
| 1860 | 1860 | $limit_query = ''; |
| 1861 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1861 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1862 | 1862 | if ($departure_airport_icao != "") |
| 1863 | 1863 | { |
| 1864 | 1864 | if (!is_string($departure_airport_icao)) |
| 1865 | 1865 | { |
| 1866 | 1866 | return false; |
| 1867 | 1867 | } else { |
| 1868 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1868 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1869 | 1869 | $additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)"; |
| 1870 | 1870 | //$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"; |
| 1871 | 1871 | $query_values = array(':departure_airport_icao' => $departure_airport_icao); |
@@ -1878,10 +1878,10 @@ discard block |
||
| 1878 | 1878 | { |
| 1879 | 1879 | return false; |
| 1880 | 1880 | } else { |
| 1881 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1881 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1882 | 1882 | $additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)"; |
| 1883 | 1883 | //$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)"; |
| 1884 | - $query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 1884 | + $query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 1885 | 1885 | } |
| 1886 | 1886 | } |
| 1887 | 1887 | |
@@ -1889,8 +1889,8 @@ discard block |
||
| 1889 | 1889 | { |
| 1890 | 1890 | $limit_array = explode(",", $limit); |
| 1891 | 1891 | |
| 1892 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1893 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1892 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1893 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1894 | 1894 | |
| 1895 | 1895 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1896 | 1896 | { |
@@ -1929,15 +1929,15 @@ discard block |
||
| 1929 | 1929 | global $global_query; |
| 1930 | 1930 | |
| 1931 | 1931 | date_default_timezone_set('UTC'); |
| 1932 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1932 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1933 | 1933 | $limit_query = ''; |
| 1934 | 1934 | |
| 1935 | 1935 | if ($limit != "") |
| 1936 | 1936 | { |
| 1937 | 1937 | $limit_array = explode(",", $limit); |
| 1938 | 1938 | |
| 1939 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1940 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1939 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1940 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1941 | 1941 | |
| 1942 | 1942 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1943 | 1943 | { |
@@ -1954,7 +1954,7 @@ discard block |
||
| 1954 | 1954 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 1955 | 1955 | } |
| 1956 | 1956 | |
| 1957 | - $query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query; |
|
| 1957 | + $query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query; |
|
| 1958 | 1958 | |
| 1959 | 1959 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1960 | 1960 | |
@@ -1967,19 +1967,19 @@ discard block |
||
| 1967 | 1967 | * @return String the highlight text |
| 1968 | 1968 | * |
| 1969 | 1969 | */ |
| 1970 | - public function getHighlightByRegistration($registration,$filter = array()) |
|
| 1970 | + public function getHighlightByRegistration($registration, $filter = array()) |
|
| 1971 | 1971 | { |
| 1972 | 1972 | global $global_query; |
| 1973 | 1973 | |
| 1974 | 1974 | date_default_timezone_set('UTC'); |
| 1975 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1976 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 1975 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1976 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 1977 | 1977 | |
| 1978 | - $query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration"; |
|
| 1978 | + $query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration"; |
|
| 1979 | 1979 | $sth = $this->db->prepare($query); |
| 1980 | 1980 | $sth->execute(array(':registration' => $registration)); |
| 1981 | 1981 | |
| 1982 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1982 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1983 | 1983 | { |
| 1984 | 1984 | $highlight = $row['highlight']; |
| 1985 | 1985 | } |
@@ -1995,14 +1995,14 @@ discard block |
||
| 1995 | 1995 | * @return String usage |
| 1996 | 1996 | * |
| 1997 | 1997 | */ |
| 1998 | - public function getSquawkUsage($squawk = '',$country = 'FR') |
|
| 1998 | + public function getSquawkUsage($squawk = '', $country = 'FR') |
|
| 1999 | 1999 | { |
| 2000 | 2000 | |
| 2001 | - $squawk = filter_var($squawk,FILTER_SANITIZE_STRING); |
|
| 2002 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 2001 | + $squawk = filter_var($squawk, FILTER_SANITIZE_STRING); |
|
| 2002 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 2003 | 2003 | |
| 2004 | 2004 | $query = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1"; |
| 2005 | - $query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country); |
|
| 2005 | + $query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country); |
|
| 2006 | 2006 | |
| 2007 | 2007 | $sth = $this->db->prepare($query); |
| 2008 | 2008 | $sth->execute($query_values); |
@@ -2024,9 +2024,9 @@ discard block |
||
| 2024 | 2024 | public function getAirportIcao($airport_iata = '') |
| 2025 | 2025 | { |
| 2026 | 2026 | |
| 2027 | - $airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING); |
|
| 2027 | + $airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING); |
|
| 2028 | 2028 | |
| 2029 | - $query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1"; |
|
| 2029 | + $query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1"; |
|
| 2030 | 2030 | $query_values = array(':airport' => $airport_iata); |
| 2031 | 2031 | |
| 2032 | 2032 | $sth = $this->db->prepare($query); |
@@ -2048,12 +2048,12 @@ discard block |
||
| 2048 | 2048 | * @return Float distance to the airport |
| 2049 | 2049 | * |
| 2050 | 2050 | */ |
| 2051 | - public function getAirportDistance($airport_icao,$latitude,$longitude) |
|
| 2051 | + public function getAirportDistance($airport_icao, $latitude, $longitude) |
|
| 2052 | 2052 | { |
| 2053 | 2053 | |
| 2054 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 2054 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 2055 | 2055 | |
| 2056 | - $query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1"; |
|
| 2056 | + $query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1"; |
|
| 2057 | 2057 | $query_values = array(':airport' => $airport_icao); |
| 2058 | 2058 | $sth = $this->db->prepare($query); |
| 2059 | 2059 | $sth->execute($query_values); |
@@ -2063,7 +2063,7 @@ discard block |
||
| 2063 | 2063 | $airport_latitude = $row['latitude']; |
| 2064 | 2064 | $airport_longitude = $row['longitude']; |
| 2065 | 2065 | $Common = new Common(); |
| 2066 | - return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
|
| 2066 | + return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude); |
|
| 2067 | 2067 | } else return ''; |
| 2068 | 2068 | } |
| 2069 | 2069 | |
@@ -2077,11 +2077,11 @@ discard block |
||
| 2077 | 2077 | public function getAllAirportInfo($airport = '') |
| 2078 | 2078 | { |
| 2079 | 2079 | |
| 2080 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
| 2080 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
| 2081 | 2081 | |
| 2082 | 2082 | $query_values = array(); |
| 2083 | 2083 | if ($airport == 'NA') { |
| 2084 | - 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' => '')); |
|
| 2084 | + 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' => '')); |
|
| 2085 | 2085 | } elseif ($airport == '') { |
| 2086 | 2086 | $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"; |
| 2087 | 2087 | } else { |
@@ -2129,14 +2129,14 @@ discard block |
||
| 2129 | 2129 | { |
| 2130 | 2130 | $lst_countries = ''; |
| 2131 | 2131 | foreach ($countries as $country) { |
| 2132 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 2132 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 2133 | 2133 | if ($lst_countries == '') { |
| 2134 | 2134 | $lst_countries = "'".$country."'"; |
| 2135 | 2135 | } else { |
| 2136 | 2136 | $lst_countries .= ",'".$country."'"; |
| 2137 | 2137 | } |
| 2138 | 2138 | } |
| 2139 | - $query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")"; |
|
| 2139 | + $query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")"; |
|
| 2140 | 2140 | |
| 2141 | 2141 | $sth = $this->db->prepare($query); |
| 2142 | 2142 | $sth->execute(); |
@@ -2144,7 +2144,7 @@ discard block |
||
| 2144 | 2144 | $airport_array = array(); |
| 2145 | 2145 | $temp_array = array(); |
| 2146 | 2146 | |
| 2147 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2147 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2148 | 2148 | { |
| 2149 | 2149 | $temp_array['name'] = $row['name']; |
| 2150 | 2150 | $temp_array['city'] = $row['city']; |
@@ -2172,10 +2172,10 @@ discard block |
||
| 2172 | 2172 | { |
| 2173 | 2173 | global $globalDBdriver; |
| 2174 | 2174 | if (is_array($coord)) { |
| 2175 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2176 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2177 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2178 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2175 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2176 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2177 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2178 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2179 | 2179 | } else return array(); |
| 2180 | 2180 | if ($globalDBdriver == 'mysql') { |
| 2181 | 2181 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
@@ -2187,7 +2187,7 @@ discard block |
||
| 2187 | 2187 | |
| 2188 | 2188 | $airport_array = array(); |
| 2189 | 2189 | |
| 2190 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2190 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2191 | 2191 | { |
| 2192 | 2192 | $temp_array = $row; |
| 2193 | 2193 | |
@@ -2207,13 +2207,13 @@ discard block |
||
| 2207 | 2207 | public function getAllWaypointsInfobyCoord($coord) |
| 2208 | 2208 | { |
| 2209 | 2209 | if (is_array($coord)) { |
| 2210 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2211 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2212 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2213 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2210 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2211 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2212 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2213 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2214 | 2214 | } else return array(); |
| 2215 | 2215 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
| 2216 | - $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.")"; |
|
| 2216 | + $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 2217 | 2217 | //$query = "SELECT waypoints.* FROM waypoints"; |
| 2218 | 2218 | //$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"; |
| 2219 | 2219 | //$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; |
@@ -2225,7 +2225,7 @@ discard block |
||
| 2225 | 2225 | |
| 2226 | 2226 | $waypoints_array = array(); |
| 2227 | 2227 | |
| 2228 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2228 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2229 | 2229 | { |
| 2230 | 2230 | $temp_array = $row; |
| 2231 | 2231 | |
@@ -2247,10 +2247,10 @@ discard block |
||
| 2247 | 2247 | { |
| 2248 | 2248 | global $globalUseRealAirlines; |
| 2249 | 2249 | if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
| 2250 | - $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
|
| 2250 | + $airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING)); |
|
| 2251 | 2251 | if ($airline_icao == 'NA') { |
| 2252 | 2252 | $airline_array = array(); |
| 2253 | - $airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>''); |
|
| 2253 | + $airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>''); |
|
| 2254 | 2254 | return $airline_array; |
| 2255 | 2255 | } else { |
| 2256 | 2256 | if (strlen($airline_icao) == 2) { |
@@ -2271,7 +2271,7 @@ discard block |
||
| 2271 | 2271 | if ($fromsource === NULL) { |
| 2272 | 2272 | $sth->execute(array(':airline_icao' => $airline_icao)); |
| 2273 | 2273 | } else { |
| 2274 | - $sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource)); |
|
| 2274 | + $sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource)); |
|
| 2275 | 2275 | } |
| 2276 | 2276 | /* |
| 2277 | 2277 | $airline_array = array(); |
@@ -2316,13 +2316,13 @@ discard block |
||
| 2316 | 2316 | { |
| 2317 | 2317 | global $globalUseRealAirlines; |
| 2318 | 2318 | if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
| 2319 | - $airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING)); |
|
| 2320 | - $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"; |
|
| 2319 | + $airline_name = strtolower(filter_var($airline_name, FILTER_SANITIZE_STRING)); |
|
| 2320 | + $query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1"; |
|
| 2321 | 2321 | $sth = $this->db->prepare($query); |
| 2322 | 2322 | if ($fromsource === NULL) { |
| 2323 | 2323 | $sth->execute(array(':airline_name' => $airline_name)); |
| 2324 | 2324 | } else { |
| 2325 | - $sth->execute(array(':airline_name' => $airline_name,':fromsource' => $fromsource)); |
|
| 2325 | + $sth->execute(array(':airline_name' => $airline_name, ':fromsource' => $fromsource)); |
|
| 2326 | 2326 | } |
| 2327 | 2327 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2328 | 2328 | if (empty($result) && $fromsource !== NULL) { |
@@ -2347,12 +2347,12 @@ discard block |
||
| 2347 | 2347 | */ |
| 2348 | 2348 | public function getAllAircraftInfo($aircraft_type) |
| 2349 | 2349 | { |
| 2350 | - $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
|
| 2350 | + $aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING); |
|
| 2351 | 2351 | |
| 2352 | 2352 | if ($aircraft_type == 'NA') { |
| 2353 | - return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL)); |
|
| 2353 | + return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL)); |
|
| 2354 | 2354 | } |
| 2355 | - $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"; |
|
| 2355 | + $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"; |
|
| 2356 | 2356 | |
| 2357 | 2357 | $sth = $this->db->prepare($query); |
| 2358 | 2358 | $sth->execute(array(':aircraft_type' => $aircraft_type)); |
@@ -2384,7 +2384,7 @@ discard block |
||
| 2384 | 2384 | */ |
| 2385 | 2385 | public function getAircraftIcao($aircraft_type) |
| 2386 | 2386 | { |
| 2387 | - $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
|
| 2387 | + $aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING); |
|
| 2388 | 2388 | $all_aircraft = array('737-300' => 'B733', |
| 2389 | 2389 | '777-200' => 'B772', |
| 2390 | 2390 | '777-200ER' => 'B772', |
@@ -2396,10 +2396,10 @@ discard block |
||
| 2396 | 2396 | 'A380' => 'A388'); |
| 2397 | 2397 | if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
| 2398 | 2398 | |
| 2399 | - $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
|
| 2399 | + $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
|
| 2400 | 2400 | $aircraft_type = strtoupper($aircraft_type); |
| 2401 | 2401 | $sth = $this->db->prepare($query); |
| 2402 | - $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
|
| 2402 | + $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,)); |
|
| 2403 | 2403 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2404 | 2404 | if (isset($result[0]['icao'])) return $result[0]['icao']; |
| 2405 | 2405 | else return ''; |
@@ -2412,10 +2412,10 @@ discard block |
||
| 2412 | 2412 | * @return String aircraft type |
| 2413 | 2413 | * |
| 2414 | 2414 | */ |
| 2415 | - public function getAllAircraftType($aircraft_modes,$source_type = '') |
|
| 2415 | + public function getAllAircraftType($aircraft_modes, $source_type = '') |
|
| 2416 | 2416 | { |
| 2417 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
| 2418 | - $source_type = filter_var($source_type,FILTER_SANITIZE_STRING); |
|
| 2417 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
| 2418 | + $source_type = filter_var($source_type, FILTER_SANITIZE_STRING); |
|
| 2419 | 2419 | |
| 2420 | 2420 | if ($source_type == '' || $source_type == 'modes') { |
| 2421 | 2421 | $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes AND aircraft_modes.source_type = 'modes' ORDER BY FirstCreated DESC LIMIT 1"; |
@@ -2446,9 +2446,9 @@ discard block |
||
| 2446 | 2446 | */ |
| 2447 | 2447 | public function getAllAircraftTypeByRegistration($registration) |
| 2448 | 2448 | { |
| 2449 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2449 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2450 | 2450 | |
| 2451 | - $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 2451 | + $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 2452 | 2452 | |
| 2453 | 2453 | $sth = $this->db->prepare($query); |
| 2454 | 2454 | $sth->execute(array(':registration' => $registration)); |
@@ -2469,9 +2469,9 @@ discard block |
||
| 2469 | 2469 | */ |
| 2470 | 2470 | public function getAllIDByRegistration($registration) |
| 2471 | 2471 | { |
| 2472 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2472 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2473 | 2473 | |
| 2474 | - $query = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
| 2474 | + $query = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
| 2475 | 2475 | |
| 2476 | 2476 | $sth = $this->db->prepare($query); |
| 2477 | 2477 | $sth->execute(array(':registration' => $registration)); |
@@ -2479,7 +2479,7 @@ discard block |
||
| 2479 | 2479 | $idarray = array(); |
| 2480 | 2480 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 2481 | 2481 | $date = $row['date']; |
| 2482 | - $idarray[$date] = array('flightaware_id' => $row['flightaware_id'],'spotter_id' => $row['spotter_id']); |
|
| 2482 | + $idarray[$date] = array('flightaware_id' => $row['flightaware_id'], 'spotter_id' => $row['spotter_id']); |
|
| 2483 | 2483 | } |
| 2484 | 2484 | return $idarray; |
| 2485 | 2485 | } |
@@ -2493,8 +2493,8 @@ discard block |
||
| 2493 | 2493 | */ |
| 2494 | 2494 | public function getOperator($operator) |
| 2495 | 2495 | { |
| 2496 | - $operator = filter_var($operator,FILTER_SANITIZE_STRING); |
|
| 2497 | - $query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1"; |
|
| 2496 | + $operator = filter_var($operator, FILTER_SANITIZE_STRING); |
|
| 2497 | + $query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1"; |
|
| 2498 | 2498 | |
| 2499 | 2499 | $sth = $this->db->prepare($query); |
| 2500 | 2500 | $sth->execute(array(':operator' => $operator)); |
@@ -2515,9 +2515,9 @@ discard block |
||
| 2515 | 2515 | */ |
| 2516 | 2516 | public function getRouteInfo($callsign) |
| 2517 | 2517 | { |
| 2518 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 2518 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 2519 | 2519 | if ($callsign == '') return array(); |
| 2520 | - $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"; |
|
| 2520 | + $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
|
| 2521 | 2521 | |
| 2522 | 2522 | $sth = $this->db->prepare($query); |
| 2523 | 2523 | $sth->execute(array(':callsign' => $callsign)); |
@@ -2538,9 +2538,9 @@ discard block |
||
| 2538 | 2538 | */ |
| 2539 | 2539 | public function getAircraftInfoByRegistration($registration) |
| 2540 | 2540 | { |
| 2541 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2541 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2542 | 2542 | |
| 2543 | - $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"; |
|
| 2543 | + $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"; |
|
| 2544 | 2544 | |
| 2545 | 2545 | $sth = $this->db->prepare($query); |
| 2546 | 2546 | $sth->execute(array(':registration' => $registration)); |
@@ -2548,7 +2548,7 @@ discard block |
||
| 2548 | 2548 | $aircraft_array = array(); |
| 2549 | 2549 | $temp_array = array(); |
| 2550 | 2550 | |
| 2551 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2551 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2552 | 2552 | { |
| 2553 | 2553 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 2554 | 2554 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -2570,7 +2570,7 @@ discard block |
||
| 2570 | 2570 | */ |
| 2571 | 2571 | public function getAircraftOwnerByRegistration($registration) |
| 2572 | 2572 | { |
| 2573 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2573 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2574 | 2574 | $Connection = new Connection($this->db); |
| 2575 | 2575 | if ($Connection->tableExists('aircraft_owner')) { |
| 2576 | 2576 | $query = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1"; |
@@ -2592,7 +2592,7 @@ discard block |
||
| 2592 | 2592 | public function getAllFlightsforSitemap() |
| 2593 | 2593 | { |
| 2594 | 2594 | //$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 "; |
| 2595 | - $query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0"; |
|
| 2595 | + $query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0"; |
|
| 2596 | 2596 | |
| 2597 | 2597 | $sth = $this->db->prepare($query); |
| 2598 | 2598 | $sth->execute(); |
@@ -2639,7 +2639,7 @@ discard block |
||
| 2639 | 2639 | $manufacturer_array = array(); |
| 2640 | 2640 | $temp_array = array(); |
| 2641 | 2641 | |
| 2642 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2642 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2643 | 2643 | { |
| 2644 | 2644 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 2645 | 2645 | |
@@ -2676,7 +2676,7 @@ discard block |
||
| 2676 | 2676 | $aircraft_array = array(); |
| 2677 | 2677 | $temp_array = array(); |
| 2678 | 2678 | |
| 2679 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2679 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2680 | 2680 | { |
| 2681 | 2681 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 2682 | 2682 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
@@ -2697,8 +2697,8 @@ discard block |
||
| 2697 | 2697 | */ |
| 2698 | 2698 | public function getAllAircraftRegistrations($filters = array()) |
| 2699 | 2699 | { |
| 2700 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2701 | - $query = "SELECT DISTINCT spotter_output.registration |
|
| 2700 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2701 | + $query = "SELECT DISTINCT spotter_output.registration |
|
| 2702 | 2702 | FROM spotter_output".$filter_query." spotter_output.registration <> '' |
| 2703 | 2703 | ORDER BY spotter_output.registration ASC"; |
| 2704 | 2704 | |
@@ -2708,7 +2708,7 @@ discard block |
||
| 2708 | 2708 | $aircraft_array = array(); |
| 2709 | 2709 | $temp_array = array(); |
| 2710 | 2710 | |
| 2711 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2711 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2712 | 2712 | { |
| 2713 | 2713 | $temp_array['registration'] = $row['registration']; |
| 2714 | 2714 | |
@@ -2725,11 +2725,11 @@ discard block |
||
| 2725 | 2725 | * @return Array list of source name |
| 2726 | 2726 | * |
| 2727 | 2727 | */ |
| 2728 | - public function getAllSourceName($type = '',$filters = array()) |
|
| 2728 | + public function getAllSourceName($type = '', $filters = array()) |
|
| 2729 | 2729 | { |
| 2730 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2730 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2731 | 2731 | $query_values = array(); |
| 2732 | - $query = "SELECT DISTINCT spotter_output.source_name |
|
| 2732 | + $query = "SELECT DISTINCT spotter_output.source_name |
|
| 2733 | 2733 | FROM spotter_output".$filter_query." spotter_output.source_name <> ''"; |
| 2734 | 2734 | if ($type != '') { |
| 2735 | 2735 | $query_values = array(':type' => $type); |
@@ -2744,7 +2744,7 @@ discard block |
||
| 2744 | 2744 | $source_array = array(); |
| 2745 | 2745 | $temp_array = array(); |
| 2746 | 2746 | |
| 2747 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2747 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2748 | 2748 | { |
| 2749 | 2749 | $temp_array['source_name'] = $row['source_name']; |
| 2750 | 2750 | $source_array[] = $temp_array; |
@@ -2760,11 +2760,11 @@ discard block |
||
| 2760 | 2760 | * @return Array list of airline names |
| 2761 | 2761 | * |
| 2762 | 2762 | */ |
| 2763 | - public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array()) |
|
| 2763 | + public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array()) |
|
| 2764 | 2764 | { |
| 2765 | - global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
|
| 2766 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2767 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
| 2765 | + global $globalAirlinesSource, $globalVATSIM, $globalIVAO; |
|
| 2766 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2767 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
| 2768 | 2768 | if ($airline_type == '' || $airline_type == 'all') { |
| 2769 | 2769 | /* |
| 2770 | 2770 | $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
@@ -2783,7 +2783,7 @@ discard block |
||
| 2783 | 2783 | $query_data = array(':forsource' => $forsource); |
| 2784 | 2784 | } |
| 2785 | 2785 | } else { |
| 2786 | - $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
|
| 2786 | + $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
|
| 2787 | 2787 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 2788 | 2788 | AND spotter_output.airline_type = :airline_type |
| 2789 | 2789 | ORDER BY spotter_output.airline_icao ASC"; |
@@ -2796,7 +2796,7 @@ discard block |
||
| 2796 | 2796 | $airline_array = array(); |
| 2797 | 2797 | $temp_array = array(); |
| 2798 | 2798 | |
| 2799 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2799 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2800 | 2800 | { |
| 2801 | 2801 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 2802 | 2802 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -2813,10 +2813,10 @@ discard block |
||
| 2813 | 2813 | * @return Array list of alliance names |
| 2814 | 2814 | * |
| 2815 | 2815 | */ |
| 2816 | - public function getAllAllianceNames($forsource = NULL,$filters = array()) |
|
| 2816 | + public function getAllAllianceNames($forsource = NULL, $filters = array()) |
|
| 2817 | 2817 | { |
| 2818 | - global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
|
| 2819 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2818 | + global $globalAirlinesSource, $globalVATSIM, $globalIVAO; |
|
| 2819 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2820 | 2820 | if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
| 2821 | 2821 | elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
| 2822 | 2822 | elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
@@ -2844,8 +2844,8 @@ discard block |
||
| 2844 | 2844 | */ |
| 2845 | 2845 | public function getAllAirlineCountries($filters = array()) |
| 2846 | 2846 | { |
| 2847 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2848 | - $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2847 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2848 | + $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2849 | 2849 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' |
| 2850 | 2850 | ORDER BY spotter_output.airline_country ASC"; |
| 2851 | 2851 | |
@@ -2856,7 +2856,7 @@ discard block |
||
| 2856 | 2856 | $airline_array = array(); |
| 2857 | 2857 | $temp_array = array(); |
| 2858 | 2858 | |
| 2859 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2859 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2860 | 2860 | { |
| 2861 | 2861 | $temp_array['airline_country'] = $row['airline_country']; |
| 2862 | 2862 | |
@@ -2876,9 +2876,9 @@ discard block |
||
| 2876 | 2876 | */ |
| 2877 | 2877 | public function getAllAirportNames($filters = array()) |
| 2878 | 2878 | { |
| 2879 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2879 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2880 | 2880 | $airport_array = array(); |
| 2881 | - $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 |
|
| 2881 | + $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 |
|
| 2882 | 2882 | FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' |
| 2883 | 2883 | ORDER BY spotter_output.departure_airport_city ASC"; |
| 2884 | 2884 | |
@@ -2887,7 +2887,7 @@ discard block |
||
| 2887 | 2887 | $sth->execute(); |
| 2888 | 2888 | |
| 2889 | 2889 | $temp_array = array(); |
| 2890 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2890 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2891 | 2891 | { |
| 2892 | 2892 | $temp_array['airport_icao'] = $row['airport_icao']; |
| 2893 | 2893 | $temp_array['airport_name'] = $row['airport_name']; |
@@ -2897,14 +2897,14 @@ discard block |
||
| 2897 | 2897 | $airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array; |
| 2898 | 2898 | } |
| 2899 | 2899 | |
| 2900 | - $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 |
|
| 2900 | + $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 |
|
| 2901 | 2901 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' |
| 2902 | 2902 | ORDER BY spotter_output.arrival_airport_city ASC"; |
| 2903 | 2903 | |
| 2904 | 2904 | $sth = $this->db->prepare($query); |
| 2905 | 2905 | $sth->execute(); |
| 2906 | 2906 | |
| 2907 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2907 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2908 | 2908 | { |
| 2909 | 2909 | // if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao']) |
| 2910 | 2910 | // { |
@@ -2928,8 +2928,8 @@ discard block |
||
| 2928 | 2928 | */ |
| 2929 | 2929 | public function getAllOwnerNames($filters = array()) |
| 2930 | 2930 | { |
| 2931 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2932 | - $query = "SELECT DISTINCT spotter_output.owner_name |
|
| 2931 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2932 | + $query = "SELECT DISTINCT spotter_output.owner_name |
|
| 2933 | 2933 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' |
| 2934 | 2934 | ORDER BY spotter_output.owner_name ASC"; |
| 2935 | 2935 | |
@@ -2946,8 +2946,8 @@ discard block |
||
| 2946 | 2946 | */ |
| 2947 | 2947 | public function getAllPilotNames($filters = array()) |
| 2948 | 2948 | { |
| 2949 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2950 | - $query = "SELECT DISTINCT spotter_output.pilot_name, spotter_output.pilot_id |
|
| 2949 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2950 | + $query = "SELECT DISTINCT spotter_output.pilot_name, spotter_output.pilot_id |
|
| 2951 | 2951 | FROM spotter_output".$filter_query." spotter_output.pilot_name <> '' |
| 2952 | 2952 | ORDER BY spotter_output.pilot_name ASC"; |
| 2953 | 2953 | |
@@ -2980,21 +2980,21 @@ discard block |
||
| 2980 | 2980 | |
| 2981 | 2981 | $temp_array = array(); |
| 2982 | 2982 | |
| 2983 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2983 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2984 | 2984 | { |
| 2985 | 2985 | $temp_array['airport_country'] = $row['airport_country']; |
| 2986 | 2986 | |
| 2987 | 2987 | $airport_array[$row['airport_country']] = $temp_array; |
| 2988 | 2988 | } |
| 2989 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2990 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2989 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2990 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2991 | 2991 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' |
| 2992 | 2992 | ORDER BY spotter_output.arrival_airport_country ASC"; |
| 2993 | 2993 | |
| 2994 | 2994 | $sth = $this->db->prepare($query); |
| 2995 | 2995 | $sth->execute(); |
| 2996 | 2996 | |
| 2997 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2997 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2998 | 2998 | { |
| 2999 | 2999 | if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country']) |
| 3000 | 3000 | { |
@@ -3017,9 +3017,9 @@ discard block |
||
| 3017 | 3017 | */ |
| 3018 | 3018 | public function getAllCountries($filters = array()) |
| 3019 | 3019 | { |
| 3020 | - $Connection= new Connection($this->db); |
|
| 3020 | + $Connection = new Connection($this->db); |
|
| 3021 | 3021 | if ($Connection->tableExists('countries')) { |
| 3022 | - $query = "SELECT countries.name AS airport_country |
|
| 3022 | + $query = "SELECT countries.name AS airport_country |
|
| 3023 | 3023 | FROM countries |
| 3024 | 3024 | ORDER BY countries.name ASC"; |
| 3025 | 3025 | $sth = $this->db->prepare($query); |
@@ -3028,14 +3028,14 @@ discard block |
||
| 3028 | 3028 | $temp_array = array(); |
| 3029 | 3029 | $country_array = array(); |
| 3030 | 3030 | |
| 3031 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3031 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3032 | 3032 | { |
| 3033 | 3033 | $temp_array['country'] = $row['airport_country']; |
| 3034 | 3034 | $country_array[$row['airport_country']] = $temp_array; |
| 3035 | 3035 | } |
| 3036 | 3036 | } else { |
| 3037 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3038 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country |
|
| 3037 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3038 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country |
|
| 3039 | 3039 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' |
| 3040 | 3040 | ORDER BY spotter_output.departure_airport_country ASC"; |
| 3041 | 3041 | |
@@ -3044,20 +3044,20 @@ discard block |
||
| 3044 | 3044 | |
| 3045 | 3045 | $temp_array = array(); |
| 3046 | 3046 | $country_array = array(); |
| 3047 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3047 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3048 | 3048 | { |
| 3049 | 3049 | $temp_array['country'] = $row['airport_country']; |
| 3050 | 3050 | $country_array[$row['airport_country']] = $temp_array; |
| 3051 | 3051 | } |
| 3052 | 3052 | |
| 3053 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 3053 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 3054 | 3054 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' |
| 3055 | 3055 | ORDER BY spotter_output.arrival_airport_country ASC"; |
| 3056 | 3056 | |
| 3057 | 3057 | $sth = $this->db->prepare($query); |
| 3058 | 3058 | $sth->execute(); |
| 3059 | 3059 | |
| 3060 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3060 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3061 | 3061 | { |
| 3062 | 3062 | if ($country_array[$row['airport_country']]['country'] != $row['airport_country']) |
| 3063 | 3063 | { |
@@ -3067,14 +3067,14 @@ discard block |
||
| 3067 | 3067 | } |
| 3068 | 3068 | } |
| 3069 | 3069 | |
| 3070 | - $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 3070 | + $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 3071 | 3071 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' |
| 3072 | 3072 | ORDER BY spotter_output.airline_country ASC"; |
| 3073 | 3073 | |
| 3074 | 3074 | $sth = $this->db->prepare($query); |
| 3075 | 3075 | $sth->execute(); |
| 3076 | 3076 | |
| 3077 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3077 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3078 | 3078 | { |
| 3079 | 3079 | if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country']) |
| 3080 | 3080 | { |
@@ -3098,8 +3098,8 @@ discard block |
||
| 3098 | 3098 | */ |
| 3099 | 3099 | public function getAllIdents($filters = array()) |
| 3100 | 3100 | { |
| 3101 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3102 | - $query = "SELECT DISTINCT spotter_output.ident |
|
| 3101 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3102 | + $query = "SELECT DISTINCT spotter_output.ident |
|
| 3103 | 3103 | FROM spotter_output".$filter_query." spotter_output.ident <> '' |
| 3104 | 3104 | ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0"; |
| 3105 | 3105 | |
@@ -3109,7 +3109,7 @@ discard block |
||
| 3109 | 3109 | $ident_array = array(); |
| 3110 | 3110 | $temp_array = array(); |
| 3111 | 3111 | |
| 3112 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3112 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3113 | 3113 | { |
| 3114 | 3114 | $temp_array['ident'] = $row['ident']; |
| 3115 | 3115 | $ident_array[] = $temp_array; |
@@ -3123,9 +3123,9 @@ discard block |
||
| 3123 | 3123 | * @return Array number, icao, name and city of airports |
| 3124 | 3124 | */ |
| 3125 | 3125 | |
| 3126 | - public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) { |
|
| 3126 | + public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) { |
|
| 3127 | 3127 | global $globalTimezone, $globalDBdriver; |
| 3128 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3128 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3129 | 3129 | if ($globalTimezone != '') { |
| 3130 | 3130 | date_default_timezone_set($globalTimezone); |
| 3131 | 3131 | $datetime = new DateTime(); |
@@ -3190,7 +3190,7 @@ discard block |
||
| 3190 | 3190 | |
| 3191 | 3191 | public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) { |
| 3192 | 3192 | global $globalTimezone, $globalDBdriver; |
| 3193 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3193 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3194 | 3194 | if ($globalTimezone != '') { |
| 3195 | 3195 | date_default_timezone_set($globalTimezone); |
| 3196 | 3196 | $datetime = new DateTime(); |
@@ -3274,7 +3274,7 @@ discard block |
||
| 3274 | 3274 | |
| 3275 | 3275 | public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) { |
| 3276 | 3276 | global $globalTimezone, $globalDBdriver; |
| 3277 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3277 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3278 | 3278 | if ($globalTimezone != '') { |
| 3279 | 3279 | date_default_timezone_set($globalTimezone); |
| 3280 | 3280 | $datetime = new DateTime(); |
@@ -3307,9 +3307,9 @@ discard block |
||
| 3307 | 3307 | * @return Array number, icao, name and city of airports |
| 3308 | 3308 | */ |
| 3309 | 3309 | |
| 3310 | - public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) { |
|
| 3310 | + public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) { |
|
| 3311 | 3311 | global $globalTimezone, $globalDBdriver; |
| 3312 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3312 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3313 | 3313 | if ($globalTimezone != '') { |
| 3314 | 3314 | date_default_timezone_set($globalTimezone); |
| 3315 | 3315 | $datetime = new DateTime(); |
@@ -3441,12 +3441,12 @@ discard block |
||
| 3441 | 3441 | } else $offset = '+00:00'; |
| 3442 | 3442 | |
| 3443 | 3443 | if ($globalDBdriver == 'mysql') { |
| 3444 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
|
| 3444 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
|
| 3445 | 3445 | FROM spotter_output |
| 3446 | 3446 | WHERE spotter_output.date <> '' |
| 3447 | 3447 | ORDER BY spotter_output.date ASC LIMIT 0,200"; |
| 3448 | 3448 | } else { |
| 3449 | - $query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 3449 | + $query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 3450 | 3450 | FROM spotter_output |
| 3451 | 3451 | WHERE spotter_output.date <> '' |
| 3452 | 3452 | ORDER BY spotter_output.date ASC LIMIT 0,200"; |
@@ -3458,7 +3458,7 @@ discard block |
||
| 3458 | 3458 | $date_array = array(); |
| 3459 | 3459 | $temp_array = array(); |
| 3460 | 3460 | |
| 3461 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3461 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3462 | 3462 | { |
| 3463 | 3463 | $temp_array['date'] = $row['date']; |
| 3464 | 3464 | |
@@ -3478,7 +3478,7 @@ discard block |
||
| 3478 | 3478 | */ |
| 3479 | 3479 | public function getAllRoutes() |
| 3480 | 3480 | { |
| 3481 | - $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 |
|
| 3481 | + $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 |
|
| 3482 | 3482 | FROM spotter_output |
| 3483 | 3483 | WHERE spotter_output.ident <> '' |
| 3484 | 3484 | GROUP BY route |
@@ -3489,7 +3489,7 @@ discard block |
||
| 3489 | 3489 | |
| 3490 | 3490 | $routes_array = array(); |
| 3491 | 3491 | $temp_array = array(); |
| 3492 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3492 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3493 | 3493 | { |
| 3494 | 3494 | $temp_array['route'] = $row['route']; |
| 3495 | 3495 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -3508,21 +3508,21 @@ discard block |
||
| 3508 | 3508 | * @return String success or false |
| 3509 | 3509 | * |
| 3510 | 3510 | */ |
| 3511 | - public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL) |
|
| 3511 | + public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL) |
|
| 3512 | 3512 | { |
| 3513 | 3513 | if (!is_numeric(substr($ident, 0, 3))) |
| 3514 | 3514 | { |
| 3515 | 3515 | if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
| 3516 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource); |
|
| 3516 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource); |
|
| 3517 | 3517 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
| 3518 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource); |
|
| 3518 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource); |
|
| 3519 | 3519 | } else { |
| 3520 | 3520 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3521 | 3521 | } |
| 3522 | 3522 | if (count($airline_array) == 0) { |
| 3523 | 3523 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3524 | 3524 | } |
| 3525 | - if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
|
| 3525 | + if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") { |
|
| 3526 | 3526 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3527 | 3527 | } |
| 3528 | 3528 | } else { |
@@ -3535,7 +3535,7 @@ discard block |
||
| 3535 | 3535 | |
| 3536 | 3536 | |
| 3537 | 3537 | $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'; |
| 3538 | - $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); |
|
| 3538 | + $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); |
|
| 3539 | 3539 | |
| 3540 | 3540 | try { |
| 3541 | 3541 | $sth = $this->db->prepare($query); |
@@ -3556,11 +3556,11 @@ discard block |
||
| 3556 | 3556 | * @return String success or false |
| 3557 | 3557 | * |
| 3558 | 3558 | */ |
| 3559 | - public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
|
| 3559 | + public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '') |
|
| 3560 | 3560 | { |
| 3561 | 3561 | if ($groundspeed == '') $groundspeed = NULL; |
| 3562 | 3562 | $query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id'; |
| 3563 | - $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); |
|
| 3563 | + $query_values = array(':flightaware_id' => $flightaware_id, ':real_arrival_airport_icao' => $arrival_airport_icao, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
| 3564 | 3564 | |
| 3565 | 3565 | try { |
| 3566 | 3566 | $sth = $this->db->prepare($query); |
@@ -3600,7 +3600,7 @@ discard block |
||
| 3600 | 3600 | * @param String $verticalrate vertival rate of flight |
| 3601 | 3601 | * @return String success or false |
| 3602 | 3602 | */ |
| 3603 | - public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$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 = '',$source_type = '') |
|
| 3603 | + public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $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 = '', $source_type = '') |
|
| 3604 | 3604 | { |
| 3605 | 3605 | global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM; |
| 3606 | 3606 | |
@@ -3623,14 +3623,14 @@ discard block |
||
| 3623 | 3623 | } else { |
| 3624 | 3624 | if ($ModeS != '') { |
| 3625 | 3625 | $timeelapsed = microtime(true); |
| 3626 | - $registration = $this->getAircraftRegistrationBymodeS($ModeS,$source_type); |
|
| 3627 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3626 | + $registration = $this->getAircraftRegistrationBymodeS($ModeS, $source_type); |
|
| 3627 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3628 | 3628 | } else { |
| 3629 | - $myhex = explode('-',$flightaware_id); |
|
| 3629 | + $myhex = explode('-', $flightaware_id); |
|
| 3630 | 3630 | if (count($myhex) > 0) { |
| 3631 | 3631 | $timeelapsed = microtime(true); |
| 3632 | - $registration = $this->getAircraftRegistrationBymodeS($myhex[0],$source_type); |
|
| 3633 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3632 | + $registration = $this->getAircraftRegistrationBymodeS($myhex[0], $source_type); |
|
| 3633 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3634 | 3634 | } |
| 3635 | 3635 | } |
| 3636 | 3636 | } |
@@ -3652,24 +3652,24 @@ discard block |
||
| 3652 | 3652 | { |
| 3653 | 3653 | $timeelapsed = microtime(true); |
| 3654 | 3654 | if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
| 3655 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource); |
|
| 3655 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource); |
|
| 3656 | 3656 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
| 3657 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource); |
|
| 3657 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource); |
|
| 3658 | 3658 | } else { |
| 3659 | 3659 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3660 | 3660 | } |
| 3661 | 3661 | if (count($airline_array) == 0) { |
| 3662 | 3662 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3663 | 3663 | } |
| 3664 | - if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
|
| 3664 | + if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") { |
|
| 3665 | 3665 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3666 | 3666 | } |
| 3667 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3667 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3668 | 3668 | |
| 3669 | 3669 | } else { |
| 3670 | 3670 | $timeelapsed = microtime(true); |
| 3671 | 3671 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3672 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3672 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3673 | 3673 | } |
| 3674 | 3674 | } |
| 3675 | 3675 | } else $airline_array = array(); |
@@ -3686,27 +3686,27 @@ discard block |
||
| 3686 | 3686 | { |
| 3687 | 3687 | $timeelapsed = microtime(true); |
| 3688 | 3688 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3689 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3689 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3690 | 3690 | } else { |
| 3691 | 3691 | $timeelapsed = microtime(true); |
| 3692 | 3692 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3693 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3693 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3694 | 3694 | } |
| 3695 | 3695 | } |
| 3696 | 3696 | } else { |
| 3697 | 3697 | if ($ModeS != '') { |
| 3698 | 3698 | $timeelapsed = microtime(true); |
| 3699 | - $aircraft_icao = $this->getAllAircraftType($ModeS,$source_type); |
|
| 3700 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3699 | + $aircraft_icao = $this->getAllAircraftType($ModeS, $source_type); |
|
| 3700 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3701 | 3701 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
| 3702 | 3702 | { |
| 3703 | 3703 | $timeelapsed = microtime(true); |
| 3704 | 3704 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3705 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3705 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3706 | 3706 | } else { |
| 3707 | 3707 | $timeelapsed = microtime(true); |
| 3708 | 3708 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3709 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3709 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3710 | 3710 | } |
| 3711 | 3711 | } |
| 3712 | 3712 | } |
@@ -3722,7 +3722,7 @@ discard block |
||
| 3722 | 3722 | } else { |
| 3723 | 3723 | $timeelapsed = microtime(true); |
| 3724 | 3724 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
| 3725 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3725 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3726 | 3726 | } |
| 3727 | 3727 | } |
| 3728 | 3728 | |
@@ -3737,7 +3737,7 @@ discard block |
||
| 3737 | 3737 | } else { |
| 3738 | 3738 | $timeelapsed = microtime(true); |
| 3739 | 3739 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
| 3740 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3740 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3741 | 3741 | } |
| 3742 | 3742 | } |
| 3743 | 3743 | |
@@ -3790,7 +3790,7 @@ discard block |
||
| 3790 | 3790 | } |
| 3791 | 3791 | |
| 3792 | 3792 | |
| 3793 | - if ($date == "" || strtotime($date) < time()-20*60) |
|
| 3793 | + if ($date == "" || strtotime($date) < time() - 20*60) |
|
| 3794 | 3794 | { |
| 3795 | 3795 | $date = date("Y-m-d H:i:s", time()); |
| 3796 | 3796 | } |
@@ -3800,7 +3800,7 @@ discard block |
||
| 3800 | 3800 | { |
| 3801 | 3801 | $timeelapsed = microtime(true); |
| 3802 | 3802 | $image_array = $Image->getSpotterImage($registration); |
| 3803 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3803 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3804 | 3804 | if (!isset($image_array[0]['registration'])) |
| 3805 | 3805 | { |
| 3806 | 3806 | //echo "Add image !!!! \n"; |
@@ -3808,7 +3808,7 @@ discard block |
||
| 3808 | 3808 | } |
| 3809 | 3809 | $timeelapsed = microtime(true); |
| 3810 | 3810 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
| 3811 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3811 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3812 | 3812 | if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
| 3813 | 3813 | } |
| 3814 | 3814 | |
@@ -3816,33 +3816,33 @@ discard block |
||
| 3816 | 3816 | { |
| 3817 | 3817 | if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
| 3818 | 3818 | else $airline_icao = ''; |
| 3819 | - $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
| 3819 | + $image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao); |
|
| 3820 | 3820 | if (!isset($image_array[0]['registration'])) |
| 3821 | 3821 | { |
| 3822 | 3822 | //echo "Add image !!!! \n"; |
| 3823 | - $Image->addSpotterImage('',$aircraft_icao,$airline_icao); |
|
| 3823 | + $Image->addSpotterImage('', $aircraft_icao, $airline_icao); |
|
| 3824 | 3824 | } |
| 3825 | 3825 | } |
| 3826 | 3826 | |
| 3827 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 3828 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 3829 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 3830 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 3831 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 3832 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 3833 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3834 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3835 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
| 3836 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3837 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 3838 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3839 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
| 3840 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
| 3841 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
| 3842 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
| 3843 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 3844 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 3845 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
| 3827 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 3828 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 3829 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 3830 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 3831 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 3832 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 3833 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3834 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3835 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
| 3836 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3837 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 3838 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3839 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
| 3840 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
| 3841 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
| 3842 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
| 3843 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 3844 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 3845 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
| 3846 | 3846 | |
| 3847 | 3847 | if (count($airline_array) == 0) |
| 3848 | 3848 | { |
@@ -3870,7 +3870,7 @@ discard block |
||
| 3870 | 3870 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
| 3871 | 3871 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
| 3872 | 3872 | if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
| 3873 | - $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) |
|
| 3873 | + $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
| 3874 | 3874 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)"; |
| 3875 | 3875 | |
| 3876 | 3876 | $airline_name = $airline_array[0]['name']; |
@@ -3880,7 +3880,7 @@ discard block |
||
| 3880 | 3880 | if ($airline_type == '') { |
| 3881 | 3881 | $timeelapsed = microtime(true); |
| 3882 | 3882 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3883 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3883 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3884 | 3884 | } |
| 3885 | 3885 | if ($airline_type == null) $airline_type = ''; |
| 3886 | 3886 | $aircraft_type = $aircraft_array[0]['type']; |
@@ -3892,7 +3892,7 @@ discard block |
||
| 3892 | 3892 | $arrival_airport_name = $arrival_airport_array[0]['name']; |
| 3893 | 3893 | $arrival_airport_city = $arrival_airport_array[0]['city']; |
| 3894 | 3894 | $arrival_airport_country = $arrival_airport_array[0]['country']; |
| 3895 | - $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); |
|
| 3895 | + $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); |
|
| 3896 | 3896 | |
| 3897 | 3897 | try { |
| 3898 | 3898 | |
@@ -3918,13 +3918,13 @@ discard block |
||
| 3918 | 3918 | { |
| 3919 | 3919 | global $globalDBdriver, $globalTimezone; |
| 3920 | 3920 | if ($globalDBdriver == 'mysql') { |
| 3921 | - $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3921 | + $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3922 | 3922 | WHERE spotter_output.ident = :ident |
| 3923 | 3923 | AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 3924 | 3924 | AND spotter_output.date < UTC_TIMESTAMP()"; |
| 3925 | 3925 | $query_data = array(':ident' => $ident); |
| 3926 | 3926 | } else { |
| 3927 | - $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3927 | + $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3928 | 3928 | WHERE spotter_output.ident = :ident |
| 3929 | 3929 | AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 3930 | 3930 | AND spotter_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -3933,8 +3933,8 @@ discard block |
||
| 3933 | 3933 | |
| 3934 | 3934 | $sth = $this->db->prepare($query); |
| 3935 | 3935 | $sth->execute($query_data); |
| 3936 | - $ident_result=''; |
|
| 3937 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3936 | + $ident_result = ''; |
|
| 3937 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3938 | 3938 | { |
| 3939 | 3939 | $ident_result = $row['ident']; |
| 3940 | 3940 | } |
@@ -3960,8 +3960,8 @@ discard block |
||
| 3960 | 3960 | return false; |
| 3961 | 3961 | } else { |
| 3962 | 3962 | $q_array = explode(" ", $q); |
| 3963 | - foreach ($q_array as $q_item){ |
|
| 3964 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 3963 | + foreach ($q_array as $q_item) { |
|
| 3964 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 3965 | 3965 | $additional_query .= " AND ("; |
| 3966 | 3966 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
| 3967 | 3967 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
@@ -3976,11 +3976,11 @@ discard block |
||
| 3976 | 3976 | } |
| 3977 | 3977 | } |
| 3978 | 3978 | if ($globalDBdriver == 'mysql') { |
| 3979 | - $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3979 | + $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3980 | 3980 | WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
| 3981 | 3981 | AND spotter_output.date < UTC_TIMESTAMP()"; |
| 3982 | 3982 | } else { |
| 3983 | - $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3983 | + $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3984 | 3984 | WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
| 3985 | 3985 | AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
| 3986 | 3986 | } |
@@ -3997,11 +3997,11 @@ discard block |
||
| 3997 | 3997 | * @return Array the airline list |
| 3998 | 3998 | * |
| 3999 | 3999 | */ |
| 4000 | - public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '') |
|
| 4000 | + public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 4001 | 4001 | { |
| 4002 | 4002 | global $globalDBdriver; |
| 4003 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4004 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4003 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4004 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4005 | 4005 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA'"; |
| 4006 | 4006 | if ($olderthanmonths > 0) { |
| 4007 | 4007 | if ($globalDBdriver == 'mysql') { |
@@ -4021,28 +4021,28 @@ discard block |
||
| 4021 | 4021 | if ($year != '') { |
| 4022 | 4022 | if ($globalDBdriver == 'mysql') { |
| 4023 | 4023 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 4024 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4024 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4025 | 4025 | } else { |
| 4026 | 4026 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 4027 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4027 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4028 | 4028 | } |
| 4029 | 4029 | } |
| 4030 | 4030 | if ($month != '') { |
| 4031 | 4031 | if ($globalDBdriver == 'mysql') { |
| 4032 | 4032 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 4033 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4033 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4034 | 4034 | } else { |
| 4035 | 4035 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 4036 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4036 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4037 | 4037 | } |
| 4038 | 4038 | } |
| 4039 | 4039 | if ($day != '') { |
| 4040 | 4040 | if ($globalDBdriver == 'mysql') { |
| 4041 | 4041 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 4042 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4042 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4043 | 4043 | } else { |
| 4044 | 4044 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 4045 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4045 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4046 | 4046 | } |
| 4047 | 4047 | } |
| 4048 | 4048 | $query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC"; |
@@ -4052,7 +4052,7 @@ discard block |
||
| 4052 | 4052 | $sth->execute($query_values); |
| 4053 | 4053 | $airline_array = array(); |
| 4054 | 4054 | $temp_array = array(); |
| 4055 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4055 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4056 | 4056 | { |
| 4057 | 4057 | $temp_array['airline_name'] = $row['airline_name']; |
| 4058 | 4058 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4069,11 +4069,11 @@ discard block |
||
| 4069 | 4069 | * @return Array the pilots list |
| 4070 | 4070 | * |
| 4071 | 4071 | */ |
| 4072 | - public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '') |
|
| 4072 | + public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 4073 | 4073 | { |
| 4074 | 4074 | global $globalDBdriver; |
| 4075 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4076 | - $query = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
| 4075 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4076 | + $query = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
| 4077 | 4077 | FROM spotter_output LEFT JOIN (SELECT DISTINCT pilot_id, pilot_name, max(date) as date FROM spotter_output GROUP BY pilot_id, pilot_name) s ON s.pilot_id = spotter_output.pilot_id".$filter_query." spotter_output.pilot_id <> ''"; |
| 4078 | 4078 | if ($olderthanmonths > 0) { |
| 4079 | 4079 | if ($globalDBdriver == 'mysql') { |
@@ -4093,28 +4093,28 @@ discard block |
||
| 4093 | 4093 | if ($year != '') { |
| 4094 | 4094 | if ($globalDBdriver == 'mysql') { |
| 4095 | 4095 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 4096 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4096 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4097 | 4097 | } else { |
| 4098 | 4098 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 4099 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4099 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4100 | 4100 | } |
| 4101 | 4101 | } |
| 4102 | 4102 | if ($month != '') { |
| 4103 | 4103 | if ($globalDBdriver == 'mysql') { |
| 4104 | 4104 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 4105 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4105 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4106 | 4106 | } else { |
| 4107 | 4107 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 4108 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4108 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4109 | 4109 | } |
| 4110 | 4110 | } |
| 4111 | 4111 | if ($day != '') { |
| 4112 | 4112 | if ($globalDBdriver == 'mysql') { |
| 4113 | 4113 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 4114 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4114 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4115 | 4115 | } else { |
| 4116 | 4116 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 4117 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4117 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4118 | 4118 | } |
| 4119 | 4119 | } |
| 4120 | 4120 | |
@@ -4126,7 +4126,7 @@ discard block |
||
| 4126 | 4126 | $sth->execute($query_values); |
| 4127 | 4127 | $airline_array = array(); |
| 4128 | 4128 | $temp_array = array(); |
| 4129 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4129 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4130 | 4130 | { |
| 4131 | 4131 | $temp_array['pilot_name'] = $row['pilot_name']; |
| 4132 | 4132 | $temp_array['pilot_id'] = $row['pilot_id']; |
@@ -4146,7 +4146,7 @@ discard block |
||
| 4146 | 4146 | public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
| 4147 | 4147 | { |
| 4148 | 4148 | global $globalDBdriver; |
| 4149 | - $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 |
|
| 4149 | + $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 |
|
| 4150 | 4150 | FROM spotter_output WHERE spotter_output.pilot_id <> '' "; |
| 4151 | 4151 | if ($olderthanmonths > 0) { |
| 4152 | 4152 | if ($globalDBdriver == 'mysql') { |
@@ -4172,7 +4172,7 @@ discard block |
||
| 4172 | 4172 | $airline_array = array(); |
| 4173 | 4173 | $temp_array = array(); |
| 4174 | 4174 | |
| 4175 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4175 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4176 | 4176 | { |
| 4177 | 4177 | $temp_array['pilot_name'] = $row['pilot_name']; |
| 4178 | 4178 | $temp_array['pilot_id'] = $row['pilot_id']; |
@@ -4190,11 +4190,11 @@ discard block |
||
| 4190 | 4190 | * @return Array the pilots list |
| 4191 | 4191 | * |
| 4192 | 4192 | */ |
| 4193 | - public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
| 4193 | + public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 4194 | 4194 | { |
| 4195 | 4195 | global $globalDBdriver; |
| 4196 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4197 | - $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 4196 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4197 | + $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 4198 | 4198 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL"; |
| 4199 | 4199 | if ($olderthanmonths > 0) { |
| 4200 | 4200 | if ($globalDBdriver == 'mysql') { |
@@ -4214,28 +4214,28 @@ discard block |
||
| 4214 | 4214 | if ($year != '') { |
| 4215 | 4215 | if ($globalDBdriver == 'mysql') { |
| 4216 | 4216 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 4217 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4217 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4218 | 4218 | } else { |
| 4219 | 4219 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 4220 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4220 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4221 | 4221 | } |
| 4222 | 4222 | } |
| 4223 | 4223 | if ($month != '') { |
| 4224 | 4224 | if ($globalDBdriver == 'mysql') { |
| 4225 | 4225 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 4226 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4226 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4227 | 4227 | } else { |
| 4228 | 4228 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 4229 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4229 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4230 | 4230 | } |
| 4231 | 4231 | } |
| 4232 | 4232 | if ($day != '') { |
| 4233 | 4233 | if ($globalDBdriver == 'mysql') { |
| 4234 | 4234 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 4235 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4235 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4236 | 4236 | } else { |
| 4237 | 4237 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 4238 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4238 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4239 | 4239 | } |
| 4240 | 4240 | } |
| 4241 | 4241 | $query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC"; |
@@ -4245,7 +4245,7 @@ discard block |
||
| 4245 | 4245 | $sth->execute($query_values); |
| 4246 | 4246 | $airline_array = array(); |
| 4247 | 4247 | $temp_array = array(); |
| 4248 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4248 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4249 | 4249 | { |
| 4250 | 4250 | $temp_array['owner_name'] = $row['owner_name']; |
| 4251 | 4251 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -4260,11 +4260,11 @@ discard block |
||
| 4260 | 4260 | * @return Array the pilots list |
| 4261 | 4261 | * |
| 4262 | 4262 | */ |
| 4263 | - public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 4263 | + public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 4264 | 4264 | { |
| 4265 | 4265 | global $globalDBdriver; |
| 4266 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4267 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 4266 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4267 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 4268 | 4268 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
| 4269 | 4269 | if ($olderthanmonths > 0) { |
| 4270 | 4270 | if ($globalDBdriver == 'mysql') { |
@@ -4290,7 +4290,7 @@ discard block |
||
| 4290 | 4290 | $airline_array = array(); |
| 4291 | 4291 | $temp_array = array(); |
| 4292 | 4292 | |
| 4293 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4293 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4294 | 4294 | { |
| 4295 | 4295 | $temp_array['owner_name'] = $row['owner_name']; |
| 4296 | 4296 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -4306,11 +4306,11 @@ discard block |
||
| 4306 | 4306 | * @return Array the airline list |
| 4307 | 4307 | * |
| 4308 | 4308 | */ |
| 4309 | - public function countAllAirlinesByAircraft($aircraft_icao,$filters = array()) |
|
| 4309 | + public function countAllAirlinesByAircraft($aircraft_icao, $filters = array()) |
|
| 4310 | 4310 | { |
| 4311 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 4312 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4313 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4311 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 4312 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4313 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4314 | 4314 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 4315 | 4315 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
| 4316 | 4316 | ORDER BY airline_count DESC"; |
@@ -4322,7 +4322,7 @@ discard block |
||
| 4322 | 4322 | $airline_array = array(); |
| 4323 | 4323 | $temp_array = array(); |
| 4324 | 4324 | |
| 4325 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4325 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4326 | 4326 | { |
| 4327 | 4327 | $temp_array['airline_name'] = $row['airline_name']; |
| 4328 | 4328 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4342,11 +4342,11 @@ discard block |
||
| 4342 | 4342 | * @return Array the airline country list |
| 4343 | 4343 | * |
| 4344 | 4344 | */ |
| 4345 | - public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array()) |
|
| 4345 | + public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array()) |
|
| 4346 | 4346 | { |
| 4347 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 4348 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4349 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4347 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 4348 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4349 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4350 | 4350 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 4351 | 4351 | GROUP BY spotter_output.airline_country |
| 4352 | 4352 | ORDER BY airline_country_count DESC |
@@ -4359,7 +4359,7 @@ discard block |
||
| 4359 | 4359 | $airline_country_array = array(); |
| 4360 | 4360 | $temp_array = array(); |
| 4361 | 4361 | |
| 4362 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4362 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4363 | 4363 | { |
| 4364 | 4364 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4365 | 4365 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4378,11 +4378,11 @@ discard block |
||
| 4378 | 4378 | * @return Array the airline list |
| 4379 | 4379 | * |
| 4380 | 4380 | */ |
| 4381 | - public function countAllAirlinesByAirport($airport_icao,$filters = array()) |
|
| 4381 | + public function countAllAirlinesByAirport($airport_icao, $filters = array()) |
|
| 4382 | 4382 | { |
| 4383 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 4384 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4385 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4383 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 4384 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4385 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4386 | 4386 | 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 ) |
| 4387 | 4387 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
| 4388 | 4388 | ORDER BY airline_count DESC"; |
@@ -4394,7 +4394,7 @@ discard block |
||
| 4394 | 4394 | $airline_array = array(); |
| 4395 | 4395 | $temp_array = array(); |
| 4396 | 4396 | |
| 4397 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4397 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4398 | 4398 | { |
| 4399 | 4399 | $temp_array['airline_name'] = $row['airline_name']; |
| 4400 | 4400 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4413,11 +4413,11 @@ discard block |
||
| 4413 | 4413 | * @return Array the airline country list |
| 4414 | 4414 | * |
| 4415 | 4415 | */ |
| 4416 | - public function countAllAirlineCountriesByAirport($airport_icao,$filters = array()) |
|
| 4416 | + public function countAllAirlineCountriesByAirport($airport_icao, $filters = array()) |
|
| 4417 | 4417 | { |
| 4418 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 4419 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4420 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4418 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 4419 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4420 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4421 | 4421 | 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 ) |
| 4422 | 4422 | GROUP BY spotter_output.airline_country |
| 4423 | 4423 | ORDER BY airline_country_count DESC |
@@ -4430,7 +4430,7 @@ discard block |
||
| 4430 | 4430 | $airline_country_array = array(); |
| 4431 | 4431 | $temp_array = array(); |
| 4432 | 4432 | |
| 4433 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4433 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4434 | 4434 | { |
| 4435 | 4435 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4436 | 4436 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4447,11 +4447,11 @@ discard block |
||
| 4447 | 4447 | * @return Array the airline list |
| 4448 | 4448 | * |
| 4449 | 4449 | */ |
| 4450 | - public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 4450 | + public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 4451 | 4451 | { |
| 4452 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 4453 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4454 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4452 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 4453 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4454 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4455 | 4455 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 4456 | 4456 | GROUP BY spotter_output.airline_name |
| 4457 | 4457 | ORDER BY airline_count DESC"; |
@@ -4462,7 +4462,7 @@ discard block |
||
| 4462 | 4462 | $airline_array = array(); |
| 4463 | 4463 | $temp_array = array(); |
| 4464 | 4464 | |
| 4465 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4465 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4466 | 4466 | { |
| 4467 | 4467 | $temp_array['airline_name'] = $row['airline_name']; |
| 4468 | 4468 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4482,11 +4482,11 @@ discard block |
||
| 4482 | 4482 | * @return Array the airline country list |
| 4483 | 4483 | * |
| 4484 | 4484 | */ |
| 4485 | - public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 4485 | + public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 4486 | 4486 | { |
| 4487 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 4488 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4489 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4487 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 4488 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4489 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4490 | 4490 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 4491 | 4491 | GROUP BY spotter_output.airline_country |
| 4492 | 4492 | ORDER BY airline_country_count DESC |
@@ -4499,7 +4499,7 @@ discard block |
||
| 4499 | 4499 | $airline_country_array = array(); |
| 4500 | 4500 | $temp_array = array(); |
| 4501 | 4501 | |
| 4502 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4502 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4503 | 4503 | { |
| 4504 | 4504 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4505 | 4505 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4515,11 +4515,11 @@ discard block |
||
| 4515 | 4515 | * @return Array the airline list |
| 4516 | 4516 | * |
| 4517 | 4517 | */ |
| 4518 | - public function countAllAirlinesByDate($date,$filters = array()) |
|
| 4518 | + public function countAllAirlinesByDate($date, $filters = array()) |
|
| 4519 | 4519 | { |
| 4520 | 4520 | global $globalTimezone, $globalDBdriver; |
| 4521 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4522 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 4521 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4522 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 4523 | 4523 | if ($globalTimezone != '') { |
| 4524 | 4524 | date_default_timezone_set($globalTimezone); |
| 4525 | 4525 | $datetime = new DateTime($date); |
@@ -4527,12 +4527,12 @@ discard block |
||
| 4527 | 4527 | } else $offset = '+00:00'; |
| 4528 | 4528 | |
| 4529 | 4529 | if ($globalDBdriver == 'mysql') { |
| 4530 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4530 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4531 | 4531 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 4532 | 4532 | GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country |
| 4533 | 4533 | ORDER BY airline_count DESC"; |
| 4534 | 4534 | } else { |
| 4535 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4535 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4536 | 4536 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 4537 | 4537 | GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country |
| 4538 | 4538 | ORDER BY airline_count DESC"; |
@@ -4543,7 +4543,7 @@ discard block |
||
| 4543 | 4543 | |
| 4544 | 4544 | $airline_array = array(); |
| 4545 | 4545 | $temp_array = array(); |
| 4546 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4546 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4547 | 4547 | { |
| 4548 | 4548 | $temp_array['airline_name'] = $row['airline_name']; |
| 4549 | 4549 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4563,11 +4563,11 @@ discard block |
||
| 4563 | 4563 | * @return Array the airline country list |
| 4564 | 4564 | * |
| 4565 | 4565 | */ |
| 4566 | - public function countAllAirlineCountriesByDate($date,$filters = array()) |
|
| 4566 | + public function countAllAirlineCountriesByDate($date, $filters = array()) |
|
| 4567 | 4567 | { |
| 4568 | 4568 | global $globalTimezone, $globalDBdriver; |
| 4569 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4570 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 4569 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4570 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 4571 | 4571 | if ($globalTimezone != '') { |
| 4572 | 4572 | date_default_timezone_set($globalTimezone); |
| 4573 | 4573 | $datetime = new DateTime($date); |
@@ -4575,13 +4575,13 @@ discard block |
||
| 4575 | 4575 | } else $offset = '+00:00'; |
| 4576 | 4576 | |
| 4577 | 4577 | if ($globalDBdriver == 'mysql') { |
| 4578 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4578 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4579 | 4579 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 4580 | 4580 | GROUP BY spotter_output.airline_country |
| 4581 | 4581 | ORDER BY airline_country_count DESC |
| 4582 | 4582 | LIMIT 10 OFFSET 0"; |
| 4583 | 4583 | } else { |
| 4584 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4584 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4585 | 4585 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 4586 | 4586 | GROUP BY spotter_output.airline_country |
| 4587 | 4587 | ORDER BY airline_country_count DESC |
@@ -4593,7 +4593,7 @@ discard block |
||
| 4593 | 4593 | |
| 4594 | 4594 | $airline_country_array = array(); |
| 4595 | 4595 | $temp_array = array(); |
| 4596 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4596 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4597 | 4597 | { |
| 4598 | 4598 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4599 | 4599 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4610,11 +4610,11 @@ discard block |
||
| 4610 | 4610 | * @return Array the airline list |
| 4611 | 4611 | * |
| 4612 | 4612 | */ |
| 4613 | - public function countAllAirlinesByIdent($ident,$filters = array()) |
|
| 4613 | + public function countAllAirlinesByIdent($ident, $filters = array()) |
|
| 4614 | 4614 | { |
| 4615 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 4616 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4617 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4615 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 4616 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4617 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4618 | 4618 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 4619 | 4619 | GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country |
| 4620 | 4620 | ORDER BY airline_count DESC"; |
@@ -4631,11 +4631,11 @@ discard block |
||
| 4631 | 4631 | * @return Array the airline list |
| 4632 | 4632 | * |
| 4633 | 4633 | */ |
| 4634 | - public function countAllAirlinesByOwner($owner,$filters = array()) |
|
| 4634 | + public function countAllAirlinesByOwner($owner, $filters = array()) |
|
| 4635 | 4635 | { |
| 4636 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 4637 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4638 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4636 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 4637 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4638 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4639 | 4639 | FROM spotter_output".$filter_query." spotter_output.owner_name = :owner |
| 4640 | 4640 | GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country |
| 4641 | 4641 | ORDER BY airline_count DESC"; |
@@ -4652,47 +4652,47 @@ discard block |
||
| 4652 | 4652 | * @return String Duration of all flights |
| 4653 | 4653 | * |
| 4654 | 4654 | */ |
| 4655 | - public function getFlightDurationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '') |
|
| 4655 | + public function getFlightDurationByOwner($owner, $filters = array(), $year = '', $month = '', $day = '') |
|
| 4656 | 4656 | { |
| 4657 | 4657 | global $globalDBdriver; |
| 4658 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 4659 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4660 | - $query = "SELECT SUM(last_seen - date) AS duration |
|
| 4658 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 4659 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4660 | + $query = "SELECT SUM(last_seen - date) AS duration |
|
| 4661 | 4661 | FROM spotter_output".$filter_query." spotter_output.owner_name = :owner |
| 4662 | 4662 | AND last_seen > date"; |
| 4663 | 4663 | $query_values = array(); |
| 4664 | 4664 | if ($year != '') { |
| 4665 | 4665 | if ($globalDBdriver == 'mysql') { |
| 4666 | 4666 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 4667 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4667 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4668 | 4668 | } else { |
| 4669 | 4669 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 4670 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4670 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4671 | 4671 | } |
| 4672 | 4672 | } |
| 4673 | 4673 | if ($month != '') { |
| 4674 | 4674 | if ($globalDBdriver == 'mysql') { |
| 4675 | 4675 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 4676 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4676 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4677 | 4677 | } else { |
| 4678 | 4678 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 4679 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4679 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4680 | 4680 | } |
| 4681 | 4681 | } |
| 4682 | 4682 | if ($day != '') { |
| 4683 | 4683 | if ($globalDBdriver == 'mysql') { |
| 4684 | 4684 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 4685 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4685 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4686 | 4686 | } else { |
| 4687 | 4687 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 4688 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4688 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4689 | 4689 | } |
| 4690 | 4690 | } |
| 4691 | - $query_values = array_merge($query_values,array(':owner' => $owner)); |
|
| 4691 | + $query_values = array_merge($query_values, array(':owner' => $owner)); |
|
| 4692 | 4692 | $sth = $this->db->prepare($query); |
| 4693 | 4693 | $sth->execute($query_values); |
| 4694 | 4694 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 4695 | - if (is_numeric($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
| 4695 | + if (is_numeric($result[0]['duration'])) return gmdate('H:i:s', $result[0]['duration']); |
|
| 4696 | 4696 | elseif ($result[0]['duration'] == '') return 0; |
| 4697 | 4697 | else return $result[0]['duration']; |
| 4698 | 4698 | } |
@@ -4703,14 +4703,14 @@ discard block |
||
| 4703 | 4703 | * @return String Duration of all flights |
| 4704 | 4704 | * |
| 4705 | 4705 | */ |
| 4706 | - public function countFlightsByOwner($owner,$filters = array()) |
|
| 4706 | + public function countFlightsByOwner($owner, $filters = array()) |
|
| 4707 | 4707 | { |
| 4708 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 4709 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4710 | - $query = "SELECT COUNT(*) AS nb |
|
| 4708 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 4709 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4710 | + $query = "SELECT COUNT(*) AS nb |
|
| 4711 | 4711 | FROM spotter_output".$filter_query." spotter_output.owner_name = :owner"; |
| 4712 | 4712 | $query_values = array(); |
| 4713 | - $query_values = array_merge($query_values,array(':owner' => $owner)); |
|
| 4713 | + $query_values = array_merge($query_values, array(':owner' => $owner)); |
|
| 4714 | 4714 | $sth = $this->db->prepare($query); |
| 4715 | 4715 | $sth->execute($query_values); |
| 4716 | 4716 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -4723,14 +4723,14 @@ discard block |
||
| 4723 | 4723 | * @return String Duration of all flights |
| 4724 | 4724 | * |
| 4725 | 4725 | */ |
| 4726 | - public function countFlightsByPilot($pilot,$filters = array()) |
|
| 4726 | + public function countFlightsByPilot($pilot, $filters = array()) |
|
| 4727 | 4727 | { |
| 4728 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 4729 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4730 | - $query = "SELECT COUNT(*) AS nb |
|
| 4728 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 4729 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4730 | + $query = "SELECT COUNT(*) AS nb |
|
| 4731 | 4731 | FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilod_id = :pilot)"; |
| 4732 | 4732 | $query_values = array(); |
| 4733 | - $query_values = array_merge($query_values,array(':pilot' => $pilot)); |
|
| 4733 | + $query_values = array_merge($query_values, array(':pilot' => $pilot)); |
|
| 4734 | 4734 | $sth = $this->db->prepare($query); |
| 4735 | 4735 | $sth->execute($query_values); |
| 4736 | 4736 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -4743,47 +4743,47 @@ discard block |
||
| 4743 | 4743 | * @return String Duration of all flights |
| 4744 | 4744 | * |
| 4745 | 4745 | */ |
| 4746 | - public function getFlightDurationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '') |
|
| 4746 | + public function getFlightDurationByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '') |
|
| 4747 | 4747 | { |
| 4748 | 4748 | global $globalDBdriver; |
| 4749 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 4750 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4751 | - $query = "SELECT SUM(last_seen - date) AS duration |
|
| 4749 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 4750 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4751 | + $query = "SELECT SUM(last_seen - date) AS duration |
|
| 4752 | 4752 | FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) |
| 4753 | 4753 | AND last_seen > date"; |
| 4754 | 4754 | $query_values = array(); |
| 4755 | 4755 | if ($year != '') { |
| 4756 | 4756 | if ($globalDBdriver == 'mysql') { |
| 4757 | 4757 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 4758 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4758 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4759 | 4759 | } else { |
| 4760 | 4760 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 4761 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4761 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4762 | 4762 | } |
| 4763 | 4763 | } |
| 4764 | 4764 | if ($month != '') { |
| 4765 | 4765 | if ($globalDBdriver == 'mysql') { |
| 4766 | 4766 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 4767 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4767 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4768 | 4768 | } else { |
| 4769 | 4769 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 4770 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4770 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4771 | 4771 | } |
| 4772 | 4772 | } |
| 4773 | 4773 | if ($day != '') { |
| 4774 | 4774 | if ($globalDBdriver == 'mysql') { |
| 4775 | 4775 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 4776 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4776 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4777 | 4777 | } else { |
| 4778 | 4778 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 4779 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4779 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4780 | 4780 | } |
| 4781 | 4781 | } |
| 4782 | - $query_values = array_merge($query_values,array(':pilot' => $pilot)); |
|
| 4782 | + $query_values = array_merge($query_values, array(':pilot' => $pilot)); |
|
| 4783 | 4783 | $sth = $this->db->prepare($query); |
| 4784 | 4784 | $sth->execute($query_values); |
| 4785 | 4785 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 4786 | - if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
| 4786 | + if (is_int($result[0]['duration'])) return gmdate('H:i:s', $result[0]['duration']); |
|
| 4787 | 4787 | else return $result[0]['duration']; |
| 4788 | 4788 | } |
| 4789 | 4789 | |
@@ -4793,11 +4793,11 @@ discard block |
||
| 4793 | 4793 | * @return Array the airline list |
| 4794 | 4794 | * |
| 4795 | 4795 | */ |
| 4796 | - public function countAllAirlinesByPilot($pilot,$filters = array()) |
|
| 4796 | + public function countAllAirlinesByPilot($pilot, $filters = array()) |
|
| 4797 | 4797 | { |
| 4798 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 4799 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4800 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4798 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 4799 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4800 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4801 | 4801 | FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) |
| 4802 | 4802 | GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country |
| 4803 | 4803 | ORDER BY airline_count DESC"; |
@@ -4814,25 +4814,25 @@ discard block |
||
| 4814 | 4814 | * @return Array the airline list |
| 4815 | 4815 | * |
| 4816 | 4816 | */ |
| 4817 | - public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 4817 | + public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 4818 | 4818 | { |
| 4819 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4820 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4821 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4819 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4820 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4821 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4822 | 4822 | |
| 4823 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4823 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4824 | 4824 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 4825 | 4825 | GROUP BY spotter_output.airline_name |
| 4826 | 4826 | ORDER BY airline_count DESC"; |
| 4827 | 4827 | |
| 4828 | 4828 | |
| 4829 | 4829 | $sth = $this->db->prepare($query); |
| 4830 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4830 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4831 | 4831 | |
| 4832 | 4832 | $airline_array = array(); |
| 4833 | 4833 | $temp_array = array(); |
| 4834 | 4834 | |
| 4835 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4835 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4836 | 4836 | { |
| 4837 | 4837 | $temp_array['airline_name'] = $row['airline_name']; |
| 4838 | 4838 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4850,13 +4850,13 @@ discard block |
||
| 4850 | 4850 | * @return Array the airline country list |
| 4851 | 4851 | * |
| 4852 | 4852 | */ |
| 4853 | - public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array()) |
|
| 4853 | + public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 4854 | 4854 | { |
| 4855 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4856 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4857 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4855 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4856 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4857 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4858 | 4858 | |
| 4859 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4859 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4860 | 4860 | 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) |
| 4861 | 4861 | GROUP BY spotter_output.airline_country |
| 4862 | 4862 | ORDER BY airline_country_count DESC |
@@ -4864,11 +4864,11 @@ discard block |
||
| 4864 | 4864 | |
| 4865 | 4865 | |
| 4866 | 4866 | $sth = $this->db->prepare($query); |
| 4867 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4867 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4868 | 4868 | |
| 4869 | 4869 | $airline_country_array = array(); |
| 4870 | 4870 | $temp_array = array(); |
| 4871 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4871 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4872 | 4872 | { |
| 4873 | 4873 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4874 | 4874 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4886,11 +4886,11 @@ discard block |
||
| 4886 | 4886 | * @return Array the airline list |
| 4887 | 4887 | * |
| 4888 | 4888 | */ |
| 4889 | - public function countAllAirlinesByCountry($country,$filters = array()) |
|
| 4889 | + public function countAllAirlinesByCountry($country, $filters = array()) |
|
| 4890 | 4890 | { |
| 4891 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 4892 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4893 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4891 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 4892 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4893 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4894 | 4894 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 4895 | 4895 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
| 4896 | 4896 | ORDER BY airline_count DESC"; |
@@ -4901,7 +4901,7 @@ discard block |
||
| 4901 | 4901 | |
| 4902 | 4902 | $airline_array = array(); |
| 4903 | 4903 | $temp_array = array(); |
| 4904 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4904 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4905 | 4905 | { |
| 4906 | 4906 | $temp_array['airline_name'] = $row['airline_name']; |
| 4907 | 4907 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4920,11 +4920,11 @@ discard block |
||
| 4920 | 4920 | * @return Array the airline country list |
| 4921 | 4921 | * |
| 4922 | 4922 | */ |
| 4923 | - public function countAllAirlineCountriesByCountry($country,$filters = array()) |
|
| 4923 | + public function countAllAirlineCountriesByCountry($country, $filters = array()) |
|
| 4924 | 4924 | { |
| 4925 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4926 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 4927 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4925 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4926 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 4927 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4928 | 4928 | 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 |
| 4929 | 4929 | GROUP BY spotter_output.airline_country |
| 4930 | 4930 | ORDER BY airline_country_count DESC |
@@ -4936,7 +4936,7 @@ discard block |
||
| 4936 | 4936 | |
| 4937 | 4937 | $airline_country_array = array(); |
| 4938 | 4938 | $temp_array = array(); |
| 4939 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4939 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4940 | 4940 | { |
| 4941 | 4941 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4942 | 4942 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4956,35 +4956,35 @@ discard block |
||
| 4956 | 4956 | public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '') |
| 4957 | 4957 | { |
| 4958 | 4958 | global $globalDBdriver; |
| 4959 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4960 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count, countries.iso3 AS airline_country_iso3 |
|
| 4959 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4960 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count, countries.iso3 AS airline_country_iso3 |
|
| 4961 | 4961 | FROM countries, spotter_output".$filter_query." countries.name = spotter_output.airline_country AND spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA'"; |
| 4962 | 4962 | $query_values = array(); |
| 4963 | 4963 | if ($year != '') { |
| 4964 | 4964 | if ($globalDBdriver == 'mysql') { |
| 4965 | 4965 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 4966 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4966 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4967 | 4967 | } else { |
| 4968 | 4968 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 4969 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4969 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4970 | 4970 | } |
| 4971 | 4971 | } |
| 4972 | 4972 | if ($month != '') { |
| 4973 | 4973 | if ($globalDBdriver == 'mysql') { |
| 4974 | 4974 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 4975 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4975 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4976 | 4976 | } else { |
| 4977 | 4977 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 4978 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4978 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4979 | 4979 | } |
| 4980 | 4980 | } |
| 4981 | 4981 | if ($day != '') { |
| 4982 | 4982 | if ($globalDBdriver == 'mysql') { |
| 4983 | 4983 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 4984 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4984 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4985 | 4985 | } else { |
| 4986 | 4986 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 4987 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4987 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4988 | 4988 | } |
| 4989 | 4989 | } |
| 4990 | 4990 | $query .= " GROUP BY spotter_output.airline_country, countries.iso3 |
@@ -4996,7 +4996,7 @@ discard block |
||
| 4996 | 4996 | |
| 4997 | 4997 | $airline_array = array(); |
| 4998 | 4998 | $temp_array = array(); |
| 4999 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4999 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5000 | 5000 | { |
| 5001 | 5001 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 5002 | 5002 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -5013,11 +5013,11 @@ discard block |
||
| 5013 | 5013 | * @return Array the airline country list |
| 5014 | 5014 | * |
| 5015 | 5015 | */ |
| 5016 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 5016 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5017 | 5017 | { |
| 5018 | 5018 | global $globalDBdriver; |
| 5019 | 5019 | //$filter_query = $this->getFilter($filters,true,true); |
| 5020 | - $Connection= new Connection($this->db); |
|
| 5020 | + $Connection = new Connection($this->db); |
|
| 5021 | 5021 | if (!$Connection->tableExists('countries')) return array(); |
| 5022 | 5022 | /* |
| 5023 | 5023 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -5032,7 +5032,7 @@ discard block |
||
| 5032 | 5032 | */ |
| 5033 | 5033 | require_once('class.SpotterLive.php'); |
| 5034 | 5034 | $SpotterLive = new SpotterLive(); |
| 5035 | - $filter_query = $SpotterLive->getFilter($filters,true,true); |
|
| 5035 | + $filter_query = $SpotterLive->getFilter($filters, true, true); |
|
| 5036 | 5036 | $filter_query .= ' over_country IS NOT NULL'; |
| 5037 | 5037 | if ($olderthanmonths > 0) { |
| 5038 | 5038 | if ($globalDBdriver == 'mysql') { |
@@ -5059,7 +5059,7 @@ discard block |
||
| 5059 | 5059 | $flight_array = array(); |
| 5060 | 5060 | $temp_array = array(); |
| 5061 | 5061 | |
| 5062 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5062 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5063 | 5063 | { |
| 5064 | 5064 | $temp_array['flight_count'] = $row['nb']; |
| 5065 | 5065 | $temp_array['flight_country'] = $row['name']; |
@@ -5077,11 +5077,11 @@ discard block |
||
| 5077 | 5077 | * @return Array the aircraft list |
| 5078 | 5078 | * |
| 5079 | 5079 | */ |
| 5080 | - public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
| 5080 | + public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 5081 | 5081 | { |
| 5082 | 5082 | global $globalDBdriver; |
| 5083 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5084 | - $query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 5083 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5084 | + $query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 5085 | 5085 | FROM spotter_output ".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> ''"; |
| 5086 | 5086 | if ($olderthanmonths > 0) { |
| 5087 | 5087 | if ($globalDBdriver == 'mysql') { |
@@ -5101,28 +5101,28 @@ discard block |
||
| 5101 | 5101 | if ($year != '') { |
| 5102 | 5102 | if ($globalDBdriver == 'mysql') { |
| 5103 | 5103 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 5104 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 5104 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 5105 | 5105 | } else { |
| 5106 | 5106 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 5107 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 5107 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 5108 | 5108 | } |
| 5109 | 5109 | } |
| 5110 | 5110 | if ($month != '') { |
| 5111 | 5111 | if ($globalDBdriver == 'mysql') { |
| 5112 | 5112 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 5113 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 5113 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 5114 | 5114 | } else { |
| 5115 | 5115 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 5116 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 5116 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 5117 | 5117 | } |
| 5118 | 5118 | } |
| 5119 | 5119 | if ($day != '') { |
| 5120 | 5120 | if ($globalDBdriver == 'mysql') { |
| 5121 | 5121 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 5122 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 5122 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 5123 | 5123 | } else { |
| 5124 | 5124 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 5125 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 5125 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 5126 | 5126 | } |
| 5127 | 5127 | } |
| 5128 | 5128 | |
@@ -5134,7 +5134,7 @@ discard block |
||
| 5134 | 5134 | |
| 5135 | 5135 | $aircraft_array = array(); |
| 5136 | 5136 | $temp_array = array(); |
| 5137 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5137 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5138 | 5138 | { |
| 5139 | 5139 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5140 | 5140 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5151,11 +5151,11 @@ discard block |
||
| 5151 | 5151 | * @return Array the aircraft list |
| 5152 | 5152 | * |
| 5153 | 5153 | */ |
| 5154 | - public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '') |
|
| 5154 | + public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 5155 | 5155 | { |
| 5156 | 5156 | global $globalDBdriver; |
| 5157 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5158 | - $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 |
|
| 5157 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5158 | + $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 |
|
| 5159 | 5159 | 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'"; |
| 5160 | 5160 | if ($olderthanmonths > 0) { |
| 5161 | 5161 | if ($globalDBdriver == 'mysql') { |
@@ -5175,28 +5175,28 @@ discard block |
||
| 5175 | 5175 | if ($year != '') { |
| 5176 | 5176 | if ($globalDBdriver == 'mysql') { |
| 5177 | 5177 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 5178 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 5178 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 5179 | 5179 | } else { |
| 5180 | 5180 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 5181 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 5181 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 5182 | 5182 | } |
| 5183 | 5183 | } |
| 5184 | 5184 | if ($month != '') { |
| 5185 | 5185 | if ($globalDBdriver == 'mysql') { |
| 5186 | 5186 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 5187 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 5187 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 5188 | 5188 | } else { |
| 5189 | 5189 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 5190 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 5190 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 5191 | 5191 | } |
| 5192 | 5192 | } |
| 5193 | 5193 | if ($day != '') { |
| 5194 | 5194 | if ($globalDBdriver == 'mysql') { |
| 5195 | 5195 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 5196 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 5196 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 5197 | 5197 | } else { |
| 5198 | 5198 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 5199 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 5199 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 5200 | 5200 | } |
| 5201 | 5201 | } |
| 5202 | 5202 | |
@@ -5208,7 +5208,7 @@ discard block |
||
| 5208 | 5208 | |
| 5209 | 5209 | $aircraft_array = array(); |
| 5210 | 5210 | $temp_array = array(); |
| 5211 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5211 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5212 | 5212 | { |
| 5213 | 5213 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 5214 | 5214 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -5226,11 +5226,11 @@ discard block |
||
| 5226 | 5226 | * @return Array the aircraft list |
| 5227 | 5227 | * |
| 5228 | 5228 | */ |
| 5229 | - public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 5229 | + public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5230 | 5230 | { |
| 5231 | 5231 | global $globalDBdriver; |
| 5232 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5233 | - $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 |
|
| 5232 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5233 | + $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 |
|
| 5234 | 5234 | 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' "; |
| 5235 | 5235 | if ($olderthanmonths > 0) { |
| 5236 | 5236 | if ($globalDBdriver == 'mysql') { |
@@ -5255,7 +5255,7 @@ discard block |
||
| 5255 | 5255 | |
| 5256 | 5256 | $aircraft_array = array(); |
| 5257 | 5257 | $temp_array = array(); |
| 5258 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5258 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5259 | 5259 | { |
| 5260 | 5260 | //$temp_array['airline_icao'] = $row['airline_icao']; |
| 5261 | 5261 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -5274,13 +5274,13 @@ discard block |
||
| 5274 | 5274 | * @return Array the aircraft list |
| 5275 | 5275 | * |
| 5276 | 5276 | */ |
| 5277 | - public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array()) |
|
| 5277 | + public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array()) |
|
| 5278 | 5278 | { |
| 5279 | 5279 | $Image = new Image($this->db); |
| 5280 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5281 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 5280 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5281 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 5282 | 5282 | |
| 5283 | - $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 |
|
| 5283 | + $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 |
|
| 5284 | 5284 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 5285 | 5285 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
| 5286 | 5286 | ORDER BY registration_count DESC"; |
@@ -5291,14 +5291,14 @@ discard block |
||
| 5291 | 5291 | $aircraft_array = array(); |
| 5292 | 5292 | $temp_array = array(); |
| 5293 | 5293 | |
| 5294 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5294 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5295 | 5295 | { |
| 5296 | 5296 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5297 | 5297 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5298 | 5298 | $temp_array['registration'] = $row['registration']; |
| 5299 | 5299 | $temp_array['airline_name'] = $row['airline_name']; |
| 5300 | 5300 | $temp_array['image_thumbnail'] = ""; |
| 5301 | - if($row['registration'] != "") |
|
| 5301 | + if ($row['registration'] != "") |
|
| 5302 | 5302 | { |
| 5303 | 5303 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5304 | 5304 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5317,11 +5317,11 @@ discard block |
||
| 5317 | 5317 | * @return Array the aircraft list |
| 5318 | 5318 | * |
| 5319 | 5319 | */ |
| 5320 | - public function countAllAircraftTypesByAirline($airline_icao,$filters = array()) |
|
| 5320 | + public function countAllAircraftTypesByAirline($airline_icao, $filters = array()) |
|
| 5321 | 5321 | { |
| 5322 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5323 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 5324 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5322 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5323 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 5324 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5325 | 5325 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao |
| 5326 | 5326 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5327 | 5327 | ORDER BY aircraft_icao_count DESC"; |
@@ -5332,7 +5332,7 @@ discard block |
||
| 5332 | 5332 | $aircraft_array = array(); |
| 5333 | 5333 | $temp_array = array(); |
| 5334 | 5334 | |
| 5335 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5335 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5336 | 5336 | { |
| 5337 | 5337 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5338 | 5338 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5350,13 +5350,13 @@ discard block |
||
| 5350 | 5350 | * @return Array the aircraft list |
| 5351 | 5351 | * |
| 5352 | 5352 | */ |
| 5353 | - public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array()) |
|
| 5353 | + public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array()) |
|
| 5354 | 5354 | { |
| 5355 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5355 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5356 | 5356 | $Image = new Image($this->db); |
| 5357 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 5357 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 5358 | 5358 | |
| 5359 | - $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 |
|
| 5359 | + $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 |
|
| 5360 | 5360 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao |
| 5361 | 5361 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5362 | 5362 | ORDER BY registration_count DESC"; |
@@ -5366,14 +5366,14 @@ discard block |
||
| 5366 | 5366 | |
| 5367 | 5367 | $aircraft_array = array(); |
| 5368 | 5368 | $temp_array = array(); |
| 5369 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5369 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5370 | 5370 | { |
| 5371 | 5371 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5372 | 5372 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5373 | 5373 | $temp_array['registration'] = $row['registration']; |
| 5374 | 5374 | $temp_array['airline_name'] = $row['airline_name']; |
| 5375 | 5375 | $temp_array['image_thumbnail'] = ""; |
| 5376 | - if($row['registration'] != "") |
|
| 5376 | + if ($row['registration'] != "") |
|
| 5377 | 5377 | { |
| 5378 | 5378 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5379 | 5379 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5392,11 +5392,11 @@ discard block |
||
| 5392 | 5392 | * @return Array the aircraft list |
| 5393 | 5393 | * |
| 5394 | 5394 | */ |
| 5395 | - public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array()) |
|
| 5395 | + public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array()) |
|
| 5396 | 5396 | { |
| 5397 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5398 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 5399 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5397 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5398 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 5399 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5400 | 5400 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao |
| 5401 | 5401 | GROUP BY spotter_output.aircraft_manufacturer |
| 5402 | 5402 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5407,7 +5407,7 @@ discard block |
||
| 5407 | 5407 | $aircraft_array = array(); |
| 5408 | 5408 | $temp_array = array(); |
| 5409 | 5409 | |
| 5410 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5410 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5411 | 5411 | { |
| 5412 | 5412 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5413 | 5413 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5424,12 +5424,12 @@ discard block |
||
| 5424 | 5424 | * @return Array the aircraft list |
| 5425 | 5425 | * |
| 5426 | 5426 | */ |
| 5427 | - public function countAllAircraftTypesByAirport($airport_icao,$filters = array()) |
|
| 5427 | + public function countAllAircraftTypesByAirport($airport_icao, $filters = array()) |
|
| 5428 | 5428 | { |
| 5429 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5430 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 5429 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5430 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 5431 | 5431 | |
| 5432 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5432 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5433 | 5433 | 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) |
| 5434 | 5434 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5435 | 5435 | ORDER BY aircraft_icao_count DESC"; |
@@ -5439,7 +5439,7 @@ discard block |
||
| 5439 | 5439 | |
| 5440 | 5440 | $aircraft_array = array(); |
| 5441 | 5441 | $temp_array = array(); |
| 5442 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5442 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5443 | 5443 | { |
| 5444 | 5444 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5445 | 5445 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5457,13 +5457,13 @@ discard block |
||
| 5457 | 5457 | * @return Array the aircraft list |
| 5458 | 5458 | * |
| 5459 | 5459 | */ |
| 5460 | - public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array()) |
|
| 5460 | + public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array()) |
|
| 5461 | 5461 | { |
| 5462 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5462 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5463 | 5463 | $Image = new Image($this->db); |
| 5464 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 5464 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 5465 | 5465 | |
| 5466 | - $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 |
|
| 5466 | + $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 |
|
| 5467 | 5467 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 5468 | 5468 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5469 | 5469 | ORDER BY registration_count DESC"; |
@@ -5473,14 +5473,14 @@ discard block |
||
| 5473 | 5473 | |
| 5474 | 5474 | $aircraft_array = array(); |
| 5475 | 5475 | $temp_array = array(); |
| 5476 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5476 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5477 | 5477 | { |
| 5478 | 5478 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5479 | 5479 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5480 | 5480 | $temp_array['registration'] = $row['registration']; |
| 5481 | 5481 | $temp_array['airline_name'] = $row['airline_name']; |
| 5482 | 5482 | $temp_array['image_thumbnail'] = ""; |
| 5483 | - if($row['registration'] != "") |
|
| 5483 | + if ($row['registration'] != "") |
|
| 5484 | 5484 | { |
| 5485 | 5485 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5486 | 5486 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5498,11 +5498,11 @@ discard block |
||
| 5498 | 5498 | * @return Array the aircraft list |
| 5499 | 5499 | * |
| 5500 | 5500 | */ |
| 5501 | - public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array()) |
|
| 5501 | + public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array()) |
|
| 5502 | 5502 | { |
| 5503 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5504 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 5505 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5503 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5504 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 5505 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5506 | 5506 | 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) |
| 5507 | 5507 | GROUP BY spotter_output.aircraft_manufacturer |
| 5508 | 5508 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5513,7 +5513,7 @@ discard block |
||
| 5513 | 5513 | |
| 5514 | 5514 | $aircraft_array = array(); |
| 5515 | 5515 | $temp_array = array(); |
| 5516 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5516 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5517 | 5517 | { |
| 5518 | 5518 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5519 | 5519 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5528,12 +5528,12 @@ discard block |
||
| 5528 | 5528 | * @return Array the aircraft list |
| 5529 | 5529 | * |
| 5530 | 5530 | */ |
| 5531 | - public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 5531 | + public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 5532 | 5532 | { |
| 5533 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5534 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 5533 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5534 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 5535 | 5535 | |
| 5536 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5536 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5537 | 5537 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 5538 | 5538 | GROUP BY spotter_output.aircraft_name |
| 5539 | 5539 | ORDER BY aircraft_icao_count DESC"; |
@@ -5542,7 +5542,7 @@ discard block |
||
| 5542 | 5542 | $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
| 5543 | 5543 | $aircraft_array = array(); |
| 5544 | 5544 | $temp_array = array(); |
| 5545 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5545 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5546 | 5546 | { |
| 5547 | 5547 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5548 | 5548 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5561,11 +5561,11 @@ discard block |
||
| 5561 | 5561 | */ |
| 5562 | 5562 | public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array()) |
| 5563 | 5563 | { |
| 5564 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5564 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5565 | 5565 | $Image = new Image($this->db); |
| 5566 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 5566 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 5567 | 5567 | |
| 5568 | - $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 |
|
| 5568 | + $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 |
|
| 5569 | 5569 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 5570 | 5570 | GROUP BY spotter_output.registration |
| 5571 | 5571 | ORDER BY registration_count DESC"; |
@@ -5575,14 +5575,14 @@ discard block |
||
| 5575 | 5575 | $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
| 5576 | 5576 | $aircraft_array = array(); |
| 5577 | 5577 | $temp_array = array(); |
| 5578 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5578 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5579 | 5579 | { |
| 5580 | 5580 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5581 | 5581 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5582 | 5582 | $temp_array['registration'] = $row['registration']; |
| 5583 | 5583 | $temp_array['airline_name'] = $row['airline_name']; |
| 5584 | 5584 | $temp_array['image_thumbnail'] = ""; |
| 5585 | - if($row['registration'] != "") |
|
| 5585 | + if ($row['registration'] != "") |
|
| 5586 | 5586 | { |
| 5587 | 5587 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5588 | 5588 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5599,11 +5599,11 @@ discard block |
||
| 5599 | 5599 | * @return Array the aircraft list |
| 5600 | 5600 | * |
| 5601 | 5601 | */ |
| 5602 | - public function countAllAircraftTypesByDate($date,$filters = array()) |
|
| 5602 | + public function countAllAircraftTypesByDate($date, $filters = array()) |
|
| 5603 | 5603 | { |
| 5604 | 5604 | global $globalTimezone, $globalDBdriver; |
| 5605 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5606 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 5605 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5606 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 5607 | 5607 | if ($globalTimezone != '') { |
| 5608 | 5608 | date_default_timezone_set($globalTimezone); |
| 5609 | 5609 | $datetime = new DateTime($date); |
@@ -5611,12 +5611,12 @@ discard block |
||
| 5611 | 5611 | } else $offset = '+00:00'; |
| 5612 | 5612 | |
| 5613 | 5613 | if ($globalDBdriver == 'mysql') { |
| 5614 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5614 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5615 | 5615 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 5616 | 5616 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5617 | 5617 | ORDER BY aircraft_icao_count DESC"; |
| 5618 | 5618 | } else { |
| 5619 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5619 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5620 | 5620 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 5621 | 5621 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5622 | 5622 | ORDER BY aircraft_icao_count DESC"; |
@@ -5627,7 +5627,7 @@ discard block |
||
| 5627 | 5627 | |
| 5628 | 5628 | $aircraft_array = array(); |
| 5629 | 5629 | $temp_array = array(); |
| 5630 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5630 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5631 | 5631 | { |
| 5632 | 5632 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5633 | 5633 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5645,12 +5645,12 @@ discard block |
||
| 5645 | 5645 | * @return Array the aircraft list |
| 5646 | 5646 | * |
| 5647 | 5647 | */ |
| 5648 | - public function countAllAircraftRegistrationByDate($date,$filters = array()) |
|
| 5648 | + public function countAllAircraftRegistrationByDate($date, $filters = array()) |
|
| 5649 | 5649 | { |
| 5650 | 5650 | global $globalTimezone, $globalDBdriver; |
| 5651 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5651 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5652 | 5652 | $Image = new Image($this->db); |
| 5653 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 5653 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 5654 | 5654 | if ($globalTimezone != '') { |
| 5655 | 5655 | date_default_timezone_set($globalTimezone); |
| 5656 | 5656 | $datetime = new DateTime($date); |
@@ -5658,12 +5658,12 @@ discard block |
||
| 5658 | 5658 | } else $offset = '+00:00'; |
| 5659 | 5659 | |
| 5660 | 5660 | if ($globalDBdriver == 'mysql') { |
| 5661 | - $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 |
|
| 5661 | + $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 |
|
| 5662 | 5662 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 5663 | 5663 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5664 | 5664 | ORDER BY registration_count DESC"; |
| 5665 | 5665 | } else { |
| 5666 | - $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 |
|
| 5666 | + $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 |
|
| 5667 | 5667 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 5668 | 5668 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5669 | 5669 | ORDER BY registration_count DESC"; |
@@ -5674,14 +5674,14 @@ discard block |
||
| 5674 | 5674 | |
| 5675 | 5675 | $aircraft_array = array(); |
| 5676 | 5676 | $temp_array = array(); |
| 5677 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5677 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5678 | 5678 | { |
| 5679 | 5679 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5680 | 5680 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5681 | 5681 | $temp_array['registration'] = $row['registration']; |
| 5682 | 5682 | $temp_array['airline_name'] = $row['airline_name']; |
| 5683 | 5683 | $temp_array['image_thumbnail'] = ""; |
| 5684 | - if($row['registration'] != "") |
|
| 5684 | + if ($row['registration'] != "") |
|
| 5685 | 5685 | { |
| 5686 | 5686 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5687 | 5687 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5700,11 +5700,11 @@ discard block |
||
| 5700 | 5700 | * @return Array the aircraft manufacturer list |
| 5701 | 5701 | * |
| 5702 | 5702 | */ |
| 5703 | - public function countAllAircraftManufacturerByDate($date,$filters = array()) |
|
| 5703 | + public function countAllAircraftManufacturerByDate($date, $filters = array()) |
|
| 5704 | 5704 | { |
| 5705 | 5705 | global $globalTimezone, $globalDBdriver; |
| 5706 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5707 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 5706 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5707 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 5708 | 5708 | if ($globalTimezone != '') { |
| 5709 | 5709 | date_default_timezone_set($globalTimezone); |
| 5710 | 5710 | $datetime = new DateTime($date); |
@@ -5712,12 +5712,12 @@ discard block |
||
| 5712 | 5712 | } else $offset = '+00:00'; |
| 5713 | 5713 | |
| 5714 | 5714 | if ($globalDBdriver == 'mysql') { |
| 5715 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5715 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5716 | 5716 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 5717 | 5717 | GROUP BY spotter_output.aircraft_manufacturer |
| 5718 | 5718 | ORDER BY aircraft_manufacturer_count DESC"; |
| 5719 | 5719 | } else { |
| 5720 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5720 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5721 | 5721 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 5722 | 5722 | GROUP BY spotter_output.aircraft_manufacturer |
| 5723 | 5723 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5729,7 +5729,7 @@ discard block |
||
| 5729 | 5729 | $aircraft_array = array(); |
| 5730 | 5730 | $temp_array = array(); |
| 5731 | 5731 | |
| 5732 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5732 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5733 | 5733 | { |
| 5734 | 5734 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5735 | 5735 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5746,11 +5746,11 @@ discard block |
||
| 5746 | 5746 | * @return Array the aircraft list |
| 5747 | 5747 | * |
| 5748 | 5748 | */ |
| 5749 | - public function countAllAircraftTypesByIdent($ident,$filters = array()) |
|
| 5749 | + public function countAllAircraftTypesByIdent($ident, $filters = array()) |
|
| 5750 | 5750 | { |
| 5751 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5752 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 5753 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5751 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5752 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 5753 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5754 | 5754 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 5755 | 5755 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5756 | 5756 | ORDER BY aircraft_icao_count DESC"; |
@@ -5761,7 +5761,7 @@ discard block |
||
| 5761 | 5761 | $aircraft_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_icao'] = $row['aircraft_icao']; |
| 5767 | 5767 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5778,45 +5778,45 @@ discard block |
||
| 5778 | 5778 | * @return Array the aircraft list |
| 5779 | 5779 | * |
| 5780 | 5780 | */ |
| 5781 | - public function countAllAircraftTypesByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '') |
|
| 5781 | + public function countAllAircraftTypesByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '') |
|
| 5782 | 5782 | { |
| 5783 | 5783 | global $globalDBdriver; |
| 5784 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5785 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 5786 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5784 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5785 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 5786 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5787 | 5787 | FROM spotter_output".$filter_query." (spotter_output.pilot_id = :pilot OR spotter_output.pilot_name = :pilot)"; |
| 5788 | 5788 | $query_values = array(); |
| 5789 | 5789 | if ($year != '') { |
| 5790 | 5790 | if ($globalDBdriver == 'mysql') { |
| 5791 | 5791 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 5792 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 5792 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 5793 | 5793 | } else { |
| 5794 | 5794 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 5795 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 5795 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 5796 | 5796 | } |
| 5797 | 5797 | } |
| 5798 | 5798 | if ($month != '') { |
| 5799 | 5799 | if ($globalDBdriver == 'mysql') { |
| 5800 | 5800 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 5801 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 5801 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 5802 | 5802 | } else { |
| 5803 | 5803 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 5804 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 5804 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 5805 | 5805 | } |
| 5806 | 5806 | } |
| 5807 | 5807 | if ($day != '') { |
| 5808 | 5808 | if ($globalDBdriver == 'mysql') { |
| 5809 | 5809 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 5810 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 5810 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 5811 | 5811 | } else { |
| 5812 | 5812 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 5813 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 5813 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 5814 | 5814 | } |
| 5815 | 5815 | } |
| 5816 | 5816 | |
| 5817 | 5817 | $query .= " GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5818 | 5818 | ORDER BY aircraft_icao_count DESC"; |
| 5819 | - $query_values = array_merge($query_values,array(':pilot' => $pilot)); |
|
| 5819 | + $query_values = array_merge($query_values, array(':pilot' => $pilot)); |
|
| 5820 | 5820 | $sth = $this->db->prepare($query); |
| 5821 | 5821 | $sth->execute($query_values); |
| 5822 | 5822 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -5828,44 +5828,44 @@ discard block |
||
| 5828 | 5828 | * @return Array the aircraft list |
| 5829 | 5829 | * |
| 5830 | 5830 | */ |
| 5831 | - public function countAllAircraftTypesByOwner($owner,$filters = array(),$year = '',$month = '',$day = '') |
|
| 5831 | + public function countAllAircraftTypesByOwner($owner, $filters = array(), $year = '', $month = '', $day = '') |
|
| 5832 | 5832 | { |
| 5833 | 5833 | global $globalDBdriver; |
| 5834 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5835 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 5836 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 5834 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5835 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 5836 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 5837 | 5837 | FROM spotter_output".$filter_query." spotter_output.owner_name = :owner"; |
| 5838 | 5838 | $query_values = array(); |
| 5839 | 5839 | if ($year != '') { |
| 5840 | 5840 | if ($globalDBdriver == 'mysql') { |
| 5841 | 5841 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 5842 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 5842 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 5843 | 5843 | } else { |
| 5844 | 5844 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 5845 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 5845 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 5846 | 5846 | } |
| 5847 | 5847 | } |
| 5848 | 5848 | if ($month != '') { |
| 5849 | 5849 | if ($globalDBdriver == 'mysql') { |
| 5850 | 5850 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 5851 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 5851 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 5852 | 5852 | } else { |
| 5853 | 5853 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 5854 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 5854 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 5855 | 5855 | } |
| 5856 | 5856 | } |
| 5857 | 5857 | if ($day != '') { |
| 5858 | 5858 | if ($globalDBdriver == 'mysql') { |
| 5859 | 5859 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 5860 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 5860 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 5861 | 5861 | } else { |
| 5862 | 5862 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 5863 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 5863 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 5864 | 5864 | } |
| 5865 | 5865 | } |
| 5866 | 5866 | $query .= " GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.aircraft_icao |
| 5867 | 5867 | ORDER BY aircraft_icao_count DESC"; |
| 5868 | - $query_values = array_merge($query_values,array(':owner' => $owner)); |
|
| 5868 | + $query_values = array_merge($query_values, array(':owner' => $owner)); |
|
| 5869 | 5869 | $sth = $this->db->prepare($query); |
| 5870 | 5870 | $sth->execute($query_values); |
| 5871 | 5871 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -5877,13 +5877,13 @@ discard block |
||
| 5877 | 5877 | * @return Array the aircraft list |
| 5878 | 5878 | * |
| 5879 | 5879 | */ |
| 5880 | - public function countAllAircraftRegistrationByIdent($ident,$filters = array()) |
|
| 5880 | + public function countAllAircraftRegistrationByIdent($ident, $filters = array()) |
|
| 5881 | 5881 | { |
| 5882 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5882 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5883 | 5883 | $Image = new Image($this->db); |
| 5884 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 5884 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 5885 | 5885 | |
| 5886 | - $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 |
|
| 5886 | + $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 |
|
| 5887 | 5887 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident |
| 5888 | 5888 | GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5889 | 5889 | ORDER BY registration_count DESC"; |
@@ -5895,14 +5895,14 @@ discard block |
||
| 5895 | 5895 | $aircraft_array = array(); |
| 5896 | 5896 | $temp_array = array(); |
| 5897 | 5897 | |
| 5898 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5898 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5899 | 5899 | { |
| 5900 | 5900 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5901 | 5901 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5902 | 5902 | $temp_array['registration'] = $row['registration']; |
| 5903 | 5903 | $temp_array['airline_name'] = $row['airline_name']; |
| 5904 | 5904 | $temp_array['image_thumbnail'] = ""; |
| 5905 | - if($row['registration'] != "") |
|
| 5905 | + if ($row['registration'] != "") |
|
| 5906 | 5906 | { |
| 5907 | 5907 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5908 | 5908 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5920,44 +5920,44 @@ discard block |
||
| 5920 | 5920 | * @return Array the aircraft list |
| 5921 | 5921 | * |
| 5922 | 5922 | */ |
| 5923 | - public function countAllAircraftRegistrationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '') |
|
| 5923 | + public function countAllAircraftRegistrationByOwner($owner, $filters = array(), $year = '', $month = '', $day = '') |
|
| 5924 | 5924 | { |
| 5925 | 5925 | global $globalDBdriver; |
| 5926 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5926 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5927 | 5927 | $Image = new Image($this->db); |
| 5928 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 5928 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 5929 | 5929 | |
| 5930 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name |
|
| 5930 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name |
|
| 5931 | 5931 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.owner_name = :owner"; |
| 5932 | 5932 | $query_values = array(); |
| 5933 | 5933 | if ($year != '') { |
| 5934 | 5934 | if ($globalDBdriver == 'mysql') { |
| 5935 | 5935 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 5936 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 5936 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 5937 | 5937 | } else { |
| 5938 | 5938 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 5939 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 5939 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 5940 | 5940 | } |
| 5941 | 5941 | } |
| 5942 | 5942 | if ($month != '') { |
| 5943 | 5943 | if ($globalDBdriver == 'mysql') { |
| 5944 | 5944 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 5945 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 5945 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 5946 | 5946 | } else { |
| 5947 | 5947 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 5948 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 5948 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 5949 | 5949 | } |
| 5950 | 5950 | } |
| 5951 | 5951 | if ($day != '') { |
| 5952 | 5952 | if ($globalDBdriver == 'mysql') { |
| 5953 | 5953 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 5954 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 5954 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 5955 | 5955 | } else { |
| 5956 | 5956 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 5957 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 5957 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 5958 | 5958 | } |
| 5959 | 5959 | } |
| 5960 | - $query_values = array_merge($query_values,array(':owner' => $owner)); |
|
| 5960 | + $query_values = array_merge($query_values, array(':owner' => $owner)); |
|
| 5961 | 5961 | |
| 5962 | 5962 | $query .= " GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name |
| 5963 | 5963 | ORDER BY registration_count DESC"; |
@@ -5969,7 +5969,7 @@ discard block |
||
| 5969 | 5969 | $aircraft_array = array(); |
| 5970 | 5970 | $temp_array = array(); |
| 5971 | 5971 | |
| 5972 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5972 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5973 | 5973 | { |
| 5974 | 5974 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5975 | 5975 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5977,7 +5977,7 @@ discard block |
||
| 5977 | 5977 | $temp_array['registration'] = $row['registration']; |
| 5978 | 5978 | $temp_array['airline_name'] = $row['airline_name']; |
| 5979 | 5979 | $temp_array['image_thumbnail'] = ""; |
| 5980 | - if($row['registration'] != "") |
|
| 5980 | + if ($row['registration'] != "") |
|
| 5981 | 5981 | { |
| 5982 | 5982 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5983 | 5983 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5995,44 +5995,44 @@ discard block |
||
| 5995 | 5995 | * @return Array the aircraft list |
| 5996 | 5996 | * |
| 5997 | 5997 | */ |
| 5998 | - public function countAllAircraftRegistrationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '') |
|
| 5998 | + public function countAllAircraftRegistrationByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '') |
|
| 5999 | 5999 | { |
| 6000 | 6000 | global $globalDBdriver; |
| 6001 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6001 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6002 | 6002 | $Image = new Image($this->db); |
| 6003 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 6003 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 6004 | 6004 | |
| 6005 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name |
|
| 6005 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name |
|
| 6006 | 6006 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)"; |
| 6007 | 6007 | $query_values = array(); |
| 6008 | 6008 | if ($year != '') { |
| 6009 | 6009 | if ($globalDBdriver == 'mysql') { |
| 6010 | 6010 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 6011 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6011 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6012 | 6012 | } else { |
| 6013 | 6013 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 6014 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6014 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6015 | 6015 | } |
| 6016 | 6016 | } |
| 6017 | 6017 | if ($month != '') { |
| 6018 | 6018 | if ($globalDBdriver == 'mysql') { |
| 6019 | 6019 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 6020 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6020 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6021 | 6021 | } else { |
| 6022 | 6022 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 6023 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6023 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6024 | 6024 | } |
| 6025 | 6025 | } |
| 6026 | 6026 | if ($day != '') { |
| 6027 | 6027 | if ($globalDBdriver == 'mysql') { |
| 6028 | 6028 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 6029 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6029 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6030 | 6030 | } else { |
| 6031 | 6031 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 6032 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6032 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6033 | 6033 | } |
| 6034 | 6034 | } |
| 6035 | - $query_values = array_merge($query_values,array(':pilot' => $pilot)); |
|
| 6035 | + $query_values = array_merge($query_values, array(':pilot' => $pilot)); |
|
| 6036 | 6036 | |
| 6037 | 6037 | $query .= " GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name |
| 6038 | 6038 | ORDER BY registration_count DESC"; |
@@ -6044,7 +6044,7 @@ discard block |
||
| 6044 | 6044 | $aircraft_array = array(); |
| 6045 | 6045 | $temp_array = array(); |
| 6046 | 6046 | |
| 6047 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6047 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6048 | 6048 | { |
| 6049 | 6049 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 6050 | 6050 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -6052,7 +6052,7 @@ discard block |
||
| 6052 | 6052 | $temp_array['registration'] = $row['registration']; |
| 6053 | 6053 | $temp_array['airline_name'] = $row['airline_name']; |
| 6054 | 6054 | $temp_array['image_thumbnail'] = ""; |
| 6055 | - if($row['registration'] != "") |
|
| 6055 | + if ($row['registration'] != "") |
|
| 6056 | 6056 | { |
| 6057 | 6057 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6058 | 6058 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -6071,11 +6071,11 @@ discard block |
||
| 6071 | 6071 | * @return Array the aircraft manufacturer list |
| 6072 | 6072 | * |
| 6073 | 6073 | */ |
| 6074 | - public function countAllAircraftManufacturerByIdent($ident,$filters = array()) |
|
| 6074 | + public function countAllAircraftManufacturerByIdent($ident, $filters = array()) |
|
| 6075 | 6075 | { |
| 6076 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6077 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 6078 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 6076 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6077 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 6078 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 6079 | 6079 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident |
| 6080 | 6080 | GROUP BY spotter_output.aircraft_manufacturer |
| 6081 | 6081 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -6085,7 +6085,7 @@ discard block |
||
| 6085 | 6085 | $sth->execute(array(':ident' => $ident)); |
| 6086 | 6086 | $aircraft_array = array(); |
| 6087 | 6087 | $temp_array = array(); |
| 6088 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6088 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6089 | 6089 | { |
| 6090 | 6090 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 6091 | 6091 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -6100,42 +6100,42 @@ discard block |
||
| 6100 | 6100 | * @return Array the aircraft manufacturer list |
| 6101 | 6101 | * |
| 6102 | 6102 | */ |
| 6103 | - public function countAllAircraftManufacturerByOwner($owner,$filters = array(),$year = '',$month = '',$day = '') |
|
| 6103 | + public function countAllAircraftManufacturerByOwner($owner, $filters = array(), $year = '', $month = '', $day = '') |
|
| 6104 | 6104 | { |
| 6105 | 6105 | global $globalDBdriver; |
| 6106 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6107 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 6108 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 6106 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6107 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 6108 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 6109 | 6109 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.owner_name = :owner"; |
| 6110 | 6110 | $query_values = array(); |
| 6111 | 6111 | if ($year != '') { |
| 6112 | 6112 | if ($globalDBdriver == 'mysql') { |
| 6113 | 6113 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 6114 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6114 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6115 | 6115 | } else { |
| 6116 | 6116 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 6117 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6117 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6118 | 6118 | } |
| 6119 | 6119 | } |
| 6120 | 6120 | if ($month != '') { |
| 6121 | 6121 | if ($globalDBdriver == 'mysql') { |
| 6122 | 6122 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 6123 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6123 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6124 | 6124 | } else { |
| 6125 | 6125 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 6126 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6126 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6127 | 6127 | } |
| 6128 | 6128 | } |
| 6129 | 6129 | if ($day != '') { |
| 6130 | 6130 | if ($globalDBdriver == 'mysql') { |
| 6131 | 6131 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 6132 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6132 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6133 | 6133 | } else { |
| 6134 | 6134 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 6135 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6135 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6136 | 6136 | } |
| 6137 | 6137 | } |
| 6138 | - $query_values = array_merge($query_values,array(':owner' => $owner)); |
|
| 6138 | + $query_values = array_merge($query_values, array(':owner' => $owner)); |
|
| 6139 | 6139 | |
| 6140 | 6140 | $query .= " GROUP BY spotter_output.aircraft_manufacturer |
| 6141 | 6141 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -6152,42 +6152,42 @@ discard block |
||
| 6152 | 6152 | * @return Array the aircraft manufacturer list |
| 6153 | 6153 | * |
| 6154 | 6154 | */ |
| 6155 | - public function countAllAircraftManufacturerByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '') |
|
| 6155 | + public function countAllAircraftManufacturerByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '') |
|
| 6156 | 6156 | { |
| 6157 | 6157 | global $globalDBdriver; |
| 6158 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6159 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 6160 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 6158 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6159 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 6160 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 6161 | 6161 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)"; |
| 6162 | 6162 | $query_values = array(); |
| 6163 | 6163 | if ($year != '') { |
| 6164 | 6164 | if ($globalDBdriver == 'mysql') { |
| 6165 | 6165 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 6166 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6166 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6167 | 6167 | } else { |
| 6168 | 6168 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 6169 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6169 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6170 | 6170 | } |
| 6171 | 6171 | } |
| 6172 | 6172 | if ($month != '') { |
| 6173 | 6173 | if ($globalDBdriver == 'mysql') { |
| 6174 | 6174 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 6175 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6175 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6176 | 6176 | } else { |
| 6177 | 6177 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 6178 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6178 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6179 | 6179 | } |
| 6180 | 6180 | } |
| 6181 | 6181 | if ($day != '') { |
| 6182 | 6182 | if ($globalDBdriver == 'mysql') { |
| 6183 | 6183 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 6184 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6184 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6185 | 6185 | } else { |
| 6186 | 6186 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 6187 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6187 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6188 | 6188 | } |
| 6189 | 6189 | } |
| 6190 | - $query_values = array_merge($query_values,array(':pilot' => $pilot)); |
|
| 6190 | + $query_values = array_merge($query_values, array(':pilot' => $pilot)); |
|
| 6191 | 6191 | |
| 6192 | 6192 | $query .= " GROUP BY spotter_output.aircraft_manufacturer |
| 6193 | 6193 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -6205,24 +6205,24 @@ discard block |
||
| 6205 | 6205 | * @return Array the aircraft list |
| 6206 | 6206 | * |
| 6207 | 6207 | */ |
| 6208 | - public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 6208 | + public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 6209 | 6209 | { |
| 6210 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6211 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 6212 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 6210 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6211 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 6212 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 6213 | 6213 | |
| 6214 | 6214 | |
| 6215 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 6215 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 6216 | 6216 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 6217 | 6217 | GROUP BY spotter_output.aircraft_name |
| 6218 | 6218 | ORDER BY aircraft_icao_count DESC"; |
| 6219 | 6219 | |
| 6220 | 6220 | |
| 6221 | 6221 | $sth = $this->db->prepare($query); |
| 6222 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 6222 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 6223 | 6223 | $aircraft_array = array(); |
| 6224 | 6224 | $temp_array = array(); |
| 6225 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6225 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6226 | 6226 | { |
| 6227 | 6227 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 6228 | 6228 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -6238,33 +6238,33 @@ discard block |
||
| 6238 | 6238 | * @return Array the aircraft list |
| 6239 | 6239 | * |
| 6240 | 6240 | */ |
| 6241 | - public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 6241 | + public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 6242 | 6242 | { |
| 6243 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6243 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6244 | 6244 | $Image = new Image($this->db); |
| 6245 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 6246 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 6245 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 6246 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 6247 | 6247 | |
| 6248 | - $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 |
|
| 6248 | + $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 |
|
| 6249 | 6249 | 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) |
| 6250 | 6250 | GROUP BY spotter_output.registration |
| 6251 | 6251 | ORDER BY registration_count DESC"; |
| 6252 | 6252 | |
| 6253 | 6253 | |
| 6254 | 6254 | $sth = $this->db->prepare($query); |
| 6255 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 6255 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 6256 | 6256 | |
| 6257 | 6257 | $aircraft_array = array(); |
| 6258 | 6258 | $temp_array = array(); |
| 6259 | 6259 | |
| 6260 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6260 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6261 | 6261 | { |
| 6262 | 6262 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 6263 | 6263 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 6264 | 6264 | $temp_array['registration'] = $row['registration']; |
| 6265 | 6265 | $temp_array['airline_name'] = $row['airline_name']; |
| 6266 | 6266 | $temp_array['image_thumbnail'] = ""; |
| 6267 | - if($row['registration'] != "") |
|
| 6267 | + if ($row['registration'] != "") |
|
| 6268 | 6268 | { |
| 6269 | 6269 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6270 | 6270 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -6284,25 +6284,25 @@ discard block |
||
| 6284 | 6284 | * @return Array the aircraft manufacturer list |
| 6285 | 6285 | * |
| 6286 | 6286 | */ |
| 6287 | - public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 6287 | + public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 6288 | 6288 | { |
| 6289 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6290 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 6291 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 6289 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6290 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 6291 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 6292 | 6292 | |
| 6293 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 6293 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 6294 | 6294 | 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) |
| 6295 | 6295 | GROUP BY spotter_output.aircraft_manufacturer |
| 6296 | 6296 | ORDER BY aircraft_manufacturer_count DESC"; |
| 6297 | 6297 | |
| 6298 | 6298 | |
| 6299 | 6299 | $sth = $this->db->prepare($query); |
| 6300 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 6300 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 6301 | 6301 | |
| 6302 | 6302 | $aircraft_array = array(); |
| 6303 | 6303 | $temp_array = array(); |
| 6304 | 6304 | |
| 6305 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6305 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6306 | 6306 | { |
| 6307 | 6307 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 6308 | 6308 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -6322,11 +6322,11 @@ discard block |
||
| 6322 | 6322 | * @return Array the aircraft list |
| 6323 | 6323 | * |
| 6324 | 6324 | */ |
| 6325 | - public function countAllAircraftTypesByCountry($country,$filters = array()) |
|
| 6325 | + public function countAllAircraftTypesByCountry($country, $filters = array()) |
|
| 6326 | 6326 | { |
| 6327 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6328 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 6329 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 6327 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6328 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 6329 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 6330 | 6330 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 6331 | 6331 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 6332 | 6332 | ORDER BY aircraft_icao_count DESC"; |
@@ -6338,7 +6338,7 @@ discard block |
||
| 6338 | 6338 | $aircraft_array = array(); |
| 6339 | 6339 | $temp_array = array(); |
| 6340 | 6340 | |
| 6341 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6341 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6342 | 6342 | { |
| 6343 | 6343 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 6344 | 6344 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -6357,12 +6357,12 @@ discard block |
||
| 6357 | 6357 | * @return Array the aircraft list |
| 6358 | 6358 | * |
| 6359 | 6359 | */ |
| 6360 | - public function countAllAircraftRegistrationByCountry($country,$filters = array()) |
|
| 6360 | + public function countAllAircraftRegistrationByCountry($country, $filters = array()) |
|
| 6361 | 6361 | { |
| 6362 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6362 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6363 | 6363 | $Image = new Image($this->db); |
| 6364 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 6365 | - $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 |
|
| 6364 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 6365 | + $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 |
|
| 6366 | 6366 | 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) |
| 6367 | 6367 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 6368 | 6368 | ORDER BY registration_count DESC"; |
@@ -6374,14 +6374,14 @@ discard block |
||
| 6374 | 6374 | $aircraft_array = array(); |
| 6375 | 6375 | $temp_array = array(); |
| 6376 | 6376 | |
| 6377 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6377 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6378 | 6378 | { |
| 6379 | 6379 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 6380 | 6380 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 6381 | 6381 | $temp_array['registration'] = $row['registration']; |
| 6382 | 6382 | $temp_array['airline_name'] = $row['airline_name']; |
| 6383 | 6383 | $temp_array['image_thumbnail'] = ""; |
| 6384 | - if($row['registration'] != "") |
|
| 6384 | + if ($row['registration'] != "") |
|
| 6385 | 6385 | { |
| 6386 | 6386 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6387 | 6387 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -6401,11 +6401,11 @@ discard block |
||
| 6401 | 6401 | * @return Array the aircraft manufacturer list |
| 6402 | 6402 | * |
| 6403 | 6403 | */ |
| 6404 | - public function countAllAircraftManufacturerByCountry($country,$filters = array()) |
|
| 6404 | + public function countAllAircraftManufacturerByCountry($country, $filters = array()) |
|
| 6405 | 6405 | { |
| 6406 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6407 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 6408 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 6406 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6407 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 6408 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 6409 | 6409 | 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) |
| 6410 | 6410 | GROUP BY spotter_output.aircraft_manufacturer |
| 6411 | 6411 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -6417,7 +6417,7 @@ discard block |
||
| 6417 | 6417 | $aircraft_array = array(); |
| 6418 | 6418 | $temp_array = array(); |
| 6419 | 6419 | |
| 6420 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6420 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6421 | 6421 | { |
| 6422 | 6422 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 6423 | 6423 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -6436,38 +6436,38 @@ discard block |
||
| 6436 | 6436 | * @return Array the aircraft list |
| 6437 | 6437 | * |
| 6438 | 6438 | */ |
| 6439 | - public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '') |
|
| 6439 | + public function countAllAircraftManufacturers($filters = array(), $year = '', $month = '', $day = '') |
|
| 6440 | 6440 | { |
| 6441 | 6441 | global $globalDBdriver; |
| 6442 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6443 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 6442 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6443 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 6444 | 6444 | FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'"; |
| 6445 | 6445 | $query_values = array(); |
| 6446 | 6446 | if ($year != '') { |
| 6447 | 6447 | if ($globalDBdriver == 'mysql') { |
| 6448 | 6448 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 6449 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6449 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6450 | 6450 | } else { |
| 6451 | 6451 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 6452 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6452 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6453 | 6453 | } |
| 6454 | 6454 | } |
| 6455 | 6455 | if ($month != '') { |
| 6456 | 6456 | if ($globalDBdriver == 'mysql') { |
| 6457 | 6457 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 6458 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6458 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6459 | 6459 | } else { |
| 6460 | 6460 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 6461 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6461 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6462 | 6462 | } |
| 6463 | 6463 | } |
| 6464 | 6464 | if ($day != '') { |
| 6465 | 6465 | if ($globalDBdriver == 'mysql') { |
| 6466 | 6466 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 6467 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6467 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6468 | 6468 | } else { |
| 6469 | 6469 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 6470 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6470 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6471 | 6471 | } |
| 6472 | 6472 | } |
| 6473 | 6473 | $query .= " GROUP BY spotter_output.aircraft_manufacturer |
@@ -6481,7 +6481,7 @@ discard block |
||
| 6481 | 6481 | $manufacturer_array = array(); |
| 6482 | 6482 | $temp_array = array(); |
| 6483 | 6483 | |
| 6484 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6484 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6485 | 6485 | { |
| 6486 | 6486 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 6487 | 6487 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -6500,12 +6500,12 @@ discard block |
||
| 6500 | 6500 | * @return Array the aircraft list |
| 6501 | 6501 | * |
| 6502 | 6502 | */ |
| 6503 | - public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
|
| 6503 | + public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 6504 | 6504 | { |
| 6505 | 6505 | global $globalDBdriver; |
| 6506 | 6506 | $Image = new Image($this->db); |
| 6507 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6508 | - $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 |
|
| 6507 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6508 | + $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 |
|
| 6509 | 6509 | FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'"; |
| 6510 | 6510 | if ($olderthanmonths > 0) { |
| 6511 | 6511 | if ($globalDBdriver == 'mysql') { |
@@ -6525,28 +6525,28 @@ discard block |
||
| 6525 | 6525 | if ($year != '') { |
| 6526 | 6526 | if ($globalDBdriver == 'mysql') { |
| 6527 | 6527 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 6528 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6528 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6529 | 6529 | } else { |
| 6530 | 6530 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 6531 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6531 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6532 | 6532 | } |
| 6533 | 6533 | } |
| 6534 | 6534 | if ($month != '') { |
| 6535 | 6535 | if ($globalDBdriver == 'mysql') { |
| 6536 | 6536 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 6537 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6537 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6538 | 6538 | } else { |
| 6539 | 6539 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 6540 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6540 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6541 | 6541 | } |
| 6542 | 6542 | } |
| 6543 | 6543 | if ($day != '') { |
| 6544 | 6544 | if ($globalDBdriver == 'mysql') { |
| 6545 | 6545 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 6546 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6546 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6547 | 6547 | } else { |
| 6548 | 6548 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 6549 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6549 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6550 | 6550 | } |
| 6551 | 6551 | } |
| 6552 | 6552 | $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
@@ -6558,7 +6558,7 @@ discard block |
||
| 6558 | 6558 | $aircraft_array = array(); |
| 6559 | 6559 | $temp_array = array(); |
| 6560 | 6560 | |
| 6561 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6561 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6562 | 6562 | { |
| 6563 | 6563 | $temp_array['registration'] = $row['registration']; |
| 6564 | 6564 | $temp_array['aircraft_registration_count'] = $row['aircraft_registration_count']; |
@@ -6566,7 +6566,7 @@ discard block |
||
| 6566 | 6566 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 6567 | 6567 | $temp_array['airline_name'] = $row['airline_name']; |
| 6568 | 6568 | $temp_array['image_thumbnail'] = ""; |
| 6569 | - if($row['registration'] != "") |
|
| 6569 | + if ($row['registration'] != "") |
|
| 6570 | 6570 | { |
| 6571 | 6571 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6572 | 6572 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -6585,12 +6585,12 @@ discard block |
||
| 6585 | 6585 | * @return Array the aircraft list |
| 6586 | 6586 | * |
| 6587 | 6587 | */ |
| 6588 | - public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 6588 | + public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 6589 | 6589 | { |
| 6590 | 6590 | global $globalDBdriver; |
| 6591 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6591 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6592 | 6592 | $Image = new Image($this->db); |
| 6593 | - $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 |
|
| 6593 | + $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 |
|
| 6594 | 6594 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' "; |
| 6595 | 6595 | if ($olderthanmonths > 0) { |
| 6596 | 6596 | if ($globalDBdriver == 'mysql') { |
@@ -6618,7 +6618,7 @@ discard block |
||
| 6618 | 6618 | $aircraft_array = array(); |
| 6619 | 6619 | $temp_array = array(); |
| 6620 | 6620 | |
| 6621 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6621 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6622 | 6622 | { |
| 6623 | 6623 | $temp_array['registration'] = $row['registration']; |
| 6624 | 6624 | $temp_array['aircraft_registration_count'] = $row['aircraft_registration_count']; |
@@ -6627,7 +6627,7 @@ discard block |
||
| 6627 | 6627 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 6628 | 6628 | $temp_array['airline_name'] = $row['airline_name']; |
| 6629 | 6629 | $temp_array['image_thumbnail'] = ""; |
| 6630 | - if($row['registration'] != "") |
|
| 6630 | + if ($row['registration'] != "") |
|
| 6631 | 6631 | { |
| 6632 | 6632 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6633 | 6633 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -6646,11 +6646,11 @@ discard block |
||
| 6646 | 6646 | * @return Array the airport list |
| 6647 | 6647 | * |
| 6648 | 6648 | */ |
| 6649 | - public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
| 6649 | + public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 6650 | 6650 | { |
| 6651 | 6651 | global $globalDBdriver; |
| 6652 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6653 | - $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, airport.latitude, airport.longitude |
|
| 6652 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6653 | + $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, airport.latitude, airport.longitude |
|
| 6654 | 6654 | FROM airport, spotter_output".$filter_query." airport.icao = spotter_output.departure_airport_icao AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''"; |
| 6655 | 6655 | if ($olderthanmonths > 0) { |
| 6656 | 6656 | if ($globalDBdriver == 'mysql') { |
@@ -6670,28 +6670,28 @@ discard block |
||
| 6670 | 6670 | if ($year != '') { |
| 6671 | 6671 | if ($globalDBdriver == 'mysql') { |
| 6672 | 6672 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 6673 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6673 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6674 | 6674 | } else { |
| 6675 | 6675 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 6676 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6676 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6677 | 6677 | } |
| 6678 | 6678 | } |
| 6679 | 6679 | if ($month != '') { |
| 6680 | 6680 | if ($globalDBdriver == 'mysql') { |
| 6681 | 6681 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 6682 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6682 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6683 | 6683 | } else { |
| 6684 | 6684 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 6685 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6685 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6686 | 6686 | } |
| 6687 | 6687 | } |
| 6688 | 6688 | if ($day != '') { |
| 6689 | 6689 | if ($globalDBdriver == 'mysql') { |
| 6690 | 6690 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 6691 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6691 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6692 | 6692 | } else { |
| 6693 | 6693 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 6694 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6694 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6695 | 6695 | } |
| 6696 | 6696 | } |
| 6697 | 6697 | $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, airport.latitude, airport.longitude |
@@ -6703,7 +6703,7 @@ discard block |
||
| 6703 | 6703 | |
| 6704 | 6704 | $airport_array = array(); |
| 6705 | 6705 | $temp_array = array(); |
| 6706 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6706 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6707 | 6707 | { |
| 6708 | 6708 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6709 | 6709 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6723,11 +6723,11 @@ discard block |
||
| 6723 | 6723 | * @return Array the airport list |
| 6724 | 6724 | * |
| 6725 | 6725 | */ |
| 6726 | - public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 6726 | + public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 6727 | 6727 | { |
| 6728 | 6728 | global $globalDBdriver; |
| 6729 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6730 | - $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 |
|
| 6729 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6730 | + $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 |
|
| 6731 | 6731 | 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 <> '' "; |
| 6732 | 6732 | if ($olderthanmonths > 0) { |
| 6733 | 6733 | if ($globalDBdriver == 'mysql') { |
@@ -6756,7 +6756,7 @@ discard block |
||
| 6756 | 6756 | $airport_array = array(); |
| 6757 | 6757 | $temp_array = array(); |
| 6758 | 6758 | |
| 6759 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6759 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6760 | 6760 | { |
| 6761 | 6761 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 6762 | 6762 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -6776,11 +6776,11 @@ discard block |
||
| 6776 | 6776 | * @return Array the airport list |
| 6777 | 6777 | * |
| 6778 | 6778 | */ |
| 6779 | - public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
| 6779 | + public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 6780 | 6780 | { |
| 6781 | 6781 | global $globalDBdriver; |
| 6782 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6783 | - $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, airport.latitude as departure_airport_latitude, airport.longitude as departure_airport.longitude |
|
| 6782 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6783 | + $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, airport.latitude as departure_airport_latitude, airport.longitude as departure_airport.longitude |
|
| 6784 | 6784 | 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"; |
| 6785 | 6785 | if ($olderthanmonths > 0) { |
| 6786 | 6786 | if ($globalDBdriver == 'mysql') { |
@@ -6800,28 +6800,28 @@ discard block |
||
| 6800 | 6800 | if ($year != '') { |
| 6801 | 6801 | if ($globalDBdriver == 'mysql') { |
| 6802 | 6802 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 6803 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6803 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6804 | 6804 | } else { |
| 6805 | 6805 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 6806 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6806 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6807 | 6807 | } |
| 6808 | 6808 | } |
| 6809 | 6809 | if ($month != '') { |
| 6810 | 6810 | if ($globalDBdriver == 'mysql') { |
| 6811 | 6811 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 6812 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6812 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6813 | 6813 | } else { |
| 6814 | 6814 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 6815 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6815 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6816 | 6816 | } |
| 6817 | 6817 | } |
| 6818 | 6818 | if ($day != '') { |
| 6819 | 6819 | if ($globalDBdriver == 'mysql') { |
| 6820 | 6820 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 6821 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6821 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6822 | 6822 | } else { |
| 6823 | 6823 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 6824 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6824 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6825 | 6825 | } |
| 6826 | 6826 | } |
| 6827 | 6827 | $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude |
@@ -6834,7 +6834,7 @@ discard block |
||
| 6834 | 6834 | $airport_array = array(); |
| 6835 | 6835 | $temp_array = array(); |
| 6836 | 6836 | |
| 6837 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6837 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6838 | 6838 | { |
| 6839 | 6839 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6840 | 6840 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6855,11 +6855,11 @@ discard block |
||
| 6855 | 6855 | * @return Array the airport list |
| 6856 | 6856 | * |
| 6857 | 6857 | */ |
| 6858 | - public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 6858 | + public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 6859 | 6859 | { |
| 6860 | 6860 | global $globalDBdriver; |
| 6861 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6862 | - $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 |
|
| 6861 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6862 | + $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 |
|
| 6863 | 6863 | 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 "; |
| 6864 | 6864 | if ($olderthanmonths > 0) { |
| 6865 | 6865 | if ($globalDBdriver == 'mysql') { |
@@ -6888,7 +6888,7 @@ discard block |
||
| 6888 | 6888 | $airport_array = array(); |
| 6889 | 6889 | $temp_array = array(); |
| 6890 | 6890 | |
| 6891 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6891 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6892 | 6892 | { |
| 6893 | 6893 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 6894 | 6894 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -6908,11 +6908,11 @@ discard block |
||
| 6908 | 6908 | * @return Array the airport list |
| 6909 | 6909 | * |
| 6910 | 6910 | */ |
| 6911 | - public function countAllDepartureAirportsByAirline($airline_icao,$filters = array()) |
|
| 6911 | + public function countAllDepartureAirportsByAirline($airline_icao, $filters = array()) |
|
| 6912 | 6912 | { |
| 6913 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6914 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 6915 | - $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 |
|
| 6913 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6914 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 6915 | + $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 |
|
| 6916 | 6916 | 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 <> '' |
| 6917 | 6917 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6918 | 6918 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6924,7 +6924,7 @@ discard block |
||
| 6924 | 6924 | $airport_array = array(); |
| 6925 | 6925 | $temp_array = array(); |
| 6926 | 6926 | |
| 6927 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6927 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6928 | 6928 | { |
| 6929 | 6929 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6930 | 6930 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6946,11 +6946,11 @@ discard block |
||
| 6946 | 6946 | * @return Array the airport list |
| 6947 | 6947 | * |
| 6948 | 6948 | */ |
| 6949 | - public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array()) |
|
| 6949 | + public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array()) |
|
| 6950 | 6950 | { |
| 6951 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6952 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 6953 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6951 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6952 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 6953 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6954 | 6954 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao |
| 6955 | 6955 | GROUP BY spotter_output.departure_airport_country |
| 6956 | 6956 | ORDER BY airport_departure_country_count DESC"; |
@@ -6962,7 +6962,7 @@ discard block |
||
| 6962 | 6962 | $airport_array = array(); |
| 6963 | 6963 | $temp_array = array(); |
| 6964 | 6964 | |
| 6965 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6965 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6966 | 6966 | { |
| 6967 | 6967 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6968 | 6968 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6981,11 +6981,11 @@ discard block |
||
| 6981 | 6981 | * @return Array the airport list |
| 6982 | 6982 | * |
| 6983 | 6983 | */ |
| 6984 | - public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array()) |
|
| 6984 | + public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array()) |
|
| 6985 | 6985 | { |
| 6986 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6987 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 6988 | - $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 |
|
| 6986 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6987 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 6988 | + $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 |
|
| 6989 | 6989 | 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 <> '' |
| 6990 | 6990 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6991 | 6991 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6997,7 +6997,7 @@ discard block |
||
| 6997 | 6997 | $airport_array = array(); |
| 6998 | 6998 | $temp_array = array(); |
| 6999 | 6999 | |
| 7000 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7000 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7001 | 7001 | { |
| 7002 | 7002 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 7003 | 7003 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -7018,11 +7018,11 @@ discard block |
||
| 7018 | 7018 | * @return Array the airport list |
| 7019 | 7019 | * |
| 7020 | 7020 | */ |
| 7021 | - public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
|
| 7021 | + public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array()) |
|
| 7022 | 7022 | { |
| 7023 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7024 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 7025 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7023 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7024 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 7025 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7026 | 7026 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 7027 | 7027 | GROUP BY spotter_output.departure_airport_country |
| 7028 | 7028 | ORDER BY airport_departure_country_count DESC"; |
@@ -7034,7 +7034,7 @@ discard block |
||
| 7034 | 7034 | $airport_array = array(); |
| 7035 | 7035 | $temp_array = array(); |
| 7036 | 7036 | |
| 7037 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7037 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7038 | 7038 | { |
| 7039 | 7039 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 7040 | 7040 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -7052,11 +7052,11 @@ discard block |
||
| 7052 | 7052 | * @return Array the airport list |
| 7053 | 7053 | * |
| 7054 | 7054 | */ |
| 7055 | - public function countAllDepartureAirportsByRegistration($registration,$filters = array()) |
|
| 7055 | + public function countAllDepartureAirportsByRegistration($registration, $filters = array()) |
|
| 7056 | 7056 | { |
| 7057 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7058 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 7059 | - $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 |
|
| 7057 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7058 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 7059 | + $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 |
|
| 7060 | 7060 | 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 <> '' |
| 7061 | 7061 | GROUP BY spotter_output.departure_airport_icao |
| 7062 | 7062 | ORDER BY airport_departure_icao_count DESC"; |
@@ -7068,7 +7068,7 @@ discard block |
||
| 7068 | 7068 | $airport_array = array(); |
| 7069 | 7069 | $temp_array = array(); |
| 7070 | 7070 | |
| 7071 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7071 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7072 | 7072 | { |
| 7073 | 7073 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 7074 | 7074 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -7089,11 +7089,11 @@ discard block |
||
| 7089 | 7089 | * @return Array the airport list |
| 7090 | 7090 | * |
| 7091 | 7091 | */ |
| 7092 | - public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array()) |
|
| 7092 | + public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array()) |
|
| 7093 | 7093 | { |
| 7094 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7095 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 7096 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7094 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7095 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 7096 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7097 | 7097 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration |
| 7098 | 7098 | GROUP BY spotter_output.departure_airport_country |
| 7099 | 7099 | ORDER BY airport_departure_country_count DESC"; |
@@ -7105,7 +7105,7 @@ discard block |
||
| 7105 | 7105 | $airport_array = array(); |
| 7106 | 7106 | $temp_array = array(); |
| 7107 | 7107 | |
| 7108 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7108 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7109 | 7109 | { |
| 7110 | 7110 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 7111 | 7111 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -7123,11 +7123,11 @@ discard block |
||
| 7123 | 7123 | * @return Array the airport list |
| 7124 | 7124 | * |
| 7125 | 7125 | */ |
| 7126 | - public function countAllDepartureAirportsByAirport($airport_icao,$filters = array()) |
|
| 7126 | + public function countAllDepartureAirportsByAirport($airport_icao, $filters = array()) |
|
| 7127 | 7127 | { |
| 7128 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7129 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 7130 | - $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 |
|
| 7128 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7129 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 7130 | + $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 |
|
| 7131 | 7131 | 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 <> '' |
| 7132 | 7132 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 7133 | 7133 | ORDER BY airport_departure_icao_count DESC"; |
@@ -7139,7 +7139,7 @@ discard block |
||
| 7139 | 7139 | $airport_array = array(); |
| 7140 | 7140 | $temp_array = array(); |
| 7141 | 7141 | |
| 7142 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7142 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7143 | 7143 | { |
| 7144 | 7144 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 7145 | 7145 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -7160,11 +7160,11 @@ discard block |
||
| 7160 | 7160 | * @return Array the airport list |
| 7161 | 7161 | * |
| 7162 | 7162 | */ |
| 7163 | - public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array()) |
|
| 7163 | + public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array()) |
|
| 7164 | 7164 | { |
| 7165 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7166 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 7167 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7165 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7166 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 7167 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7168 | 7168 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao |
| 7169 | 7169 | GROUP BY spotter_output.departure_airport_country |
| 7170 | 7170 | ORDER BY airport_departure_country_count DESC"; |
@@ -7176,7 +7176,7 @@ discard block |
||
| 7176 | 7176 | $airport_array = array(); |
| 7177 | 7177 | $temp_array = array(); |
| 7178 | 7178 | |
| 7179 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7179 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7180 | 7180 | { |
| 7181 | 7181 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 7182 | 7182 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -7195,11 +7195,11 @@ discard block |
||
| 7195 | 7195 | * @return Array the airport list |
| 7196 | 7196 | * |
| 7197 | 7197 | */ |
| 7198 | - public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 7198 | + public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 7199 | 7199 | { |
| 7200 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7201 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 7202 | - $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 |
|
| 7200 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7201 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 7202 | + $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 |
|
| 7203 | 7203 | 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 <> '' |
| 7204 | 7204 | GROUP BY spotter_output.departure_airport_icao |
| 7205 | 7205 | ORDER BY airport_departure_icao_count DESC"; |
@@ -7211,7 +7211,7 @@ discard block |
||
| 7211 | 7211 | $airport_array = array(); |
| 7212 | 7212 | $temp_array = array(); |
| 7213 | 7213 | |
| 7214 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7214 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7215 | 7215 | { |
| 7216 | 7216 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 7217 | 7217 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -7232,11 +7232,11 @@ discard block |
||
| 7232 | 7232 | * @return Array the airport list |
| 7233 | 7233 | * |
| 7234 | 7234 | */ |
| 7235 | - public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 7235 | + public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 7236 | 7236 | { |
| 7237 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7238 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 7239 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7237 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7238 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 7239 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7240 | 7240 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 7241 | 7241 | GROUP BY spotter_output.departure_airport_country |
| 7242 | 7242 | ORDER BY airport_departure_country_count DESC"; |
@@ -7248,7 +7248,7 @@ discard block |
||
| 7248 | 7248 | $airport_array = array(); |
| 7249 | 7249 | $temp_array = array(); |
| 7250 | 7250 | |
| 7251 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7251 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7252 | 7252 | { |
| 7253 | 7253 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 7254 | 7254 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -7266,11 +7266,11 @@ discard block |
||
| 7266 | 7266 | * @return Array the airport list |
| 7267 | 7267 | * |
| 7268 | 7268 | */ |
| 7269 | - public function countAllDepartureAirportsByDate($date,$filters = array()) |
|
| 7269 | + public function countAllDepartureAirportsByDate($date, $filters = array()) |
|
| 7270 | 7270 | { |
| 7271 | 7271 | global $globalTimezone, $globalDBdriver; |
| 7272 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7273 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 7272 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7273 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 7274 | 7274 | if ($globalTimezone != '') { |
| 7275 | 7275 | date_default_timezone_set($globalTimezone); |
| 7276 | 7276 | $datetime = new DateTime($date); |
@@ -7278,12 +7278,12 @@ discard block |
||
| 7278 | 7278 | } else $offset = '+00:00'; |
| 7279 | 7279 | |
| 7280 | 7280 | if ($globalDBdriver == 'mysql') { |
| 7281 | - $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 |
|
| 7281 | + $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 |
|
| 7282 | 7282 | 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 |
| 7283 | 7283 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 7284 | 7284 | ORDER BY airport_departure_icao_count DESC"; |
| 7285 | 7285 | } else { |
| 7286 | - $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 |
|
| 7286 | + $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 |
|
| 7287 | 7287 | 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 |
| 7288 | 7288 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 7289 | 7289 | ORDER BY airport_departure_icao_count DESC"; |
@@ -7295,7 +7295,7 @@ discard block |
||
| 7295 | 7295 | $airport_array = array(); |
| 7296 | 7296 | $temp_array = array(); |
| 7297 | 7297 | |
| 7298 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7298 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7299 | 7299 | { |
| 7300 | 7300 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 7301 | 7301 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -7316,11 +7316,11 @@ discard block |
||
| 7316 | 7316 | * @return Array the airport list |
| 7317 | 7317 | * |
| 7318 | 7318 | */ |
| 7319 | - public function countAllDepartureAirportCountriesByDate($date,$filters = array()) |
|
| 7319 | + public function countAllDepartureAirportCountriesByDate($date, $filters = array()) |
|
| 7320 | 7320 | { |
| 7321 | 7321 | global $globalTimezone, $globalDBdriver; |
| 7322 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7323 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 7322 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7323 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 7324 | 7324 | if ($globalTimezone != '') { |
| 7325 | 7325 | date_default_timezone_set($globalTimezone); |
| 7326 | 7326 | $datetime = new DateTime($date); |
@@ -7328,12 +7328,12 @@ discard block |
||
| 7328 | 7328 | } else $offset = '+00:00'; |
| 7329 | 7329 | |
| 7330 | 7330 | if ($globalDBdriver == 'mysql') { |
| 7331 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7331 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7332 | 7332 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 7333 | 7333 | GROUP BY spotter_output.departure_airport_country |
| 7334 | 7334 | ORDER BY airport_departure_country_count DESC"; |
| 7335 | 7335 | } else { |
| 7336 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7336 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7337 | 7337 | 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 |
| 7338 | 7338 | GROUP BY spotter_output.departure_airport_country |
| 7339 | 7339 | ORDER BY airport_departure_country_count DESC"; |
@@ -7345,7 +7345,7 @@ discard block |
||
| 7345 | 7345 | $airport_array = array(); |
| 7346 | 7346 | $temp_array = array(); |
| 7347 | 7347 | |
| 7348 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7348 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7349 | 7349 | { |
| 7350 | 7350 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 7351 | 7351 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -7363,11 +7363,11 @@ discard block |
||
| 7363 | 7363 | * @return Array the airport list |
| 7364 | 7364 | * |
| 7365 | 7365 | */ |
| 7366 | - public function countAllDepartureAirportsByIdent($ident,$filters = array()) |
|
| 7366 | + public function countAllDepartureAirportsByIdent($ident, $filters = array()) |
|
| 7367 | 7367 | { |
| 7368 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7369 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 7370 | - $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 |
|
| 7368 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7369 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 7370 | + $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 |
|
| 7371 | 7371 | 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 |
| 7372 | 7372 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 7373 | 7373 | ORDER BY airport_departure_icao_count DESC"; |
@@ -7379,7 +7379,7 @@ discard block |
||
| 7379 | 7379 | $airport_array = array(); |
| 7380 | 7380 | $temp_array = array(); |
| 7381 | 7381 | |
| 7382 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7382 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7383 | 7383 | { |
| 7384 | 7384 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 7385 | 7385 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -7399,11 +7399,11 @@ discard block |
||
| 7399 | 7399 | * @return Array the airport list |
| 7400 | 7400 | * |
| 7401 | 7401 | */ |
| 7402 | - public function countAllDepartureAirportsByOwner($owner,$filters = array()) |
|
| 7402 | + public function countAllDepartureAirportsByOwner($owner, $filters = array()) |
|
| 7403 | 7403 | { |
| 7404 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7405 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 7406 | - $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 |
|
| 7404 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7405 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 7406 | + $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 |
|
| 7407 | 7407 | 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.owner_name = :owner |
| 7408 | 7408 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 7409 | 7409 | ORDER BY airport_departure_icao_count DESC"; |
@@ -7415,7 +7415,7 @@ discard block |
||
| 7415 | 7415 | $airport_array = array(); |
| 7416 | 7416 | $temp_array = array(); |
| 7417 | 7417 | |
| 7418 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7418 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7419 | 7419 | { |
| 7420 | 7420 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 7421 | 7421 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -7435,11 +7435,11 @@ discard block |
||
| 7435 | 7435 | * @return Array the airport list |
| 7436 | 7436 | * |
| 7437 | 7437 | */ |
| 7438 | - public function countAllDepartureAirportsByPilot($pilot,$filters = array()) |
|
| 7438 | + public function countAllDepartureAirportsByPilot($pilot, $filters = array()) |
|
| 7439 | 7439 | { |
| 7440 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7441 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 7442 | - $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 |
|
| 7440 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7441 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 7442 | + $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 |
|
| 7443 | 7443 | 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.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) |
| 7444 | 7444 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 7445 | 7445 | ORDER BY airport_departure_icao_count DESC"; |
@@ -7450,7 +7450,7 @@ discard block |
||
| 7450 | 7450 | $airport_array = array(); |
| 7451 | 7451 | $temp_array = array(); |
| 7452 | 7452 | |
| 7453 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7453 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7454 | 7454 | { |
| 7455 | 7455 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 7456 | 7456 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -7472,11 +7472,11 @@ discard block |
||
| 7472 | 7472 | * @return Array the airport list |
| 7473 | 7473 | * |
| 7474 | 7474 | */ |
| 7475 | - public function countAllDepartureAirportCountriesByIdent($ident,$filters = array()) |
|
| 7475 | + public function countAllDepartureAirportCountriesByIdent($ident, $filters = array()) |
|
| 7476 | 7476 | { |
| 7477 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7478 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 7479 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7477 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7478 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 7479 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7480 | 7480 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident |
| 7481 | 7481 | GROUP BY spotter_output.departure_airport_country |
| 7482 | 7482 | ORDER BY airport_departure_country_count DESC"; |
@@ -7488,7 +7488,7 @@ discard block |
||
| 7488 | 7488 | $airport_array = array(); |
| 7489 | 7489 | $temp_array = array(); |
| 7490 | 7490 | |
| 7491 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7491 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7492 | 7492 | { |
| 7493 | 7493 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 7494 | 7494 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -7505,11 +7505,11 @@ discard block |
||
| 7505 | 7505 | * @return Array the airport list |
| 7506 | 7506 | * |
| 7507 | 7507 | */ |
| 7508 | - public function countAllDepartureAirportCountriesByOwner($owner,$filters = array()) |
|
| 7508 | + public function countAllDepartureAirportCountriesByOwner($owner, $filters = array()) |
|
| 7509 | 7509 | { |
| 7510 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7511 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 7512 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7510 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7511 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 7512 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7513 | 7513 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.owner_name = :owner |
| 7514 | 7514 | GROUP BY spotter_output.departure_airport_country |
| 7515 | 7515 | ORDER BY airport_departure_country_count DESC"; |
@@ -7525,11 +7525,11 @@ discard block |
||
| 7525 | 7525 | * @return Array the airport list |
| 7526 | 7526 | * |
| 7527 | 7527 | */ |
| 7528 | - public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array()) |
|
| 7528 | + public function countAllDepartureAirportCountriesByPilot($pilot, $filters = array()) |
|
| 7529 | 7529 | { |
| 7530 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7531 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 7532 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7530 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7531 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 7532 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7533 | 7533 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) |
| 7534 | 7534 | GROUP BY spotter_output.departure_airport_country |
| 7535 | 7535 | ORDER BY airport_departure_country_count DESC"; |
@@ -7547,12 +7547,12 @@ discard block |
||
| 7547 | 7547 | * @return Array the airport list |
| 7548 | 7548 | * |
| 7549 | 7549 | */ |
| 7550 | - public function countAllDepartureAirportsByCountry($country,$filters = array()) |
|
| 7550 | + public function countAllDepartureAirportsByCountry($country, $filters = array()) |
|
| 7551 | 7551 | { |
| 7552 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7553 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 7552 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7553 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 7554 | 7554 | |
| 7555 | - $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 |
|
| 7555 | + $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 |
|
| 7556 | 7556 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 7557 | 7557 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 7558 | 7558 | ORDER BY airport_departure_icao_count DESC"; |
@@ -7564,7 +7564,7 @@ discard block |
||
| 7564 | 7564 | $airport_array = array(); |
| 7565 | 7565 | $temp_array = array(); |
| 7566 | 7566 | |
| 7567 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7567 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7568 | 7568 | { |
| 7569 | 7569 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 7570 | 7570 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -7585,11 +7585,11 @@ discard block |
||
| 7585 | 7585 | * @return Array the airport list |
| 7586 | 7586 | * |
| 7587 | 7587 | */ |
| 7588 | - public function countAllDepartureAirportCountriesByCountry($country,$filters = array()) |
|
| 7588 | + public function countAllDepartureAirportCountriesByCountry($country, $filters = array()) |
|
| 7589 | 7589 | { |
| 7590 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7591 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 7592 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7590 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7591 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 7592 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7593 | 7593 | 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 |
| 7594 | 7594 | GROUP BY spotter_output.departure_airport_country |
| 7595 | 7595 | ORDER BY airport_departure_country_count DESC"; |
@@ -7601,7 +7601,7 @@ discard block |
||
| 7601 | 7601 | $airport_array = array(); |
| 7602 | 7602 | $temp_array = array(); |
| 7603 | 7603 | |
| 7604 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7604 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7605 | 7605 | { |
| 7606 | 7606 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 7607 | 7607 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -7624,11 +7624,11 @@ discard block |
||
| 7624 | 7624 | * @return Array the airport list |
| 7625 | 7625 | * |
| 7626 | 7626 | */ |
| 7627 | - public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '') |
|
| 7627 | + public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '') |
|
| 7628 | 7628 | { |
| 7629 | 7629 | global $globalDBdriver; |
| 7630 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7631 | - $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, airport.latitude as arrival_airport_latitude, airport.longitude as arrival_airport_longitude |
|
| 7630 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7631 | + $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, airport.latitude as arrival_airport_latitude, airport.longitude as arrival_airport_longitude |
|
| 7632 | 7632 | FROM airport, spotter_output".$filter_query." airport.icao = spotter_output.arrival_airport_icao AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''"; |
| 7633 | 7633 | if ($olderthanmonths > 0) { |
| 7634 | 7634 | if ($globalDBdriver == 'mysql') { |
@@ -7648,28 +7648,28 @@ discard block |
||
| 7648 | 7648 | if ($year != '') { |
| 7649 | 7649 | if ($globalDBdriver == 'mysql') { |
| 7650 | 7650 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 7651 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 7651 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 7652 | 7652 | } else { |
| 7653 | 7653 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 7654 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 7654 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 7655 | 7655 | } |
| 7656 | 7656 | } |
| 7657 | 7657 | if ($month != '') { |
| 7658 | 7658 | if ($globalDBdriver == 'mysql') { |
| 7659 | 7659 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 7660 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 7660 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 7661 | 7661 | } else { |
| 7662 | 7662 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 7663 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 7663 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 7664 | 7664 | } |
| 7665 | 7665 | } |
| 7666 | 7666 | if ($day != '') { |
| 7667 | 7667 | if ($globalDBdriver == 'mysql') { |
| 7668 | 7668 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 7669 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 7669 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 7670 | 7670 | } else { |
| 7671 | 7671 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 7672 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 7672 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 7673 | 7673 | } |
| 7674 | 7674 | } |
| 7675 | 7675 | $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, airport.latitude, airport.longitude |
@@ -7683,7 +7683,7 @@ discard block |
||
| 7683 | 7683 | $airport_array = array(); |
| 7684 | 7684 | $temp_array = array(); |
| 7685 | 7685 | |
| 7686 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7686 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7687 | 7687 | { |
| 7688 | 7688 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7689 | 7689 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7708,11 +7708,11 @@ discard block |
||
| 7708 | 7708 | * @return Array the airport list |
| 7709 | 7709 | * |
| 7710 | 7710 | */ |
| 7711 | - public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
|
| 7711 | + public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
| 7712 | 7712 | { |
| 7713 | 7713 | global $globalDBdriver; |
| 7714 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7715 | - $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 |
|
| 7714 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7715 | + $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 |
|
| 7716 | 7716 | 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 <> '' "; |
| 7717 | 7717 | if ($olderthanmonths > 0) { |
| 7718 | 7718 | if ($globalDBdriver == 'mysql') { |
@@ -7742,7 +7742,7 @@ discard block |
||
| 7742 | 7742 | $airport_array = array(); |
| 7743 | 7743 | $temp_array = array(); |
| 7744 | 7744 | |
| 7745 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7745 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7746 | 7746 | { |
| 7747 | 7747 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 7748 | 7748 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
@@ -7767,11 +7767,11 @@ discard block |
||
| 7767 | 7767 | * @return Array the airport list |
| 7768 | 7768 | * |
| 7769 | 7769 | */ |
| 7770 | - public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '') |
|
| 7770 | + public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '') |
|
| 7771 | 7771 | { |
| 7772 | 7772 | global $globalDBdriver; |
| 7773 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7774 | - $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, airport.latitude AS arrival_airport_latitude, airport.longitude AS arrival_airport_longitude |
|
| 7773 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7774 | + $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, airport.latitude AS arrival_airport_latitude, airport.longitude AS arrival_airport_longitude |
|
| 7775 | 7775 | 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"; |
| 7776 | 7776 | if ($olderthanmonths > 0) { |
| 7777 | 7777 | if ($globalDBdriver == 'mysql') { |
@@ -7791,28 +7791,28 @@ discard block |
||
| 7791 | 7791 | if ($year != '') { |
| 7792 | 7792 | if ($globalDBdriver == 'mysql') { |
| 7793 | 7793 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 7794 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 7794 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 7795 | 7795 | } else { |
| 7796 | 7796 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 7797 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 7797 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 7798 | 7798 | } |
| 7799 | 7799 | } |
| 7800 | 7800 | if ($month != '') { |
| 7801 | 7801 | if ($globalDBdriver == 'mysql') { |
| 7802 | 7802 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 7803 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 7803 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 7804 | 7804 | } else { |
| 7805 | 7805 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 7806 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 7806 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 7807 | 7807 | } |
| 7808 | 7808 | } |
| 7809 | 7809 | if ($day != '') { |
| 7810 | 7810 | if ($globalDBdriver == 'mysql') { |
| 7811 | 7811 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 7812 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 7812 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 7813 | 7813 | } else { |
| 7814 | 7814 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 7815 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 7815 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 7816 | 7816 | } |
| 7817 | 7817 | } |
| 7818 | 7818 | $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude |
@@ -7825,7 +7825,7 @@ discard block |
||
| 7825 | 7825 | |
| 7826 | 7826 | $airport_array = array(); |
| 7827 | 7827 | $temp_array = array(); |
| 7828 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7828 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7829 | 7829 | { |
| 7830 | 7830 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7831 | 7831 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7848,11 +7848,11 @@ discard block |
||
| 7848 | 7848 | * @return Array the airport list |
| 7849 | 7849 | * |
| 7850 | 7850 | */ |
| 7851 | - public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
|
| 7851 | + public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
| 7852 | 7852 | { |
| 7853 | 7853 | global $globalDBdriver; |
| 7854 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7855 | - $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 |
|
| 7854 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7855 | + $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 |
|
| 7856 | 7856 | 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 "; |
| 7857 | 7857 | if ($olderthanmonths > 0) { |
| 7858 | 7858 | if ($globalDBdriver == 'mysql') { |
@@ -7882,7 +7882,7 @@ discard block |
||
| 7882 | 7882 | $airport_array = array(); |
| 7883 | 7883 | $temp_array = array(); |
| 7884 | 7884 | |
| 7885 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7885 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7886 | 7886 | { |
| 7887 | 7887 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7888 | 7888 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7908,9 +7908,9 @@ discard block |
||
| 7908 | 7908 | */ |
| 7909 | 7909 | public function countAllArrivalAirportsByAirline($airline_icao, $filters = array()) |
| 7910 | 7910 | { |
| 7911 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7912 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 7913 | - $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 |
|
| 7911 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7912 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 7913 | + $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 |
|
| 7914 | 7914 | 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 |
| 7915 | 7915 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7916 | 7916 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7921,7 +7921,7 @@ discard block |
||
| 7921 | 7921 | $airport_array = array(); |
| 7922 | 7922 | $temp_array = array(); |
| 7923 | 7923 | |
| 7924 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7924 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7925 | 7925 | { |
| 7926 | 7926 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7927 | 7927 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7942,12 +7942,12 @@ discard block |
||
| 7942 | 7942 | * @return Array the airport list |
| 7943 | 7943 | * |
| 7944 | 7944 | */ |
| 7945 | - public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array()) |
|
| 7945 | + public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array()) |
|
| 7946 | 7946 | { |
| 7947 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7948 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 7947 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7948 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 7949 | 7949 | |
| 7950 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7950 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7951 | 7951 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao |
| 7952 | 7952 | GROUP BY spotter_output.arrival_airport_country |
| 7953 | 7953 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7959,7 +7959,7 @@ discard block |
||
| 7959 | 7959 | $airport_array = array(); |
| 7960 | 7960 | $temp_array = array(); |
| 7961 | 7961 | |
| 7962 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7962 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7963 | 7963 | { |
| 7964 | 7964 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7965 | 7965 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7977,11 +7977,11 @@ discard block |
||
| 7977 | 7977 | * @return Array the airport list |
| 7978 | 7978 | * |
| 7979 | 7979 | */ |
| 7980 | - public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array()) |
|
| 7980 | + public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array()) |
|
| 7981 | 7981 | { |
| 7982 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7983 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 7984 | - $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 |
|
| 7982 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7983 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 7984 | + $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 |
|
| 7985 | 7985 | 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 |
| 7986 | 7986 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7987 | 7987 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7993,7 +7993,7 @@ discard block |
||
| 7993 | 7993 | $airport_array = array(); |
| 7994 | 7994 | $temp_array = array(); |
| 7995 | 7995 | |
| 7996 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7996 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7997 | 7997 | { |
| 7998 | 7998 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7999 | 7999 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -8015,11 +8015,11 @@ discard block |
||
| 8015 | 8015 | * @return Array the airport list |
| 8016 | 8016 | * |
| 8017 | 8017 | */ |
| 8018 | - public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
|
| 8018 | + public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array()) |
|
| 8019 | 8019 | { |
| 8020 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8021 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 8022 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8020 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8021 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 8022 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8023 | 8023 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 8024 | 8024 | GROUP BY spotter_output.arrival_airport_country |
| 8025 | 8025 | ORDER BY airport_arrival_country_count DESC"; |
@@ -8031,7 +8031,7 @@ discard block |
||
| 8031 | 8031 | $airport_array = array(); |
| 8032 | 8032 | $temp_array = array(); |
| 8033 | 8033 | |
| 8034 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8034 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8035 | 8035 | { |
| 8036 | 8036 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 8037 | 8037 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -8049,12 +8049,12 @@ discard block |
||
| 8049 | 8049 | * @return Array the airport list |
| 8050 | 8050 | * |
| 8051 | 8051 | */ |
| 8052 | - public function countAllArrivalAirportsByRegistration($registration,$filters = array()) |
|
| 8052 | + public function countAllArrivalAirportsByRegistration($registration, $filters = array()) |
|
| 8053 | 8053 | { |
| 8054 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8055 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 8054 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8055 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 8056 | 8056 | |
| 8057 | - $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 |
|
| 8057 | + $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 |
|
| 8058 | 8058 | 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 |
| 8059 | 8059 | GROUP BY spotter_output.arrival_airport_icao |
| 8060 | 8060 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -8066,7 +8066,7 @@ discard block |
||
| 8066 | 8066 | $airport_array = array(); |
| 8067 | 8067 | $temp_array = array(); |
| 8068 | 8068 | |
| 8069 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8069 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8070 | 8070 | { |
| 8071 | 8071 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 8072 | 8072 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -8087,11 +8087,11 @@ discard block |
||
| 8087 | 8087 | * @return Array the airport list |
| 8088 | 8088 | * |
| 8089 | 8089 | */ |
| 8090 | - public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array()) |
|
| 8090 | + public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array()) |
|
| 8091 | 8091 | { |
| 8092 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8093 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 8094 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8092 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8093 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 8094 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8095 | 8095 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration |
| 8096 | 8096 | GROUP BY spotter_output.arrival_airport_country |
| 8097 | 8097 | ORDER BY airport_arrival_country_count DESC"; |
@@ -8103,7 +8103,7 @@ discard block |
||
| 8103 | 8103 | $airport_array = array(); |
| 8104 | 8104 | $temp_array = array(); |
| 8105 | 8105 | |
| 8106 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8106 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8107 | 8107 | { |
| 8108 | 8108 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 8109 | 8109 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -8122,11 +8122,11 @@ discard block |
||
| 8122 | 8122 | * @return Array the airport list |
| 8123 | 8123 | * |
| 8124 | 8124 | */ |
| 8125 | - public function countAllArrivalAirportsByAirport($airport_icao,$filters = array()) |
|
| 8125 | + public function countAllArrivalAirportsByAirport($airport_icao, $filters = array()) |
|
| 8126 | 8126 | { |
| 8127 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8128 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 8129 | - $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 |
|
| 8127 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8128 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 8129 | + $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 |
|
| 8130 | 8130 | 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 |
| 8131 | 8131 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8132 | 8132 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -8138,7 +8138,7 @@ discard block |
||
| 8138 | 8138 | $airport_array = array(); |
| 8139 | 8139 | $temp_array = array(); |
| 8140 | 8140 | |
| 8141 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8141 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8142 | 8142 | { |
| 8143 | 8143 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 8144 | 8144 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -8159,11 +8159,11 @@ discard block |
||
| 8159 | 8159 | * @return Array the airport list |
| 8160 | 8160 | * |
| 8161 | 8161 | */ |
| 8162 | - public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array()) |
|
| 8162 | + public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array()) |
|
| 8163 | 8163 | { |
| 8164 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8165 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 8166 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8164 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8165 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 8166 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8167 | 8167 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao |
| 8168 | 8168 | GROUP BY spotter_output.arrival_airport_country |
| 8169 | 8169 | ORDER BY airport_arrival_country_count DESC"; |
@@ -8175,7 +8175,7 @@ discard block |
||
| 8175 | 8175 | $airport_array = array(); |
| 8176 | 8176 | $temp_array = array(); |
| 8177 | 8177 | |
| 8178 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8178 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8179 | 8179 | { |
| 8180 | 8180 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 8181 | 8181 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -8193,11 +8193,11 @@ discard block |
||
| 8193 | 8193 | * @return Array the airport list |
| 8194 | 8194 | * |
| 8195 | 8195 | */ |
| 8196 | - public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 8196 | + public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 8197 | 8197 | { |
| 8198 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8199 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 8200 | - $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 |
|
| 8198 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8199 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 8200 | + $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 |
|
| 8201 | 8201 | 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 |
| 8202 | 8202 | GROUP BY spotter_output.arrival_airport_icao |
| 8203 | 8203 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -8209,7 +8209,7 @@ discard block |
||
| 8209 | 8209 | $airport_array = array(); |
| 8210 | 8210 | $temp_array = array(); |
| 8211 | 8211 | |
| 8212 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8212 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8213 | 8213 | { |
| 8214 | 8214 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 8215 | 8215 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -8231,11 +8231,11 @@ discard block |
||
| 8231 | 8231 | * @return Array the airport list |
| 8232 | 8232 | * |
| 8233 | 8233 | */ |
| 8234 | - public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 8234 | + public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 8235 | 8235 | { |
| 8236 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8237 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 8238 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8236 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8237 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 8238 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8239 | 8239 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 8240 | 8240 | GROUP BY spotter_output.arrival_airport_country |
| 8241 | 8241 | ORDER BY airport_arrival_country_count DESC"; |
@@ -8247,7 +8247,7 @@ discard block |
||
| 8247 | 8247 | $airport_array = array(); |
| 8248 | 8248 | $temp_array = array(); |
| 8249 | 8249 | |
| 8250 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8250 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8251 | 8251 | { |
| 8252 | 8252 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 8253 | 8253 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -8266,11 +8266,11 @@ discard block |
||
| 8266 | 8266 | * @return Array the airport list |
| 8267 | 8267 | * |
| 8268 | 8268 | */ |
| 8269 | - public function countAllArrivalAirportsByDate($date,$filters = array()) |
|
| 8269 | + public function countAllArrivalAirportsByDate($date, $filters = array()) |
|
| 8270 | 8270 | { |
| 8271 | 8271 | global $globalTimezone, $globalDBdriver; |
| 8272 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8273 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 8272 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8273 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 8274 | 8274 | if ($globalTimezone != '') { |
| 8275 | 8275 | date_default_timezone_set($globalTimezone); |
| 8276 | 8276 | $datetime = new DateTime($date); |
@@ -8278,12 +8278,12 @@ discard block |
||
| 8278 | 8278 | } else $offset = '+00:00'; |
| 8279 | 8279 | |
| 8280 | 8280 | if ($globalDBdriver == 'mysql') { |
| 8281 | - $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 |
|
| 8281 | + $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 |
|
| 8282 | 8282 | 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 |
| 8283 | 8283 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8284 | 8284 | ORDER BY airport_arrival_icao_count DESC"; |
| 8285 | 8285 | } else { |
| 8286 | - $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 |
|
| 8286 | + $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 |
|
| 8287 | 8287 | 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 |
| 8288 | 8288 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8289 | 8289 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -8295,7 +8295,7 @@ discard block |
||
| 8295 | 8295 | $airport_array = array(); |
| 8296 | 8296 | $temp_array = array(); |
| 8297 | 8297 | |
| 8298 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8298 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8299 | 8299 | { |
| 8300 | 8300 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 8301 | 8301 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -8319,8 +8319,8 @@ discard block |
||
| 8319 | 8319 | public function countAllArrivalAirportCountriesByDate($date, $filters = array()) |
| 8320 | 8320 | { |
| 8321 | 8321 | global $globalTimezone, $globalDBdriver; |
| 8322 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8323 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 8322 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8323 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 8324 | 8324 | if ($globalTimezone != '') { |
| 8325 | 8325 | date_default_timezone_set($globalTimezone); |
| 8326 | 8326 | $datetime = new DateTime($date); |
@@ -8328,12 +8328,12 @@ discard block |
||
| 8328 | 8328 | } else $offset = '+00:00'; |
| 8329 | 8329 | |
| 8330 | 8330 | if ($globalDBdriver == 'mysql') { |
| 8331 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8331 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8332 | 8332 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 8333 | 8333 | GROUP BY spotter_output.arrival_airport_country |
| 8334 | 8334 | ORDER BY airport_arrival_country_count DESC"; |
| 8335 | 8335 | } else { |
| 8336 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8336 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8337 | 8337 | 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 |
| 8338 | 8338 | GROUP BY spotter_output.arrival_airport_country |
| 8339 | 8339 | ORDER BY airport_arrival_country_count DESC"; |
@@ -8345,7 +8345,7 @@ discard block |
||
| 8345 | 8345 | $airport_array = array(); |
| 8346 | 8346 | $temp_array = array(); |
| 8347 | 8347 | |
| 8348 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8348 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8349 | 8349 | { |
| 8350 | 8350 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 8351 | 8351 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -8363,11 +8363,11 @@ discard block |
||
| 8363 | 8363 | * @return Array the airport list |
| 8364 | 8364 | * |
| 8365 | 8365 | */ |
| 8366 | - public function countAllArrivalAirportsByIdent($ident,$filters = array()) |
|
| 8366 | + public function countAllArrivalAirportsByIdent($ident, $filters = array()) |
|
| 8367 | 8367 | { |
| 8368 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8369 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 8370 | - $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 |
|
| 8368 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8369 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 8370 | + $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 |
|
| 8371 | 8371 | 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.ident = :ident |
| 8372 | 8372 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8373 | 8373 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -8379,7 +8379,7 @@ discard block |
||
| 8379 | 8379 | $airport_array = array(); |
| 8380 | 8380 | $temp_array = array(); |
| 8381 | 8381 | |
| 8382 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8382 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8383 | 8383 | { |
| 8384 | 8384 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 8385 | 8385 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -8399,11 +8399,11 @@ discard block |
||
| 8399 | 8399 | * @return Array the airport list |
| 8400 | 8400 | * |
| 8401 | 8401 | */ |
| 8402 | - public function countAllArrivalAirportsByOwner($owner,$filters = array()) |
|
| 8402 | + public function countAllArrivalAirportsByOwner($owner, $filters = array()) |
|
| 8403 | 8403 | { |
| 8404 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8405 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 8406 | - $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 |
|
| 8404 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8405 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 8406 | + $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 |
|
| 8407 | 8407 | 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.owner_name = :owner |
| 8408 | 8408 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8409 | 8409 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -8414,7 +8414,7 @@ discard block |
||
| 8414 | 8414 | $airport_array = array(); |
| 8415 | 8415 | $temp_array = array(); |
| 8416 | 8416 | |
| 8417 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8417 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8418 | 8418 | { |
| 8419 | 8419 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 8420 | 8420 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -8434,11 +8434,11 @@ discard block |
||
| 8434 | 8434 | * @return Array the airport list |
| 8435 | 8435 | * |
| 8436 | 8436 | */ |
| 8437 | - public function countAllArrivalAirportsByPilot($pilot,$filters = array()) |
|
| 8437 | + public function countAllArrivalAirportsByPilot($pilot, $filters = array()) |
|
| 8438 | 8438 | { |
| 8439 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8440 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 8441 | - $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 |
|
| 8439 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8440 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 8441 | + $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 |
|
| 8442 | 8442 | 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.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) |
| 8443 | 8443 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8444 | 8444 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -8449,7 +8449,7 @@ discard block |
||
| 8449 | 8449 | $airport_array = array(); |
| 8450 | 8450 | $temp_array = array(); |
| 8451 | 8451 | |
| 8452 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8452 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8453 | 8453 | { |
| 8454 | 8454 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 8455 | 8455 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -8471,9 +8471,9 @@ discard block |
||
| 8471 | 8471 | */ |
| 8472 | 8472 | public function countAllArrivalAirportCountriesByIdent($ident, $filters = array()) |
| 8473 | 8473 | { |
| 8474 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8475 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 8476 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8474 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8475 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 8476 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8477 | 8477 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident |
| 8478 | 8478 | GROUP BY spotter_output.arrival_airport_country |
| 8479 | 8479 | ORDER BY airport_arrival_country_count DESC"; |
@@ -8485,7 +8485,7 @@ discard block |
||
| 8485 | 8485 | $airport_array = array(); |
| 8486 | 8486 | $temp_array = array(); |
| 8487 | 8487 | |
| 8488 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8488 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8489 | 8489 | { |
| 8490 | 8490 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 8491 | 8491 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -8504,9 +8504,9 @@ discard block |
||
| 8504 | 8504 | */ |
| 8505 | 8505 | public function countAllArrivalAirportCountriesByOwner($owner, $filters = array()) |
| 8506 | 8506 | { |
| 8507 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8508 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 8509 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8507 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8508 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 8509 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8510 | 8510 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.owner_name = :owner |
| 8511 | 8511 | GROUP BY spotter_output.arrival_airport_country |
| 8512 | 8512 | ORDER BY airport_arrival_country_count DESC"; |
@@ -8524,9 +8524,9 @@ discard block |
||
| 8524 | 8524 | */ |
| 8525 | 8525 | public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array()) |
| 8526 | 8526 | { |
| 8527 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8528 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 8529 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8527 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8528 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 8529 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8530 | 8530 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) |
| 8531 | 8531 | GROUP BY spotter_output.arrival_airport_country |
| 8532 | 8532 | ORDER BY airport_arrival_country_count DESC"; |
@@ -8544,11 +8544,11 @@ discard block |
||
| 8544 | 8544 | * @return Array the airport list |
| 8545 | 8545 | * |
| 8546 | 8546 | */ |
| 8547 | - public function countAllArrivalAirportsByCountry($country,$filters = array()) |
|
| 8547 | + public function countAllArrivalAirportsByCountry($country, $filters = array()) |
|
| 8548 | 8548 | { |
| 8549 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8550 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 8551 | - $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 |
|
| 8549 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8550 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 8551 | + $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 |
|
| 8552 | 8552 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 8553 | 8553 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8554 | 8554 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -8560,7 +8560,7 @@ discard block |
||
| 8560 | 8560 | $airport_array = array(); |
| 8561 | 8561 | $temp_array = array(); |
| 8562 | 8562 | |
| 8563 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8563 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8564 | 8564 | { |
| 8565 | 8565 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 8566 | 8566 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -8581,12 +8581,12 @@ discard block |
||
| 8581 | 8581 | * @return Array the airport list |
| 8582 | 8582 | * |
| 8583 | 8583 | */ |
| 8584 | - public function countAllArrivalAirportCountriesByCountry($country,$filters = array()) |
|
| 8584 | + public function countAllArrivalAirportCountriesByCountry($country, $filters = array()) |
|
| 8585 | 8585 | { |
| 8586 | 8586 | global $globalDBdriver; |
| 8587 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8588 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 8589 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8587 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8588 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 8589 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8590 | 8590 | 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 |
| 8591 | 8591 | GROUP BY spotter_output.arrival_airport_country |
| 8592 | 8592 | ORDER BY airport_arrival_country_count DESC"; |
@@ -8598,7 +8598,7 @@ discard block |
||
| 8598 | 8598 | $airport_array = array(); |
| 8599 | 8599 | $temp_array = array(); |
| 8600 | 8600 | |
| 8601 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8601 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8602 | 8602 | { |
| 8603 | 8603 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 8604 | 8604 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -8617,38 +8617,38 @@ discard block |
||
| 8617 | 8617 | * @return Array the airport departure list |
| 8618 | 8618 | * |
| 8619 | 8619 | */ |
| 8620 | - public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '') |
|
| 8620 | + public function countAllDepartureCountries($filters = array(), $year = '', $month = '', $day = '') |
|
| 8621 | 8621 | { |
| 8622 | 8622 | global $globalDBdriver; |
| 8623 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8624 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count, countries.iso3 AS airport_departure_country_iso3 |
|
| 8623 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8624 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count, countries.iso3 AS airport_departure_country_iso3 |
|
| 8625 | 8625 | FROM countries,spotter_output".$filter_query." countries.name = spotter_output.departure_airport_country AND spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''"; |
| 8626 | 8626 | $query_values = array(); |
| 8627 | 8627 | if ($year != '') { |
| 8628 | 8628 | if ($globalDBdriver == 'mysql') { |
| 8629 | 8629 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 8630 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 8630 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 8631 | 8631 | } else { |
| 8632 | 8632 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 8633 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 8633 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 8634 | 8634 | } |
| 8635 | 8635 | } |
| 8636 | 8636 | if ($month != '') { |
| 8637 | 8637 | if ($globalDBdriver == 'mysql') { |
| 8638 | 8638 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 8639 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 8639 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 8640 | 8640 | } else { |
| 8641 | 8641 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 8642 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 8642 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 8643 | 8643 | } |
| 8644 | 8644 | } |
| 8645 | 8645 | if ($day != '') { |
| 8646 | 8646 | if ($globalDBdriver == 'mysql') { |
| 8647 | 8647 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 8648 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 8648 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 8649 | 8649 | } else { |
| 8650 | 8650 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 8651 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 8651 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 8652 | 8652 | } |
| 8653 | 8653 | } |
| 8654 | 8654 | $query .= " GROUP BY spotter_output.departure_airport_country, countries.iso3 |
@@ -8662,7 +8662,7 @@ discard block |
||
| 8662 | 8662 | $airport_array = array(); |
| 8663 | 8663 | $temp_array = array(); |
| 8664 | 8664 | |
| 8665 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8665 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8666 | 8666 | { |
| 8667 | 8667 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
| 8668 | 8668 | $temp_array['airport_departure_country'] = $row['departure_airport_country']; |
@@ -8680,38 +8680,38 @@ discard block |
||
| 8680 | 8680 | * @return Array the airport arrival list |
| 8681 | 8681 | * |
| 8682 | 8682 | */ |
| 8683 | - public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '') |
|
| 8683 | + public function countAllArrivalCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '') |
|
| 8684 | 8684 | { |
| 8685 | 8685 | global $globalDBdriver; |
| 8686 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8687 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 |
|
| 8686 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8687 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 |
|
| 8688 | 8688 | FROM countries, spotter_output".$filter_query." countries.name = spotter_output.arrival_airport_country AND spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''"; |
| 8689 | 8689 | $query_values = array(); |
| 8690 | 8690 | if ($year != '') { |
| 8691 | 8691 | if ($globalDBdriver == 'mysql') { |
| 8692 | 8692 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 8693 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 8693 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 8694 | 8694 | } else { |
| 8695 | 8695 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 8696 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 8696 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 8697 | 8697 | } |
| 8698 | 8698 | } |
| 8699 | 8699 | if ($month != '') { |
| 8700 | 8700 | if ($globalDBdriver == 'mysql') { |
| 8701 | 8701 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 8702 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 8702 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 8703 | 8703 | } else { |
| 8704 | 8704 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 8705 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 8705 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 8706 | 8706 | } |
| 8707 | 8707 | } |
| 8708 | 8708 | if ($day != '') { |
| 8709 | 8709 | if ($globalDBdriver == 'mysql') { |
| 8710 | 8710 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 8711 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 8711 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 8712 | 8712 | } else { |
| 8713 | 8713 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 8714 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 8714 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 8715 | 8715 | } |
| 8716 | 8716 | } |
| 8717 | 8717 | $query .= " GROUP BY spotter_output.arrival_airport_country, countries.iso3 |
@@ -8725,7 +8725,7 @@ discard block |
||
| 8725 | 8725 | $airport_array = array(); |
| 8726 | 8726 | $temp_array = array(); |
| 8727 | 8727 | |
| 8728 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8728 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8729 | 8729 | { |
| 8730 | 8730 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
| 8731 | 8731 | $temp_array['airport_arrival_country'] = $row['arrival_airport_country']; |
@@ -8749,8 +8749,8 @@ discard block |
||
| 8749 | 8749 | */ |
| 8750 | 8750 | public function countAllRoutes($filters = array()) |
| 8751 | 8751 | { |
| 8752 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8753 | - $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 |
|
| 8752 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8753 | + $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 |
|
| 8754 | 8754 | 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 <> '' |
| 8755 | 8755 | 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 |
| 8756 | 8756 | ORDER BY route_count DESC |
@@ -8763,7 +8763,7 @@ discard block |
||
| 8763 | 8763 | $routes_array = array(); |
| 8764 | 8764 | $temp_array = array(); |
| 8765 | 8765 | |
| 8766 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8766 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8767 | 8767 | { |
| 8768 | 8768 | $temp_array['route_count'] = $row['route_count']; |
| 8769 | 8769 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -8790,11 +8790,11 @@ discard block |
||
| 8790 | 8790 | * @return Array the route list |
| 8791 | 8791 | * |
| 8792 | 8792 | */ |
| 8793 | - public function countAllRoutesByAircraft($aircraft_icao,$filters = array()) |
|
| 8793 | + public function countAllRoutesByAircraft($aircraft_icao, $filters = array()) |
|
| 8794 | 8794 | { |
| 8795 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8796 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 8797 | - $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 |
|
| 8795 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8796 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 8797 | + $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 |
|
| 8798 | 8798 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 8799 | 8799 | 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 |
| 8800 | 8800 | ORDER BY route_count DESC"; |
@@ -8805,7 +8805,7 @@ discard block |
||
| 8805 | 8805 | $routes_array = array(); |
| 8806 | 8806 | $temp_array = array(); |
| 8807 | 8807 | |
| 8808 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8808 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8809 | 8809 | { |
| 8810 | 8810 | $temp_array['route_count'] = $row['route_count']; |
| 8811 | 8811 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -8832,9 +8832,9 @@ discard block |
||
| 8832 | 8832 | */ |
| 8833 | 8833 | public function countAllRoutesByRegistration($registration, $filters = array()) |
| 8834 | 8834 | { |
| 8835 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8835 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8836 | 8836 | $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
| 8837 | - $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 |
|
| 8837 | + $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 |
|
| 8838 | 8838 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration |
| 8839 | 8839 | GROUP BY route |
| 8840 | 8840 | ORDER BY route_count DESC"; |
@@ -8846,7 +8846,7 @@ discard block |
||
| 8846 | 8846 | $routes_array = array(); |
| 8847 | 8847 | $temp_array = array(); |
| 8848 | 8848 | |
| 8849 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8849 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8850 | 8850 | { |
| 8851 | 8851 | $temp_array['route_count'] = $row['route_count']; |
| 8852 | 8852 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -8874,9 +8874,9 @@ discard block |
||
| 8874 | 8874 | */ |
| 8875 | 8875 | public function countAllRoutesByAirline($airline_icao, $filters = array()) |
| 8876 | 8876 | { |
| 8877 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8878 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 8879 | - $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 |
|
| 8877 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8878 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 8879 | + $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 |
|
| 8880 | 8880 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao |
| 8881 | 8881 | 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 |
| 8882 | 8882 | ORDER BY route_count DESC"; |
@@ -8888,7 +8888,7 @@ discard block |
||
| 8888 | 8888 | $routes_array = array(); |
| 8889 | 8889 | $temp_array = array(); |
| 8890 | 8890 | |
| 8891 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8891 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8892 | 8892 | { |
| 8893 | 8893 | $temp_array['route_count'] = $row['route_count']; |
| 8894 | 8894 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -8916,9 +8916,9 @@ discard block |
||
| 8916 | 8916 | */ |
| 8917 | 8917 | public function countAllRoutesByAirport($airport_icao, $filters = array()) |
| 8918 | 8918 | { |
| 8919 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8920 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 8921 | - $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 |
|
| 8919 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8920 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 8921 | + $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 |
|
| 8922 | 8922 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 8923 | 8923 | 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 |
| 8924 | 8924 | ORDER BY route_count DESC"; |
@@ -8929,7 +8929,7 @@ discard block |
||
| 8929 | 8929 | $routes_array = array(); |
| 8930 | 8930 | $temp_array = array(); |
| 8931 | 8931 | |
| 8932 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8932 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8933 | 8933 | { |
| 8934 | 8934 | $temp_array['route_count'] = $row['route_count']; |
| 8935 | 8935 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -8957,9 +8957,9 @@ discard block |
||
| 8957 | 8957 | */ |
| 8958 | 8958 | public function countAllRoutesByCountry($country, $filters = array()) |
| 8959 | 8959 | { |
| 8960 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8961 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 8962 | - $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 |
|
| 8960 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8961 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 8962 | + $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 |
|
| 8963 | 8963 | 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 |
| 8964 | 8964 | 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 |
| 8965 | 8965 | ORDER BY route_count DESC"; |
@@ -8970,7 +8970,7 @@ discard block |
||
| 8970 | 8970 | $routes_array = array(); |
| 8971 | 8971 | $temp_array = array(); |
| 8972 | 8972 | |
| 8973 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8973 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8974 | 8974 | { |
| 8975 | 8975 | $temp_array['route_count'] = $row['route_count']; |
| 8976 | 8976 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -8998,8 +8998,8 @@ discard block |
||
| 8998 | 8998 | public function countAllRoutesByDate($date, $filters = array()) |
| 8999 | 8999 | { |
| 9000 | 9000 | global $globalTimezone, $globalDBdriver; |
| 9001 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9002 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 9001 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9002 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 9003 | 9003 | if ($globalTimezone != '') { |
| 9004 | 9004 | date_default_timezone_set($globalTimezone); |
| 9005 | 9005 | $datetime = new DateTime($date); |
@@ -9007,12 +9007,12 @@ discard block |
||
| 9007 | 9007 | } else $offset = '+00:00'; |
| 9008 | 9008 | |
| 9009 | 9009 | if ($globalDBdriver == 'mysql') { |
| 9010 | - $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 |
|
| 9010 | + $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 |
|
| 9011 | 9011 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 9012 | 9012 | 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 |
| 9013 | 9013 | ORDER BY route_count DESC"; |
| 9014 | 9014 | } else { |
| 9015 | - $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 |
|
| 9015 | + $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 |
|
| 9016 | 9016 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 9017 | 9017 | 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 |
| 9018 | 9018 | ORDER BY route_count DESC"; |
@@ -9024,7 +9024,7 @@ discard block |
||
| 9024 | 9024 | $routes_array = array(); |
| 9025 | 9025 | $temp_array = array(); |
| 9026 | 9026 | |
| 9027 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9027 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9028 | 9028 | { |
| 9029 | 9029 | $temp_array['route_count'] = $row['route_count']; |
| 9030 | 9030 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -9051,9 +9051,9 @@ discard block |
||
| 9051 | 9051 | */ |
| 9052 | 9052 | public function countAllRoutesByIdent($ident, $filters = array()) |
| 9053 | 9053 | { |
| 9054 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9055 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 9056 | - $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 |
|
| 9054 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9055 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 9056 | + $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 |
|
| 9057 | 9057 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident |
| 9058 | 9058 | 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 |
| 9059 | 9059 | ORDER BY route_count DESC"; |
@@ -9065,7 +9065,7 @@ discard block |
||
| 9065 | 9065 | $routes_array = array(); |
| 9066 | 9066 | $temp_array = array(); |
| 9067 | 9067 | |
| 9068 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9068 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9069 | 9069 | { |
| 9070 | 9070 | $temp_array['route_count'] = $row['route_count']; |
| 9071 | 9071 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -9089,11 +9089,11 @@ discard block |
||
| 9089 | 9089 | * @return Array the route list |
| 9090 | 9090 | * |
| 9091 | 9091 | */ |
| 9092 | - public function countAllRoutesByOwner($owner,$filters = array()) |
|
| 9092 | + public function countAllRoutesByOwner($owner, $filters = array()) |
|
| 9093 | 9093 | { |
| 9094 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9095 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 9096 | - $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 |
|
| 9094 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9095 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 9096 | + $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 |
|
| 9097 | 9097 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.owner_name = :owner |
| 9098 | 9098 | 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 |
| 9099 | 9099 | ORDER BY route_count DESC"; |
@@ -9105,7 +9105,7 @@ discard block |
||
| 9105 | 9105 | $routes_array = array(); |
| 9106 | 9106 | $temp_array = array(); |
| 9107 | 9107 | |
| 9108 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9108 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9109 | 9109 | { |
| 9110 | 9110 | $temp_array['route_count'] = $row['route_count']; |
| 9111 | 9111 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -9129,11 +9129,11 @@ discard block |
||
| 9129 | 9129 | * @return Array the route list |
| 9130 | 9130 | * |
| 9131 | 9131 | */ |
| 9132 | - public function countAllRoutesByPilot($pilot,$filters = array()) |
|
| 9132 | + public function countAllRoutesByPilot($pilot, $filters = array()) |
|
| 9133 | 9133 | { |
| 9134 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9135 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 9136 | - $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 |
|
| 9134 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9135 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 9136 | + $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 |
|
| 9137 | 9137 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) |
| 9138 | 9138 | 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 |
| 9139 | 9139 | ORDER BY route_count DESC"; |
@@ -9145,7 +9145,7 @@ discard block |
||
| 9145 | 9145 | $routes_array = array(); |
| 9146 | 9146 | $temp_array = array(); |
| 9147 | 9147 | |
| 9148 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9148 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9149 | 9149 | { |
| 9150 | 9150 | $temp_array['route_count'] = $row['route_count']; |
| 9151 | 9151 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -9172,9 +9172,9 @@ discard block |
||
| 9172 | 9172 | */ |
| 9173 | 9173 | public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array()) |
| 9174 | 9174 | { |
| 9175 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9176 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 9177 | - $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 |
|
| 9175 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9176 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 9177 | + $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 |
|
| 9178 | 9178 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 9179 | 9179 | GROUP BY route |
| 9180 | 9180 | ORDER BY route_count DESC"; |
@@ -9186,7 +9186,7 @@ discard block |
||
| 9186 | 9186 | $routes_array = array(); |
| 9187 | 9187 | $temp_array = array(); |
| 9188 | 9188 | |
| 9189 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9189 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9190 | 9190 | { |
| 9191 | 9191 | $temp_array['route_count'] = $row['route_count']; |
| 9192 | 9192 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -9214,8 +9214,8 @@ discard block |
||
| 9214 | 9214 | */ |
| 9215 | 9215 | public function countAllRoutesWithWaypoints($filters = array()) |
| 9216 | 9216 | { |
| 9217 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9218 | - $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 |
|
| 9217 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9218 | + $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 |
|
| 9219 | 9219 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' |
| 9220 | 9220 | 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 |
| 9221 | 9221 | ORDER BY route_count DESC |
@@ -9228,7 +9228,7 @@ discard block |
||
| 9228 | 9228 | $routes_array = array(); |
| 9229 | 9229 | $temp_array = array(); |
| 9230 | 9230 | |
| 9231 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9231 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9232 | 9232 | { |
| 9233 | 9233 | $temp_array['spotter_id'] = $row['spotter_id']; |
| 9234 | 9234 | $temp_array['route_count'] = $row['route_count']; |
@@ -9253,11 +9253,11 @@ discard block |
||
| 9253 | 9253 | * @return Array the callsign list |
| 9254 | 9254 | * |
| 9255 | 9255 | */ |
| 9256 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
|
| 9256 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 9257 | 9257 | { |
| 9258 | 9258 | global $globalDBdriver; |
| 9259 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9260 | - $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
|
| 9259 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9260 | + $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
|
| 9261 | 9261 | FROM spotter_output".$filter_query." spotter_output.ident <> ''"; |
| 9262 | 9262 | if ($olderthanmonths > 0) { |
| 9263 | 9263 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -9271,28 +9271,28 @@ discard block |
||
| 9271 | 9271 | if ($year != '') { |
| 9272 | 9272 | if ($globalDBdriver == 'mysql') { |
| 9273 | 9273 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 9274 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 9274 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 9275 | 9275 | } else { |
| 9276 | 9276 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 9277 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 9277 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 9278 | 9278 | } |
| 9279 | 9279 | } |
| 9280 | 9280 | if ($month != '') { |
| 9281 | 9281 | if ($globalDBdriver == 'mysql') { |
| 9282 | 9282 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 9283 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 9283 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 9284 | 9284 | } else { |
| 9285 | 9285 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 9286 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 9286 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 9287 | 9287 | } |
| 9288 | 9288 | } |
| 9289 | 9289 | if ($day != '') { |
| 9290 | 9290 | if ($globalDBdriver == 'mysql') { |
| 9291 | 9291 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 9292 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 9292 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 9293 | 9293 | } else { |
| 9294 | 9294 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 9295 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 9295 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 9296 | 9296 | } |
| 9297 | 9297 | } |
| 9298 | 9298 | $query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
@@ -9304,7 +9304,7 @@ discard block |
||
| 9304 | 9304 | $callsign_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['callsign_icao'] = $row['ident']; |
| 9310 | 9310 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -9326,8 +9326,8 @@ discard block |
||
| 9326 | 9326 | public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
| 9327 | 9327 | { |
| 9328 | 9328 | global $globalDBdriver; |
| 9329 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9330 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
|
| 9329 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9330 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
|
| 9331 | 9331 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
| 9332 | 9332 | if ($olderthanmonths > 0) { |
| 9333 | 9333 | if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
@@ -9346,7 +9346,7 @@ discard block |
||
| 9346 | 9346 | $callsign_array = array(); |
| 9347 | 9347 | $temp_array = array(); |
| 9348 | 9348 | |
| 9349 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9349 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9350 | 9350 | { |
| 9351 | 9351 | $temp_array['callsign_icao'] = $row['ident']; |
| 9352 | 9352 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -9400,7 +9400,7 @@ discard block |
||
| 9400 | 9400 | $date_array = array(); |
| 9401 | 9401 | $temp_array = array(); |
| 9402 | 9402 | |
| 9403 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9403 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9404 | 9404 | { |
| 9405 | 9405 | $temp_array['date_name'] = $row['date_name']; |
| 9406 | 9406 | $temp_array['date_count'] = $row['date_count']; |
@@ -9425,15 +9425,15 @@ discard block |
||
| 9425 | 9425 | $datetime = new DateTime(); |
| 9426 | 9426 | $offset = $datetime->format('P'); |
| 9427 | 9427 | } else $offset = '+00:00'; |
| 9428 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9428 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9429 | 9429 | if ($globalDBdriver == 'mysql') { |
| 9430 | - $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 9430 | + $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 9431 | 9431 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 9432 | 9432 | GROUP BY spotter_output.airline_icao, date_name |
| 9433 | 9433 | ORDER BY date_count DESC |
| 9434 | 9434 | LIMIT 10 OFFSET 0"; |
| 9435 | 9435 | } else { |
| 9436 | - $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 |
|
| 9436 | + $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 |
|
| 9437 | 9437 | FROM spotter_output |
| 9438 | 9438 | WHERE spotter_output.airline_icao <> '' |
| 9439 | 9439 | GROUP BY spotter_output.airline_icao, date_name |
@@ -9448,7 +9448,7 @@ discard block |
||
| 9448 | 9448 | $date_array = array(); |
| 9449 | 9449 | $temp_array = array(); |
| 9450 | 9450 | |
| 9451 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9451 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9452 | 9452 | { |
| 9453 | 9453 | $temp_array['date_name'] = $row['date_name']; |
| 9454 | 9454 | $temp_array['date_count'] = $row['date_count']; |
@@ -9474,7 +9474,7 @@ discard block |
||
| 9474 | 9474 | $datetime = new DateTime(); |
| 9475 | 9475 | $offset = $datetime->format('P'); |
| 9476 | 9476 | } else $offset = '+00:00'; |
| 9477 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9477 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9478 | 9478 | if ($globalDBdriver == 'mysql') { |
| 9479 | 9479 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 9480 | 9480 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -9495,7 +9495,7 @@ discard block |
||
| 9495 | 9495 | $date_array = array(); |
| 9496 | 9496 | $temp_array = array(); |
| 9497 | 9497 | |
| 9498 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9498 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9499 | 9499 | { |
| 9500 | 9500 | $temp_array['date_name'] = $row['date_name']; |
| 9501 | 9501 | $temp_array['date_count'] = $row['date_count']; |
@@ -9520,7 +9520,7 @@ discard block |
||
| 9520 | 9520 | $datetime = new DateTime(); |
| 9521 | 9521 | $offset = $datetime->format('P'); |
| 9522 | 9522 | } else $offset = '+00:00'; |
| 9523 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9523 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9524 | 9524 | if ($globalDBdriver == 'mysql') { |
| 9525 | 9525 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 9526 | 9526 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -9541,7 +9541,7 @@ discard block |
||
| 9541 | 9541 | $date_array = array(); |
| 9542 | 9542 | $temp_array = array(); |
| 9543 | 9543 | |
| 9544 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9544 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9545 | 9545 | { |
| 9546 | 9546 | $temp_array['date_name'] = $row['date_name']; |
| 9547 | 9547 | $temp_array['date_count'] = $row['date_count']; |
@@ -9562,7 +9562,7 @@ discard block |
||
| 9562 | 9562 | public function countAllDatesLastMonthByAirlines($filters = array()) |
| 9563 | 9563 | { |
| 9564 | 9564 | global $globalTimezone, $globalDBdriver; |
| 9565 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9565 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9566 | 9566 | if ($globalTimezone != '') { |
| 9567 | 9567 | date_default_timezone_set($globalTimezone); |
| 9568 | 9568 | $datetime = new DateTime(); |
@@ -9570,13 +9570,13 @@ discard block |
||
| 9570 | 9570 | } else $offset = '+00:00'; |
| 9571 | 9571 | |
| 9572 | 9572 | if ($globalDBdriver == 'mysql') { |
| 9573 | - $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 9573 | + $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 9574 | 9574 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH) |
| 9575 | 9575 | GROUP BY spotter_output.airline_icao, date_name |
| 9576 | 9576 | ORDER BY spotter_output.date ASC"; |
| 9577 | 9577 | $query_data = array(':offset' => $offset); |
| 9578 | 9578 | } else { |
| 9579 | - $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 |
|
| 9579 | + $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 |
|
| 9580 | 9580 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS' |
| 9581 | 9581 | GROUP BY spotter_output.airline_icao, date_name |
| 9582 | 9582 | ORDER BY date_name ASC"; |
@@ -9589,7 +9589,7 @@ discard block |
||
| 9589 | 9589 | $date_array = array(); |
| 9590 | 9590 | $temp_array = array(); |
| 9591 | 9591 | |
| 9592 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9592 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9593 | 9593 | { |
| 9594 | 9594 | $temp_array['date_name'] = $row['date_name']; |
| 9595 | 9595 | $temp_array['date_count'] = $row['date_count']; |
@@ -9636,7 +9636,7 @@ discard block |
||
| 9636 | 9636 | $date_array = array(); |
| 9637 | 9637 | $temp_array = array(); |
| 9638 | 9638 | |
| 9639 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9639 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9640 | 9640 | { |
| 9641 | 9641 | $temp_array['month_name'] = $row['month_name']; |
| 9642 | 9642 | $temp_array['year_name'] = $row['year_name']; |
@@ -9657,7 +9657,7 @@ discard block |
||
| 9657 | 9657 | public function countAllMonthsByAirlines($filters = array()) |
| 9658 | 9658 | { |
| 9659 | 9659 | global $globalTimezone, $globalDBdriver; |
| 9660 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9660 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9661 | 9661 | if ($globalTimezone != '') { |
| 9662 | 9662 | date_default_timezone_set($globalTimezone); |
| 9663 | 9663 | $datetime = new DateTime(); |
@@ -9665,12 +9665,12 @@ discard block |
||
| 9665 | 9665 | } else $offset = '+00:00'; |
| 9666 | 9666 | |
| 9667 | 9667 | if ($globalDBdriver == 'mysql') { |
| 9668 | - $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 |
|
| 9668 | + $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 |
|
| 9669 | 9669 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 9670 | 9670 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 9671 | 9671 | ORDER BY date_count DESC"; |
| 9672 | 9672 | } else { |
| 9673 | - $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 |
|
| 9673 | + $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 |
|
| 9674 | 9674 | FROM spotter_output |
| 9675 | 9675 | WHERE spotter_output.airline_icao <> '' |
| 9676 | 9676 | GROUP BY spotter_output.airline_icao, year_name, month_name |
@@ -9684,7 +9684,7 @@ discard block |
||
| 9684 | 9684 | $date_array = array(); |
| 9685 | 9685 | $temp_array = array(); |
| 9686 | 9686 | |
| 9687 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9687 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9688 | 9688 | { |
| 9689 | 9689 | $temp_array['month_name'] = $row['month_name']; |
| 9690 | 9690 | $temp_array['year_name'] = $row['year_name']; |
@@ -9711,14 +9711,14 @@ discard block |
||
| 9711 | 9711 | $datetime = new DateTime(); |
| 9712 | 9712 | $offset = $datetime->format('P'); |
| 9713 | 9713 | } else $offset = '+00:00'; |
| 9714 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9714 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9715 | 9715 | if ($globalDBdriver == 'mysql') { |
| 9716 | - $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 |
|
| 9716 | + $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 |
|
| 9717 | 9717 | FROM spotter_output".$filter_query." spotter_output.airline_type = 'military' |
| 9718 | 9718 | GROUP BY year_name, month_name |
| 9719 | 9719 | ORDER BY date_count DESC"; |
| 9720 | 9720 | } else { |
| 9721 | - $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 |
|
| 9721 | + $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 |
|
| 9722 | 9722 | FROM spotter_output".$filter_query." spotter_output.airline_type = 'military' |
| 9723 | 9723 | GROUP BY year_name, month_name |
| 9724 | 9724 | ORDER BY date_count DESC"; |
@@ -9730,7 +9730,7 @@ discard block |
||
| 9730 | 9730 | $date_array = array(); |
| 9731 | 9731 | $temp_array = array(); |
| 9732 | 9732 | |
| 9733 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9733 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9734 | 9734 | { |
| 9735 | 9735 | $temp_array['month_name'] = $row['month_name']; |
| 9736 | 9736 | $temp_array['year_name'] = $row['year_name']; |
@@ -9756,15 +9756,15 @@ discard block |
||
| 9756 | 9756 | $datetime = new DateTime(); |
| 9757 | 9757 | $offset = $datetime->format('P'); |
| 9758 | 9758 | } else $offset = '+00:00'; |
| 9759 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9759 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9760 | 9760 | |
| 9761 | 9761 | if ($globalDBdriver == 'mysql') { |
| 9762 | - $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 |
|
| 9762 | + $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 |
|
| 9763 | 9763 | FROM spotter_output".$filter_query." owner_name <> '' |
| 9764 | 9764 | GROUP BY year_name, month_name |
| 9765 | 9765 | ORDER BY date_count DESC"; |
| 9766 | 9766 | } else { |
| 9767 | - $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 |
|
| 9767 | + $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 |
|
| 9768 | 9768 | FROM spotter_output".$filter_query." owner_name <> '' |
| 9769 | 9769 | GROUP BY year_name, month_name |
| 9770 | 9770 | ORDER BY date_count DESC"; |
@@ -9776,7 +9776,7 @@ discard block |
||
| 9776 | 9776 | $date_array = array(); |
| 9777 | 9777 | $temp_array = array(); |
| 9778 | 9778 | |
| 9779 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9779 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9780 | 9780 | { |
| 9781 | 9781 | $temp_array['month_name'] = $row['month_name']; |
| 9782 | 9782 | $temp_array['year_name'] = $row['year_name']; |
@@ -9797,7 +9797,7 @@ discard block |
||
| 9797 | 9797 | public function countAllMonthsOwnersByAirlines($filters = array()) |
| 9798 | 9798 | { |
| 9799 | 9799 | global $globalTimezone, $globalDBdriver; |
| 9800 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9800 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9801 | 9801 | if ($globalTimezone != '') { |
| 9802 | 9802 | date_default_timezone_set($globalTimezone); |
| 9803 | 9803 | $datetime = new DateTime(); |
@@ -9805,12 +9805,12 @@ discard block |
||
| 9805 | 9805 | } else $offset = '+00:00'; |
| 9806 | 9806 | |
| 9807 | 9807 | if ($globalDBdriver == 'mysql') { |
| 9808 | - $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 |
|
| 9808 | + $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 |
|
| 9809 | 9809 | FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' |
| 9810 | 9810 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 9811 | 9811 | ORDER BY date_count DESC"; |
| 9812 | 9812 | } else { |
| 9813 | - $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 |
|
| 9813 | + $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 |
|
| 9814 | 9814 | FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' |
| 9815 | 9815 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 9816 | 9816 | ORDER BY date_count DESC"; |
@@ -9822,7 +9822,7 @@ discard block |
||
| 9822 | 9822 | $date_array = array(); |
| 9823 | 9823 | $temp_array = array(); |
| 9824 | 9824 | |
| 9825 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9825 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9826 | 9826 | { |
| 9827 | 9827 | $temp_array['month_name'] = $row['month_name']; |
| 9828 | 9828 | $temp_array['year_name'] = $row['year_name']; |
@@ -9849,15 +9849,15 @@ discard block |
||
| 9849 | 9849 | $datetime = new DateTime(); |
| 9850 | 9850 | $offset = $datetime->format('P'); |
| 9851 | 9851 | } else $offset = '+00:00'; |
| 9852 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9852 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9853 | 9853 | |
| 9854 | 9854 | if ($globalDBdriver == 'mysql') { |
| 9855 | - $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 |
|
| 9855 | + $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 |
|
| 9856 | 9856 | FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL |
| 9857 | 9857 | GROUP BY year_name, month_name |
| 9858 | 9858 | ORDER BY date_count DESC"; |
| 9859 | 9859 | } else { |
| 9860 | - $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 |
|
| 9860 | + $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 |
|
| 9861 | 9861 | FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL |
| 9862 | 9862 | GROUP BY year_name, month_name |
| 9863 | 9863 | ORDER BY date_count DESC"; |
@@ -9869,7 +9869,7 @@ discard block |
||
| 9869 | 9869 | $date_array = array(); |
| 9870 | 9870 | $temp_array = array(); |
| 9871 | 9871 | |
| 9872 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9872 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9873 | 9873 | { |
| 9874 | 9874 | $temp_array['month_name'] = $row['month_name']; |
| 9875 | 9875 | $temp_array['year_name'] = $row['year_name']; |
@@ -9890,7 +9890,7 @@ discard block |
||
| 9890 | 9890 | public function countAllMonthsPilotsByAirlines($filters = array()) |
| 9891 | 9891 | { |
| 9892 | 9892 | global $globalTimezone, $globalDBdriver; |
| 9893 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9893 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9894 | 9894 | if ($globalTimezone != '') { |
| 9895 | 9895 | date_default_timezone_set($globalTimezone); |
| 9896 | 9896 | $datetime = new DateTime(); |
@@ -9898,12 +9898,12 @@ discard block |
||
| 9898 | 9898 | } else $offset = '+00:00'; |
| 9899 | 9899 | |
| 9900 | 9900 | if ($globalDBdriver == 'mysql') { |
| 9901 | - $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 |
|
| 9901 | + $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 |
|
| 9902 | 9902 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL |
| 9903 | 9903 | GROUP BY spotter_output.airline_icao,year_name, month_name |
| 9904 | 9904 | ORDER BY date_count DESC"; |
| 9905 | 9905 | } else { |
| 9906 | - $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 |
|
| 9906 | + $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 |
|
| 9907 | 9907 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL |
| 9908 | 9908 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 9909 | 9909 | ORDER BY date_count DESC"; |
@@ -9915,7 +9915,7 @@ discard block |
||
| 9915 | 9915 | $date_array = array(); |
| 9916 | 9916 | $temp_array = array(); |
| 9917 | 9917 | |
| 9918 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9918 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9919 | 9919 | { |
| 9920 | 9920 | $temp_array['month_name'] = $row['month_name']; |
| 9921 | 9921 | $temp_array['year_name'] = $row['year_name']; |
@@ -9937,7 +9937,7 @@ discard block |
||
| 9937 | 9937 | public function countAllMonthsAirlines($filters = array()) |
| 9938 | 9938 | { |
| 9939 | 9939 | global $globalTimezone, $globalDBdriver; |
| 9940 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9940 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9941 | 9941 | if ($globalTimezone != '') { |
| 9942 | 9942 | date_default_timezone_set($globalTimezone); |
| 9943 | 9943 | $datetime = new DateTime(); |
@@ -9945,12 +9945,12 @@ discard block |
||
| 9945 | 9945 | } else $offset = '+00:00'; |
| 9946 | 9946 | |
| 9947 | 9947 | if ($globalDBdriver == 'mysql') { |
| 9948 | - $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 |
|
| 9948 | + $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 |
|
| 9949 | 9949 | FROM spotter_output".$filter_query." airline_icao <> '' |
| 9950 | 9950 | GROUP BY year_name, month_name |
| 9951 | 9951 | ORDER BY date_count DESC"; |
| 9952 | 9952 | } else { |
| 9953 | - $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 |
|
| 9953 | + $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 |
|
| 9954 | 9954 | FROM spotter_output".$filter_query." airline_icao <> '' |
| 9955 | 9955 | GROUP BY year_name, month_name |
| 9956 | 9956 | ORDER BY date_count DESC"; |
@@ -9962,7 +9962,7 @@ discard block |
||
| 9962 | 9962 | $date_array = array(); |
| 9963 | 9963 | $temp_array = array(); |
| 9964 | 9964 | |
| 9965 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9965 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9966 | 9966 | { |
| 9967 | 9967 | $temp_array['month_name'] = $row['month_name']; |
| 9968 | 9968 | $temp_array['year_name'] = $row['year_name']; |
@@ -9988,15 +9988,15 @@ discard block |
||
| 9988 | 9988 | $datetime = new DateTime(); |
| 9989 | 9989 | $offset = $datetime->format('P'); |
| 9990 | 9990 | } else $offset = '+00:00'; |
| 9991 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9991 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9992 | 9992 | |
| 9993 | 9993 | if ($globalDBdriver == 'mysql') { |
| 9994 | - $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 |
|
| 9994 | + $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 |
|
| 9995 | 9995 | FROM spotter_output".$filter_query." aircraft_icao <> '' |
| 9996 | 9996 | GROUP BY year_name, month_name |
| 9997 | 9997 | ORDER BY date_count DESC"; |
| 9998 | 9998 | } else { |
| 9999 | - $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 |
|
| 9999 | + $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 |
|
| 10000 | 10000 | FROM spotter_output".$filter_query." aircraft_icao <> '' |
| 10001 | 10001 | GROUP BY year_name, month_name |
| 10002 | 10002 | ORDER BY date_count DESC"; |
@@ -10008,7 +10008,7 @@ discard block |
||
| 10008 | 10008 | $date_array = array(); |
| 10009 | 10009 | $temp_array = array(); |
| 10010 | 10010 | |
| 10011 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10011 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10012 | 10012 | { |
| 10013 | 10013 | $temp_array['month_name'] = $row['month_name']; |
| 10014 | 10014 | $temp_array['year_name'] = $row['year_name']; |
@@ -10030,7 +10030,7 @@ discard block |
||
| 10030 | 10030 | public function countAllMonthsAircraftsByAirlines($filters = array()) |
| 10031 | 10031 | { |
| 10032 | 10032 | global $globalTimezone, $globalDBdriver; |
| 10033 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10033 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10034 | 10034 | if ($globalTimezone != '') { |
| 10035 | 10035 | date_default_timezone_set($globalTimezone); |
| 10036 | 10036 | $datetime = new DateTime(); |
@@ -10038,12 +10038,12 @@ discard block |
||
| 10038 | 10038 | } else $offset = '+00:00'; |
| 10039 | 10039 | |
| 10040 | 10040 | if ($globalDBdriver == 'mysql') { |
| 10041 | - $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 |
|
| 10041 | + $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 |
|
| 10042 | 10042 | FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' |
| 10043 | 10043 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 10044 | 10044 | ORDER BY date_count DESC"; |
| 10045 | 10045 | } else { |
| 10046 | - $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 |
|
| 10046 | + $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 |
|
| 10047 | 10047 | FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' |
| 10048 | 10048 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 10049 | 10049 | ORDER BY date_count DESC"; |
@@ -10055,7 +10055,7 @@ discard block |
||
| 10055 | 10055 | $date_array = array(); |
| 10056 | 10056 | $temp_array = array(); |
| 10057 | 10057 | |
| 10058 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10058 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10059 | 10059 | { |
| 10060 | 10060 | $temp_array['month_name'] = $row['month_name']; |
| 10061 | 10061 | $temp_array['year_name'] = $row['year_name']; |
@@ -10082,15 +10082,15 @@ discard block |
||
| 10082 | 10082 | $datetime = new DateTime(); |
| 10083 | 10083 | $offset = $datetime->format('P'); |
| 10084 | 10084 | } else $offset = '+00:00'; |
| 10085 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10085 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10086 | 10086 | |
| 10087 | 10087 | if ($globalDBdriver == 'mysql') { |
| 10088 | - $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 |
|
| 10088 | + $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 |
|
| 10089 | 10089 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' |
| 10090 | 10090 | GROUP BY year_name, month_name |
| 10091 | 10091 | ORDER BY date_count DESC"; |
| 10092 | 10092 | } else { |
| 10093 | - $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 |
|
| 10093 | + $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 |
|
| 10094 | 10094 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' |
| 10095 | 10095 | GROUP BY year_name, month_name |
| 10096 | 10096 | ORDER BY date_count DESC"; |
@@ -10102,7 +10102,7 @@ discard block |
||
| 10102 | 10102 | $date_array = array(); |
| 10103 | 10103 | $temp_array = array(); |
| 10104 | 10104 | |
| 10105 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10105 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10106 | 10106 | { |
| 10107 | 10107 | $temp_array['month_name'] = $row['month_name']; |
| 10108 | 10108 | $temp_array['year_name'] = $row['year_name']; |
@@ -10124,7 +10124,7 @@ discard block |
||
| 10124 | 10124 | public function countAllMonthsRealArrivalsByAirlines($filters = array()) |
| 10125 | 10125 | { |
| 10126 | 10126 | global $globalTimezone, $globalDBdriver; |
| 10127 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10127 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10128 | 10128 | if ($globalTimezone != '') { |
| 10129 | 10129 | date_default_timezone_set($globalTimezone); |
| 10130 | 10130 | $datetime = new DateTime(); |
@@ -10132,12 +10132,12 @@ discard block |
||
| 10132 | 10132 | } else $offset = '+00:00'; |
| 10133 | 10133 | |
| 10134 | 10134 | if ($globalDBdriver == 'mysql') { |
| 10135 | - $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 |
|
| 10135 | + $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 |
|
| 10136 | 10136 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' |
| 10137 | 10137 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 10138 | 10138 | ORDER BY date_count DESC"; |
| 10139 | 10139 | } else { |
| 10140 | - $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 |
|
| 10140 | + $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 |
|
| 10141 | 10141 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' |
| 10142 | 10142 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 10143 | 10143 | ORDER BY date_count DESC"; |
@@ -10149,7 +10149,7 @@ discard block |
||
| 10149 | 10149 | $date_array = array(); |
| 10150 | 10150 | $temp_array = array(); |
| 10151 | 10151 | |
| 10152 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10152 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10153 | 10153 | { |
| 10154 | 10154 | $temp_array['month_name'] = $row['month_name']; |
| 10155 | 10155 | $temp_array['year_name'] = $row['year_name']; |
@@ -10177,7 +10177,7 @@ discard block |
||
| 10177 | 10177 | $datetime = new DateTime(); |
| 10178 | 10178 | $offset = $datetime->format('P'); |
| 10179 | 10179 | } else $offset = '+00:00'; |
| 10180 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10180 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10181 | 10181 | if ($globalDBdriver == 'mysql') { |
| 10182 | 10182 | $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 |
| 10183 | 10183 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -10198,7 +10198,7 @@ discard block |
||
| 10198 | 10198 | $date_array = array(); |
| 10199 | 10199 | $temp_array = array(); |
| 10200 | 10200 | |
| 10201 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10201 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10202 | 10202 | { |
| 10203 | 10203 | $temp_array['year_name'] = $row['year_name']; |
| 10204 | 10204 | $temp_array['month_name'] = $row['month_name']; |
@@ -10218,7 +10218,7 @@ discard block |
||
| 10218 | 10218 | * @return Array the hour list |
| 10219 | 10219 | * |
| 10220 | 10220 | */ |
| 10221 | - public function countAllHours($orderby,$filters = array()) |
|
| 10221 | + public function countAllHours($orderby, $filters = array()) |
|
| 10222 | 10222 | { |
| 10223 | 10223 | global $globalTimezone, $globalDBdriver; |
| 10224 | 10224 | if ($globalTimezone != '') { |
@@ -10266,7 +10266,7 @@ discard block |
||
| 10266 | 10266 | $hour_array = array(); |
| 10267 | 10267 | $temp_array = array(); |
| 10268 | 10268 | |
| 10269 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10269 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10270 | 10270 | { |
| 10271 | 10271 | $temp_array['hour_name'] = $row['hour_name']; |
| 10272 | 10272 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10286,7 +10286,7 @@ discard block |
||
| 10286 | 10286 | public function countAllHoursByAirlines($orderby, $filters = array()) |
| 10287 | 10287 | { |
| 10288 | 10288 | global $globalTimezone, $globalDBdriver; |
| 10289 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10289 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10290 | 10290 | if ($globalTimezone != '') { |
| 10291 | 10291 | date_default_timezone_set($globalTimezone); |
| 10292 | 10292 | $datetime = new DateTime(); |
@@ -10304,7 +10304,7 @@ discard block |
||
| 10304 | 10304 | } |
| 10305 | 10305 | |
| 10306 | 10306 | if ($globalDBdriver == 'mysql') { |
| 10307 | - $query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10307 | + $query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10308 | 10308 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 10309 | 10309 | GROUP BY spotter_output.airline_icao, hour_name |
| 10310 | 10310 | ".$orderby_sql; |
@@ -10317,7 +10317,7 @@ discard block |
||
| 10317 | 10317 | */ |
| 10318 | 10318 | $query_data = array(':offset' => $offset); |
| 10319 | 10319 | } else { |
| 10320 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10320 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10321 | 10321 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 10322 | 10322 | GROUP BY spotter_output.airline_icao, hour_name |
| 10323 | 10323 | ".$orderby_sql; |
@@ -10330,7 +10330,7 @@ discard block |
||
| 10330 | 10330 | $hour_array = array(); |
| 10331 | 10331 | $temp_array = array(); |
| 10332 | 10332 | |
| 10333 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10333 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10334 | 10334 | { |
| 10335 | 10335 | $temp_array['hour_name'] = $row['hour_name']; |
| 10336 | 10336 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10353,34 +10353,34 @@ discard block |
||
| 10353 | 10353 | public function countAllHoursByAirline($airline_icao, $filters = array()) |
| 10354 | 10354 | { |
| 10355 | 10355 | global $globalTimezone, $globalDBdriver; |
| 10356 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10356 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10357 | 10357 | if ($globalTimezone != '') { |
| 10358 | 10358 | date_default_timezone_set($globalTimezone); |
| 10359 | 10359 | $datetime = new DateTime(); |
| 10360 | 10360 | $offset = $datetime->format('P'); |
| 10361 | 10361 | } else $offset = '+00:00'; |
| 10362 | 10362 | |
| 10363 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 10363 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 10364 | 10364 | |
| 10365 | 10365 | if ($globalDBdriver == 'mysql') { |
| 10366 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10366 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10367 | 10367 | FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao |
| 10368 | 10368 | GROUP BY hour_name |
| 10369 | 10369 | ORDER BY hour_name ASC"; |
| 10370 | 10370 | } else { |
| 10371 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10371 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10372 | 10372 | FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao |
| 10373 | 10373 | GROUP BY hour_name |
| 10374 | 10374 | ORDER BY hour_name ASC"; |
| 10375 | 10375 | } |
| 10376 | 10376 | |
| 10377 | 10377 | $sth = $this->db->prepare($query); |
| 10378 | - $sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset)); |
|
| 10378 | + $sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset)); |
|
| 10379 | 10379 | |
| 10380 | 10380 | $hour_array = array(); |
| 10381 | 10381 | $temp_array = array(); |
| 10382 | 10382 | |
| 10383 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10383 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10384 | 10384 | { |
| 10385 | 10385 | $temp_array['hour_name'] = $row['hour_name']; |
| 10386 | 10386 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10403,8 +10403,8 @@ discard block |
||
| 10403 | 10403 | public function countAllHoursByAircraft($aircraft_icao, $filters = array()) |
| 10404 | 10404 | { |
| 10405 | 10405 | global $globalTimezone, $globalDBdriver; |
| 10406 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10407 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 10406 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10407 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 10408 | 10408 | if ($globalTimezone != '') { |
| 10409 | 10409 | date_default_timezone_set($globalTimezone); |
| 10410 | 10410 | $datetime = new DateTime(); |
@@ -10412,24 +10412,24 @@ discard block |
||
| 10412 | 10412 | } else $offset = '+00:00'; |
| 10413 | 10413 | |
| 10414 | 10414 | if ($globalDBdriver == 'mysql') { |
| 10415 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10415 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10416 | 10416 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao |
| 10417 | 10417 | GROUP BY hour_name |
| 10418 | 10418 | ORDER BY hour_name ASC"; |
| 10419 | 10419 | } else { |
| 10420 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10420 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10421 | 10421 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao |
| 10422 | 10422 | GROUP BY hour_name |
| 10423 | 10423 | ORDER BY hour_name ASC"; |
| 10424 | 10424 | } |
| 10425 | 10425 | |
| 10426 | 10426 | $sth = $this->db->prepare($query); |
| 10427 | - $sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset)); |
|
| 10427 | + $sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset)); |
|
| 10428 | 10428 | |
| 10429 | 10429 | $hour_array = array(); |
| 10430 | 10430 | $temp_array = array(); |
| 10431 | 10431 | |
| 10432 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10432 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10433 | 10433 | { |
| 10434 | 10434 | $temp_array['hour_name'] = $row['hour_name']; |
| 10435 | 10435 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10450,8 +10450,8 @@ discard block |
||
| 10450 | 10450 | public function countAllHoursByRegistration($registration, $filters = array()) |
| 10451 | 10451 | { |
| 10452 | 10452 | global $globalTimezone, $globalDBdriver; |
| 10453 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10454 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 10453 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10454 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 10455 | 10455 | if ($globalTimezone != '') { |
| 10456 | 10456 | date_default_timezone_set($globalTimezone); |
| 10457 | 10457 | $datetime = new DateTime(); |
@@ -10459,24 +10459,24 @@ discard block |
||
| 10459 | 10459 | } else $offset = '+00:00'; |
| 10460 | 10460 | |
| 10461 | 10461 | if ($globalDBdriver == 'mysql') { |
| 10462 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10462 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10463 | 10463 | FROM spotter_output".$filter_query." spotter_output.registration = :registration |
| 10464 | 10464 | GROUP BY hour_name |
| 10465 | 10465 | ORDER BY hour_name ASC"; |
| 10466 | 10466 | } else { |
| 10467 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10467 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10468 | 10468 | FROM spotter_output".$filter_query." spotter_output.registration = :registration |
| 10469 | 10469 | GROUP BY hour_name |
| 10470 | 10470 | ORDER BY hour_name ASC"; |
| 10471 | 10471 | } |
| 10472 | 10472 | |
| 10473 | 10473 | $sth = $this->db->prepare($query); |
| 10474 | - $sth->execute(array(':registration' => $registration,':offset' => $offset)); |
|
| 10474 | + $sth->execute(array(':registration' => $registration, ':offset' => $offset)); |
|
| 10475 | 10475 | |
| 10476 | 10476 | $hour_array = array(); |
| 10477 | 10477 | $temp_array = array(); |
| 10478 | 10478 | |
| 10479 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10479 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10480 | 10480 | { |
| 10481 | 10481 | $temp_array['hour_name'] = $row['hour_name']; |
| 10482 | 10482 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10497,8 +10497,8 @@ discard block |
||
| 10497 | 10497 | public function countAllHoursByAirport($airport_icao, $filters = array()) |
| 10498 | 10498 | { |
| 10499 | 10499 | global $globalTimezone, $globalDBdriver; |
| 10500 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10501 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 10500 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10501 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 10502 | 10502 | if ($globalTimezone != '') { |
| 10503 | 10503 | date_default_timezone_set($globalTimezone); |
| 10504 | 10504 | $datetime = new DateTime(); |
@@ -10506,24 +10506,24 @@ discard block |
||
| 10506 | 10506 | } else $offset = '+00:00'; |
| 10507 | 10507 | |
| 10508 | 10508 | if ($globalDBdriver == 'mysql') { |
| 10509 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10509 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10510 | 10510 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 10511 | 10511 | GROUP BY hour_name |
| 10512 | 10512 | ORDER BY hour_name ASC"; |
| 10513 | 10513 | } else { |
| 10514 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10514 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10515 | 10515 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 10516 | 10516 | GROUP BY hour_name |
| 10517 | 10517 | ORDER BY hour_name ASC"; |
| 10518 | 10518 | } |
| 10519 | 10519 | |
| 10520 | 10520 | $sth = $this->db->prepare($query); |
| 10521 | - $sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset)); |
|
| 10521 | + $sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset)); |
|
| 10522 | 10522 | |
| 10523 | 10523 | $hour_array = array(); |
| 10524 | 10524 | $temp_array = array(); |
| 10525 | 10525 | |
| 10526 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10526 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10527 | 10527 | { |
| 10528 | 10528 | $temp_array['hour_name'] = $row['hour_name']; |
| 10529 | 10529 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10542,11 +10542,11 @@ discard block |
||
| 10542 | 10542 | * @return Array the hour list |
| 10543 | 10543 | * |
| 10544 | 10544 | */ |
| 10545 | - public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array()) |
|
| 10545 | + public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 10546 | 10546 | { |
| 10547 | 10547 | global $globalTimezone, $globalDBdriver; |
| 10548 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10549 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 10548 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10549 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 10550 | 10550 | if ($globalTimezone != '') { |
| 10551 | 10551 | date_default_timezone_set($globalTimezone); |
| 10552 | 10552 | $datetime = new DateTime(); |
@@ -10554,24 +10554,24 @@ discard block |
||
| 10554 | 10554 | } else $offset = '+00:00'; |
| 10555 | 10555 | |
| 10556 | 10556 | if ($globalDBdriver == 'mysql') { |
| 10557 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10557 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10558 | 10558 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 10559 | 10559 | GROUP BY hour_name |
| 10560 | 10560 | ORDER BY hour_name ASC"; |
| 10561 | 10561 | } else { |
| 10562 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10562 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10563 | 10563 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 10564 | 10564 | GROUP BY hour_name |
| 10565 | 10565 | ORDER BY hour_name ASC"; |
| 10566 | 10566 | } |
| 10567 | 10567 | |
| 10568 | 10568 | $sth = $this->db->prepare($query); |
| 10569 | - $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset)); |
|
| 10569 | + $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset)); |
|
| 10570 | 10570 | |
| 10571 | 10571 | $hour_array = array(); |
| 10572 | 10572 | $temp_array = array(); |
| 10573 | 10573 | |
| 10574 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10574 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10575 | 10575 | { |
| 10576 | 10576 | $temp_array['hour_name'] = $row['hour_name']; |
| 10577 | 10577 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10593,8 +10593,8 @@ discard block |
||
| 10593 | 10593 | public function countAllHoursByDate($date, $filters = array()) |
| 10594 | 10594 | { |
| 10595 | 10595 | global $globalTimezone, $globalDBdriver; |
| 10596 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10597 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 10596 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10597 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 10598 | 10598 | if ($globalTimezone != '') { |
| 10599 | 10599 | date_default_timezone_set($globalTimezone); |
| 10600 | 10600 | $datetime = new DateTime($date); |
@@ -10602,12 +10602,12 @@ discard block |
||
| 10602 | 10602 | } else $offset = '+00:00'; |
| 10603 | 10603 | |
| 10604 | 10604 | if ($globalDBdriver == 'mysql') { |
| 10605 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10605 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10606 | 10606 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 10607 | 10607 | GROUP BY hour_name |
| 10608 | 10608 | ORDER BY hour_name ASC"; |
| 10609 | 10609 | } else { |
| 10610 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10610 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10611 | 10611 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
| 10612 | 10612 | GROUP BY hour_name |
| 10613 | 10613 | ORDER BY hour_name ASC"; |
@@ -10619,7 +10619,7 @@ discard block |
||
| 10619 | 10619 | $hour_array = array(); |
| 10620 | 10620 | $temp_array = array(); |
| 10621 | 10621 | |
| 10622 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10622 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10623 | 10623 | { |
| 10624 | 10624 | $temp_array['hour_name'] = $row['hour_name']; |
| 10625 | 10625 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10641,8 +10641,8 @@ discard block |
||
| 10641 | 10641 | public function countAllHoursByIdent($ident, $filters = array()) |
| 10642 | 10642 | { |
| 10643 | 10643 | global $globalTimezone, $globalDBdriver; |
| 10644 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10645 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 10644 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10645 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 10646 | 10646 | if ($globalTimezone != '') { |
| 10647 | 10647 | date_default_timezone_set($globalTimezone); |
| 10648 | 10648 | $datetime = new DateTime(); |
@@ -10650,12 +10650,12 @@ discard block |
||
| 10650 | 10650 | } else $offset = '+00:00'; |
| 10651 | 10651 | |
| 10652 | 10652 | if ($globalDBdriver == 'mysql') { |
| 10653 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10653 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10654 | 10654 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 10655 | 10655 | GROUP BY hour_name |
| 10656 | 10656 | ORDER BY hour_name ASC"; |
| 10657 | 10657 | } else { |
| 10658 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10658 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10659 | 10659 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 10660 | 10660 | GROUP BY hour_name |
| 10661 | 10661 | ORDER BY hour_name ASC"; |
@@ -10663,12 +10663,12 @@ discard block |
||
| 10663 | 10663 | |
| 10664 | 10664 | |
| 10665 | 10665 | $sth = $this->db->prepare($query); |
| 10666 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
| 10666 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
| 10667 | 10667 | |
| 10668 | 10668 | $hour_array = array(); |
| 10669 | 10669 | $temp_array = array(); |
| 10670 | 10670 | |
| 10671 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10671 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10672 | 10672 | { |
| 10673 | 10673 | $temp_array['hour_name'] = $row['hour_name']; |
| 10674 | 10674 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10688,8 +10688,8 @@ discard block |
||
| 10688 | 10688 | public function countAllHoursByOwner($owner, $filters = array()) |
| 10689 | 10689 | { |
| 10690 | 10690 | global $globalTimezone, $globalDBdriver; |
| 10691 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10692 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 10691 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10692 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 10693 | 10693 | if ($globalTimezone != '') { |
| 10694 | 10694 | date_default_timezone_set($globalTimezone); |
| 10695 | 10695 | $datetime = new DateTime(); |
@@ -10697,12 +10697,12 @@ discard block |
||
| 10697 | 10697 | } else $offset = '+00:00'; |
| 10698 | 10698 | |
| 10699 | 10699 | if ($globalDBdriver == 'mysql') { |
| 10700 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10700 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10701 | 10701 | FROM spotter_output".$filter_query." spotter_output.owner_name = :owner |
| 10702 | 10702 | GROUP BY hour_name |
| 10703 | 10703 | ORDER BY hour_name ASC"; |
| 10704 | 10704 | } else { |
| 10705 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10705 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10706 | 10706 | FROM spotter_output".$filter_query." spotter_output.owner_name = :owner |
| 10707 | 10707 | GROUP BY hour_name |
| 10708 | 10708 | ORDER BY hour_name ASC"; |
@@ -10710,12 +10710,12 @@ discard block |
||
| 10710 | 10710 | |
| 10711 | 10711 | |
| 10712 | 10712 | $sth = $this->db->prepare($query); |
| 10713 | - $sth->execute(array(':owner' => $owner,':offset' => $offset)); |
|
| 10713 | + $sth->execute(array(':owner' => $owner, ':offset' => $offset)); |
|
| 10714 | 10714 | |
| 10715 | 10715 | $hour_array = array(); |
| 10716 | 10716 | $temp_array = array(); |
| 10717 | 10717 | |
| 10718 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10718 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10719 | 10719 | { |
| 10720 | 10720 | $temp_array['hour_name'] = $row['hour_name']; |
| 10721 | 10721 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10735,8 +10735,8 @@ discard block |
||
| 10735 | 10735 | public function countAllHoursByPilot($pilot, $filters = array()) |
| 10736 | 10736 | { |
| 10737 | 10737 | global $globalTimezone, $globalDBdriver; |
| 10738 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10739 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 10738 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10739 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 10740 | 10740 | if ($globalTimezone != '') { |
| 10741 | 10741 | date_default_timezone_set($globalTimezone); |
| 10742 | 10742 | $datetime = new DateTime(); |
@@ -10744,12 +10744,12 @@ discard block |
||
| 10744 | 10744 | } else $offset = '+00:00'; |
| 10745 | 10745 | |
| 10746 | 10746 | if ($globalDBdriver == 'mysql') { |
| 10747 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10747 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10748 | 10748 | FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) |
| 10749 | 10749 | GROUP BY hour_name |
| 10750 | 10750 | ORDER BY hour_name ASC"; |
| 10751 | 10751 | } else { |
| 10752 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10752 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10753 | 10753 | FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) |
| 10754 | 10754 | GROUP BY hour_name |
| 10755 | 10755 | ORDER BY hour_name ASC"; |
@@ -10757,12 +10757,12 @@ discard block |
||
| 10757 | 10757 | |
| 10758 | 10758 | |
| 10759 | 10759 | $sth = $this->db->prepare($query); |
| 10760 | - $sth->execute(array(':pilot' => $pilot,':offset' => $offset)); |
|
| 10760 | + $sth->execute(array(':pilot' => $pilot, ':offset' => $offset)); |
|
| 10761 | 10761 | |
| 10762 | 10762 | $hour_array = array(); |
| 10763 | 10763 | $temp_array = array(); |
| 10764 | 10764 | |
| 10765 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10765 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10766 | 10766 | { |
| 10767 | 10767 | $temp_array['hour_name'] = $row['hour_name']; |
| 10768 | 10768 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10781,12 +10781,12 @@ discard block |
||
| 10781 | 10781 | * @return Array the hour list |
| 10782 | 10782 | * |
| 10783 | 10783 | */ |
| 10784 | - public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array()) |
|
| 10784 | + public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 10785 | 10785 | { |
| 10786 | 10786 | global $globalTimezone, $globalDBdriver; |
| 10787 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10788 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 10789 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 10787 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10788 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 10789 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 10790 | 10790 | if ($globalTimezone != '') { |
| 10791 | 10791 | date_default_timezone_set($globalTimezone); |
| 10792 | 10792 | $datetime = new DateTime(); |
@@ -10794,24 +10794,24 @@ discard block |
||
| 10794 | 10794 | } else $offset = '+00:00'; |
| 10795 | 10795 | |
| 10796 | 10796 | if ($globalDBdriver == 'mysql') { |
| 10797 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10797 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10798 | 10798 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 10799 | 10799 | GROUP BY hour_name |
| 10800 | 10800 | ORDER BY hour_name ASC"; |
| 10801 | 10801 | } else { |
| 10802 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10802 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10803 | 10803 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 10804 | 10804 | GROUP BY hour_name |
| 10805 | 10805 | ORDER BY hour_name ASC"; |
| 10806 | 10806 | } |
| 10807 | 10807 | |
| 10808 | 10808 | $sth = $this->db->prepare($query); |
| 10809 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset)); |
|
| 10809 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset)); |
|
| 10810 | 10810 | |
| 10811 | 10811 | $hour_array = array(); |
| 10812 | 10812 | $temp_array = array(); |
| 10813 | 10813 | |
| 10814 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10814 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10815 | 10815 | { |
| 10816 | 10816 | $temp_array['hour_name'] = $row['hour_name']; |
| 10817 | 10817 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10832,8 +10832,8 @@ discard block |
||
| 10832 | 10832 | public function countAllHoursByCountry($country, $filters = array()) |
| 10833 | 10833 | { |
| 10834 | 10834 | global $globalTimezone, $globalDBdriver; |
| 10835 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10836 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 10835 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10836 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 10837 | 10837 | if ($globalTimezone != '') { |
| 10838 | 10838 | date_default_timezone_set($globalTimezone); |
| 10839 | 10839 | $datetime = new DateTime(); |
@@ -10841,24 +10841,24 @@ discard block |
||
| 10841 | 10841 | } else $offset = '+00:00'; |
| 10842 | 10842 | |
| 10843 | 10843 | if ($globalDBdriver == 'mysql') { |
| 10844 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10844 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10845 | 10845 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 10846 | 10846 | GROUP BY hour_name |
| 10847 | 10847 | ORDER BY hour_name ASC"; |
| 10848 | 10848 | } else { |
| 10849 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10849 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10850 | 10850 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 10851 | 10851 | GROUP BY hour_name |
| 10852 | 10852 | ORDER BY hour_name ASC"; |
| 10853 | 10853 | } |
| 10854 | 10854 | |
| 10855 | 10855 | $sth = $this->db->prepare($query); |
| 10856 | - $sth->execute(array(':country' => $country,':offset' => $offset)); |
|
| 10856 | + $sth->execute(array(':country' => $country, ':offset' => $offset)); |
|
| 10857 | 10857 | |
| 10858 | 10858 | $hour_array = array(); |
| 10859 | 10859 | $temp_array = array(); |
| 10860 | 10860 | |
| 10861 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10861 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10862 | 10862 | { |
| 10863 | 10863 | $temp_array['hour_name'] = $row['hour_name']; |
| 10864 | 10864 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10878,29 +10878,29 @@ discard block |
||
| 10878 | 10878 | * @return Integer the number of aircrafts |
| 10879 | 10879 | * |
| 10880 | 10880 | */ |
| 10881 | - public function countOverallAircrafts($filters = array(),$year = '',$month = '') |
|
| 10881 | + public function countOverallAircrafts($filters = array(), $year = '', $month = '') |
|
| 10882 | 10882 | { |
| 10883 | 10883 | global $globalDBdriver; |
| 10884 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10885 | - $query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count |
|
| 10884 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10885 | + $query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count |
|
| 10886 | 10886 | FROM spotter_output".$filter_query." spotter_output.ident <> ''"; |
| 10887 | 10887 | $query_values = array(); |
| 10888 | 10888 | if ($year != '') { |
| 10889 | 10889 | if ($globalDBdriver == 'mysql') { |
| 10890 | 10890 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 10891 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 10891 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 10892 | 10892 | } else { |
| 10893 | 10893 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 10894 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 10894 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 10895 | 10895 | } |
| 10896 | 10896 | } |
| 10897 | 10897 | if ($month != '') { |
| 10898 | 10898 | if ($globalDBdriver == 'mysql') { |
| 10899 | 10899 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 10900 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 10900 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 10901 | 10901 | } else { |
| 10902 | 10902 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 10903 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 10903 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 10904 | 10904 | } |
| 10905 | 10905 | } |
| 10906 | 10906 | |
@@ -10915,29 +10915,29 @@ discard block |
||
| 10915 | 10915 | * @return Integer the number of aircrafts |
| 10916 | 10916 | * |
| 10917 | 10917 | */ |
| 10918 | - public function countOverallArrival($filters = array(),$year = '',$month = '') |
|
| 10918 | + public function countOverallArrival($filters = array(), $year = '', $month = '') |
|
| 10919 | 10919 | { |
| 10920 | 10920 | global $globalDBdriver; |
| 10921 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10922 | - $query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count |
|
| 10921 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10922 | + $query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count |
|
| 10923 | 10923 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''"; |
| 10924 | 10924 | $query_values = array(); |
| 10925 | 10925 | if ($year != '') { |
| 10926 | 10926 | if ($globalDBdriver == 'mysql') { |
| 10927 | 10927 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 10928 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 10928 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 10929 | 10929 | } else { |
| 10930 | 10930 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 10931 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 10931 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 10932 | 10932 | } |
| 10933 | 10933 | } |
| 10934 | 10934 | if ($month != '') { |
| 10935 | 10935 | if ($globalDBdriver == 'mysql') { |
| 10936 | 10936 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 10937 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 10937 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 10938 | 10938 | } else { |
| 10939 | 10939 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 10940 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 10940 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 10941 | 10941 | } |
| 10942 | 10942 | } |
| 10943 | 10943 | |
@@ -10952,29 +10952,29 @@ discard block |
||
| 10952 | 10952 | * @return Integer the number of pilots |
| 10953 | 10953 | * |
| 10954 | 10954 | */ |
| 10955 | - public function countOverallPilots($filters = array(),$year = '',$month = '') |
|
| 10955 | + public function countOverallPilots($filters = array(), $year = '', $month = '') |
|
| 10956 | 10956 | { |
| 10957 | 10957 | global $globalDBdriver; |
| 10958 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10959 | - $query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count |
|
| 10958 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10959 | + $query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count |
|
| 10960 | 10960 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''"; |
| 10961 | 10961 | $query_values = array(); |
| 10962 | 10962 | if ($year != '') { |
| 10963 | 10963 | if ($globalDBdriver == 'mysql') { |
| 10964 | 10964 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 10965 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 10965 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 10966 | 10966 | } else { |
| 10967 | 10967 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 10968 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 10968 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 10969 | 10969 | } |
| 10970 | 10970 | } |
| 10971 | 10971 | if ($month != '') { |
| 10972 | 10972 | if ($globalDBdriver == 'mysql') { |
| 10973 | 10973 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 10974 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 10974 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 10975 | 10975 | } else { |
| 10976 | 10976 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 10977 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 10977 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 10978 | 10978 | } |
| 10979 | 10979 | } |
| 10980 | 10980 | $sth = $this->db->prepare($query); |
@@ -10988,29 +10988,29 @@ discard block |
||
| 10988 | 10988 | * @return Integer the number of owners |
| 10989 | 10989 | * |
| 10990 | 10990 | */ |
| 10991 | - public function countOverallOwners($filters = array(),$year = '',$month = '') |
|
| 10991 | + public function countOverallOwners($filters = array(), $year = '', $month = '') |
|
| 10992 | 10992 | { |
| 10993 | 10993 | global $globalDBdriver; |
| 10994 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10995 | - $query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count |
|
| 10994 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10995 | + $query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count |
|
| 10996 | 10996 | FROM spotter_output".$filter_query." spotter_output.owner_name <> ''"; |
| 10997 | 10997 | $query_values = array(); |
| 10998 | 10998 | if ($year != '') { |
| 10999 | 10999 | if ($globalDBdriver == 'mysql') { |
| 11000 | 11000 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 11001 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 11001 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 11002 | 11002 | } else { |
| 11003 | 11003 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 11004 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 11004 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 11005 | 11005 | } |
| 11006 | 11006 | } |
| 11007 | 11007 | if ($month != '') { |
| 11008 | 11008 | if ($globalDBdriver == 'mysql') { |
| 11009 | 11009 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 11010 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 11010 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 11011 | 11011 | } else { |
| 11012 | 11012 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 11013 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 11013 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 11014 | 11014 | } |
| 11015 | 11015 | } |
| 11016 | 11016 | $sth = $this->db->prepare($query); |
@@ -11025,32 +11025,32 @@ discard block |
||
| 11025 | 11025 | * @return Integer the number of flights |
| 11026 | 11026 | * |
| 11027 | 11027 | */ |
| 11028 | - public function countOverallFlights($filters = array(),$year = '',$month = '') |
|
| 11028 | + public function countOverallFlights($filters = array(), $year = '', $month = '') |
|
| 11029 | 11029 | { |
| 11030 | 11030 | global $globalDBdriver; |
| 11031 | - $queryi = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output"; |
|
| 11031 | + $queryi = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output"; |
|
| 11032 | 11032 | $query_values = array(); |
| 11033 | 11033 | $query = ''; |
| 11034 | 11034 | if ($year != '') { |
| 11035 | 11035 | if ($globalDBdriver == 'mysql') { |
| 11036 | 11036 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 11037 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 11037 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 11038 | 11038 | } else { |
| 11039 | 11039 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 11040 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 11040 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 11041 | 11041 | } |
| 11042 | 11042 | } |
| 11043 | 11043 | if ($month != '') { |
| 11044 | 11044 | if ($globalDBdriver == 'mysql') { |
| 11045 | 11045 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 11046 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 11046 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 11047 | 11047 | } else { |
| 11048 | 11048 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 11049 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 11049 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 11050 | 11050 | } |
| 11051 | 11051 | } |
| 11052 | 11052 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
| 11053 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11053 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
| 11054 | 11054 | |
| 11055 | 11055 | $sth = $this->db->prepare($queryi); |
| 11056 | 11056 | $sth->execute($query_values); |
@@ -11063,29 +11063,29 @@ discard block |
||
| 11063 | 11063 | * @return Integer the number of flights |
| 11064 | 11064 | * |
| 11065 | 11065 | */ |
| 11066 | - public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '') |
|
| 11066 | + public function countOverallMilitaryFlights($filters = array(), $year = '', $month = '') |
|
| 11067 | 11067 | { |
| 11068 | 11068 | global $globalDBdriver; |
| 11069 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 11070 | - $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
|
| 11069 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 11070 | + $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
|
| 11071 | 11071 | FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'"; |
| 11072 | 11072 | $query_values = array(); |
| 11073 | 11073 | if ($year != '') { |
| 11074 | 11074 | if ($globalDBdriver == 'mysql') { |
| 11075 | 11075 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 11076 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 11076 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 11077 | 11077 | } else { |
| 11078 | 11078 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 11079 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 11079 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 11080 | 11080 | } |
| 11081 | 11081 | } |
| 11082 | 11082 | if ($month != '') { |
| 11083 | 11083 | if ($globalDBdriver == 'mysql') { |
| 11084 | 11084 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 11085 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 11085 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 11086 | 11086 | } else { |
| 11087 | 11087 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 11088 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 11088 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 11089 | 11089 | } |
| 11090 | 11090 | } |
| 11091 | 11091 | |
@@ -11102,10 +11102,10 @@ discard block |
||
| 11102 | 11102 | * @return Integer the number of airlines |
| 11103 | 11103 | * |
| 11104 | 11104 | */ |
| 11105 | - public function countOverallAirlines($filters = array(),$year = '',$month = '') |
|
| 11105 | + public function countOverallAirlines($filters = array(), $year = '', $month = '') |
|
| 11106 | 11106 | { |
| 11107 | 11107 | global $globalDBdriver; |
| 11108 | - $queryi = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count |
|
| 11108 | + $queryi = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count |
|
| 11109 | 11109 | FROM spotter_output"; |
| 11110 | 11110 | |
| 11111 | 11111 | $query_values = array(); |
@@ -11113,23 +11113,23 @@ discard block |
||
| 11113 | 11113 | if ($year != '') { |
| 11114 | 11114 | if ($globalDBdriver == 'mysql') { |
| 11115 | 11115 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 11116 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 11116 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 11117 | 11117 | } else { |
| 11118 | 11118 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 11119 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 11119 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 11120 | 11120 | } |
| 11121 | 11121 | } |
| 11122 | 11122 | if ($month != '') { |
| 11123 | 11123 | if ($globalDBdriver == 'mysql') { |
| 11124 | 11124 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 11125 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 11125 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 11126 | 11126 | } else { |
| 11127 | 11127 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 11128 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 11128 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 11129 | 11129 | } |
| 11130 | 11130 | } |
| 11131 | 11131 | if ($query == '') $queryi .= $this->getFilter($filters); |
| 11132 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11132 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
| 11133 | 11133 | |
| 11134 | 11134 | |
| 11135 | 11135 | $sth = $this->db->prepare($queryi); |
@@ -11147,7 +11147,7 @@ discard block |
||
| 11147 | 11147 | public function countAllHoursFromToday($filters = array()) |
| 11148 | 11148 | { |
| 11149 | 11149 | global $globalTimezone, $globalDBdriver; |
| 11150 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 11150 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 11151 | 11151 | if ($globalTimezone != '') { |
| 11152 | 11152 | date_default_timezone_set($globalTimezone); |
| 11153 | 11153 | $datetime = new DateTime(); |
@@ -11155,12 +11155,12 @@ discard block |
||
| 11155 | 11155 | } else $offset = '+00:00'; |
| 11156 | 11156 | |
| 11157 | 11157 | if ($globalDBdriver == 'mysql') { |
| 11158 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 11158 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 11159 | 11159 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE() |
| 11160 | 11160 | GROUP BY hour_name |
| 11161 | 11161 | ORDER BY hour_name ASC"; |
| 11162 | 11162 | } else { |
| 11163 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 11163 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 11164 | 11164 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
| 11165 | 11165 | GROUP BY hour_name |
| 11166 | 11166 | ORDER BY hour_name ASC"; |
@@ -11172,7 +11172,7 @@ discard block |
||
| 11172 | 11172 | $hour_array = array(); |
| 11173 | 11173 | $temp_array = array(); |
| 11174 | 11174 | |
| 11175 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11175 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11176 | 11176 | { |
| 11177 | 11177 | $temp_array['hour_name'] = $row['hour_name']; |
| 11178 | 11178 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -11191,14 +11191,14 @@ discard block |
||
| 11191 | 11191 | public function getUpcomingFlights($limit = '', $sort = '', $filters = array()) |
| 11192 | 11192 | { |
| 11193 | 11193 | global $global_query, $globalDBdriver, $globalTimezone; |
| 11194 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 11194 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 11195 | 11195 | date_default_timezone_set('UTC'); |
| 11196 | 11196 | $limit_query = ''; |
| 11197 | 11197 | if ($limit != "") |
| 11198 | 11198 | { |
| 11199 | 11199 | $limit_array = explode(",", $limit); |
| 11200 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 11201 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 11200 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 11201 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 11202 | 11202 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 11203 | 11203 | { |
| 11204 | 11204 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -11251,7 +11251,7 @@ discard block |
||
| 11251 | 11251 | 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') |
| 11252 | 11252 | HAVING count(spotter_output.ident) > 5$orderby_query"; |
| 11253 | 11253 | //echo $query; |
| 11254 | - $spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone)); |
|
| 11254 | + $spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone)); |
|
| 11255 | 11255 | /* |
| 11256 | 11256 | $sth = $this->db->prepare($query); |
| 11257 | 11257 | $sth->execute(array(':timezone' => $globalTimezone)); |
@@ -11270,9 +11270,9 @@ discard block |
||
| 11270 | 11270 | */ |
| 11271 | 11271 | public function getSpotterIDBasedOnFlightAwareID($flightaware_id) |
| 11272 | 11272 | { |
| 11273 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 11273 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 11274 | 11274 | |
| 11275 | - $query = "SELECT spotter_output.spotter_id |
|
| 11275 | + $query = "SELECT spotter_output.spotter_id |
|
| 11276 | 11276 | FROM spotter_output |
| 11277 | 11277 | WHERE spotter_output.flightaware_id = '".$flightaware_id."'"; |
| 11278 | 11278 | |
@@ -11280,7 +11280,7 @@ discard block |
||
| 11280 | 11280 | $sth = $this->db->prepare($query); |
| 11281 | 11281 | $sth->execute(); |
| 11282 | 11282 | |
| 11283 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11283 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11284 | 11284 | { |
| 11285 | 11285 | return $row['spotter_id']; |
| 11286 | 11286 | } |
@@ -11305,23 +11305,23 @@ discard block |
||
| 11305 | 11305 | } |
| 11306 | 11306 | |
| 11307 | 11307 | $current_date = date("Y-m-d H:i:s"); |
| 11308 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
| 11308 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
| 11309 | 11309 | |
| 11310 | 11310 | $diff = abs(strtotime($current_date) - strtotime($date)); |
| 11311 | 11311 | |
| 11312 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
| 11312 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
| 11313 | 11313 | $years = $time_array['years']; |
| 11314 | 11314 | |
| 11315 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
| 11315 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
| 11316 | 11316 | $months = $time_array['months']; |
| 11317 | 11317 | |
| 11318 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
| 11318 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
| 11319 | 11319 | $days = $time_array['days']; |
| 11320 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
| 11320 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
| 11321 | 11321 | $hours = $time_array['hours']; |
| 11322 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
| 11322 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
| 11323 | 11323 | $minutes = $time_array['minutes']; |
| 11324 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 11324 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 11325 | 11325 | |
| 11326 | 11326 | return $time_array; |
| 11327 | 11327 | } |
@@ -11347,63 +11347,63 @@ discard block |
||
| 11347 | 11347 | $temp_array['direction_degree'] = $direction; |
| 11348 | 11348 | $temp_array['direction_shortname'] = "N"; |
| 11349 | 11349 | $temp_array['direction_fullname'] = "North"; |
| 11350 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
| 11350 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
| 11351 | 11351 | $temp_array['direction_degree'] = $direction; |
| 11352 | 11352 | $temp_array['direction_shortname'] = "NNE"; |
| 11353 | 11353 | $temp_array['direction_fullname'] = "North-Northeast"; |
| 11354 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
| 11354 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
| 11355 | 11355 | $temp_array['direction_degree'] = $direction; |
| 11356 | 11356 | $temp_array['direction_shortname'] = "NE"; |
| 11357 | 11357 | $temp_array['direction_fullname'] = "Northeast"; |
| 11358 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
| 11358 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
| 11359 | 11359 | $temp_array['direction_degree'] = $direction; |
| 11360 | 11360 | $temp_array['direction_shortname'] = "ENE"; |
| 11361 | 11361 | $temp_array['direction_fullname'] = "East-Northeast"; |
| 11362 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
| 11362 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
| 11363 | 11363 | $temp_array['direction_degree'] = $direction; |
| 11364 | 11364 | $temp_array['direction_shortname'] = "E"; |
| 11365 | 11365 | $temp_array['direction_fullname'] = "East"; |
| 11366 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
| 11366 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
| 11367 | 11367 | $temp_array['direction_degree'] = $direction; |
| 11368 | 11368 | $temp_array['direction_shortname'] = "ESE"; |
| 11369 | 11369 | $temp_array['direction_fullname'] = "East-Southeast"; |
| 11370 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
| 11370 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
| 11371 | 11371 | $temp_array['direction_degree'] = $direction; |
| 11372 | 11372 | $temp_array['direction_shortname'] = "SE"; |
| 11373 | 11373 | $temp_array['direction_fullname'] = "Southeast"; |
| 11374 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
| 11374 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
| 11375 | 11375 | $temp_array['direction_degree'] = $direction; |
| 11376 | 11376 | $temp_array['direction_shortname'] = "SSE"; |
| 11377 | 11377 | $temp_array['direction_fullname'] = "South-Southeast"; |
| 11378 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
| 11378 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
| 11379 | 11379 | $temp_array['direction_degree'] = $direction; |
| 11380 | 11380 | $temp_array['direction_shortname'] = "S"; |
| 11381 | 11381 | $temp_array['direction_fullname'] = "South"; |
| 11382 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
| 11382 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
| 11383 | 11383 | $temp_array['direction_degree'] = $direction; |
| 11384 | 11384 | $temp_array['direction_shortname'] = "SSW"; |
| 11385 | 11385 | $temp_array['direction_fullname'] = "South-Southwest"; |
| 11386 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
| 11386 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
| 11387 | 11387 | $temp_array['direction_degree'] = $direction; |
| 11388 | 11388 | $temp_array['direction_shortname'] = "SW"; |
| 11389 | 11389 | $temp_array['direction_fullname'] = "Southwest"; |
| 11390 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
| 11390 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
| 11391 | 11391 | $temp_array['direction_degree'] = $direction; |
| 11392 | 11392 | $temp_array['direction_shortname'] = "WSW"; |
| 11393 | 11393 | $temp_array['direction_fullname'] = "West-Southwest"; |
| 11394 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
| 11394 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
| 11395 | 11395 | $temp_array['direction_degree'] = $direction; |
| 11396 | 11396 | $temp_array['direction_shortname'] = "W"; |
| 11397 | 11397 | $temp_array['direction_fullname'] = "West"; |
| 11398 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
| 11398 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
| 11399 | 11399 | $temp_array['direction_degree'] = $direction; |
| 11400 | 11400 | $temp_array['direction_shortname'] = "WNW"; |
| 11401 | 11401 | $temp_array['direction_fullname'] = "West-Northwest"; |
| 11402 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
| 11402 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
| 11403 | 11403 | $temp_array['direction_degree'] = $direction; |
| 11404 | 11404 | $temp_array['direction_shortname'] = "NW"; |
| 11405 | 11405 | $temp_array['direction_fullname'] = "Northwest"; |
| 11406 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
| 11406 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
| 11407 | 11407 | $temp_array['direction_degree'] = $direction; |
| 11408 | 11408 | $temp_array['direction_shortname'] = "NNW"; |
| 11409 | 11409 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -11456,8 +11456,8 @@ discard block |
||
| 11456 | 11456 | */ |
| 11457 | 11457 | public function getAircraftRegistrationBymodeS($aircraft_modes, $source_type = '') |
| 11458 | 11458 | { |
| 11459 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
| 11460 | - $source_type = filter_var($source_type,FILTER_SANITIZE_STRING); |
|
| 11459 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
| 11460 | + $source_type = filter_var($source_type, FILTER_SANITIZE_STRING); |
|
| 11461 | 11461 | if ($source_type == '' || $source_type == 'modes') { |
| 11462 | 11462 | $query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes AND aircraft_modes.source_type = 'modes' ORDER BY FirstCreated DESC LIMIT 1"; |
| 11463 | 11463 | } else { |
@@ -11484,10 +11484,10 @@ discard block |
||
| 11484 | 11484 | * @return String the aircraft type |
| 11485 | 11485 | * |
| 11486 | 11486 | */ |
| 11487 | - public function getAircraftTypeBymodeS($aircraft_modes,$source_type = '') |
|
| 11487 | + public function getAircraftTypeBymodeS($aircraft_modes, $source_type = '') |
|
| 11488 | 11488 | { |
| 11489 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
| 11490 | - $source_type = filter_var($source_type,FILTER_SANITIZE_STRING); |
|
| 11489 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
| 11490 | + $source_type = filter_var($source_type, FILTER_SANITIZE_STRING); |
|
| 11491 | 11491 | if ($source_type == '' || $source_type == 'modes') { |
| 11492 | 11492 | $query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes AND aircraft_modes.source_type = 'modes' ORDER BY FirstCreated DESC LIMIT 1"; |
| 11493 | 11493 | } else { |
@@ -11515,11 +11515,11 @@ discard block |
||
| 11515 | 11515 | * @param Float $longitude longitute of the flight |
| 11516 | 11516 | * @return String the countrie |
| 11517 | 11517 | */ |
| 11518 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
| 11518 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
| 11519 | 11519 | { |
| 11520 | 11520 | global $globalDBdriver, $globalDebug; |
| 11521 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 11522 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 11521 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 11522 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 11523 | 11523 | |
| 11524 | 11524 | $Connection = new Connection($this->db); |
| 11525 | 11525 | if (!$Connection->tableExists('countries')) return ''; |
@@ -11559,7 +11559,7 @@ discard block |
||
| 11559 | 11559 | public function getCountryFromISO2($iso2) |
| 11560 | 11560 | { |
| 11561 | 11561 | global $globalDBdriver, $globalDebug; |
| 11562 | - $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
|
| 11562 | + $iso2 = filter_var($iso2, FILTER_SANITIZE_STRING); |
|
| 11563 | 11563 | |
| 11564 | 11564 | $Connection = new Connection($this->db); |
| 11565 | 11565 | if (!$Connection->tableExists('countries')) return ''; |
@@ -11591,19 +11591,19 @@ discard block |
||
| 11591 | 11591 | */ |
| 11592 | 11592 | public function convertAircraftRegistration($registration) |
| 11593 | 11593 | { |
| 11594 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 11594 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 11595 | 11595 | $registration_prefix = ''; |
| 11596 | 11596 | $registration_1 = substr($registration, 0, 1); |
| 11597 | 11597 | $registration_2 = substr($registration, 0, 2); |
| 11598 | 11598 | |
| 11599 | 11599 | //first get the prefix based on two characters |
| 11600 | - $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2"; |
|
| 11600 | + $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2"; |
|
| 11601 | 11601 | |
| 11602 | 11602 | |
| 11603 | 11603 | $sth = $this->db->prepare($query); |
| 11604 | 11604 | $sth->execute(array(':registration_2' => $registration_2)); |
| 11605 | 11605 | |
| 11606 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11606 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11607 | 11607 | { |
| 11608 | 11608 | $registration_prefix = $row['registration_prefix']; |
| 11609 | 11609 | } |
@@ -11611,11 +11611,11 @@ discard block |
||
| 11611 | 11611 | //if we didn't find a two chracter prefix lets just search the one with one character |
| 11612 | 11612 | if ($registration_prefix == '') |
| 11613 | 11613 | { |
| 11614 | - $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1"; |
|
| 11614 | + $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1"; |
|
| 11615 | 11615 | $sth = $this->db->prepare($query); |
| 11616 | 11616 | $sth->execute(array(':registration_1' => $registration_1)); |
| 11617 | 11617 | |
| 11618 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11618 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11619 | 11619 | { |
| 11620 | 11620 | $registration_prefix = $row['registration_prefix']; |
| 11621 | 11621 | } |
@@ -11629,7 +11629,7 @@ discard block |
||
| 11629 | 11629 | } else { |
| 11630 | 11630 | $registration = preg_replace("/^(.{1})/", "$1-", $registration); |
| 11631 | 11631 | } |
| 11632 | - } else if(strlen($registration_prefix) == 2){ |
|
| 11632 | + } else if (strlen($registration_prefix) == 2) { |
|
| 11633 | 11633 | if (0 === strpos($registration, 'N')) { |
| 11634 | 11634 | $registration = preg_replace("/^(.{2})/", "$1", $registration); |
| 11635 | 11635 | } else { |
@@ -11648,17 +11648,17 @@ discard block |
||
| 11648 | 11648 | */ |
| 11649 | 11649 | public function countryFromAircraftRegistration($registration) |
| 11650 | 11650 | { |
| 11651 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 11651 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 11652 | 11652 | |
| 11653 | 11653 | $registration_prefix = ''; |
| 11654 | - $registration_test = explode('-',$registration); |
|
| 11654 | + $registration_test = explode('-', $registration); |
|
| 11655 | 11655 | $country = ''; |
| 11656 | 11656 | if ($registration_test[0] != $registration) { |
| 11657 | 11657 | $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
| 11658 | 11658 | |
| 11659 | 11659 | $sth = $this->db->prepare($query); |
| 11660 | 11660 | $sth->execute(array(':registration_1' => $registration_test[0])); |
| 11661 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11661 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11662 | 11662 | { |
| 11663 | 11663 | //$registration_prefix = $row['registration_prefix']; |
| 11664 | 11664 | $country = $row['country']; |
@@ -11669,13 +11669,13 @@ discard block |
||
| 11669 | 11669 | |
| 11670 | 11670 | $country = ''; |
| 11671 | 11671 | //first get the prefix based on two characters |
| 11672 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
| 11672 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
| 11673 | 11673 | |
| 11674 | 11674 | |
| 11675 | 11675 | $sth = $this->db->prepare($query); |
| 11676 | 11676 | $sth->execute(array(':registration_2' => $registration_2)); |
| 11677 | 11677 | |
| 11678 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11678 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11679 | 11679 | { |
| 11680 | 11680 | $registration_prefix = $row['registration_prefix']; |
| 11681 | 11681 | $country = $row['country']; |
@@ -11684,12 +11684,12 @@ discard block |
||
| 11684 | 11684 | //if we didn't find a two chracter prefix lets just search the one with one character |
| 11685 | 11685 | if ($registration_prefix == "") |
| 11686 | 11686 | { |
| 11687 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 11687 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 11688 | 11688 | |
| 11689 | 11689 | $sth = $this->db->prepare($query); |
| 11690 | 11690 | $sth->execute(array(':registration_1' => $registration_1)); |
| 11691 | 11691 | |
| 11692 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11692 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11693 | 11693 | { |
| 11694 | 11694 | //$registration_prefix = $row['registration_prefix']; |
| 11695 | 11695 | $country = $row['country']; |
@@ -11709,17 +11709,17 @@ discard block |
||
| 11709 | 11709 | */ |
| 11710 | 11710 | public function registrationPrefixFromAircraftRegistration($registration) |
| 11711 | 11711 | { |
| 11712 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 11712 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 11713 | 11713 | |
| 11714 | 11714 | $registration_prefix = ''; |
| 11715 | - $registration_test = explode('-',$registration); |
|
| 11715 | + $registration_test = explode('-', $registration); |
|
| 11716 | 11716 | //$country = ''; |
| 11717 | 11717 | if ($registration_test[0] != $registration) { |
| 11718 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 11718 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 11719 | 11719 | |
| 11720 | 11720 | $sth = $this->db->prepare($query); |
| 11721 | 11721 | $sth->execute(array(':registration_1' => $registration_test[0])); |
| 11722 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11722 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11723 | 11723 | { |
| 11724 | 11724 | $registration_prefix = $row['registration_prefix']; |
| 11725 | 11725 | //$country = $row['country']; |
@@ -11729,13 +11729,13 @@ discard block |
||
| 11729 | 11729 | $registration_2 = substr($registration, 0, 2); |
| 11730 | 11730 | |
| 11731 | 11731 | //first get the prefix based on two characters |
| 11732 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
| 11732 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
| 11733 | 11733 | |
| 11734 | 11734 | |
| 11735 | 11735 | $sth = $this->db->prepare($query); |
| 11736 | 11736 | $sth->execute(array(':registration_2' => $registration_2)); |
| 11737 | 11737 | |
| 11738 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11738 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11739 | 11739 | { |
| 11740 | 11740 | $registration_prefix = $row['registration_prefix']; |
| 11741 | 11741 | //$country = $row['country']; |
@@ -11744,12 +11744,12 @@ discard block |
||
| 11744 | 11744 | //if we didn't find a two chracter prefix lets just search the one with one character |
| 11745 | 11745 | if ($registration_prefix == "") |
| 11746 | 11746 | { |
| 11747 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 11747 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 11748 | 11748 | |
| 11749 | 11749 | $sth = $this->db->prepare($query); |
| 11750 | 11750 | $sth->execute(array(':registration_1' => $registration_1)); |
| 11751 | 11751 | |
| 11752 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11752 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11753 | 11753 | { |
| 11754 | 11754 | $registration_prefix = $row['registration_prefix']; |
| 11755 | 11755 | //$country = $row['country']; |
@@ -11770,13 +11770,13 @@ discard block |
||
| 11770 | 11770 | */ |
| 11771 | 11771 | public function countryFromAircraftRegistrationCode($registration) |
| 11772 | 11772 | { |
| 11773 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 11773 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 11774 | 11774 | |
| 11775 | 11775 | $country = ''; |
| 11776 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1"; |
|
| 11776 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1"; |
|
| 11777 | 11777 | $sth = $this->db->prepare($query); |
| 11778 | 11778 | $sth->execute(array(':registration' => $registration)); |
| 11779 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11779 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11780 | 11780 | { |
| 11781 | 11781 | $country = $row['country']; |
| 11782 | 11782 | } |
@@ -11789,9 +11789,9 @@ discard block |
||
| 11789 | 11789 | * @param String $flightaware_id flightaware_id from spotter_output table |
| 11790 | 11790 | * @param String $highlight New highlight value |
| 11791 | 11791 | */ |
| 11792 | - public function setHighlightFlight($flightaware_id,$highlight) { |
|
| 11792 | + public function setHighlightFlight($flightaware_id, $highlight) { |
|
| 11793 | 11793 | |
| 11794 | - $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
|
| 11794 | + $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
|
| 11795 | 11795 | $sth = $this->db->prepare($query); |
| 11796 | 11796 | $sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight)); |
| 11797 | 11797 | } |
@@ -11803,13 +11803,13 @@ discard block |
||
| 11803 | 11803 | * @param String $date Date of spotted aircraft |
| 11804 | 11804 | * @param String $highlight New highlight value |
| 11805 | 11805 | */ |
| 11806 | - public function setHighlightFlightByRegistration($registration,$highlight, $date = '') { |
|
| 11806 | + public function setHighlightFlightByRegistration($registration, $highlight, $date = '') { |
|
| 11807 | 11807 | if ($date == '') { |
| 11808 | 11808 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)"; |
| 11809 | 11809 | $query_values = array(':registration' => $registration, ':highlight' => $highlight); |
| 11810 | 11810 | } else { |
| 11811 | 11811 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE registration = :registration AND date(date) = :date"; |
| 11812 | - $query_values = array(':registration' => $registration, ':highlight' => $highlight,':date' => $date); |
|
| 11812 | + $query_values = array(':registration' => $registration, ':highlight' => $highlight, ':date' => $date); |
|
| 11813 | 11813 | } |
| 11814 | 11814 | $sth = $this->db->prepare($query); |
| 11815 | 11815 | $sth->execute($query_values); |
@@ -11839,7 +11839,7 @@ discard block |
||
| 11839 | 11839 | |
| 11840 | 11840 | $bitly_data = json_decode($bitly_data); |
| 11841 | 11841 | $bitly_url = ''; |
| 11842 | - if ($bitly_data->status_txt = "OK"){ |
|
| 11842 | + if ($bitly_data->status_txt = "OK") { |
|
| 11843 | 11843 | $bitly_url = $bitly_data->data->url; |
| 11844 | 11844 | } |
| 11845 | 11845 | |
@@ -11849,7 +11849,7 @@ discard block |
||
| 11849 | 11849 | |
| 11850 | 11850 | public function getOrderBy() |
| 11851 | 11851 | { |
| 11852 | - $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")); |
|
| 11852 | + $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")); |
|
| 11853 | 11853 | |
| 11854 | 11854 | return $orderby; |
| 11855 | 11855 | |
@@ -11983,14 +11983,14 @@ discard block |
||
| 11983 | 11983 | } |
| 11984 | 11984 | $sth = $this->db->prepare($query); |
| 11985 | 11985 | $sth->execute(); |
| 11986 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11986 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11987 | 11987 | { |
| 11988 | 11988 | $departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']); |
| 11989 | 11989 | $arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']); |
| 11990 | 11990 | if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) { |
| 11991 | - $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"; |
|
| 11991 | + $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"; |
|
| 11992 | 11992 | $sthu = $this->db->prepare($update_query); |
| 11993 | - $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'])); |
|
| 11993 | + $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'])); |
|
| 11994 | 11994 | } |
| 11995 | 11995 | } |
| 11996 | 11996 | |
@@ -12003,7 +12003,7 @@ discard block |
||
| 12003 | 12003 | } |
| 12004 | 12004 | $sth = $this->db->prepare($query); |
| 12005 | 12005 | $sth->execute(); |
| 12006 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 12006 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 12007 | 12007 | { |
| 12008 | 12008 | if (is_numeric(substr($row['ident'], -1, 1))) |
| 12009 | 12009 | { |
@@ -12012,11 +12012,11 @@ discard block |
||
| 12012 | 12012 | elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
| 12013 | 12013 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
| 12014 | 12014 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
| 12015 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
|
| 12015 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource); |
|
| 12016 | 12016 | if (isset($airline_array[0]['name'])) { |
| 12017 | - $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"; |
|
| 12017 | + $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"; |
|
| 12018 | 12018 | $sthu = $this->db->prepare($update_query); |
| 12019 | - $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'])); |
|
| 12019 | + $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'])); |
|
| 12020 | 12020 | } |
| 12021 | 12021 | } |
| 12022 | 12022 | } |
@@ -12036,18 +12036,18 @@ discard block |
||
| 12036 | 12036 | } |
| 12037 | 12037 | $sth = $this->db->prepare($query); |
| 12038 | 12038 | $sth->execute(); |
| 12039 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 12039 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 12040 | 12040 | { |
| 12041 | 12041 | if ($row['aircraft_icao'] != '') { |
| 12042 | 12042 | $aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']); |
| 12043 | - if ($row['registration'] != ""){ |
|
| 12043 | + if ($row['registration'] != "") { |
|
| 12044 | 12044 | $image_array = $Image->getSpotterImage($row['registration']); |
| 12045 | 12045 | if (!isset($image_array[0]['registration'])) { |
| 12046 | 12046 | $Image->addSpotterImage($row['registration']); |
| 12047 | 12047 | } |
| 12048 | 12048 | } |
| 12049 | 12049 | if (count($aircraft_name) > 0) { |
| 12050 | - $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"; |
|
| 12050 | + $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"; |
|
| 12051 | 12051 | $sthu = $this->db->prepare($update_query); |
| 12052 | 12052 | $sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id'])); |
| 12053 | 12053 | } |
@@ -12062,10 +12062,10 @@ discard block |
||
| 12062 | 12062 | $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"; |
| 12063 | 12063 | $sth = $this->db->prepare($query); |
| 12064 | 12064 | $sth->execute(); |
| 12065 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 12065 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 12066 | 12066 | { |
| 12067 | 12067 | if ($row['last_latitude'] != '' && $row['last_longitude'] != '') { |
| 12068 | - $closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist); |
|
| 12068 | + $closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist); |
|
| 12069 | 12069 | $airport_icao = ''; |
| 12070 | 12070 | if (isset($closestAirports[0])) { |
| 12071 | 12071 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
@@ -12079,7 +12079,7 @@ discard block |
||
| 12079 | 12079 | break; |
| 12080 | 12080 | } |
| 12081 | 12081 | } |
| 12082 | - } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
|
| 12082 | + } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) { |
|
| 12083 | 12083 | $airport_icao = $closestAirports[0]['icao']; |
| 12084 | 12084 | if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
| 12085 | 12085 | } else { |
@@ -12090,28 +12090,28 @@ discard block |
||
| 12090 | 12090 | } |
| 12091 | 12091 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
| 12092 | 12092 | if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
| 12093 | - $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
|
| 12093 | + $update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
|
| 12094 | 12094 | $sthu = $this->db->prepare($update_query); |
| 12095 | - $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
|
| 12095 | + $sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id'])); |
|
| 12096 | 12096 | } |
| 12097 | 12097 | } |
| 12098 | 12098 | } |
| 12099 | 12099 | } |
| 12100 | 12100 | |
| 12101 | - public function closestAirports($origLat,$origLon,$dist = 10) { |
|
| 12101 | + public function closestAirports($origLat, $origLon, $dist = 10) { |
|
| 12102 | 12102 | global $globalDBdriver; |
| 12103 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
| 12103 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
| 12104 | 12104 | /* |
| 12105 | 12105 | $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 |
| 12106 | 12106 | 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)) |
| 12107 | 12107 | having distance < $dist ORDER BY distance limit 100;"; |
| 12108 | 12108 | */ |
| 12109 | 12109 | if ($globalDBdriver == 'mysql') { |
| 12110 | - $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 |
|
| 12110 | + $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 |
|
| 12111 | 12111 | 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)) |
| 12112 | 12112 | 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;"; |
| 12113 | 12113 | } else { |
| 12114 | - $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 |
|
| 12114 | + $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 |
|
| 12115 | 12115 | 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)) |
| 12116 | 12116 | 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;"; |
| 12117 | 12117 | } |
@@ -72,7 +72,9 @@ discard block |
||
| 72 | 72 | if (isset($filter[0]['source'])) { |
| 73 | 73 | $filters = array_merge($filters,$filter); |
| 74 | 74 | } |
| 75 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 75 | + if (is_array($globalFilter)) { |
|
| 76 | + $filter = array_merge($filter,$globalFilter); |
|
| 77 | + } |
|
| 76 | 78 | $filter_query_join = ''; |
| 77 | 79 | $filter_query_where = ''; |
| 78 | 80 | foreach($filters as $flt) { |
@@ -156,8 +158,11 @@ discard block |
||
| 156 | 158 | $filter_query_where .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'"; |
| 157 | 159 | } |
| 158 | 160 | } |
| 159 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 160 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 161 | + if ($filter_query_where == '' && $where) { |
|
| 162 | + $filter_query_where = ' WHERE'; |
|
| 163 | + } elseif ($filter_query_where != '' && $and) { |
|
| 164 | + $filter_query_where .= ' AND'; |
|
| 165 | + } |
|
| 161 | 166 | if ($filter_query_where != '') { |
| 162 | 167 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 163 | 168 | } |
@@ -180,10 +185,18 @@ discard block |
||
| 180 | 185 | $Image = new Image($this->db); |
| 181 | 186 | $Schedule = new Schedule($this->db); |
| 182 | 187 | $ACARS = new ACARS($this->db); |
| 183 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 184 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 185 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 186 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 188 | + if (!isset($globalIVAO)) { |
|
| 189 | + $globalIVAO = FALSE; |
|
| 190 | + } |
|
| 191 | + if (!isset($globalVATSIM)) { |
|
| 192 | + $globalVATSIM = FALSE; |
|
| 193 | + } |
|
| 194 | + if (!isset($globalphpVMS)) { |
|
| 195 | + $globalphpVMS = FALSE; |
|
| 196 | + } |
|
| 197 | + if (!isset($globalVAM)) { |
|
| 198 | + $globalVAM = FALSE; |
|
| 199 | + } |
|
| 187 | 200 | date_default_timezone_set('UTC'); |
| 188 | 201 | |
| 189 | 202 | if (!is_string($query)) |
@@ -230,21 +243,35 @@ discard block |
||
| 230 | 243 | } else { |
| 231 | 244 | $temp_array['spotter_id'] = ''; |
| 232 | 245 | } |
| 233 | - if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 234 | - if (isset($row['modes'])) $temp_array['modes'] = $row['modes']; |
|
| 246 | + if (isset($row['flightaware_id'])) { |
|
| 247 | + $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 248 | + } |
|
| 249 | + if (isset($row['modes'])) { |
|
| 250 | + $temp_array['modes'] = $row['modes']; |
|
| 251 | + } |
|
| 235 | 252 | $temp_array['ident'] = $row['ident']; |
| 236 | 253 | if (isset($row['registration']) && $row['registration'] != '') { |
| 237 | 254 | $temp_array['registration'] = $row['registration']; |
| 238 | 255 | } elseif (isset($temp_array['modes'])) { |
| 239 | 256 | $temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']); |
| 240 | - } else $temp_array['registration'] = ''; |
|
| 241 | - if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 257 | + } else { |
|
| 258 | + $temp_array['registration'] = ''; |
|
| 259 | + } |
|
| 260 | + if (isset($row['aircraft_icao'])) { |
|
| 261 | + $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 262 | + } |
|
| 242 | 263 | |
| 243 | 264 | $temp_array['departure_airport'] = $row['departure_airport_icao']; |
| 244 | 265 | $temp_array['arrival_airport'] = $row['arrival_airport_icao']; |
| 245 | - if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 246 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
| 247 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
| 266 | + if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) { |
|
| 267 | + $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 268 | + } |
|
| 269 | + if (isset($row['latitude'])) { |
|
| 270 | + $temp_array['latitude'] = $row['latitude']; |
|
| 271 | + } |
|
| 272 | + if (isset($row['longitude'])) { |
|
| 273 | + $temp_array['longitude'] = $row['longitude']; |
|
| 274 | + } |
|
| 248 | 275 | /* |
| 249 | 276 | if (Connection->tableExists('countries')) { |
| 250 | 277 | $country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']); |
@@ -254,8 +281,12 @@ discard block |
||
| 254 | 281 | } |
| 255 | 282 | } |
| 256 | 283 | */ |
| 257 | - if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints']; |
|
| 258 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
| 284 | + if (isset($row['waypoints'])) { |
|
| 285 | + $temp_array['waypoints'] = $row['waypoints']; |
|
| 286 | + } |
|
| 287 | + if (isset($row['format_source'])) { |
|
| 288 | + $temp_array['format_source'] = $row['format_source']; |
|
| 289 | + } |
|
| 259 | 290 | if (isset($row['route_stop']) && $row['route_stop'] != '') { |
| 260 | 291 | $temp_array['route_stop'] = $row['route_stop']; |
| 261 | 292 | $allroute = explode(' ',$row['route_stop']); |
@@ -271,13 +302,19 @@ discard block |
||
| 271 | 302 | } |
| 272 | 303 | } |
| 273 | 304 | } |
| 274 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
| 305 | + if (isset($row['altitude'])) { |
|
| 306 | + $temp_array['altitude'] = $row['altitude']; |
|
| 307 | + } |
|
| 275 | 308 | if (isset($row['heading'])) { |
| 276 | 309 | $temp_array['heading'] = $row['heading']; |
| 277 | 310 | $heading_direction = $this->parseDirection($row['heading']); |
| 278 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 311 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
| 312 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 313 | + } |
|
| 314 | + } |
|
| 315 | + if (isset($row['ground_speed'])) { |
|
| 316 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 279 | 317 | } |
| 280 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 281 | 318 | $temp_array['image'] = ""; |
| 282 | 319 | $temp_array['image_thumbnail'] = ""; |
| 283 | 320 | $temp_array['image_source'] = ""; |
@@ -285,7 +322,9 @@ discard block |
||
| 285 | 322 | |
| 286 | 323 | if (isset($row['highlight'])) { |
| 287 | 324 | $temp_array['highlight'] = $row['highlight']; |
| 288 | - } else $temp_array['highlight'] = ''; |
|
| 325 | + } else { |
|
| 326 | + $temp_array['highlight'] = ''; |
|
| 327 | + } |
|
| 289 | 328 | |
| 290 | 329 | if (isset($row['date'])) { |
| 291 | 330 | $dateArray = $this->parseDateString($row['date']); |
@@ -341,7 +380,9 @@ discard block |
||
| 341 | 380 | |
| 342 | 381 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
| 343 | 382 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
| 344 | - } else $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 383 | + } else { |
|
| 384 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 385 | + } |
|
| 345 | 386 | } else { |
| 346 | 387 | $temp_array['aircraft_shadow'] = 'default.png'; |
| 347 | 388 | $temp_array['aircraft_name'] = 'N/A'; |
@@ -349,11 +390,17 @@ discard block |
||
| 349 | 390 | } |
| 350 | 391 | } |
| 351 | 392 | $fromsource = NULL; |
| 352 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 353 | - elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 354 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 355 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 356 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 393 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 394 | + $fromsource = $globalAirlinesSource; |
|
| 395 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 396 | + $fromsource = 'vatsim'; |
|
| 397 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 398 | + $fromsource = 'ivao'; |
|
| 399 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 400 | + $fromsource = 'vatsim'; |
|
| 401 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 402 | + $fromsource = 'ivao'; |
|
| 403 | + } |
|
| 357 | 404 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
| 358 | 405 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
| 359 | 406 | if (is_numeric(substr($row['ident'], 2, 1))) { |
@@ -376,12 +423,18 @@ discard block |
||
| 376 | 423 | } |
| 377 | 424 | } else { |
| 378 | 425 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 379 | - if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 380 | - else $temp_array['airline_iata'] = 'N/A'; |
|
| 426 | + if (isset($row['airline_iata'])) { |
|
| 427 | + $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 428 | + } else { |
|
| 429 | + $temp_array['airline_iata'] = 'N/A'; |
|
| 430 | + } |
|
| 381 | 431 | $temp_array['airline_name'] = $row['airline_name']; |
| 382 | 432 | $temp_array['airline_country'] = $row['airline_country']; |
| 383 | - if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 384 | - else $temp_array['airline_callsign'] = 'N/A'; |
|
| 433 | + if (isset($row['airline_callsign'])) { |
|
| 434 | + $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 435 | + } else { |
|
| 436 | + $temp_array['airline_callsign'] = 'N/A'; |
|
| 437 | + } |
|
| 385 | 438 | $temp_array['airline_type'] = $row['airline_type']; |
| 386 | 439 | if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') { |
| 387 | 440 | $airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']); |
@@ -408,7 +461,9 @@ discard block |
||
| 408 | 461 | } |
| 409 | 462 | if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) { |
| 410 | 463 | $owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']); |
| 411 | - if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 464 | + if ($owner_info['owner'] != '') { |
|
| 465 | + $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 466 | + } |
|
| 412 | 467 | $temp_array['aircraft_base'] = $owner_info['base']; |
| 413 | 468 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
| 414 | 469 | } |
@@ -416,9 +471,14 @@ discard block |
||
| 416 | 471 | if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
| 417 | 472 | { |
| 418 | 473 | if ($globalIVAO) { |
| 419 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 420 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 421 | - } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 474 | + if (isset($temp_array['airline_icao'])) { |
|
| 475 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 476 | + } else { |
|
| 477 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 478 | + } |
|
| 479 | + } else { |
|
| 480 | + $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 481 | + } |
|
| 422 | 482 | if (count($image_array) > 0) { |
| 423 | 483 | $temp_array['image'] = $image_array[0]['image']; |
| 424 | 484 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -470,7 +530,9 @@ discard block |
||
| 470 | 530 | //if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') { |
| 471 | 531 | if ($row['departure_airport_icao'] != '') { |
| 472 | 532 | $departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']); |
| 473 | - if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 533 | + if (!isset($departure_airport_array[0]['name'])) { |
|
| 534 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 535 | + } |
|
| 474 | 536 | /* |
| 475 | 537 | } elseif ($row['departure_airport_name'] != '') { |
| 476 | 538 | $temp_array['departure_airport_name'] = $row['departure_airport_name']; |
@@ -478,7 +540,9 @@ discard block |
||
| 478 | 540 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 479 | 541 | $temp_array['departure_airport_icao'] = $row['departure_airport_icao']; |
| 480 | 542 | */ |
| 481 | - } else $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 543 | + } else { |
|
| 544 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 545 | + } |
|
| 482 | 546 | if (isset($departure_airport_array[0]['name'])) { |
| 483 | 547 | $temp_array['departure_airport_name'] = $departure_airport_array[0]['name']; |
| 484 | 548 | $temp_array['departure_airport_city'] = $departure_airport_array[0]['city']; |
@@ -498,8 +562,12 @@ discard block |
||
| 498 | 562 | |
| 499 | 563 | if ($row['arrival_airport_icao'] != '') { |
| 500 | 564 | $arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']); |
| 501 | - if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 502 | - } else $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 565 | + if (count($arrival_airport_array) == 0) { |
|
| 566 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 567 | + } |
|
| 568 | + } else { |
|
| 569 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 570 | + } |
|
| 503 | 571 | if (isset($arrival_airport_array[0]['name'])) { |
| 504 | 572 | $temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name']; |
| 505 | 573 | $temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city']; |
@@ -515,27 +583,45 @@ discard block |
||
| 515 | 583 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
| 516 | 584 | } |
| 517 | 585 | */ |
| 518 | - if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 519 | - if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 520 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
| 521 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
| 522 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
| 586 | + if (isset($row['pilot_id']) && $row['pilot_id'] != '') { |
|
| 587 | + $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 588 | + } |
|
| 589 | + if (isset($row['pilot_name']) && $row['pilot_name'] != '') { |
|
| 590 | + $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 591 | + } |
|
| 592 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
| 593 | + $temp_array['source_name'] = $row['source_name']; |
|
| 594 | + } |
|
| 595 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
| 596 | + $temp_array['over_country'] = $row['over_country']; |
|
| 597 | + } |
|
| 598 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
| 599 | + $temp_array['distance'] = $row['distance']; |
|
| 600 | + } |
|
| 523 | 601 | if (isset($row['squawk'])) { |
| 524 | 602 | $temp_array['squawk'] = $row['squawk']; |
| 525 | 603 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
| 526 | 604 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
| 527 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 605 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 606 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 607 | + } |
|
| 528 | 608 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
| 529 | 609 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
| 530 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 531 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 610 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 611 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 612 | + } |
|
| 613 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) { |
|
| 614 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 615 | + } |
|
| 532 | 616 | } |
| 533 | 617 | |
| 534 | 618 | $temp_array['query_number_rows'] = $num_rows; |
| 535 | 619 | |
| 536 | 620 | $spotter_array[] = $temp_array; |
| 537 | 621 | } |
| 538 | - if ($num_rows == 0) return array(); |
|
| 622 | + if ($num_rows == 0) { |
|
| 623 | + return array(); |
|
| 624 | + } |
|
| 539 | 625 | $spotter_array[0]['query_number_rows'] = $num_rows; |
| 540 | 626 | return $spotter_array; |
| 541 | 627 | } |
@@ -568,7 +654,9 @@ discard block |
||
| 568 | 654 | foreach ($q_array as $q_item){ |
| 569 | 655 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
| 570 | 656 | $additional_query .= " AND ("; |
| 571 | - if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 657 | + if (is_int($q_item)) { |
|
| 658 | + $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 659 | + } |
|
| 572 | 660 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
| 573 | 661 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
| 574 | 662 | $additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
@@ -589,7 +677,9 @@ discard block |
||
| 589 | 677 | $additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR "; |
| 590 | 678 | $additional_query .= "(spotter_output.ident like '%".$q_item."%') OR "; |
| 591 | 679 | $translate = $Translation->ident2icao($q_item); |
| 592 | - if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 680 | + if ($translate != $q_item) { |
|
| 681 | + $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 682 | + } |
|
| 593 | 683 | $additional_query .= "(spotter_output.highlight like '%".$q_item."%')"; |
| 594 | 684 | $additional_query .= ")"; |
| 595 | 685 | } |
@@ -816,7 +906,9 @@ discard block |
||
| 816 | 906 | date_default_timezone_set($globalTimezone); |
| 817 | 907 | $datetime = new DateTime(); |
| 818 | 908 | $offset = $datetime->format('P'); |
| 819 | - } else $offset = '+00:00'; |
|
| 909 | + } else { |
|
| 910 | + $offset = '+00:00'; |
|
| 911 | + } |
|
| 820 | 912 | |
| 821 | 913 | if ($date_array[1] != "") |
| 822 | 914 | { |
@@ -848,8 +940,12 @@ discard block |
||
| 848 | 940 | { |
| 849 | 941 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 850 | 942 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 851 | - } else $limit_query = ""; |
|
| 852 | - } else $limit_query = ""; |
|
| 943 | + } else { |
|
| 944 | + $limit_query = ""; |
|
| 945 | + } |
|
| 946 | + } else { |
|
| 947 | + $limit_query = ""; |
|
| 948 | + } |
|
| 853 | 949 | |
| 854 | 950 | |
| 855 | 951 | if ($sort != "") |
@@ -917,8 +1013,12 @@ discard block |
||
| 917 | 1013 | { |
| 918 | 1014 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 919 | 1015 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 920 | - } else $limit_query = ""; |
|
| 921 | - } else $limit_query = ""; |
|
| 1016 | + } else { |
|
| 1017 | + $limit_query = ""; |
|
| 1018 | + } |
|
| 1019 | + } else { |
|
| 1020 | + $limit_query = ""; |
|
| 1021 | + } |
|
| 922 | 1022 | |
| 923 | 1023 | if ($sort != "") |
| 924 | 1024 | { |
@@ -1242,7 +1342,9 @@ discard block |
||
| 1242 | 1342 | global $global_query; |
| 1243 | 1343 | |
| 1244 | 1344 | date_default_timezone_set('UTC'); |
| 1245 | - if ($id == '') return array(); |
|
| 1345 | + if ($id == '') { |
|
| 1346 | + return array(); |
|
| 1347 | + } |
|
| 1246 | 1348 | $additional_query = "spotter_output.spotter_id = :id"; |
| 1247 | 1349 | $query_values = array(':id' => $id); |
| 1248 | 1350 | |
@@ -1357,8 +1459,11 @@ discard block |
||
| 1357 | 1459 | if ($sort != "") |
| 1358 | 1460 | { |
| 1359 | 1461 | $search_orderby_array = $this->getOrderBy(); |
| 1360 | - if (isset($search_orderby_array[$sort]['sql'])) $orderby_query = $search_orderby_array[$sort]['sql']; |
|
| 1361 | - else $orderby_query = " ORDER BY spotter_output.date DESC"; |
|
| 1462 | + if (isset($search_orderby_array[$sort]['sql'])) { |
|
| 1463 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
| 1464 | + } else { |
|
| 1465 | + $orderby_query = " ORDER BY spotter_output.date DESC"; |
|
| 1466 | + } |
|
| 1362 | 1467 | } else { |
| 1363 | 1468 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 1364 | 1469 | } |
@@ -1983,7 +2088,9 @@ discard block |
||
| 1983 | 2088 | { |
| 1984 | 2089 | $highlight = $row['highlight']; |
| 1985 | 2090 | } |
| 1986 | - if (isset($highlight)) return $highlight; |
|
| 2091 | + if (isset($highlight)) { |
|
| 2092 | + return $highlight; |
|
| 2093 | + } |
|
| 1987 | 2094 | } |
| 1988 | 2095 | |
| 1989 | 2096 | |
@@ -2011,7 +2118,9 @@ discard block |
||
| 2011 | 2118 | $sth->closeCursor(); |
| 2012 | 2119 | if (count($row) > 0) { |
| 2013 | 2120 | return $row['usage']; |
| 2014 | - } else return ''; |
|
| 2121 | + } else { |
|
| 2122 | + return ''; |
|
| 2123 | + } |
|
| 2015 | 2124 | } |
| 2016 | 2125 | |
| 2017 | 2126 | /** |
@@ -2036,7 +2145,9 @@ discard block |
||
| 2036 | 2145 | $sth->closeCursor(); |
| 2037 | 2146 | if (count($row) > 0) { |
| 2038 | 2147 | return $row['icao']; |
| 2039 | - } else return ''; |
|
| 2148 | + } else { |
|
| 2149 | + return ''; |
|
| 2150 | + } |
|
| 2040 | 2151 | } |
| 2041 | 2152 | |
| 2042 | 2153 | /** |
@@ -2064,7 +2175,9 @@ discard block |
||
| 2064 | 2175 | $airport_longitude = $row['longitude']; |
| 2065 | 2176 | $Common = new Common(); |
| 2066 | 2177 | return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
| 2067 | - } else return ''; |
|
| 2178 | + } else { |
|
| 2179 | + return ''; |
|
| 2180 | + } |
|
| 2068 | 2181 | } |
| 2069 | 2182 | |
| 2070 | 2183 | /** |
@@ -2176,7 +2289,9 @@ discard block |
||
| 2176 | 2289 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2177 | 2290 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2178 | 2291 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2179 | - } else return array(); |
|
| 2292 | + } else { |
|
| 2293 | + return array(); |
|
| 2294 | + } |
|
| 2180 | 2295 | if ($globalDBdriver == 'mysql') { |
| 2181 | 2296 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
| 2182 | 2297 | } else { |
@@ -2211,7 +2326,9 @@ discard block |
||
| 2211 | 2326 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2212 | 2327 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2213 | 2328 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2214 | - } else return array(); |
|
| 2329 | + } else { |
|
| 2330 | + return array(); |
|
| 2331 | + } |
|
| 2215 | 2332 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
| 2216 | 2333 | $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
| 2217 | 2334 | //$query = "SELECT waypoints.* FROM waypoints"; |
@@ -2246,7 +2363,9 @@ discard block |
||
| 2246 | 2363 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
| 2247 | 2364 | { |
| 2248 | 2365 | global $globalUseRealAirlines; |
| 2249 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2366 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2367 | + $fromsource = NULL; |
|
| 2368 | + } |
|
| 2250 | 2369 | $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
| 2251 | 2370 | if ($airline_icao == 'NA') { |
| 2252 | 2371 | $airline_array = array(); |
@@ -2315,7 +2434,9 @@ discard block |
||
| 2315 | 2434 | public function getAllAirlineInfoByName($airline_name, $fromsource = NULL) |
| 2316 | 2435 | { |
| 2317 | 2436 | global $globalUseRealAirlines; |
| 2318 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2437 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2438 | + $fromsource = NULL; |
|
| 2439 | + } |
|
| 2319 | 2440 | $airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING)); |
| 2320 | 2441 | $query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1"; |
| 2321 | 2442 | $sth = $this->db->prepare($query); |
@@ -2331,7 +2452,9 @@ discard block |
||
| 2331 | 2452 | $sth->execute(array(':fromsource' => $fromsource)); |
| 2332 | 2453 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2333 | 2454 | $sth->closeCursor(); |
| 2334 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name); |
|
| 2455 | + if ($row['nb'] == 0) { |
|
| 2456 | + $result = $this->getAllAirlineInfoByName($airline_name); |
|
| 2457 | + } |
|
| 2335 | 2458 | } |
| 2336 | 2459 | return $result; |
| 2337 | 2460 | } |
@@ -2394,15 +2517,20 @@ discard block |
||
| 2394 | 2517 | 'A320-211' => 'A320', |
| 2395 | 2518 | '747-8i' => 'B748', |
| 2396 | 2519 | 'A380' => 'A388'); |
| 2397 | - if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
|
| 2520 | + if (isset($all_aircraft[$aircraft_type])) { |
|
| 2521 | + return $all_aircraft[$aircraft_type]; |
|
| 2522 | + } |
|
| 2398 | 2523 | |
| 2399 | 2524 | $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
| 2400 | 2525 | $aircraft_type = strtoupper($aircraft_type); |
| 2401 | 2526 | $sth = $this->db->prepare($query); |
| 2402 | 2527 | $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
| 2403 | 2528 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2404 | - if (isset($result[0]['icao'])) return $result[0]['icao']; |
|
| 2405 | - else return ''; |
|
| 2529 | + if (isset($result[0]['icao'])) { |
|
| 2530 | + return $result[0]['icao']; |
|
| 2531 | + } else { |
|
| 2532 | + return ''; |
|
| 2533 | + } |
|
| 2406 | 2534 | } |
| 2407 | 2535 | |
| 2408 | 2536 | /** |
@@ -2430,11 +2558,15 @@ discard block |
||
| 2430 | 2558 | $sth->closeCursor(); |
| 2431 | 2559 | if (isset($row['icaotypecode'])) { |
| 2432 | 2560 | $icao = $row['icaotypecode']; |
| 2433 | - if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao]; |
|
| 2561 | + if (isset($this->aircraft_correct_icaotype[$icao])) { |
|
| 2562 | + $icao = $this->aircraft_correct_icaotype[$icao]; |
|
| 2563 | + } |
|
| 2434 | 2564 | return $icao; |
| 2435 | 2565 | } elseif ($source_type == 'flarm') { |
| 2436 | 2566 | return $this->getAllAircraftType($aircraft_modes); |
| 2437 | - } else return ''; |
|
| 2567 | + } else { |
|
| 2568 | + return ''; |
|
| 2569 | + } |
|
| 2438 | 2570 | } |
| 2439 | 2571 | |
| 2440 | 2572 | /** |
@@ -2457,7 +2589,9 @@ discard block |
||
| 2457 | 2589 | $sth->closeCursor(); |
| 2458 | 2590 | if (isset($row['icaotypecode'])) { |
| 2459 | 2591 | return $row['icaotypecode']; |
| 2460 | - } else return ''; |
|
| 2592 | + } else { |
|
| 2593 | + return ''; |
|
| 2594 | + } |
|
| 2461 | 2595 | } |
| 2462 | 2596 | |
| 2463 | 2597 | /** |
@@ -2503,7 +2637,9 @@ discard block |
||
| 2503 | 2637 | $sth->closeCursor(); |
| 2504 | 2638 | if (isset($row['operator_correct'])) { |
| 2505 | 2639 | return $row['operator_correct']; |
| 2506 | - } else return $operator; |
|
| 2640 | + } else { |
|
| 2641 | + return $operator; |
|
| 2642 | + } |
|
| 2507 | 2643 | } |
| 2508 | 2644 | |
| 2509 | 2645 | /** |
@@ -2516,7 +2652,9 @@ discard block |
||
| 2516 | 2652 | public function getRouteInfo($callsign) |
| 2517 | 2653 | { |
| 2518 | 2654 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
| 2519 | - if ($callsign == '') return array(); |
|
| 2655 | + if ($callsign == '') { |
|
| 2656 | + return array(); |
|
| 2657 | + } |
|
| 2520 | 2658 | $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
| 2521 | 2659 | |
| 2522 | 2660 | $sth = $this->db->prepare($query); |
@@ -2526,7 +2664,9 @@ discard block |
||
| 2526 | 2664 | $sth->closeCursor(); |
| 2527 | 2665 | if (count($row) > 0) { |
| 2528 | 2666 | return $row; |
| 2529 | - } else return array(); |
|
| 2667 | + } else { |
|
| 2668 | + return array(); |
|
| 2669 | + } |
|
| 2530 | 2670 | } |
| 2531 | 2671 | |
| 2532 | 2672 | /** |
@@ -2579,7 +2719,9 @@ discard block |
||
| 2579 | 2719 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 2580 | 2720 | $sth->closeCursor(); |
| 2581 | 2721 | return $result; |
| 2582 | - } else return array(); |
|
| 2722 | + } else { |
|
| 2723 | + return array(); |
|
| 2724 | + } |
|
| 2583 | 2725 | } |
| 2584 | 2726 | |
| 2585 | 2727 | |
@@ -2738,8 +2880,11 @@ discard block |
||
| 2738 | 2880 | $query .= " ORDER BY spotter_output.source_name ASC"; |
| 2739 | 2881 | |
| 2740 | 2882 | $sth = $this->db->prepare($query); |
| 2741 | - if (!empty($query_values)) $sth->execute($query_values); |
|
| 2742 | - else $sth->execute(); |
|
| 2883 | + if (!empty($query_values)) { |
|
| 2884 | + $sth->execute($query_values); |
|
| 2885 | + } else { |
|
| 2886 | + $sth->execute(); |
|
| 2887 | + } |
|
| 2743 | 2888 | |
| 2744 | 2889 | $source_array = array(); |
| 2745 | 2890 | $temp_array = array(); |
@@ -2772,9 +2917,13 @@ discard block |
||
| 2772 | 2917 | WHERE spotter_output.airline_icao <> '' |
| 2773 | 2918 | ORDER BY spotter_output.airline_name ASC"; |
| 2774 | 2919 | */ |
| 2775 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2776 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2777 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2920 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2921 | + $forsource = $globalAirlinesSource; |
|
| 2922 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2923 | + $forsource = 'vatsim'; |
|
| 2924 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2925 | + $forsource = 'ivao'; |
|
| 2926 | + } |
|
| 2778 | 2927 | if ($forsource === NULL) { |
| 2779 | 2928 | $query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC"; |
| 2780 | 2929 | $query_data = array(); |
@@ -2817,9 +2966,13 @@ discard block |
||
| 2817 | 2966 | { |
| 2818 | 2967 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
| 2819 | 2968 | $filter_query = $this->getFilter($filters,true,true); |
| 2820 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2821 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2822 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2969 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2970 | + $forsource = $globalAirlinesSource; |
|
| 2971 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2972 | + $forsource = 'vatsim'; |
|
| 2973 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2974 | + $forsource = 'ivao'; |
|
| 2975 | + } |
|
| 2823 | 2976 | if ($forsource === NULL) { |
| 2824 | 2977 | $query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC"; |
| 2825 | 2978 | $query_data = array(); |
@@ -3130,7 +3283,9 @@ discard block |
||
| 3130 | 3283 | date_default_timezone_set($globalTimezone); |
| 3131 | 3284 | $datetime = new DateTime(); |
| 3132 | 3285 | $offset = $datetime->format('P'); |
| 3133 | - } else $offset = '+00:00'; |
|
| 3286 | + } else { |
|
| 3287 | + $offset = '+00:00'; |
|
| 3288 | + } |
|
| 3134 | 3289 | if ($airport_icao == '') { |
| 3135 | 3290 | if ($globalDBdriver == 'mysql') { |
| 3136 | 3291 | $query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -3162,7 +3317,9 @@ discard block |
||
| 3162 | 3317 | date_default_timezone_set($globalTimezone); |
| 3163 | 3318 | $datetime = new DateTime(); |
| 3164 | 3319 | $offset = $datetime->format('P'); |
| 3165 | - } else $offset = '+00:00'; |
|
| 3320 | + } else { |
|
| 3321 | + $offset = '+00:00'; |
|
| 3322 | + } |
|
| 3166 | 3323 | if ($airport_icao == '') { |
| 3167 | 3324 | if ($globalDBdriver == 'mysql') { |
| 3168 | 3325 | $query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -3195,7 +3352,9 @@ discard block |
||
| 3195 | 3352 | date_default_timezone_set($globalTimezone); |
| 3196 | 3353 | $datetime = new DateTime(); |
| 3197 | 3354 | $offset = $datetime->format('P'); |
| 3198 | - } else $offset = '+00:00'; |
|
| 3355 | + } else { |
|
| 3356 | + $offset = '+00:00'; |
|
| 3357 | + } |
|
| 3199 | 3358 | if ($airport_icao == '') { |
| 3200 | 3359 | if ($globalDBdriver == 'mysql') { |
| 3201 | 3360 | $query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3234,7 +3393,9 @@ discard block |
||
| 3234 | 3393 | date_default_timezone_set($globalTimezone); |
| 3235 | 3394 | $datetime = new DateTime(); |
| 3236 | 3395 | $offset = $datetime->format('P'); |
| 3237 | - } else $offset = '+00:00'; |
|
| 3396 | + } else { |
|
| 3397 | + $offset = '+00:00'; |
|
| 3398 | + } |
|
| 3238 | 3399 | if ($airport_icao == '') { |
| 3239 | 3400 | if ($globalDBdriver == 'mysql') { |
| 3240 | 3401 | $query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3279,7 +3440,9 @@ discard block |
||
| 3279 | 3440 | date_default_timezone_set($globalTimezone); |
| 3280 | 3441 | $datetime = new DateTime(); |
| 3281 | 3442 | $offset = $datetime->format('P'); |
| 3282 | - } else $offset = '+00:00'; |
|
| 3443 | + } else { |
|
| 3444 | + $offset = '+00:00'; |
|
| 3445 | + } |
|
| 3283 | 3446 | if ($airport_icao == '') { |
| 3284 | 3447 | if ($globalDBdriver == 'mysql') { |
| 3285 | 3448 | $query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -3314,7 +3477,9 @@ discard block |
||
| 3314 | 3477 | date_default_timezone_set($globalTimezone); |
| 3315 | 3478 | $datetime = new DateTime(); |
| 3316 | 3479 | $offset = $datetime->format('P'); |
| 3317 | - } else $offset = '+00:00'; |
|
| 3480 | + } else { |
|
| 3481 | + $offset = '+00:00'; |
|
| 3482 | + } |
|
| 3318 | 3483 | if ($airport_icao == '') { |
| 3319 | 3484 | if ($globalDBdriver == 'mysql') { |
| 3320 | 3485 | $query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3356,7 +3521,9 @@ discard block |
||
| 3356 | 3521 | date_default_timezone_set($globalTimezone); |
| 3357 | 3522 | $datetime = new DateTime(); |
| 3358 | 3523 | $offset = $datetime->format('P'); |
| 3359 | - } else $offset = '+00:00'; |
|
| 3524 | + } else { |
|
| 3525 | + $offset = '+00:00'; |
|
| 3526 | + } |
|
| 3360 | 3527 | if ($airport_icao == '') { |
| 3361 | 3528 | if ($globalDBdriver == 'mysql') { |
| 3362 | 3529 | $query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -3390,7 +3557,9 @@ discard block |
||
| 3390 | 3557 | date_default_timezone_set($globalTimezone); |
| 3391 | 3558 | $datetime = new DateTime(); |
| 3392 | 3559 | $offset = $datetime->format('P'); |
| 3393 | - } else $offset = '+00:00'; |
|
| 3560 | + } else { |
|
| 3561 | + $offset = '+00:00'; |
|
| 3562 | + } |
|
| 3394 | 3563 | if ($airport_icao == '') { |
| 3395 | 3564 | if ($globalDBdriver == 'mysql') { |
| 3396 | 3565 | $query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3438,7 +3607,9 @@ discard block |
||
| 3438 | 3607 | date_default_timezone_set($globalTimezone); |
| 3439 | 3608 | $datetime = new DateTime(); |
| 3440 | 3609 | $offset = $datetime->format('P'); |
| 3441 | - } else $offset = '+00:00'; |
|
| 3610 | + } else { |
|
| 3611 | + $offset = '+00:00'; |
|
| 3612 | + } |
|
| 3442 | 3613 | |
| 3443 | 3614 | if ($globalDBdriver == 'mysql') { |
| 3444 | 3615 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
@@ -3558,7 +3729,9 @@ discard block |
||
| 3558 | 3729 | */ |
| 3559 | 3730 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
| 3560 | 3731 | { |
| 3561 | - if ($groundspeed == '') $groundspeed = NULL; |
|
| 3732 | + if ($groundspeed == '') { |
|
| 3733 | + $groundspeed = NULL; |
|
| 3734 | + } |
|
| 3562 | 3735 | $query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id'; |
| 3563 | 3736 | $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
| 3564 | 3737 | |
@@ -3608,10 +3781,18 @@ discard block |
||
| 3608 | 3781 | $Image = new Image($this->db); |
| 3609 | 3782 | $Common = new Common(); |
| 3610 | 3783 | |
| 3611 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 3612 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 3613 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 3614 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 3784 | + if (!isset($globalIVAO)) { |
|
| 3785 | + $globalIVAO = FALSE; |
|
| 3786 | + } |
|
| 3787 | + if (!isset($globalVATSIM)) { |
|
| 3788 | + $globalVATSIM = FALSE; |
|
| 3789 | + } |
|
| 3790 | + if (!isset($globalphpVMS)) { |
|
| 3791 | + $globalphpVMS = FALSE; |
|
| 3792 | + } |
|
| 3793 | + if (!isset($globalVAM)) { |
|
| 3794 | + $globalVAM = FALSE; |
|
| 3795 | + } |
|
| 3615 | 3796 | date_default_timezone_set('UTC'); |
| 3616 | 3797 | |
| 3617 | 3798 | //getting the registration |
@@ -3624,23 +3805,33 @@ discard block |
||
| 3624 | 3805 | if ($ModeS != '') { |
| 3625 | 3806 | $timeelapsed = microtime(true); |
| 3626 | 3807 | $registration = $this->getAircraftRegistrationBymodeS($ModeS,$source_type); |
| 3627 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3808 | + if ($globalDebugTimeElapsed) { |
|
| 3809 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3810 | + } |
|
| 3628 | 3811 | } else { |
| 3629 | 3812 | $myhex = explode('-',$flightaware_id); |
| 3630 | 3813 | if (count($myhex) > 0) { |
| 3631 | 3814 | $timeelapsed = microtime(true); |
| 3632 | 3815 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0],$source_type); |
| 3633 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3816 | + if ($globalDebugTimeElapsed) { |
|
| 3817 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3818 | + } |
|
| 3634 | 3819 | } |
| 3635 | 3820 | } |
| 3636 | 3821 | } |
| 3637 | 3822 | } |
| 3638 | 3823 | $fromsource = NULL; |
| 3639 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 3640 | - elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 3641 | - elseif ($format_source == 'whazzup') $fromsource = 'ivao'; |
|
| 3642 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 3643 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 3824 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 3825 | + $fromsource = $globalAirlinesSource; |
|
| 3826 | + } elseif ($format_source == 'vatsimtxt') { |
|
| 3827 | + $fromsource = 'vatsim'; |
|
| 3828 | + } elseif ($format_source == 'whazzup') { |
|
| 3829 | + $fromsource = 'ivao'; |
|
| 3830 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 3831 | + $fromsource = 'vatsim'; |
|
| 3832 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 3833 | + $fromsource = 'ivao'; |
|
| 3834 | + } |
|
| 3644 | 3835 | //getting the airline information |
| 3645 | 3836 | if ($ident != "") |
| 3646 | 3837 | { |
@@ -3664,15 +3855,21 @@ discard block |
||
| 3664 | 3855 | if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
| 3665 | 3856 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3666 | 3857 | } |
| 3667 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3858 | + if ($globalDebugTimeElapsed) { |
|
| 3859 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3860 | + } |
|
| 3668 | 3861 | |
| 3669 | 3862 | } else { |
| 3670 | 3863 | $timeelapsed = microtime(true); |
| 3671 | 3864 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3672 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3865 | + if ($globalDebugTimeElapsed) { |
|
| 3866 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3867 | + } |
|
| 3673 | 3868 | } |
| 3674 | 3869 | } |
| 3675 | - } else $airline_array = array(); |
|
| 3870 | + } else { |
|
| 3871 | + $airline_array = array(); |
|
| 3872 | + } |
|
| 3676 | 3873 | |
| 3677 | 3874 | //getting the aircraft information |
| 3678 | 3875 | $aircraft_array = array(); |
@@ -3686,27 +3883,37 @@ discard block |
||
| 3686 | 3883 | { |
| 3687 | 3884 | $timeelapsed = microtime(true); |
| 3688 | 3885 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3689 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3886 | + if ($globalDebugTimeElapsed) { |
|
| 3887 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3888 | + } |
|
| 3690 | 3889 | } else { |
| 3691 | 3890 | $timeelapsed = microtime(true); |
| 3692 | 3891 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3693 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3892 | + if ($globalDebugTimeElapsed) { |
|
| 3893 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3894 | + } |
|
| 3694 | 3895 | } |
| 3695 | 3896 | } |
| 3696 | 3897 | } else { |
| 3697 | 3898 | if ($ModeS != '') { |
| 3698 | 3899 | $timeelapsed = microtime(true); |
| 3699 | 3900 | $aircraft_icao = $this->getAllAircraftType($ModeS,$source_type); |
| 3700 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3901 | + if ($globalDebugTimeElapsed) { |
|
| 3902 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3903 | + } |
|
| 3701 | 3904 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
| 3702 | 3905 | { |
| 3703 | 3906 | $timeelapsed = microtime(true); |
| 3704 | 3907 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3705 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3908 | + if ($globalDebugTimeElapsed) { |
|
| 3909 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3910 | + } |
|
| 3706 | 3911 | } else { |
| 3707 | 3912 | $timeelapsed = microtime(true); |
| 3708 | 3913 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3709 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3914 | + if ($globalDebugTimeElapsed) { |
|
| 3915 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3916 | + } |
|
| 3710 | 3917 | } |
| 3711 | 3918 | } |
| 3712 | 3919 | } |
@@ -3722,7 +3929,9 @@ discard block |
||
| 3722 | 3929 | } else { |
| 3723 | 3930 | $timeelapsed = microtime(true); |
| 3724 | 3931 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
| 3725 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3932 | + if ($globalDebugTimeElapsed) { |
|
| 3933 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3934 | + } |
|
| 3726 | 3935 | } |
| 3727 | 3936 | } |
| 3728 | 3937 | |
@@ -3737,7 +3946,9 @@ discard block |
||
| 3737 | 3946 | } else { |
| 3738 | 3947 | $timeelapsed = microtime(true); |
| 3739 | 3948 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
| 3740 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3949 | + if ($globalDebugTimeElapsed) { |
|
| 3950 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3951 | + } |
|
| 3741 | 3952 | } |
| 3742 | 3953 | } |
| 3743 | 3954 | |
@@ -3771,7 +3982,9 @@ discard block |
||
| 3771 | 3982 | { |
| 3772 | 3983 | return false; |
| 3773 | 3984 | } |
| 3774 | - } else $altitude = 0; |
|
| 3985 | + } else { |
|
| 3986 | + $altitude = 0; |
|
| 3987 | + } |
|
| 3775 | 3988 | |
| 3776 | 3989 | if ($heading != "") |
| 3777 | 3990 | { |
@@ -3800,7 +4013,9 @@ discard block |
||
| 3800 | 4013 | { |
| 3801 | 4014 | $timeelapsed = microtime(true); |
| 3802 | 4015 | $image_array = $Image->getSpotterImage($registration); |
| 3803 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4016 | + if ($globalDebugTimeElapsed) { |
|
| 4017 | + echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4018 | + } |
|
| 3804 | 4019 | if (!isset($image_array[0]['registration'])) |
| 3805 | 4020 | { |
| 3806 | 4021 | //echo "Add image !!!! \n"; |
@@ -3808,14 +4023,21 @@ discard block |
||
| 3808 | 4023 | } |
| 3809 | 4024 | $timeelapsed = microtime(true); |
| 3810 | 4025 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
| 3811 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3812 | - if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 4026 | + if ($globalDebugTimeElapsed) { |
|
| 4027 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4028 | + } |
|
| 4029 | + if ($owner_info['owner'] != '') { |
|
| 4030 | + $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 4031 | + } |
|
| 3813 | 4032 | } |
| 3814 | 4033 | |
| 3815 | 4034 | if ($globalIVAO && $aircraft_icao != '') |
| 3816 | 4035 | { |
| 3817 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3818 | - else $airline_icao = ''; |
|
| 4036 | + if (isset($airline_array[0]['icao'])) { |
|
| 4037 | + $airline_icao = $airline_array[0]['icao']; |
|
| 4038 | + } else { |
|
| 4039 | + $airline_icao = ''; |
|
| 4040 | + } |
|
| 3819 | 4041 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
| 3820 | 4042 | if (!isset($image_array[0]['registration'])) |
| 3821 | 4043 | { |
@@ -3860,16 +4082,28 @@ discard block |
||
| 3860 | 4082 | { |
| 3861 | 4083 | $arrival_airport_array = $this->getAllAirportInfo('NA'); |
| 3862 | 4084 | } |
| 3863 | - if ($registration == '') $registration = 'NA'; |
|
| 4085 | + if ($registration == '') { |
|
| 4086 | + $registration = 'NA'; |
|
| 4087 | + } |
|
| 3864 | 4088 | if ($latitude == '' && $longitude == '') { |
| 3865 | 4089 | $latitude = 0; |
| 3866 | 4090 | $longitude = 0; |
| 3867 | 4091 | } |
| 3868 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3869 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3870 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3871 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3872 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 4092 | + if ($squawk == '' || $Common->isInteger($squawk) === false) { |
|
| 4093 | + $squawk = NULL; |
|
| 4094 | + } |
|
| 4095 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) { |
|
| 4096 | + $verticalrate = NULL; |
|
| 4097 | + } |
|
| 4098 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
| 4099 | + $heading = 0; |
|
| 4100 | + } |
|
| 4101 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
| 4102 | + $groundspeed = 0; |
|
| 4103 | + } |
|
| 4104 | + if (!isset($aircraft_owner)) { |
|
| 4105 | + $aircraft_owner = NULL; |
|
| 4106 | + } |
|
| 3873 | 4107 | $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
| 3874 | 4108 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)"; |
| 3875 | 4109 | |
@@ -3880,9 +4114,13 @@ discard block |
||
| 3880 | 4114 | if ($airline_type == '') { |
| 3881 | 4115 | $timeelapsed = microtime(true); |
| 3882 | 4116 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3883 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4117 | + if ($globalDebugTimeElapsed) { |
|
| 4118 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4119 | + } |
|
| 4120 | + } |
|
| 4121 | + if ($airline_type == null) { |
|
| 4122 | + $airline_type = ''; |
|
| 3884 | 4123 | } |
| 3885 | - if ($airline_type == null) $airline_type = ''; |
|
| 3886 | 4124 | $aircraft_type = $aircraft_array[0]['type']; |
| 3887 | 4125 | $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
| 3888 | 4126 | $departure_airport_name = $departure_airport_array[0]['name']; |
@@ -4046,7 +4284,9 @@ discard block |
||
| 4046 | 4284 | } |
| 4047 | 4285 | } |
| 4048 | 4286 | $query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC"; |
| 4049 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4287 | + if ($limit) { |
|
| 4288 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4289 | + } |
|
| 4050 | 4290 | |
| 4051 | 4291 | $sth = $this->db->prepare($query); |
| 4052 | 4292 | $sth->execute($query_values); |
@@ -4119,7 +4359,9 @@ discard block |
||
| 4119 | 4359 | } |
| 4120 | 4360 | |
| 4121 | 4361 | $query .= " GROUP BY spotter_output.pilot_id,s.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 4122 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4362 | + if ($limit) { |
|
| 4363 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4364 | + } |
|
| 4123 | 4365 | |
| 4124 | 4366 | |
| 4125 | 4367 | $sth = $this->db->prepare($query); |
@@ -4163,7 +4405,9 @@ discard block |
||
| 4163 | 4405 | } |
| 4164 | 4406 | } |
| 4165 | 4407 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 4166 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4408 | + if ($limit) { |
|
| 4409 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4410 | + } |
|
| 4167 | 4411 | |
| 4168 | 4412 | |
| 4169 | 4413 | $sth = $this->db->prepare($query); |
@@ -4239,7 +4483,9 @@ discard block |
||
| 4239 | 4483 | } |
| 4240 | 4484 | } |
| 4241 | 4485 | $query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC"; |
| 4242 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4486 | + if ($limit) { |
|
| 4487 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4488 | + } |
|
| 4243 | 4489 | |
| 4244 | 4490 | $sth = $this->db->prepare($query); |
| 4245 | 4491 | $sth->execute($query_values); |
@@ -4281,7 +4527,9 @@ discard block |
||
| 4281 | 4527 | } |
| 4282 | 4528 | } |
| 4283 | 4529 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC"; |
| 4284 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4530 | + if ($limit) { |
|
| 4531 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4532 | + } |
|
| 4285 | 4533 | |
| 4286 | 4534 | |
| 4287 | 4535 | $sth = $this->db->prepare($query); |
@@ -4524,7 +4772,9 @@ discard block |
||
| 4524 | 4772 | date_default_timezone_set($globalTimezone); |
| 4525 | 4773 | $datetime = new DateTime($date); |
| 4526 | 4774 | $offset = $datetime->format('P'); |
| 4527 | - } else $offset = '+00:00'; |
|
| 4775 | + } else { |
|
| 4776 | + $offset = '+00:00'; |
|
| 4777 | + } |
|
| 4528 | 4778 | |
| 4529 | 4779 | if ($globalDBdriver == 'mysql') { |
| 4530 | 4780 | $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
@@ -4572,7 +4822,9 @@ discard block |
||
| 4572 | 4822 | date_default_timezone_set($globalTimezone); |
| 4573 | 4823 | $datetime = new DateTime($date); |
| 4574 | 4824 | $offset = $datetime->format('P'); |
| 4575 | - } else $offset = '+00:00'; |
|
| 4825 | + } else { |
|
| 4826 | + $offset = '+00:00'; |
|
| 4827 | + } |
|
| 4576 | 4828 | |
| 4577 | 4829 | if ($globalDBdriver == 'mysql') { |
| 4578 | 4830 | $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
@@ -4692,9 +4944,13 @@ discard block |
||
| 4692 | 4944 | $sth = $this->db->prepare($query); |
| 4693 | 4945 | $sth->execute($query_values); |
| 4694 | 4946 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 4695 | - if (is_numeric($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
| 4696 | - elseif ($result[0]['duration'] == '') return 0; |
|
| 4697 | - else return $result[0]['duration']; |
|
| 4947 | + if (is_numeric($result[0]['duration'])) { |
|
| 4948 | + return gmdate('H:i:s',$result[0]['duration']); |
|
| 4949 | + } elseif ($result[0]['duration'] == '') { |
|
| 4950 | + return 0; |
|
| 4951 | + } else { |
|
| 4952 | + return $result[0]['duration']; |
|
| 4953 | + } |
|
| 4698 | 4954 | } |
| 4699 | 4955 | |
| 4700 | 4956 | /** |
@@ -4783,8 +5039,11 @@ discard block |
||
| 4783 | 5039 | $sth = $this->db->prepare($query); |
| 4784 | 5040 | $sth->execute($query_values); |
| 4785 | 5041 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 4786 | - if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
| 4787 | - else return $result[0]['duration']; |
|
| 5042 | + if (is_int($result[0]['duration'])) { |
|
| 5043 | + return gmdate('H:i:s',$result[0]['duration']); |
|
| 5044 | + } else { |
|
| 5045 | + return $result[0]['duration']; |
|
| 5046 | + } |
|
| 4788 | 5047 | } |
| 4789 | 5048 | |
| 4790 | 5049 | /** |
@@ -4989,7 +5248,9 @@ discard block |
||
| 4989 | 5248 | } |
| 4990 | 5249 | $query .= " GROUP BY spotter_output.airline_country, countries.iso3 |
| 4991 | 5250 | ORDER BY airline_country_count DESC"; |
| 4992 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5251 | + if ($limit) { |
|
| 5252 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5253 | + } |
|
| 4993 | 5254 | |
| 4994 | 5255 | $sth = $this->db->prepare($query); |
| 4995 | 5256 | $sth->execute($query_values); |
@@ -5018,7 +5279,9 @@ discard block |
||
| 5018 | 5279 | global $globalDBdriver; |
| 5019 | 5280 | //$filter_query = $this->getFilter($filters,true,true); |
| 5020 | 5281 | $Connection= new Connection($this->db); |
| 5021 | - if (!$Connection->tableExists('countries')) return array(); |
|
| 5282 | + if (!$Connection->tableExists('countries')) { |
|
| 5283 | + return array(); |
|
| 5284 | + } |
|
| 5022 | 5285 | /* |
| 5023 | 5286 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
| 5024 | 5287 | FROM countries c, spotter_output s |
@@ -5050,7 +5313,9 @@ discard block |
||
| 5050 | 5313 | } |
| 5051 | 5314 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT flightaware_id,over_country FROM spotter_live".$filter_query.") l ON c.iso2 = l.over_country "; |
| 5052 | 5315 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
| 5053 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5316 | + if ($limit) { |
|
| 5317 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5318 | + } |
|
| 5054 | 5319 | |
| 5055 | 5320 | |
| 5056 | 5321 | $sth = $this->db->prepare($query); |
@@ -5127,7 +5392,9 @@ discard block |
||
| 5127 | 5392 | } |
| 5128 | 5393 | |
| 5129 | 5394 | $query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 5130 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5395 | + if ($limit) { |
|
| 5396 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5397 | + } |
|
| 5131 | 5398 | |
| 5132 | 5399 | $sth = $this->db->prepare($query); |
| 5133 | 5400 | $sth->execute($query_values); |
@@ -5201,7 +5468,9 @@ discard block |
||
| 5201 | 5468 | } |
| 5202 | 5469 | |
| 5203 | 5470 | $query .= " GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 5204 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5471 | + if ($limit) { |
|
| 5472 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5473 | + } |
|
| 5205 | 5474 | |
| 5206 | 5475 | $sth = $this->db->prepare($query); |
| 5207 | 5476 | $sth->execute($query_values); |
@@ -5248,7 +5517,9 @@ discard block |
||
| 5248 | 5517 | } |
| 5249 | 5518 | |
| 5250 | 5519 | $query .= "GROUP BY EXTRACT(month from spotter_output.date), EXTRACT(year from spotter_output.date), spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 5251 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5520 | + if ($limit) { |
|
| 5521 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5522 | + } |
|
| 5252 | 5523 | |
| 5253 | 5524 | $sth = $this->db->prepare($query); |
| 5254 | 5525 | $sth->execute(); |
@@ -5301,7 +5572,9 @@ discard block |
||
| 5301 | 5572 | if($row['registration'] != "") |
| 5302 | 5573 | { |
| 5303 | 5574 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5304 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5575 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5576 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5577 | + } |
|
| 5305 | 5578 | } |
| 5306 | 5579 | $temp_array['registration_count'] = $row['registration_count']; |
| 5307 | 5580 | |
@@ -5376,7 +5649,9 @@ discard block |
||
| 5376 | 5649 | if($row['registration'] != "") |
| 5377 | 5650 | { |
| 5378 | 5651 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5379 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5652 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5653 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5654 | + } |
|
| 5380 | 5655 | } |
| 5381 | 5656 | $temp_array['registration_count'] = $row['registration_count']; |
| 5382 | 5657 | |
@@ -5483,7 +5758,9 @@ discard block |
||
| 5483 | 5758 | if($row['registration'] != "") |
| 5484 | 5759 | { |
| 5485 | 5760 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5486 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5761 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5762 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5763 | + } |
|
| 5487 | 5764 | } |
| 5488 | 5765 | $temp_array['registration_count'] = $row['registration_count']; |
| 5489 | 5766 | $aircraft_array[] = $temp_array; |
@@ -5608,7 +5885,9 @@ discard block |
||
| 5608 | 5885 | date_default_timezone_set($globalTimezone); |
| 5609 | 5886 | $datetime = new DateTime($date); |
| 5610 | 5887 | $offset = $datetime->format('P'); |
| 5611 | - } else $offset = '+00:00'; |
|
| 5888 | + } else { |
|
| 5889 | + $offset = '+00:00'; |
|
| 5890 | + } |
|
| 5612 | 5891 | |
| 5613 | 5892 | if ($globalDBdriver == 'mysql') { |
| 5614 | 5893 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
@@ -5655,7 +5934,9 @@ discard block |
||
| 5655 | 5934 | date_default_timezone_set($globalTimezone); |
| 5656 | 5935 | $datetime = new DateTime($date); |
| 5657 | 5936 | $offset = $datetime->format('P'); |
| 5658 | - } else $offset = '+00:00'; |
|
| 5937 | + } else { |
|
| 5938 | + $offset = '+00:00'; |
|
| 5939 | + } |
|
| 5659 | 5940 | |
| 5660 | 5941 | if ($globalDBdriver == 'mysql') { |
| 5661 | 5942 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
@@ -5684,7 +5965,9 @@ discard block |
||
| 5684 | 5965 | if($row['registration'] != "") |
| 5685 | 5966 | { |
| 5686 | 5967 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5687 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5968 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5969 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5970 | + } |
|
| 5688 | 5971 | } |
| 5689 | 5972 | $temp_array['registration_count'] = $row['registration_count']; |
| 5690 | 5973 | |
@@ -5709,7 +5992,9 @@ discard block |
||
| 5709 | 5992 | date_default_timezone_set($globalTimezone); |
| 5710 | 5993 | $datetime = new DateTime($date); |
| 5711 | 5994 | $offset = $datetime->format('P'); |
| 5712 | - } else $offset = '+00:00'; |
|
| 5995 | + } else { |
|
| 5996 | + $offset = '+00:00'; |
|
| 5997 | + } |
|
| 5713 | 5998 | |
| 5714 | 5999 | if ($globalDBdriver == 'mysql') { |
| 5715 | 6000 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
@@ -5905,8 +6190,11 @@ discard block |
||
| 5905 | 6190 | if($row['registration'] != "") |
| 5906 | 6191 | { |
| 5907 | 6192 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5908 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5909 | - else $temp_array['image_thumbnail'] = ''; |
|
| 6193 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6194 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6195 | + } else { |
|
| 6196 | + $temp_array['image_thumbnail'] = ''; |
|
| 6197 | + } |
|
| 5910 | 6198 | } |
| 5911 | 6199 | $temp_array['registration_count'] = $row['registration_count']; |
| 5912 | 6200 | $aircraft_array[] = $temp_array; |
@@ -5980,8 +6268,11 @@ discard block |
||
| 5980 | 6268 | if($row['registration'] != "") |
| 5981 | 6269 | { |
| 5982 | 6270 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5983 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5984 | - else $temp_array['image_thumbnail'] = ''; |
|
| 6271 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6272 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6273 | + } else { |
|
| 6274 | + $temp_array['image_thumbnail'] = ''; |
|
| 6275 | + } |
|
| 5985 | 6276 | } |
| 5986 | 6277 | $temp_array['registration_count'] = $row['registration_count']; |
| 5987 | 6278 | $aircraft_array[] = $temp_array; |
@@ -6055,8 +6346,11 @@ discard block |
||
| 6055 | 6346 | if($row['registration'] != "") |
| 6056 | 6347 | { |
| 6057 | 6348 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6058 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6059 | - else $temp_array['image_thumbnail'] = ''; |
|
| 6349 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6350 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6351 | + } else { |
|
| 6352 | + $temp_array['image_thumbnail'] = ''; |
|
| 6353 | + } |
|
| 6060 | 6354 | } |
| 6061 | 6355 | $temp_array['registration_count'] = $row['registration_count']; |
| 6062 | 6356 | $aircraft_array[] = $temp_array; |
@@ -6267,7 +6561,9 @@ discard block |
||
| 6267 | 6561 | if($row['registration'] != "") |
| 6268 | 6562 | { |
| 6269 | 6563 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6270 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6564 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6565 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6566 | + } |
|
| 6271 | 6567 | } |
| 6272 | 6568 | $temp_array['registration_count'] = $row['registration_count']; |
| 6273 | 6569 | |
@@ -6384,7 +6680,9 @@ discard block |
||
| 6384 | 6680 | if($row['registration'] != "") |
| 6385 | 6681 | { |
| 6386 | 6682 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6387 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6683 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6684 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6685 | + } |
|
| 6388 | 6686 | } |
| 6389 | 6687 | $temp_array['registration_count'] = $row['registration_count']; |
| 6390 | 6688 | |
@@ -6550,7 +6848,9 @@ discard block |
||
| 6550 | 6848 | } |
| 6551 | 6849 | } |
| 6552 | 6850 | $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
| 6553 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6851 | + if ($limit) { |
|
| 6852 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6853 | + } |
|
| 6554 | 6854 | |
| 6555 | 6855 | $sth = $this->db->prepare($query); |
| 6556 | 6856 | $sth->execute($query_values); |
@@ -6569,7 +6869,9 @@ discard block |
||
| 6569 | 6869 | if($row['registration'] != "") |
| 6570 | 6870 | { |
| 6571 | 6871 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6572 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6872 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6873 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6874 | + } |
|
| 6573 | 6875 | } |
| 6574 | 6876 | |
| 6575 | 6877 | $aircraft_array[] = $temp_array; |
@@ -6610,7 +6912,9 @@ discard block |
||
| 6610 | 6912 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6611 | 6913 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6612 | 6914 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
| 6613 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6915 | + if ($limit) { |
|
| 6916 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6917 | + } |
|
| 6614 | 6918 | |
| 6615 | 6919 | $sth = $this->db->prepare($query); |
| 6616 | 6920 | $sth->execute(); |
@@ -6630,7 +6934,9 @@ discard block |
||
| 6630 | 6934 | if($row['registration'] != "") |
| 6631 | 6935 | { |
| 6632 | 6936 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6633 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6937 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6938 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6939 | + } |
|
| 6634 | 6940 | } |
| 6635 | 6941 | |
| 6636 | 6942 | $aircraft_array[] = $temp_array; |
@@ -6696,7 +7002,9 @@ discard block |
||
| 6696 | 7002 | } |
| 6697 | 7003 | $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, airport.latitude, airport.longitude |
| 6698 | 7004 | ORDER BY airport_departure_icao_count DESC"; |
| 6699 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7005 | + if ($limit) { |
|
| 7006 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7007 | + } |
|
| 6700 | 7008 | |
| 6701 | 7009 | $sth = $this->db->prepare($query); |
| 6702 | 7010 | $sth->execute($query_values); |
@@ -6748,7 +7056,9 @@ discard block |
||
| 6748 | 7056 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6749 | 7057 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6750 | 7058 | ORDER BY airport_departure_icao_count DESC"; |
| 6751 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7059 | + if ($limit) { |
|
| 7060 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7061 | + } |
|
| 6752 | 7062 | |
| 6753 | 7063 | $sth = $this->db->prepare($query); |
| 6754 | 7064 | $sth->execute(); |
@@ -6826,7 +7136,9 @@ discard block |
||
| 6826 | 7136 | } |
| 6827 | 7137 | $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude |
| 6828 | 7138 | ORDER BY airport_departure_icao_count DESC"; |
| 6829 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7139 | + if ($limit) { |
|
| 7140 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7141 | + } |
|
| 6830 | 7142 | //echo $query; |
| 6831 | 7143 | $sth = $this->db->prepare($query); |
| 6832 | 7144 | $sth->execute($query_values); |
@@ -6880,7 +7192,9 @@ discard block |
||
| 6880 | 7192 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6881 | 7193 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
| 6882 | 7194 | ORDER BY airport_departure_icao_count DESC"; |
| 6883 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7195 | + if ($limit) { |
|
| 7196 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7197 | + } |
|
| 6884 | 7198 | |
| 6885 | 7199 | $sth = $this->db->prepare($query); |
| 6886 | 7200 | $sth->execute(); |
@@ -7275,7 +7589,9 @@ discard block |
||
| 7275 | 7589 | date_default_timezone_set($globalTimezone); |
| 7276 | 7590 | $datetime = new DateTime($date); |
| 7277 | 7591 | $offset = $datetime->format('P'); |
| 7278 | - } else $offset = '+00:00'; |
|
| 7592 | + } else { |
|
| 7593 | + $offset = '+00:00'; |
|
| 7594 | + } |
|
| 7279 | 7595 | |
| 7280 | 7596 | if ($globalDBdriver == 'mysql') { |
| 7281 | 7597 | $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
@@ -7325,7 +7641,9 @@ discard block |
||
| 7325 | 7641 | date_default_timezone_set($globalTimezone); |
| 7326 | 7642 | $datetime = new DateTime($date); |
| 7327 | 7643 | $offset = $datetime->format('P'); |
| 7328 | - } else $offset = '+00:00'; |
|
| 7644 | + } else { |
|
| 7645 | + $offset = '+00:00'; |
|
| 7646 | + } |
|
| 7329 | 7647 | |
| 7330 | 7648 | if ($globalDBdriver == 'mysql') { |
| 7331 | 7649 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
@@ -7674,7 +7992,9 @@ discard block |
||
| 7674 | 7992 | } |
| 7675 | 7993 | $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, airport.latitude, airport.longitude |
| 7676 | 7994 | ORDER BY airport_arrival_icao_count DESC"; |
| 7677 | - if ($limit) $query .= " LIMIT 10"; |
|
| 7995 | + if ($limit) { |
|
| 7996 | + $query .= " LIMIT 10"; |
|
| 7997 | + } |
|
| 7678 | 7998 | |
| 7679 | 7999 | |
| 7680 | 8000 | $sth = $this->db->prepare($query); |
@@ -7696,7 +8016,9 @@ discard block |
||
| 7696 | 8016 | if ($icaoaskey) { |
| 7697 | 8017 | $icao = $row['arrival_airport_icao']; |
| 7698 | 8018 | $airport_array[$icao] = $temp_array; |
| 7699 | - } else $airport_array[] = $temp_array; |
|
| 8019 | + } else { |
|
| 8020 | + $airport_array[] = $temp_array; |
|
| 8021 | + } |
|
| 7700 | 8022 | } |
| 7701 | 8023 | |
| 7702 | 8024 | return $airport_array; |
@@ -7733,7 +8055,9 @@ discard block |
||
| 7733 | 8055 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 7734 | 8056 | $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7735 | 8057 | ORDER BY airport_arrival_icao_count DESC"; |
| 7736 | - if ($limit) $query .= " LIMIT 10"; |
|
| 8058 | + if ($limit) { |
|
| 8059 | + $query .= " LIMIT 10"; |
|
| 8060 | + } |
|
| 7737 | 8061 | |
| 7738 | 8062 | |
| 7739 | 8063 | $sth = $this->db->prepare($query); |
@@ -7754,7 +8078,9 @@ discard block |
||
| 7754 | 8078 | if ($icaoaskey) { |
| 7755 | 8079 | $icao = $row['arrival_airport_icao']; |
| 7756 | 8080 | $airport_array[$icao] = $temp_array; |
| 7757 | - } else $airport_array[] = $temp_array; |
|
| 8081 | + } else { |
|
| 8082 | + $airport_array[] = $temp_array; |
|
| 8083 | + } |
|
| 7758 | 8084 | } |
| 7759 | 8085 | |
| 7760 | 8086 | return $airport_array; |
@@ -7817,7 +8143,9 @@ discard block |
||
| 7817 | 8143 | } |
| 7818 | 8144 | $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude |
| 7819 | 8145 | ORDER BY airport_arrival_icao_count DESC"; |
| 7820 | - if ($limit) $query .= " LIMIT 10"; |
|
| 8146 | + if ($limit) { |
|
| 8147 | + $query .= " LIMIT 10"; |
|
| 8148 | + } |
|
| 7821 | 8149 | |
| 7822 | 8150 | |
| 7823 | 8151 | $sth = $this->db->prepare($query); |
@@ -7836,7 +8164,9 @@ discard block |
||
| 7836 | 8164 | if ($icaoaskey) { |
| 7837 | 8165 | $icao = $row['arrival_airport_icao']; |
| 7838 | 8166 | $airport_array[$icao] = $temp_array; |
| 7839 | - } else $airport_array[] = $temp_array; |
|
| 8167 | + } else { |
|
| 8168 | + $airport_array[] = $temp_array; |
|
| 8169 | + } |
|
| 7840 | 8170 | } |
| 7841 | 8171 | |
| 7842 | 8172 | return $airport_array; |
@@ -7873,7 +8203,9 @@ discard block |
||
| 7873 | 8203 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 7874 | 8204 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
| 7875 | 8205 | ORDER BY airport_arrival_icao_count DESC"; |
| 7876 | - if ($limit) $query .= " LIMIT 10"; |
|
| 8206 | + if ($limit) { |
|
| 8207 | + $query .= " LIMIT 10"; |
|
| 8208 | + } |
|
| 7877 | 8209 | |
| 7878 | 8210 | |
| 7879 | 8211 | $sth = $this->db->prepare($query); |
@@ -7894,7 +8226,9 @@ discard block |
||
| 7894 | 8226 | if ($icaoaskey) { |
| 7895 | 8227 | $icao = $row['arrival_airport_icao']; |
| 7896 | 8228 | $airport_array[$icao] = $temp_array; |
| 7897 | - } else $airport_array[] = $temp_array; |
|
| 8229 | + } else { |
|
| 8230 | + $airport_array[] = $temp_array; |
|
| 8231 | + } |
|
| 7898 | 8232 | } |
| 7899 | 8233 | |
| 7900 | 8234 | return $airport_array; |
@@ -8275,7 +8609,9 @@ discard block |
||
| 8275 | 8609 | date_default_timezone_set($globalTimezone); |
| 8276 | 8610 | $datetime = new DateTime($date); |
| 8277 | 8611 | $offset = $datetime->format('P'); |
| 8278 | - } else $offset = '+00:00'; |
|
| 8612 | + } else { |
|
| 8613 | + $offset = '+00:00'; |
|
| 8614 | + } |
|
| 8279 | 8615 | |
| 8280 | 8616 | if ($globalDBdriver == 'mysql') { |
| 8281 | 8617 | $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
@@ -8325,7 +8661,9 @@ discard block |
||
| 8325 | 8661 | date_default_timezone_set($globalTimezone); |
| 8326 | 8662 | $datetime = new DateTime($date); |
| 8327 | 8663 | $offset = $datetime->format('P'); |
| 8328 | - } else $offset = '+00:00'; |
|
| 8664 | + } else { |
|
| 8665 | + $offset = '+00:00'; |
|
| 8666 | + } |
|
| 8329 | 8667 | |
| 8330 | 8668 | if ($globalDBdriver == 'mysql') { |
| 8331 | 8669 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
@@ -8716,7 +9054,9 @@ discard block |
||
| 8716 | 9054 | } |
| 8717 | 9055 | $query .= " GROUP BY spotter_output.arrival_airport_country, countries.iso3 |
| 8718 | 9056 | ORDER BY airport_arrival_country_count DESC"; |
| 8719 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 9057 | + if ($limit) { |
|
| 9058 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 9059 | + } |
|
| 8720 | 9060 | |
| 8721 | 9061 | |
| 8722 | 9062 | $sth = $this->db->prepare($query); |
@@ -9004,7 +9344,9 @@ discard block |
||
| 9004 | 9344 | date_default_timezone_set($globalTimezone); |
| 9005 | 9345 | $datetime = new DateTime($date); |
| 9006 | 9346 | $offset = $datetime->format('P'); |
| 9007 | - } else $offset = '+00:00'; |
|
| 9347 | + } else { |
|
| 9348 | + $offset = '+00:00'; |
|
| 9349 | + } |
|
| 9008 | 9350 | |
| 9009 | 9351 | if ($globalDBdriver == 'mysql') { |
| 9010 | 9352 | $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
@@ -9260,12 +9602,18 @@ discard block |
||
| 9260 | 9602 | $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
| 9261 | 9603 | FROM spotter_output".$filter_query." spotter_output.ident <> ''"; |
| 9262 | 9604 | if ($olderthanmonths > 0) { |
| 9263 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 9264 | - else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 9605 | + if ($globalDBdriver == 'mysql') { |
|
| 9606 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 9607 | + } else { |
|
| 9608 | + $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 9609 | + } |
|
| 9265 | 9610 | } |
| 9266 | 9611 | if ($sincedate != '') { |
| 9267 | - if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 9268 | - else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 9612 | + if ($globalDBdriver == 'mysql') { |
|
| 9613 | + $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 9614 | + } else { |
|
| 9615 | + $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 9616 | + } |
|
| 9269 | 9617 | } |
| 9270 | 9618 | $query_values = array(); |
| 9271 | 9619 | if ($year != '') { |
@@ -9296,7 +9644,9 @@ discard block |
||
| 9296 | 9644 | } |
| 9297 | 9645 | } |
| 9298 | 9646 | $query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 9299 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 9647 | + if ($limit) { |
|
| 9648 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 9649 | + } |
|
| 9300 | 9650 | |
| 9301 | 9651 | $sth = $this->db->prepare($query); |
| 9302 | 9652 | $sth->execute($query_values); |
@@ -9330,15 +9680,23 @@ discard block |
||
| 9330 | 9680 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
| 9331 | 9681 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
| 9332 | 9682 | if ($olderthanmonths > 0) { |
| 9333 | - if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 9334 | - else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 9683 | + if ($globalDBdriver == 'mysql') { |
|
| 9684 | + $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 9685 | + } else { |
|
| 9686 | + $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 9687 | + } |
|
| 9335 | 9688 | } |
| 9336 | 9689 | if ($sincedate != '') { |
| 9337 | - if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 9338 | - else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 9690 | + if ($globalDBdriver == 'mysql') { |
|
| 9691 | + $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 9692 | + } else { |
|
| 9693 | + $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 9694 | + } |
|
| 9339 | 9695 | } |
| 9340 | 9696 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 9341 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 9697 | + if ($limit) { |
|
| 9698 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 9699 | + } |
|
| 9342 | 9700 | |
| 9343 | 9701 | $sth = $this->db->prepare($query); |
| 9344 | 9702 | $sth->execute(); |
@@ -9375,7 +9733,9 @@ discard block |
||
| 9375 | 9733 | date_default_timezone_set($globalTimezone); |
| 9376 | 9734 | $datetime = new DateTime(); |
| 9377 | 9735 | $offset = $datetime->format('P'); |
| 9378 | - } else $offset = '+00:00'; |
|
| 9736 | + } else { |
|
| 9737 | + $offset = '+00:00'; |
|
| 9738 | + } |
|
| 9379 | 9739 | |
| 9380 | 9740 | if ($globalDBdriver == 'mysql') { |
| 9381 | 9741 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9424,7 +9784,9 @@ discard block |
||
| 9424 | 9784 | date_default_timezone_set($globalTimezone); |
| 9425 | 9785 | $datetime = new DateTime(); |
| 9426 | 9786 | $offset = $datetime->format('P'); |
| 9427 | - } else $offset = '+00:00'; |
|
| 9787 | + } else { |
|
| 9788 | + $offset = '+00:00'; |
|
| 9789 | + } |
|
| 9428 | 9790 | $filter_query = $this->getFilter($filters,true,true); |
| 9429 | 9791 | if ($globalDBdriver == 'mysql') { |
| 9430 | 9792 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9473,7 +9835,9 @@ discard block |
||
| 9473 | 9835 | date_default_timezone_set($globalTimezone); |
| 9474 | 9836 | $datetime = new DateTime(); |
| 9475 | 9837 | $offset = $datetime->format('P'); |
| 9476 | - } else $offset = '+00:00'; |
|
| 9838 | + } else { |
|
| 9839 | + $offset = '+00:00'; |
|
| 9840 | + } |
|
| 9477 | 9841 | $filter_query = $this->getFilter($filters,true,true); |
| 9478 | 9842 | if ($globalDBdriver == 'mysql') { |
| 9479 | 9843 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9519,7 +9883,9 @@ discard block |
||
| 9519 | 9883 | date_default_timezone_set($globalTimezone); |
| 9520 | 9884 | $datetime = new DateTime(); |
| 9521 | 9885 | $offset = $datetime->format('P'); |
| 9522 | - } else $offset = '+00:00'; |
|
| 9886 | + } else { |
|
| 9887 | + $offset = '+00:00'; |
|
| 9888 | + } |
|
| 9523 | 9889 | $filter_query = $this->getFilter($filters,true,true); |
| 9524 | 9890 | if ($globalDBdriver == 'mysql') { |
| 9525 | 9891 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9567,7 +9933,9 @@ discard block |
||
| 9567 | 9933 | date_default_timezone_set($globalTimezone); |
| 9568 | 9934 | $datetime = new DateTime(); |
| 9569 | 9935 | $offset = $datetime->format('P'); |
| 9570 | - } else $offset = '+00:00'; |
|
| 9936 | + } else { |
|
| 9937 | + $offset = '+00:00'; |
|
| 9938 | + } |
|
| 9571 | 9939 | |
| 9572 | 9940 | if ($globalDBdriver == 'mysql') { |
| 9573 | 9941 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9615,7 +9983,9 @@ discard block |
||
| 9615 | 9983 | date_default_timezone_set($globalTimezone); |
| 9616 | 9984 | $datetime = new DateTime(); |
| 9617 | 9985 | $offset = $datetime->format('P'); |
| 9618 | - } else $offset = '+00:00'; |
|
| 9986 | + } else { |
|
| 9987 | + $offset = '+00:00'; |
|
| 9988 | + } |
|
| 9619 | 9989 | |
| 9620 | 9990 | if ($globalDBdriver == 'mysql') { |
| 9621 | 9991 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -9662,7 +10032,9 @@ discard block |
||
| 9662 | 10032 | date_default_timezone_set($globalTimezone); |
| 9663 | 10033 | $datetime = new DateTime(); |
| 9664 | 10034 | $offset = $datetime->format('P'); |
| 9665 | - } else $offset = '+00:00'; |
|
| 10035 | + } else { |
|
| 10036 | + $offset = '+00:00'; |
|
| 10037 | + } |
|
| 9666 | 10038 | |
| 9667 | 10039 | if ($globalDBdriver == 'mysql') { |
| 9668 | 10040 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -9710,7 +10082,9 @@ discard block |
||
| 9710 | 10082 | date_default_timezone_set($globalTimezone); |
| 9711 | 10083 | $datetime = new DateTime(); |
| 9712 | 10084 | $offset = $datetime->format('P'); |
| 9713 | - } else $offset = '+00:00'; |
|
| 10085 | + } else { |
|
| 10086 | + $offset = '+00:00'; |
|
| 10087 | + } |
|
| 9714 | 10088 | $filter_query = $this->getFilter($filters,true,true); |
| 9715 | 10089 | if ($globalDBdriver == 'mysql') { |
| 9716 | 10090 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -9755,7 +10129,9 @@ discard block |
||
| 9755 | 10129 | date_default_timezone_set($globalTimezone); |
| 9756 | 10130 | $datetime = new DateTime(); |
| 9757 | 10131 | $offset = $datetime->format('P'); |
| 9758 | - } else $offset = '+00:00'; |
|
| 10132 | + } else { |
|
| 10133 | + $offset = '+00:00'; |
|
| 10134 | + } |
|
| 9759 | 10135 | $filter_query = $this->getFilter($filters,true,true); |
| 9760 | 10136 | |
| 9761 | 10137 | if ($globalDBdriver == 'mysql') { |
@@ -9802,7 +10178,9 @@ discard block |
||
| 9802 | 10178 | date_default_timezone_set($globalTimezone); |
| 9803 | 10179 | $datetime = new DateTime(); |
| 9804 | 10180 | $offset = $datetime->format('P'); |
| 9805 | - } else $offset = '+00:00'; |
|
| 10181 | + } else { |
|
| 10182 | + $offset = '+00:00'; |
|
| 10183 | + } |
|
| 9806 | 10184 | |
| 9807 | 10185 | if ($globalDBdriver == 'mysql') { |
| 9808 | 10186 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
@@ -9848,7 +10226,9 @@ discard block |
||
| 9848 | 10226 | date_default_timezone_set($globalTimezone); |
| 9849 | 10227 | $datetime = new DateTime(); |
| 9850 | 10228 | $offset = $datetime->format('P'); |
| 9851 | - } else $offset = '+00:00'; |
|
| 10229 | + } else { |
|
| 10230 | + $offset = '+00:00'; |
|
| 10231 | + } |
|
| 9852 | 10232 | $filter_query = $this->getFilter($filters,true,true); |
| 9853 | 10233 | |
| 9854 | 10234 | if ($globalDBdriver == 'mysql') { |
@@ -9895,7 +10275,9 @@ discard block |
||
| 9895 | 10275 | date_default_timezone_set($globalTimezone); |
| 9896 | 10276 | $datetime = new DateTime(); |
| 9897 | 10277 | $offset = $datetime->format('P'); |
| 9898 | - } else $offset = '+00:00'; |
|
| 10278 | + } else { |
|
| 10279 | + $offset = '+00:00'; |
|
| 10280 | + } |
|
| 9899 | 10281 | |
| 9900 | 10282 | if ($globalDBdriver == 'mysql') { |
| 9901 | 10283 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
@@ -9942,7 +10324,9 @@ discard block |
||
| 9942 | 10324 | date_default_timezone_set($globalTimezone); |
| 9943 | 10325 | $datetime = new DateTime(); |
| 9944 | 10326 | $offset = $datetime->format('P'); |
| 9945 | - } else $offset = '+00:00'; |
|
| 10327 | + } else { |
|
| 10328 | + $offset = '+00:00'; |
|
| 10329 | + } |
|
| 9946 | 10330 | |
| 9947 | 10331 | if ($globalDBdriver == 'mysql') { |
| 9948 | 10332 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
@@ -9987,7 +10371,9 @@ discard block |
||
| 9987 | 10371 | date_default_timezone_set($globalTimezone); |
| 9988 | 10372 | $datetime = new DateTime(); |
| 9989 | 10373 | $offset = $datetime->format('P'); |
| 9990 | - } else $offset = '+00:00'; |
|
| 10374 | + } else { |
|
| 10375 | + $offset = '+00:00'; |
|
| 10376 | + } |
|
| 9991 | 10377 | $filter_query = $this->getFilter($filters,true,true); |
| 9992 | 10378 | |
| 9993 | 10379 | if ($globalDBdriver == 'mysql') { |
@@ -10035,7 +10421,9 @@ discard block |
||
| 10035 | 10421 | date_default_timezone_set($globalTimezone); |
| 10036 | 10422 | $datetime = new DateTime(); |
| 10037 | 10423 | $offset = $datetime->format('P'); |
| 10038 | - } else $offset = '+00:00'; |
|
| 10424 | + } else { |
|
| 10425 | + $offset = '+00:00'; |
|
| 10426 | + } |
|
| 10039 | 10427 | |
| 10040 | 10428 | if ($globalDBdriver == 'mysql') { |
| 10041 | 10429 | $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
@@ -10081,7 +10469,9 @@ discard block |
||
| 10081 | 10469 | date_default_timezone_set($globalTimezone); |
| 10082 | 10470 | $datetime = new DateTime(); |
| 10083 | 10471 | $offset = $datetime->format('P'); |
| 10084 | - } else $offset = '+00:00'; |
|
| 10472 | + } else { |
|
| 10473 | + $offset = '+00:00'; |
|
| 10474 | + } |
|
| 10085 | 10475 | $filter_query = $this->getFilter($filters,true,true); |
| 10086 | 10476 | |
| 10087 | 10477 | if ($globalDBdriver == 'mysql') { |
@@ -10129,7 +10519,9 @@ discard block |
||
| 10129 | 10519 | date_default_timezone_set($globalTimezone); |
| 10130 | 10520 | $datetime = new DateTime(); |
| 10131 | 10521 | $offset = $datetime->format('P'); |
| 10132 | - } else $offset = '+00:00'; |
|
| 10522 | + } else { |
|
| 10523 | + $offset = '+00:00'; |
|
| 10524 | + } |
|
| 10133 | 10525 | |
| 10134 | 10526 | if ($globalDBdriver == 'mysql') { |
| 10135 | 10527 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
@@ -10176,7 +10568,9 @@ discard block |
||
| 10176 | 10568 | date_default_timezone_set($globalTimezone); |
| 10177 | 10569 | $datetime = new DateTime(); |
| 10178 | 10570 | $offset = $datetime->format('P'); |
| 10179 | - } else $offset = '+00:00'; |
|
| 10571 | + } else { |
|
| 10572 | + $offset = '+00:00'; |
|
| 10573 | + } |
|
| 10180 | 10574 | $filter_query = $this->getFilter($filters,true,true); |
| 10181 | 10575 | if ($globalDBdriver == 'mysql') { |
| 10182 | 10576 | $query = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
@@ -10225,7 +10619,9 @@ discard block |
||
| 10225 | 10619 | date_default_timezone_set($globalTimezone); |
| 10226 | 10620 | $datetime = new DateTime(); |
| 10227 | 10621 | $offset = $datetime->format('P'); |
| 10228 | - } else $offset = '+00:00'; |
|
| 10622 | + } else { |
|
| 10623 | + $offset = '+00:00'; |
|
| 10624 | + } |
|
| 10229 | 10625 | |
| 10230 | 10626 | $orderby_sql = ''; |
| 10231 | 10627 | if ($orderby == "hour") |
@@ -10291,7 +10687,9 @@ discard block |
||
| 10291 | 10687 | date_default_timezone_set($globalTimezone); |
| 10292 | 10688 | $datetime = new DateTime(); |
| 10293 | 10689 | $offset = $datetime->format('P'); |
| 10294 | - } else $offset = '+00:00'; |
|
| 10690 | + } else { |
|
| 10691 | + $offset = '+00:00'; |
|
| 10692 | + } |
|
| 10295 | 10693 | |
| 10296 | 10694 | $orderby_sql = ''; |
| 10297 | 10695 | if ($orderby == "hour") |
@@ -10358,7 +10756,9 @@ discard block |
||
| 10358 | 10756 | date_default_timezone_set($globalTimezone); |
| 10359 | 10757 | $datetime = new DateTime(); |
| 10360 | 10758 | $offset = $datetime->format('P'); |
| 10361 | - } else $offset = '+00:00'; |
|
| 10759 | + } else { |
|
| 10760 | + $offset = '+00:00'; |
|
| 10761 | + } |
|
| 10362 | 10762 | |
| 10363 | 10763 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
| 10364 | 10764 | |
@@ -10409,7 +10809,9 @@ discard block |
||
| 10409 | 10809 | date_default_timezone_set($globalTimezone); |
| 10410 | 10810 | $datetime = new DateTime(); |
| 10411 | 10811 | $offset = $datetime->format('P'); |
| 10412 | - } else $offset = '+00:00'; |
|
| 10812 | + } else { |
|
| 10813 | + $offset = '+00:00'; |
|
| 10814 | + } |
|
| 10413 | 10815 | |
| 10414 | 10816 | if ($globalDBdriver == 'mysql') { |
| 10415 | 10817 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10456,7 +10858,9 @@ discard block |
||
| 10456 | 10858 | date_default_timezone_set($globalTimezone); |
| 10457 | 10859 | $datetime = new DateTime(); |
| 10458 | 10860 | $offset = $datetime->format('P'); |
| 10459 | - } else $offset = '+00:00'; |
|
| 10861 | + } else { |
|
| 10862 | + $offset = '+00:00'; |
|
| 10863 | + } |
|
| 10460 | 10864 | |
| 10461 | 10865 | if ($globalDBdriver == 'mysql') { |
| 10462 | 10866 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10503,7 +10907,9 @@ discard block |
||
| 10503 | 10907 | date_default_timezone_set($globalTimezone); |
| 10504 | 10908 | $datetime = new DateTime(); |
| 10505 | 10909 | $offset = $datetime->format('P'); |
| 10506 | - } else $offset = '+00:00'; |
|
| 10910 | + } else { |
|
| 10911 | + $offset = '+00:00'; |
|
| 10912 | + } |
|
| 10507 | 10913 | |
| 10508 | 10914 | if ($globalDBdriver == 'mysql') { |
| 10509 | 10915 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10551,7 +10957,9 @@ discard block |
||
| 10551 | 10957 | date_default_timezone_set($globalTimezone); |
| 10552 | 10958 | $datetime = new DateTime(); |
| 10553 | 10959 | $offset = $datetime->format('P'); |
| 10554 | - } else $offset = '+00:00'; |
|
| 10960 | + } else { |
|
| 10961 | + $offset = '+00:00'; |
|
| 10962 | + } |
|
| 10555 | 10963 | |
| 10556 | 10964 | if ($globalDBdriver == 'mysql') { |
| 10557 | 10965 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10599,7 +11007,9 @@ discard block |
||
| 10599 | 11007 | date_default_timezone_set($globalTimezone); |
| 10600 | 11008 | $datetime = new DateTime($date); |
| 10601 | 11009 | $offset = $datetime->format('P'); |
| 10602 | - } else $offset = '+00:00'; |
|
| 11010 | + } else { |
|
| 11011 | + $offset = '+00:00'; |
|
| 11012 | + } |
|
| 10603 | 11013 | |
| 10604 | 11014 | if ($globalDBdriver == 'mysql') { |
| 10605 | 11015 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10647,7 +11057,9 @@ discard block |
||
| 10647 | 11057 | date_default_timezone_set($globalTimezone); |
| 10648 | 11058 | $datetime = new DateTime(); |
| 10649 | 11059 | $offset = $datetime->format('P'); |
| 10650 | - } else $offset = '+00:00'; |
|
| 11060 | + } else { |
|
| 11061 | + $offset = '+00:00'; |
|
| 11062 | + } |
|
| 10651 | 11063 | |
| 10652 | 11064 | if ($globalDBdriver == 'mysql') { |
| 10653 | 11065 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10694,7 +11106,9 @@ discard block |
||
| 10694 | 11106 | date_default_timezone_set($globalTimezone); |
| 10695 | 11107 | $datetime = new DateTime(); |
| 10696 | 11108 | $offset = $datetime->format('P'); |
| 10697 | - } else $offset = '+00:00'; |
|
| 11109 | + } else { |
|
| 11110 | + $offset = '+00:00'; |
|
| 11111 | + } |
|
| 10698 | 11112 | |
| 10699 | 11113 | if ($globalDBdriver == 'mysql') { |
| 10700 | 11114 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10741,7 +11155,9 @@ discard block |
||
| 10741 | 11155 | date_default_timezone_set($globalTimezone); |
| 10742 | 11156 | $datetime = new DateTime(); |
| 10743 | 11157 | $offset = $datetime->format('P'); |
| 10744 | - } else $offset = '+00:00'; |
|
| 11158 | + } else { |
|
| 11159 | + $offset = '+00:00'; |
|
| 11160 | + } |
|
| 10745 | 11161 | |
| 10746 | 11162 | if ($globalDBdriver == 'mysql') { |
| 10747 | 11163 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10791,7 +11207,9 @@ discard block |
||
| 10791 | 11207 | date_default_timezone_set($globalTimezone); |
| 10792 | 11208 | $datetime = new DateTime(); |
| 10793 | 11209 | $offset = $datetime->format('P'); |
| 10794 | - } else $offset = '+00:00'; |
|
| 11210 | + } else { |
|
| 11211 | + $offset = '+00:00'; |
|
| 11212 | + } |
|
| 10795 | 11213 | |
| 10796 | 11214 | if ($globalDBdriver == 'mysql') { |
| 10797 | 11215 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10838,7 +11256,9 @@ discard block |
||
| 10838 | 11256 | date_default_timezone_set($globalTimezone); |
| 10839 | 11257 | $datetime = new DateTime(); |
| 10840 | 11258 | $offset = $datetime->format('P'); |
| 10841 | - } else $offset = '+00:00'; |
|
| 11259 | + } else { |
|
| 11260 | + $offset = '+00:00'; |
|
| 11261 | + } |
|
| 10842 | 11262 | |
| 10843 | 11263 | if ($globalDBdriver == 'mysql') { |
| 10844 | 11264 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -11049,8 +11469,11 @@ discard block |
||
| 11049 | 11469 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 11050 | 11470 | } |
| 11051 | 11471 | } |
| 11052 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
| 11053 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11472 | + if (empty($query_values)) { |
|
| 11473 | + $queryi .= $this->getFilter($filters); |
|
| 11474 | + } else { |
|
| 11475 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11476 | + } |
|
| 11054 | 11477 | |
| 11055 | 11478 | $sth = $this->db->prepare($queryi); |
| 11056 | 11479 | $sth->execute($query_values); |
@@ -11128,8 +11551,11 @@ discard block |
||
| 11128 | 11551 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 11129 | 11552 | } |
| 11130 | 11553 | } |
| 11131 | - if ($query == '') $queryi .= $this->getFilter($filters); |
|
| 11132 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11554 | + if ($query == '') { |
|
| 11555 | + $queryi .= $this->getFilter($filters); |
|
| 11556 | + } else { |
|
| 11557 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11558 | + } |
|
| 11133 | 11559 | |
| 11134 | 11560 | |
| 11135 | 11561 | $sth = $this->db->prepare($queryi); |
@@ -11152,7 +11578,9 @@ discard block |
||
| 11152 | 11578 | date_default_timezone_set($globalTimezone); |
| 11153 | 11579 | $datetime = new DateTime(); |
| 11154 | 11580 | $offset = $datetime->format('P'); |
| 11155 | - } else $offset = '+00:00'; |
|
| 11581 | + } else { |
|
| 11582 | + $offset = '+00:00'; |
|
| 11583 | + } |
|
| 11156 | 11584 | |
| 11157 | 11585 | if ($globalDBdriver == 'mysql') { |
| 11158 | 11586 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -11338,7 +11766,9 @@ discard block |
||
| 11338 | 11766 | */ |
| 11339 | 11767 | public function parseDirection($direction = 0) |
| 11340 | 11768 | { |
| 11341 | - if ($direction == '') $direction = 0; |
|
| 11769 | + if ($direction == '') { |
|
| 11770 | + $direction = 0; |
|
| 11771 | + } |
|
| 11342 | 11772 | $direction_array = array(); |
| 11343 | 11773 | $temp_array = array(); |
| 11344 | 11774 | |
@@ -11439,7 +11869,9 @@ discard block |
||
| 11439 | 11869 | if (isset($result->AirlineFlightInfoResult)) |
| 11440 | 11870 | { |
| 11441 | 11871 | $registration = $result->AirlineFlightInfoResult->tailnumber; |
| 11442 | - } else return ''; |
|
| 11872 | + } else { |
|
| 11873 | + return ''; |
|
| 11874 | + } |
|
| 11443 | 11875 | |
| 11444 | 11876 | $registration = $this->convertAircraftRegistration($registration); |
| 11445 | 11877 | |
@@ -11473,7 +11905,9 @@ discard block |
||
| 11473 | 11905 | return $row['registration']; |
| 11474 | 11906 | } elseif ($source_type == 'flarm') { |
| 11475 | 11907 | return $this->getAircraftRegistrationBymodeS($aircraft_modes); |
| 11476 | - } else return ''; |
|
| 11908 | + } else { |
|
| 11909 | + return ''; |
|
| 11910 | + } |
|
| 11477 | 11911 | |
| 11478 | 11912 | } |
| 11479 | 11913 | |
@@ -11500,11 +11934,16 @@ discard block |
||
| 11500 | 11934 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 11501 | 11935 | $sth->closeCursor(); |
| 11502 | 11936 | if (count($row) > 0) { |
| 11503 | - if ($row['type_flight'] == null) return ''; |
|
| 11504 | - else return $row['type_flight']; |
|
| 11937 | + if ($row['type_flight'] == null) { |
|
| 11938 | + return ''; |
|
| 11939 | + } else { |
|
| 11940 | + return $row['type_flight']; |
|
| 11941 | + } |
|
| 11505 | 11942 | } elseif ($source_type == 'flarm') { |
| 11506 | 11943 | return $this->getAircraftTypeBymodeS($aircraft_modes); |
| 11507 | - } else return ''; |
|
| 11944 | + } else { |
|
| 11945 | + return ''; |
|
| 11946 | + } |
|
| 11508 | 11947 | |
| 11509 | 11948 | } |
| 11510 | 11949 | |
@@ -11522,7 +11961,9 @@ discard block |
||
| 11522 | 11961 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 11523 | 11962 | |
| 11524 | 11963 | $Connection = new Connection($this->db); |
| 11525 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 11964 | + if (!$Connection->tableExists('countries')) { |
|
| 11965 | + return ''; |
|
| 11966 | + } |
|
| 11526 | 11967 | |
| 11527 | 11968 | try { |
| 11528 | 11969 | /* |
@@ -11542,9 +11983,13 @@ discard block |
||
| 11542 | 11983 | $sth->closeCursor(); |
| 11543 | 11984 | if (count($row) > 0) { |
| 11544 | 11985 | return $row; |
| 11545 | - } else return ''; |
|
| 11986 | + } else { |
|
| 11987 | + return ''; |
|
| 11988 | + } |
|
| 11546 | 11989 | } catch (PDOException $e) { |
| 11547 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 11990 | + if (isset($globalDebug) && $globalDebug) { |
|
| 11991 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 11992 | + } |
|
| 11548 | 11993 | return ''; |
| 11549 | 11994 | } |
| 11550 | 11995 | |
@@ -11562,7 +12007,9 @@ discard block |
||
| 11562 | 12007 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
| 11563 | 12008 | |
| 11564 | 12009 | $Connection = new Connection($this->db); |
| 11565 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 12010 | + if (!$Connection->tableExists('countries')) { |
|
| 12011 | + return ''; |
|
| 12012 | + } |
|
| 11566 | 12013 | |
| 11567 | 12014 | try { |
| 11568 | 12015 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -11574,9 +12021,13 @@ discard block |
||
| 11574 | 12021 | $sth->closeCursor(); |
| 11575 | 12022 | if (count($row) > 0) { |
| 11576 | 12023 | return $row; |
| 11577 | - } else return ''; |
|
| 12024 | + } else { |
|
| 12025 | + return ''; |
|
| 12026 | + } |
|
| 11578 | 12027 | } catch (PDOException $e) { |
| 11579 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 12028 | + if (isset($globalDebug) && $globalDebug) { |
|
| 12029 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 12030 | + } |
|
| 11580 | 12031 | return ''; |
| 11581 | 12032 | } |
| 11582 | 12033 | |
@@ -11826,7 +12277,9 @@ discard block |
||
| 11826 | 12277 | { |
| 11827 | 12278 | global $globalBitlyAccessToken; |
| 11828 | 12279 | |
| 11829 | - if ($globalBitlyAccessToken == '') return $url; |
|
| 12280 | + if ($globalBitlyAccessToken == '') { |
|
| 12281 | + return $url; |
|
| 12282 | + } |
|
| 11830 | 12283 | |
| 11831 | 12284 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
| 11832 | 12285 | |
@@ -11975,7 +12428,9 @@ discard block |
||
| 11975 | 12428 | |
| 11976 | 12429 | |
| 11977 | 12430 | // routes |
| 11978 | - if ($globalDebug) print "Routes...\n"; |
|
| 12431 | + if ($globalDebug) { |
|
| 12432 | + print "Routes...\n"; |
|
| 12433 | + } |
|
| 11979 | 12434 | if ($globalDBdriver == 'mysql') { |
| 11980 | 12435 | $query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)"; |
| 11981 | 12436 | } else { |
@@ -11994,7 +12449,9 @@ discard block |
||
| 11994 | 12449 | } |
| 11995 | 12450 | } |
| 11996 | 12451 | |
| 11997 | - if ($globalDebug) print "Airlines...\n"; |
|
| 12452 | + if ($globalDebug) { |
|
| 12453 | + print "Airlines...\n"; |
|
| 12454 | + } |
|
| 11998 | 12455 | //airlines |
| 11999 | 12456 | if ($globalDBdriver == 'mysql') { |
| 12000 | 12457 | $query = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)"; |
@@ -12008,10 +12465,15 @@ discard block |
||
| 12008 | 12465 | if (is_numeric(substr($row['ident'], -1, 1))) |
| 12009 | 12466 | { |
| 12010 | 12467 | $fromsource = NULL; |
| 12011 | - if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 12012 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 12013 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 12014 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 12468 | + if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 12469 | + $fromsource = 'vatsim'; |
|
| 12470 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 12471 | + $fromsource = 'ivao'; |
|
| 12472 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 12473 | + $fromsource = 'vatsim'; |
|
| 12474 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 12475 | + $fromsource = 'ivao'; |
|
| 12476 | + } |
|
| 12015 | 12477 | $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
| 12016 | 12478 | if (isset($airline_array[0]['name'])) { |
| 12017 | 12479 | $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
@@ -12021,13 +12483,17 @@ discard block |
||
| 12021 | 12483 | } |
| 12022 | 12484 | } |
| 12023 | 12485 | |
| 12024 | - if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n"; |
|
| 12486 | + if ($globalDebug) { |
|
| 12487 | + print "Remove Duplicate in aircraft_modes...\n"; |
|
| 12488 | + } |
|
| 12025 | 12489 | //duplicate modes |
| 12026 | 12490 | $query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL"; |
| 12027 | 12491 | $sth = $this->db->prepare($query); |
| 12028 | 12492 | $sth->execute(); |
| 12029 | 12493 | |
| 12030 | - if ($globalDebug) print "Aircraft...\n"; |
|
| 12494 | + if ($globalDebug) { |
|
| 12495 | + print "Aircraft...\n"; |
|
| 12496 | + } |
|
| 12031 | 12497 | //aircraft |
| 12032 | 12498 | if ($globalDBdriver == 'mysql') { |
| 12033 | 12499 | $query = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -12070,26 +12536,38 @@ discard block |
||
| 12070 | 12536 | if (isset($closestAirports[0])) { |
| 12071 | 12537 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
| 12072 | 12538 | $airport_icao = $closestAirports[0]['icao']; |
| 12073 | - if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12539 | + if ($globalDebug) { |
|
| 12540 | + echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12541 | + } |
|
| 12074 | 12542 | } elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') { |
| 12075 | 12543 | foreach ($closestAirports as $airport) { |
| 12076 | 12544 | if ($row['arrival_airport_icao'] == $airport['icao']) { |
| 12077 | 12545 | $airport_icao = $airport['icao']; |
| 12078 | - if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12546 | + if ($globalDebug) { |
|
| 12547 | + echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12548 | + } |
|
| 12079 | 12549 | break; |
| 12080 | 12550 | } |
| 12081 | 12551 | } |
| 12082 | 12552 | } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
| 12083 | 12553 | $airport_icao = $closestAirports[0]['icao']; |
| 12084 | - if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 12554 | + if ($globalDebug) { |
|
| 12555 | + echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 12556 | + } |
|
| 12085 | 12557 | } else { |
| 12086 | - if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 12558 | + if ($globalDebug) { |
|
| 12559 | + echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 12560 | + } |
|
| 12087 | 12561 | } |
| 12088 | 12562 | } else { |
| 12089 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 12563 | + if ($globalDebug) { |
|
| 12564 | + echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 12565 | + } |
|
| 12090 | 12566 | } |
| 12091 | 12567 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
| 12092 | - if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
|
| 12568 | + if ($globalDebug) { |
|
| 12569 | + echo "Updating airport to ".$airport_icao."...\n"; |
|
| 12570 | + } |
|
| 12093 | 12571 | $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
| 12094 | 12572 | $sthu = $this->db->prepare($update_query); |
| 12095 | 12573 | $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
@@ -6,12 +6,12 @@ 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 == '' && isset($globalFilter)) { |
| 11 | 11 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
| 12 | 12 | } |
| 13 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
| 14 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
| 13 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
| 14 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
| 15 | 15 | |
| 16 | 16 | require_once('header.php'); |
| 17 | 17 | |
@@ -23,10 +23,10 @@ discard block |
||
| 23 | 23 | </div> |
| 24 | 24 | <p>'._("Below are the <strong>Top 10</strong> most common aircraft types.").'</p>'; |
| 25 | 25 | |
| 26 | -$aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
| 26 | +$aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month); |
|
| 27 | 27 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
| 28 | 28 | $aircraft_data = ''; |
| 29 | -foreach($aircraft_array as $aircraft_item) |
|
| 29 | +foreach ($aircraft_array as $aircraft_item) |
|
| 30 | 30 | { |
| 31 | 31 | $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
| 32 | 32 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | print '</thead>'; |
| 52 | 52 | print '<tbody>'; |
| 53 | 53 | $i = 1; |
| 54 | - foreach($aircraft_array as $aircraft_item) |
|
| 54 | + foreach ($aircraft_array as $aircraft_item) |
|
| 55 | 55 | { |
| 56 | 56 | print '<tr>'; |
| 57 | 57 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -6,12 +6,12 @@ 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 == '' && isset($globalFilter)) { |
| 11 | 11 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
| 12 | 12 | } |
| 13 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
| 14 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
| 13 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
| 14 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
| 15 | 15 | require_once('header.php'); |
| 16 | 16 | include('statistics-sub-menu.php'); |
| 17 | 17 | |
@@ -22,10 +22,10 @@ discard block |
||
| 22 | 22 | </div> |
| 23 | 23 | <p>'._("Below are the <strong>Top 10</strong> most common ident/callsigns of all airlines.").'</p>'; |
| 24 | 24 | |
| 25 | -$callsign_array = $Stats->countAllCallsigns(true,$airline_icao,$filter_name,$year,$month); |
|
| 25 | +$callsign_array = $Stats->countAllCallsigns(true, $airline_icao, $filter_name, $year, $month); |
|
| 26 | 26 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
| 27 | 27 | $callsign_data = ''; |
| 28 | -foreach($callsign_array as $callsign_item) |
|
| 28 | +foreach ($callsign_array as $callsign_item) |
|
| 29 | 29 | { |
| 30 | 30 | $callsign_data .= '[ "'.$callsign_item['callsign_icao'].' ('.$callsign_item['airline_name'].')",'.$callsign_item['callsign_icao_count'].'],'; |
| 31 | 31 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | print '</thead>'; |
| 52 | 52 | print '<tbody>'; |
| 53 | 53 | $i = 1; |
| 54 | - foreach($callsign_array as $callsign_item) |
|
| 54 | + foreach ($callsign_array as $callsign_item) |
|
| 55 | 55 | { |
| 56 | 56 | print '<tr>'; |
| 57 | 57 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | $title = _("Statistics").' - '._("Busiest Month of Last Year"); |
| 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 == '' && isset($globalFilter)) { |
| 11 | 11 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
| 12 | 12 | } |
@@ -22,17 +22,17 @@ discard block |
||
| 22 | 22 | </div> |
| 23 | 23 | <p>'._("Below is a chart that plots the busiest day during the <strong>last month</strong>.").'</p>'; |
| 24 | 24 | |
| 25 | -$date_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
| 25 | +$date_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name); |
|
| 26 | 26 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
| 27 | 27 | $month_data = ''; |
| 28 | 28 | $month_cnt = ''; |
| 29 | -foreach($date_array as $month_item) |
|
| 29 | +foreach ($date_array as $month_item) |
|
| 30 | 30 | { |
| 31 | 31 | $month_data .= '"'.$month_item['date_name'].'",'; |
| 32 | 32 | $month_cnt .= $month_item['date_count'].','; |
| 33 | 33 | } |
| 34 | 34 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
| 35 | -$month_cnt = "['flights',".substr($month_cnt,0,-1)."]"; |
|
| 35 | +$month_cnt = "['flights',".substr($month_cnt, 0, -1)."]"; |
|
| 36 | 36 | print 'c3.generate({ |
| 37 | 37 | bindto: "#chart", |
| 38 | 38 | data: { x: "x", |
@@ -52,12 +52,12 @@ discard block |
||
| 52 | 52 | print '</thead>'; |
| 53 | 53 | print '<tbody>'; |
| 54 | 54 | $i = 1; |
| 55 | - foreach($date_array as $date_item) |
|
| 55 | + foreach ($date_array as $date_item) |
|
| 56 | 56 | { |
| 57 | 57 | print '<tr>'; |
| 58 | 58 | print '<td><strong>'.$i.'</strong></td>'; |
| 59 | 59 | print '<td>'; |
| 60 | - print '<a href="'.$globalURL.'/date/'.date('Y-m-d',strtotime($date_item['date_name'])).'">'.date("l F j, Y", strtotime($date_item['date_name'])).'</a>'; |
|
| 60 | + print '<a href="'.$globalURL.'/date/'.date('Y-m-d', strtotime($date_item['date_name'])).'">'.date("l F j, Y", strtotime($date_item['date_name'])).'</a>'; |
|
| 61 | 61 | print '</td>'; |
| 62 | 62 | print '<td>'; |
| 63 | 63 | print $date_item['date_count']; |