@@ -4,7 +4,9 @@ |
||
| 4 | 4 | require_once('require/class.Language.php'); |
| 5 | 5 | $Stats = new Stats(); |
| 6 | 6 | $title = _("Statistics").' - '._("Most common Airline by Country"); |
| 7 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 7 | +if (!isset($filter_name)) { |
|
| 8 | + $filter_name = ''; |
|
| 9 | +} |
|
| 8 | 10 | require_once('header.php'); |
| 9 | 11 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 10 | 12 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -5,7 +5,9 @@ discard block |
||
| 5 | 5 | $Stats = new Stats(); |
| 6 | 6 | $title = _("Statistics").' - '._("Most common owners"); |
| 7 | 7 | |
| 8 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 8 | +if (!isset($filter_name)) { |
|
| 9 | + $filter_name = ''; |
|
| 10 | +} |
|
| 9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 12 | if ($airline_icao == 'all') { |
| 11 | 13 | unset($_COOKIE['stats_airline_icao']); |
@@ -14,8 +16,10 @@ discard block |
||
| 14 | 16 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | 17 | $airline_icao = $_COOKIE['stats_airline_icao']; |
| 16 | 18 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 18 | -} |
|
| 19 | + if (isset($globalFilter['airline'])) { |
|
| 20 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 21 | + } |
|
| 22 | + } |
|
| 19 | 23 | setcookie('stats_airline_icao',$airline_icao); |
| 20 | 24 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 21 | 25 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -5,7 +5,9 @@ discard block |
||
| 5 | 5 | $Stats = new Stats(); |
| 6 | 6 | $title = _("Statistics").' - '._("Most common Pilots"); |
| 7 | 7 | |
| 8 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 8 | +if (!isset($filter_name)) { |
|
| 9 | + $filter_name = ''; |
|
| 10 | +} |
|
| 9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 12 | if ($airline_icao == 'all') { |
| 11 | 13 | unset($_COOKIE['stats_airline_icao']); |
@@ -14,8 +16,10 @@ discard block |
||
| 14 | 16 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | 17 | $airline_icao = $_COOKIE['stats_airline_icao']; |
| 16 | 18 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 18 | -} |
|
| 19 | + if (isset($globalFilter['airline'])) { |
|
| 20 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 21 | + } |
|
| 22 | + } |
|
| 19 | 23 | setcookie('stats_airline_icao',$airline_icao); |
| 20 | 24 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 21 | 25 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -12,7 +12,9 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | public function __construct($dbc = null) { |
| 14 | 14 | global $globalFilterName; |
| 15 | - if (isset($globalFilterName)) $this->filter_name = $globalFilterName; |
|
| 15 | + if (isset($globalFilterName)) { |
|
| 16 | + $this->filter_name = $globalFilterName; |
|
| 17 | + } |
|
| 16 | 18 | $Connection = new Connection($dbc); |
| 17 | 19 | $this->db = $Connection->db(); |
| 18 | 20 | } |
@@ -77,7 +79,9 @@ discard block |
||
| 77 | 79 | } |
| 78 | 80 | } |
| 79 | 81 | public function getAllAirlineNames($filter_name = '') { |
| 80 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 82 | + if ($filter_name == '') { |
|
| 83 | + $filter_name = $this->filter_name; |
|
| 84 | + } |
|
| 81 | 85 | $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
| 82 | 86 | try { |
| 83 | 87 | $sth = $this->db->prepare($query); |
@@ -89,7 +93,9 @@ discard block |
||
| 89 | 93 | return $all; |
| 90 | 94 | } |
| 91 | 95 | public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
| 92 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 96 | + if ($filter_name == '') { |
|
| 97 | + $filter_name = $this->filter_name; |
|
| 98 | + } |
|
| 93 | 99 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
| 94 | 100 | try { |
| 95 | 101 | $sth = $this->db->prepare($query); |
@@ -101,7 +107,9 @@ discard block |
||
| 101 | 107 | return $all; |
| 102 | 108 | } |
| 103 | 109 | public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
| 104 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 110 | + if ($filter_name == '') { |
|
| 111 | + $filter_name = $this->filter_name; |
|
| 112 | + } |
|
| 105 | 113 | $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC"; |
| 106 | 114 | try { |
| 107 | 115 | $sth = $this->db->prepare($query); |
@@ -113,7 +121,9 @@ discard block |
||
| 113 | 121 | return $all; |
| 114 | 122 | } |
| 115 | 123 | public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
| 116 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 124 | + if ($filter_name == '') { |
|
| 125 | + $filter_name = $this->filter_name; |
|
| 126 | + } |
|
| 117 | 127 | $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
| 118 | 128 | try { |
| 119 | 129 | $sth = $this->db->prepare($query); |
@@ -128,10 +138,15 @@ discard block |
||
| 128 | 138 | |
| 129 | 139 | public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 130 | 140 | global $globalStatsFilters; |
| 131 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 141 | + if ($filter_name == '') { |
|
| 142 | + $filter_name = $this->filter_name; |
|
| 143 | + } |
|
| 132 | 144 | if ($year == '' && $month == '') { |
| 133 | - if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 134 | - else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 145 | + if ($limit) { |
|
| 146 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 147 | + } else { |
|
| 148 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 149 | + } |
|
| 135 | 150 | try { |
| 136 | 151 | $sth = $this->db->prepare($query); |
| 137 | 152 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -139,7 +154,9 @@ discard block |
||
| 139 | 154 | echo "error : ".$e->getMessage(); |
| 140 | 155 | } |
| 141 | 156 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 142 | - } else $all = array(); |
|
| 157 | + } else { |
|
| 158 | + $all = array(); |
|
| 159 | + } |
|
| 143 | 160 | if (empty($all)) { |
| 144 | 161 | $filters = array('airlines' => array($stats_airline)); |
| 145 | 162 | if ($filter_name != '') { |
@@ -152,10 +169,15 @@ discard block |
||
| 152 | 169 | } |
| 153 | 170 | public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
| 154 | 171 | global $globalStatsFilters; |
| 155 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 172 | + if ($filter_name == '') { |
|
| 173 | + $filter_name = $this->filter_name; |
|
| 174 | + } |
|
| 156 | 175 | if ($year == '' && $month == '') { |
| 157 | - if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 158 | - else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC"; |
|
| 176 | + if ($limit) { |
|
| 177 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 178 | + } else { |
|
| 179 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC"; |
|
| 180 | + } |
|
| 159 | 181 | try { |
| 160 | 182 | $sth = $this->db->prepare($query); |
| 161 | 183 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -163,7 +185,9 @@ discard block |
||
| 163 | 185 | echo "error : ".$e->getMessage(); |
| 164 | 186 | } |
| 165 | 187 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 166 | - } else $all = array(); |
|
| 188 | + } else { |
|
| 189 | + $all = array(); |
|
| 190 | + } |
|
| 167 | 191 | if (empty($all)) { |
| 168 | 192 | $Spotter = new Spotter($this->db); |
| 169 | 193 | $filters = array(); |
@@ -176,10 +200,15 @@ discard block |
||
| 176 | 200 | } |
| 177 | 201 | public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 178 | 202 | global $globalStatsFilters; |
| 179 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 203 | + if ($filter_name == '') { |
|
| 204 | + $filter_name = $this->filter_name; |
|
| 205 | + } |
|
| 180 | 206 | if ($year == '' && $month == '') { |
| 181 | - if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
| 182 | - else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
| 207 | + if ($limit) { |
|
| 208 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
| 209 | + } else { |
|
| 210 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
| 211 | + } |
|
| 183 | 212 | try { |
| 184 | 213 | $sth = $this->db->prepare($query); |
| 185 | 214 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -187,7 +216,9 @@ discard block |
||
| 187 | 216 | echo "error : ".$e->getMessage(); |
| 188 | 217 | } |
| 189 | 218 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 190 | - } else $all = array(); |
|
| 219 | + } else { |
|
| 220 | + $all = array(); |
|
| 221 | + } |
|
| 191 | 222 | if (empty($all)) { |
| 192 | 223 | $filters = array('airlines' => array($stats_airline)); |
| 193 | 224 | if ($filter_name != '') { |
@@ -201,10 +232,15 @@ discard block |
||
| 201 | 232 | |
| 202 | 233 | public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 203 | 234 | global $globalStatsFilters; |
| 204 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 235 | + if ($filter_name == '') { |
|
| 236 | + $filter_name = $this->filter_name; |
|
| 237 | + } |
|
| 205 | 238 | if ($year == '' && $month == '') { |
| 206 | - if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 207 | - else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
|
| 239 | + if ($limit) { |
|
| 240 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 241 | + } else { |
|
| 242 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
|
| 243 | + } |
|
| 208 | 244 | try { |
| 209 | 245 | $sth = $this->db->prepare($query); |
| 210 | 246 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -212,7 +248,9 @@ discard block |
||
| 212 | 248 | echo "error : ".$e->getMessage(); |
| 213 | 249 | } |
| 214 | 250 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 215 | - } else $all = array(); |
|
| 251 | + } else { |
|
| 252 | + $all = array(); |
|
| 253 | + } |
|
| 216 | 254 | if (empty($all)) { |
| 217 | 255 | $filters = array('airlines' => array($stats_airline)); |
| 218 | 256 | if ($filter_name != '') { |
@@ -225,9 +263,14 @@ discard block |
||
| 225 | 263 | } |
| 226 | 264 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
| 227 | 265 | global $globalStatsFilters; |
| 228 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 229 | - if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 230 | - else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
|
| 266 | + if ($filter_name == '') { |
|
| 267 | + $filter_name = $this->filter_name; |
|
| 268 | + } |
|
| 269 | + if ($limit) { |
|
| 270 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 271 | + } else { |
|
| 272 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
|
| 273 | + } |
|
| 231 | 274 | try { |
| 232 | 275 | $sth = $this->db->prepare($query); |
| 233 | 276 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -248,10 +291,15 @@ discard block |
||
| 248 | 291 | |
| 249 | 292 | public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
| 250 | 293 | global $globalStatsFilters; |
| 251 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 294 | + if ($filter_name == '') { |
|
| 295 | + $filter_name = $this->filter_name; |
|
| 296 | + } |
|
| 252 | 297 | if ($year == '' && $month == '') { |
| 253 | - if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 254 | - else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC"; |
|
| 298 | + if ($limit) { |
|
| 299 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 300 | + } else { |
|
| 301 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC"; |
|
| 302 | + } |
|
| 255 | 303 | try { |
| 256 | 304 | $sth = $this->db->prepare($query); |
| 257 | 305 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -259,7 +307,9 @@ discard block |
||
| 259 | 307 | echo "error : ".$e->getMessage(); |
| 260 | 308 | } |
| 261 | 309 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 262 | - } else $all = array(); |
|
| 310 | + } else { |
|
| 311 | + $all = array(); |
|
| 312 | + } |
|
| 263 | 313 | if (empty($all)) { |
| 264 | 314 | $Spotter = new Spotter($this->db); |
| 265 | 315 | $filters = array(); |
@@ -273,10 +323,15 @@ discard block |
||
| 273 | 323 | } |
| 274 | 324 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 275 | 325 | global $globalStatsFilters; |
| 276 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 326 | + if ($filter_name == '') { |
|
| 327 | + $filter_name = $this->filter_name; |
|
| 328 | + } |
|
| 277 | 329 | if ($year == '' && $month == '') { |
| 278 | - if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
| 279 | - else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
| 330 | + if ($limit) { |
|
| 331 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
| 332 | + } else { |
|
| 333 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
| 334 | + } |
|
| 280 | 335 | try { |
| 281 | 336 | $sth = $this->db->prepare($query); |
| 282 | 337 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -284,7 +339,9 @@ discard block |
||
| 284 | 339 | echo "error : ".$e->getMessage(); |
| 285 | 340 | } |
| 286 | 341 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 287 | - } else $all = array(); |
|
| 342 | + } else { |
|
| 343 | + $all = array(); |
|
| 344 | + } |
|
| 288 | 345 | if (empty($all)) { |
| 289 | 346 | $filters = array('airlines' => array($stats_airline)); |
| 290 | 347 | if ($filter_name != '') { |
@@ -297,10 +354,15 @@ discard block |
||
| 297 | 354 | } |
| 298 | 355 | public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 299 | 356 | global $globalStatsFilters; |
| 300 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 357 | + if ($filter_name == '') { |
|
| 358 | + $filter_name = $this->filter_name; |
|
| 359 | + } |
|
| 301 | 360 | if ($year == '' && $month == '') { |
| 302 | - if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 303 | - else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
| 361 | + if ($limit) { |
|
| 362 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 363 | + } else { |
|
| 364 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
| 365 | + } |
|
| 304 | 366 | try { |
| 305 | 367 | $sth = $this->db->prepare($query); |
| 306 | 368 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -308,7 +370,9 @@ discard block |
||
| 308 | 370 | echo "error : ".$e->getMessage(); |
| 309 | 371 | } |
| 310 | 372 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 311 | - } else $all = array(); |
|
| 373 | + } else { |
|
| 374 | + $all = array(); |
|
| 375 | + } |
|
| 312 | 376 | if (empty($all)) { |
| 313 | 377 | $filters = array('airlines' => array($stats_airline)); |
| 314 | 378 | if ($filter_name != '') { |
@@ -321,11 +385,16 @@ discard block |
||
| 321 | 385 | } |
| 322 | 386 | public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 323 | 387 | $Connection = new Connection(); |
| 324 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 388 | + if ($filter_name == '') { |
|
| 389 | + $filter_name = $this->filter_name; |
|
| 390 | + } |
|
| 325 | 391 | if ($Connection->tableExists('countries')) { |
| 326 | 392 | if ($year == '' && $month == '') { |
| 327 | - if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
| 328 | - else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
| 393 | + if ($limit) { |
|
| 394 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
| 395 | + } else { |
|
| 396 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
| 397 | + } |
|
| 329 | 398 | try { |
| 330 | 399 | $sth = $this->db->prepare($query); |
| 331 | 400 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -340,17 +409,24 @@ discard block |
||
| 340 | 409 | } |
| 341 | 410 | */ |
| 342 | 411 | return $all; |
| 343 | - } else return array(); |
|
| 412 | + } else { |
|
| 413 | + return array(); |
|
| 414 | + } |
|
| 344 | 415 | } else { |
| 345 | 416 | return array(); |
| 346 | 417 | } |
| 347 | 418 | } |
| 348 | 419 | public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
| 349 | 420 | global $globalStatsFilters; |
| 350 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 421 | + if ($filter_name == '') { |
|
| 422 | + $filter_name = $this->filter_name; |
|
| 423 | + } |
|
| 351 | 424 | if ($year == '' && $month == '') { |
| 352 | - if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
|
| 353 | - else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
|
| 425 | + if ($limit) { |
|
| 426 | + $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
|
| 427 | + } else { |
|
| 428 | + $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
|
| 429 | + } |
|
| 354 | 430 | try { |
| 355 | 431 | $sth = $this->db->prepare($query); |
| 356 | 432 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -358,7 +434,9 @@ discard block |
||
| 358 | 434 | echo "error : ".$e->getMessage(); |
| 359 | 435 | } |
| 360 | 436 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 361 | - } else $all = array(); |
|
| 437 | + } else { |
|
| 438 | + $all = array(); |
|
| 439 | + } |
|
| 362 | 440 | if (empty($all)) { |
| 363 | 441 | $filters = array('airlines' => array($stats_airline)); |
| 364 | 442 | if ($filter_name != '') { |
@@ -372,10 +450,15 @@ discard block |
||
| 372 | 450 | |
| 373 | 451 | public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
| 374 | 452 | global $globalStatsFilters; |
| 375 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 453 | + if ($filter_name == '') { |
|
| 454 | + $filter_name = $this->filter_name; |
|
| 455 | + } |
|
| 376 | 456 | if ($year == '' && $month == '') { |
| 377 | - if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
| 378 | - else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
| 457 | + if ($limit) { |
|
| 458 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
| 459 | + } else { |
|
| 460 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
| 461 | + } |
|
| 379 | 462 | try { |
| 380 | 463 | $sth = $this->db->prepare($query); |
| 381 | 464 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -383,7 +466,9 @@ discard block |
||
| 383 | 466 | echo "error : ".$e->getMessage(); |
| 384 | 467 | } |
| 385 | 468 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 386 | - } else $all = array(); |
|
| 469 | + } else { |
|
| 470 | + $all = array(); |
|
| 471 | + } |
|
| 387 | 472 | if (empty($all)) { |
| 388 | 473 | $filters = array('airlines' => array($stats_airline)); |
| 389 | 474 | if ($filter_name != '') { |
@@ -396,10 +481,15 @@ discard block |
||
| 396 | 481 | } |
| 397 | 482 | public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 398 | 483 | global $globalStatsFilters; |
| 399 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 484 | + if ($filter_name == '') { |
|
| 485 | + $filter_name = $this->filter_name; |
|
| 486 | + } |
|
| 400 | 487 | if ($year == '' && $month == '') { |
| 401 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 402 | - else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
| 488 | + if ($limit) { |
|
| 489 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 490 | + } else { |
|
| 491 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
| 492 | + } |
|
| 403 | 493 | try { |
| 404 | 494 | $sth = $this->db->prepare($query); |
| 405 | 495 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -407,7 +497,9 @@ discard block |
||
| 407 | 497 | echo "error : ".$e->getMessage(); |
| 408 | 498 | } |
| 409 | 499 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 410 | - } else $all = array(); |
|
| 500 | + } else { |
|
| 501 | + $all = array(); |
|
| 502 | + } |
|
| 411 | 503 | if (empty($all)) { |
| 412 | 504 | $filters = array('airlines' => array($stats_airline)); |
| 413 | 505 | if ($filter_name != '') { |
@@ -426,7 +518,9 @@ discard block |
||
| 426 | 518 | $icao = $value['airport_departure_icao']; |
| 427 | 519 | if (isset($all[$icao])) { |
| 428 | 520 | $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 429 | - } else $all[$icao] = $value; |
|
| 521 | + } else { |
|
| 522 | + $all[$icao] = $value; |
|
| 523 | + } |
|
| 430 | 524 | } |
| 431 | 525 | $count = array(); |
| 432 | 526 | foreach ($all as $key => $row) { |
@@ -438,10 +532,15 @@ discard block |
||
| 438 | 532 | } |
| 439 | 533 | public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 440 | 534 | global $globalStatsFilters; |
| 441 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 535 | + if ($filter_name == '') { |
|
| 536 | + $filter_name = $this->filter_name; |
|
| 537 | + } |
|
| 442 | 538 | if ($year == '' && $month == '') { |
| 443 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 444 | - else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
| 539 | + if ($limit) { |
|
| 540 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 541 | + } else { |
|
| 542 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
| 543 | + } |
|
| 445 | 544 | try { |
| 446 | 545 | $sth = $this->db->prepare($query); |
| 447 | 546 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -449,7 +548,9 @@ discard block |
||
| 449 | 548 | echo "error : ".$e->getMessage(); |
| 450 | 549 | } |
| 451 | 550 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 452 | - } else $all = array(); |
|
| 551 | + } else { |
|
| 552 | + $all = array(); |
|
| 553 | + } |
|
| 453 | 554 | if (empty($all)) { |
| 454 | 555 | $filters = array('airlines' => array($stats_airline)); |
| 455 | 556 | if ($filter_name != '') { |
@@ -468,7 +569,9 @@ discard block |
||
| 468 | 569 | $icao = $value['airport_arrival_icao']; |
| 469 | 570 | if (isset($all[$icao])) { |
| 470 | 571 | $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 471 | - } else $all[$icao] = $value; |
|
| 572 | + } else { |
|
| 573 | + $all[$icao] = $value; |
|
| 574 | + } |
|
| 472 | 575 | } |
| 473 | 576 | $count = array(); |
| 474 | 577 | foreach ($all as $key => $row) { |
@@ -481,13 +584,21 @@ discard block |
||
| 481 | 584 | } |
| 482 | 585 | public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
| 483 | 586 | global $globalDBdriver, $globalStatsFilters; |
| 484 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 587 | + if ($filter_name == '') { |
|
| 588 | + $filter_name = $this->filter_name; |
|
| 589 | + } |
|
| 485 | 590 | if ($globalDBdriver == 'mysql') { |
| 486 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 487 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 591 | + if ($limit) { |
|
| 592 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 593 | + } else { |
|
| 594 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 595 | + } |
|
| 488 | 596 | } else { |
| 489 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 490 | - else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 597 | + if ($limit) { |
|
| 598 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 599 | + } else { |
|
| 600 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 601 | + } |
|
| 491 | 602 | } |
| 492 | 603 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 493 | 604 | try { |
@@ -511,7 +622,9 @@ discard block |
||
| 511 | 622 | |
| 512 | 623 | public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
| 513 | 624 | global $globalStatsFilters; |
| 514 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 625 | + if ($filter_name == '') { |
|
| 626 | + $filter_name = $this->filter_name; |
|
| 627 | + } |
|
| 515 | 628 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 516 | 629 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 517 | 630 | try { |
@@ -533,7 +646,9 @@ discard block |
||
| 533 | 646 | } |
| 534 | 647 | public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
| 535 | 648 | global $globalDBdriver, $globalStatsFilters; |
| 536 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 649 | + if ($filter_name == '') { |
|
| 650 | + $filter_name = $this->filter_name; |
|
| 651 | + } |
|
| 537 | 652 | if ($globalDBdriver == 'mysql') { |
| 538 | 653 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 539 | 654 | } else { |
@@ -559,7 +674,9 @@ discard block |
||
| 559 | 674 | } |
| 560 | 675 | public function countAllDates($stats_airline = '',$filter_name = '') { |
| 561 | 676 | global $globalStatsFilters; |
| 562 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 677 | + if ($filter_name == '') { |
|
| 678 | + $filter_name = $this->filter_name; |
|
| 679 | + } |
|
| 563 | 680 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 564 | 681 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 565 | 682 | try { |
@@ -581,7 +698,9 @@ discard block |
||
| 581 | 698 | } |
| 582 | 699 | public function countAllDatesByAirlines($filter_name = '') { |
| 583 | 700 | global $globalStatsFilters; |
| 584 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 701 | + if ($filter_name == '') { |
|
| 702 | + $filter_name = $this->filter_name; |
|
| 703 | + } |
|
| 585 | 704 | $query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name"; |
| 586 | 705 | $query_data = array('filter_name' => $filter_name); |
| 587 | 706 | try { |
@@ -603,7 +722,9 @@ discard block |
||
| 603 | 722 | } |
| 604 | 723 | public function countAllMonths($stats_airline = '',$filter_name = '') { |
| 605 | 724 | global $globalStatsFilters; |
| 606 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 725 | + if ($filter_name == '') { |
|
| 726 | + $filter_name = $this->filter_name; |
|
| 727 | + } |
|
| 607 | 728 | $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 608 | 729 | try { |
| 609 | 730 | $sth = $this->db->prepare($query); |
@@ -624,7 +745,9 @@ discard block |
||
| 624 | 745 | } |
| 625 | 746 | public function countAllMilitaryMonths($filter_name = '') { |
| 626 | 747 | global $globalStatsFilters; |
| 627 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 748 | + if ($filter_name == '') { |
|
| 749 | + $filter_name = $this->filter_name; |
|
| 750 | + } |
|
| 628 | 751 | $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name"; |
| 629 | 752 | try { |
| 630 | 753 | $sth = $this->db->prepare($query); |
@@ -645,9 +768,14 @@ discard block |
||
| 645 | 768 | } |
| 646 | 769 | public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
| 647 | 770 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
| 648 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 649 | - if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 650 | - else $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 771 | + if ($filter_name == '') { |
|
| 772 | + $filter_name = $this->filter_name; |
|
| 773 | + } |
|
| 774 | + if ($limit) { |
|
| 775 | + $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 776 | + } else { |
|
| 777 | + $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 778 | + } |
|
| 651 | 779 | if ($orderby == 'hour') { |
| 652 | 780 | /* |
| 653 | 781 | if ($globalDBdriver == 'mysql') { |
@@ -656,7 +784,9 @@ discard block |
||
| 656 | 784 | */ |
| 657 | 785 | $query .= " ORDER BY CAST(flight_date AS integer) ASC"; |
| 658 | 786 | } |
| 659 | - if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
|
| 787 | + if ($orderby == 'count') { |
|
| 788 | + $query .= " ORDER BY hour_count DESC"; |
|
| 789 | + } |
|
| 660 | 790 | try { |
| 661 | 791 | $sth = $this->db->prepare($query); |
| 662 | 792 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
@@ -677,8 +807,12 @@ discard block |
||
| 677 | 807 | |
| 678 | 808 | public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
| 679 | 809 | global $globalStatsFilters; |
| 680 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 681 | - if ($year == '') $year = date('Y'); |
|
| 810 | + if ($filter_name == '') { |
|
| 811 | + $filter_name = $this->filter_name; |
|
| 812 | + } |
|
| 813 | + if ($year == '') { |
|
| 814 | + $year = date('Y'); |
|
| 815 | + } |
|
| 682 | 816 | $all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
| 683 | 817 | if (empty($all)) { |
| 684 | 818 | $filters = array('airlines' => array($stats_airline)); |
@@ -692,8 +826,12 @@ discard block |
||
| 692 | 826 | } |
| 693 | 827 | public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
| 694 | 828 | global $globalStatsFilters; |
| 695 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 696 | - if ($year == '') $year = date('Y'); |
|
| 829 | + if ($filter_name == '') { |
|
| 830 | + $filter_name = $this->filter_name; |
|
| 831 | + } |
|
| 832 | + if ($year == '') { |
|
| 833 | + $year = date('Y'); |
|
| 834 | + } |
|
| 697 | 835 | $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
| 698 | 836 | if (empty($all)) { |
| 699 | 837 | $filters = array(); |
@@ -707,8 +845,12 @@ discard block |
||
| 707 | 845 | } |
| 708 | 846 | public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
| 709 | 847 | global $globalStatsFilters; |
| 710 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 711 | - if ($year == '') $year = date('Y'); |
|
| 848 | + if ($filter_name == '') { |
|
| 849 | + $filter_name = $this->filter_name; |
|
| 850 | + } |
|
| 851 | + if ($year == '') { |
|
| 852 | + $year = date('Y'); |
|
| 853 | + } |
|
| 712 | 854 | $all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
| 713 | 855 | if (empty($all)) { |
| 714 | 856 | $filters = array('airlines' => array($stats_airline)); |
@@ -722,8 +864,12 @@ discard block |
||
| 722 | 864 | } |
| 723 | 865 | public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
| 724 | 866 | global $globalStatsFilters; |
| 725 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 726 | - if ($year == '') $year = date('Y'); |
|
| 867 | + if ($filter_name == '') { |
|
| 868 | + $filter_name = $this->filter_name; |
|
| 869 | + } |
|
| 870 | + if ($year == '') { |
|
| 871 | + $year = date('Y'); |
|
| 872 | + } |
|
| 727 | 873 | $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
| 728 | 874 | if (empty($all)) { |
| 729 | 875 | $filters = array('airlines' => array($stats_airline)); |
@@ -737,7 +883,9 @@ discard block |
||
| 737 | 883 | } |
| 738 | 884 | public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
| 739 | 885 | global $globalStatsFilters; |
| 740 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 886 | + if ($filter_name == '') { |
|
| 887 | + $filter_name = $this->filter_name; |
|
| 888 | + } |
|
| 741 | 889 | if ($year == '' && $month == '') { |
| 742 | 890 | $query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name"; |
| 743 | 891 | try { |
@@ -748,7 +896,9 @@ discard block |
||
| 748 | 896 | } |
| 749 | 897 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 750 | 898 | $all = $result[0]['nb_airline']; |
| 751 | - } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
| 899 | + } else { |
|
| 900 | + $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
| 901 | + } |
|
| 752 | 902 | if (empty($all)) { |
| 753 | 903 | $filters = array(); |
| 754 | 904 | if ($filter_name != '') { |
@@ -761,8 +911,12 @@ discard block |
||
| 761 | 911 | } |
| 762 | 912 | public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
| 763 | 913 | global $globalStatsFilters; |
| 764 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 765 | - if ($year == '') $year = date('Y'); |
|
| 914 | + if ($filter_name == '') { |
|
| 915 | + $filter_name = $this->filter_name; |
|
| 916 | + } |
|
| 917 | + if ($year == '') { |
|
| 918 | + $year = date('Y'); |
|
| 919 | + } |
|
| 766 | 920 | /* |
| 767 | 921 | $query = "SELECT COUNT(*) AS nb_owner FROM stats_owner"; |
| 768 | 922 | try { |
@@ -787,8 +941,12 @@ discard block |
||
| 787 | 941 | } |
| 788 | 942 | public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 789 | 943 | global $globalStatsFilters; |
| 790 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 791 | - if ($year == '') $year = date('Y'); |
|
| 944 | + if ($filter_name == '') { |
|
| 945 | + $filter_name = $this->filter_name; |
|
| 946 | + } |
|
| 947 | + if ($year == '') { |
|
| 948 | + $year = date('Y'); |
|
| 949 | + } |
|
| 792 | 950 | $all = $this->getSumStats('pilots_bymonth',$year,$stats_airline,$filter_name,$month); |
| 793 | 951 | if (empty($all)) { |
| 794 | 952 | $filters = array('airlines' => array($stats_airline)); |
@@ -802,7 +960,9 @@ discard block |
||
| 802 | 960 | } |
| 803 | 961 | |
| 804 | 962 | public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
| 805 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 963 | + if ($filter_name == '') { |
|
| 964 | + $filter_name = $this->filter_name; |
|
| 965 | + } |
|
| 806 | 966 | $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date"; |
| 807 | 967 | $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
| 808 | 968 | try { |
@@ -815,7 +975,9 @@ discard block |
||
| 815 | 975 | return $all; |
| 816 | 976 | } |
| 817 | 977 | public function getStats($type,$stats_airline = '', $filter_name = '') { |
| 818 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 978 | + if ($filter_name == '') { |
|
| 979 | + $filter_name = $this->filter_name; |
|
| 980 | + } |
|
| 819 | 981 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
| 820 | 982 | $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 821 | 983 | try { |
@@ -828,7 +990,9 @@ discard block |
||
| 828 | 990 | return $all; |
| 829 | 991 | } |
| 830 | 992 | public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
| 831 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 993 | + if ($filter_name == '') { |
|
| 994 | + $filter_name = $this->filter_name; |
|
| 995 | + } |
|
| 832 | 996 | global $globalArchiveMonths, $globalDBdriver; |
| 833 | 997 | if ($globalDBdriver == 'mysql') { |
| 834 | 998 | if ($month == '') { |
@@ -858,7 +1022,9 @@ discard block |
||
| 858 | 1022 | } |
| 859 | 1023 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
| 860 | 1024 | global $globalArchiveMonths, $globalDBdriver; |
| 861 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1025 | + if ($filter_name == '') { |
|
| 1026 | + $filter_name = $this->filter_name; |
|
| 1027 | + } |
|
| 862 | 1028 | if ($globalDBdriver == 'mysql') { |
| 863 | 1029 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 864 | 1030 | } else { |
@@ -876,7 +1042,9 @@ discard block |
||
| 876 | 1042 | } |
| 877 | 1043 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
| 878 | 1044 | global $globalArchiveMonths, $globalDBdriver; |
| 879 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1045 | + if ($filter_name == '') { |
|
| 1046 | + $filter_name = $this->filter_name; |
|
| 1047 | + } |
|
| 880 | 1048 | if ($globalDBdriver == 'mysql') { |
| 881 | 1049 | $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 882 | 1050 | } else { |
@@ -893,7 +1061,9 @@ discard block |
||
| 893 | 1061 | } |
| 894 | 1062 | public function getStatsAirlineTotal($filter_name = '') { |
| 895 | 1063 | global $globalArchiveMonths, $globalDBdriver; |
| 896 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1064 | + if ($filter_name == '') { |
|
| 1065 | + $filter_name = $this->filter_name; |
|
| 1066 | + } |
|
| 897 | 1067 | if ($globalDBdriver == 'mysql') { |
| 898 | 1068 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
| 899 | 1069 | } else { |
@@ -910,7 +1080,9 @@ discard block |
||
| 910 | 1080 | } |
| 911 | 1081 | public function getStatsOwnerTotal($filter_name = '') { |
| 912 | 1082 | global $globalArchiveMonths, $globalDBdriver; |
| 913 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1083 | + if ($filter_name == '') { |
|
| 1084 | + $filter_name = $this->filter_name; |
|
| 1085 | + } |
|
| 914 | 1086 | if ($globalDBdriver == 'mysql') { |
| 915 | 1087 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
| 916 | 1088 | } else { |
@@ -927,7 +1099,9 @@ discard block |
||
| 927 | 1099 | } |
| 928 | 1100 | public function getStatsPilotTotal($filter_name = '') { |
| 929 | 1101 | global $globalArchiveMonths, $globalDBdriver; |
| 930 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1102 | + if ($filter_name == '') { |
|
| 1103 | + $filter_name = $this->filter_name; |
|
| 1104 | + } |
|
| 931 | 1105 | if ($globalDBdriver == 'mysql') { |
| 932 | 1106 | $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
| 933 | 1107 | } else { |
@@ -945,7 +1119,9 @@ discard block |
||
| 945 | 1119 | |
| 946 | 1120 | public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 947 | 1121 | global $globalDBdriver; |
| 948 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1122 | + if ($filter_name == '') { |
|
| 1123 | + $filter_name = $this->filter_name; |
|
| 1124 | + } |
|
| 949 | 1125 | if ($globalDBdriver == 'mysql') { |
| 950 | 1126 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt"; |
| 951 | 1127 | } else { |
@@ -961,7 +1137,9 @@ discard block |
||
| 961 | 1137 | } |
| 962 | 1138 | public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 963 | 1139 | global $globalDBdriver; |
| 964 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1140 | + if ($filter_name == '') { |
|
| 1141 | + $filter_name = $this->filter_name; |
|
| 1142 | + } |
|
| 965 | 1143 | if ($globalDBdriver == 'mysql') { |
| 966 | 1144 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
| 967 | 1145 | } else { |
@@ -1347,10 +1525,14 @@ discard block |
||
| 1347 | 1525 | $Connection = new Connection(); |
| 1348 | 1526 | date_default_timezone_set('UTC'); |
| 1349 | 1527 | $last_update = $this->getLastStatsUpdate('last_update_stats'); |
| 1350 | - if ($globalDebug) echo 'Update stats !'."\n"; |
|
| 1528 | + if ($globalDebug) { |
|
| 1529 | + echo 'Update stats !'."\n"; |
|
| 1530 | + } |
|
| 1351 | 1531 | if (isset($last_update[0]['value'])) { |
| 1352 | 1532 | $last_update_day = $last_update[0]['value']; |
| 1353 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
| 1533 | + } else { |
|
| 1534 | + $last_update_day = '2012-12-12 12:12:12'; |
|
| 1535 | + } |
|
| 1354 | 1536 | $reset = false; |
| 1355 | 1537 | if ($globalStatsResetYear) { |
| 1356 | 1538 | $reset = true; |
@@ -1358,42 +1540,60 @@ discard block |
||
| 1358 | 1540 | } |
| 1359 | 1541 | $Spotter = new Spotter($this->db); |
| 1360 | 1542 | |
| 1361 | - if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
|
| 1543 | + if ($globalDebug) { |
|
| 1544 | + echo 'Count all aircraft types...'."\n"; |
|
| 1545 | + } |
|
| 1362 | 1546 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
| 1363 | 1547 | foreach ($alldata as $number) { |
| 1364 | 1548 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
| 1365 | 1549 | } |
| 1366 | - if ($globalDebug) echo 'Count all airlines...'."\n"; |
|
| 1550 | + if ($globalDebug) { |
|
| 1551 | + echo 'Count all airlines...'."\n"; |
|
| 1552 | + } |
|
| 1367 | 1553 | $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
| 1368 | 1554 | foreach ($alldata as $number) { |
| 1369 | 1555 | $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
| 1370 | 1556 | } |
| 1371 | - if ($globalDebug) echo 'Count all registrations...'."\n"; |
|
| 1557 | + if ($globalDebug) { |
|
| 1558 | + echo 'Count all registrations...'."\n"; |
|
| 1559 | + } |
|
| 1372 | 1560 | $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
| 1373 | 1561 | foreach ($alldata as $number) { |
| 1374 | 1562 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
| 1375 | 1563 | } |
| 1376 | - if ($globalDebug) echo 'Count all callsigns...'."\n"; |
|
| 1564 | + if ($globalDebug) { |
|
| 1565 | + echo 'Count all callsigns...'."\n"; |
|
| 1566 | + } |
|
| 1377 | 1567 | $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
| 1378 | 1568 | foreach ($alldata as $number) { |
| 1379 | 1569 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
| 1380 | 1570 | } |
| 1381 | - if ($globalDebug) echo 'Count all owners...'."\n"; |
|
| 1571 | + if ($globalDebug) { |
|
| 1572 | + echo 'Count all owners...'."\n"; |
|
| 1573 | + } |
|
| 1382 | 1574 | $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
| 1383 | 1575 | foreach ($alldata as $number) { |
| 1384 | 1576 | $this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
| 1385 | 1577 | } |
| 1386 | - if ($globalDebug) echo 'Count all pilots...'."\n"; |
|
| 1578 | + if ($globalDebug) { |
|
| 1579 | + echo 'Count all pilots...'."\n"; |
|
| 1580 | + } |
|
| 1387 | 1581 | $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
| 1388 | 1582 | foreach ($alldata as $number) { |
| 1389 | 1583 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
| 1390 | 1584 | } |
| 1391 | 1585 | |
| 1392 | - if ($globalDebug) echo 'Count all departure airports...'."\n"; |
|
| 1586 | + if ($globalDebug) { |
|
| 1587 | + echo 'Count all departure airports...'."\n"; |
|
| 1588 | + } |
|
| 1393 | 1589 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
| 1394 | - if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
|
| 1590 | + if ($globalDebug) { |
|
| 1591 | + echo 'Count all detected departure airports...'."\n"; |
|
| 1592 | + } |
|
| 1395 | 1593 | $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
| 1396 | - if ($globalDebug) echo 'Order departure airports...'."\n"; |
|
| 1594 | + if ($globalDebug) { |
|
| 1595 | + echo 'Order departure airports...'."\n"; |
|
| 1596 | + } |
|
| 1397 | 1597 | $alldata = array(); |
| 1398 | 1598 | |
| 1399 | 1599 | foreach ($pall as $value) { |
@@ -1404,7 +1604,9 @@ discard block |
||
| 1404 | 1604 | $icao = $value['airport_departure_icao']; |
| 1405 | 1605 | if (isset($alldata[$icao])) { |
| 1406 | 1606 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 1407 | - } else $alldata[$icao] = $value; |
|
| 1607 | + } else { |
|
| 1608 | + $alldata[$icao] = $value; |
|
| 1609 | + } |
|
| 1408 | 1610 | } |
| 1409 | 1611 | $count = array(); |
| 1410 | 1612 | foreach ($alldata as $key => $row) { |
@@ -1414,11 +1616,17 @@ discard block |
||
| 1414 | 1616 | foreach ($alldata as $number) { |
| 1415 | 1617 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset); |
| 1416 | 1618 | } |
| 1417 | - if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
|
| 1619 | + if ($globalDebug) { |
|
| 1620 | + echo 'Count all arrival airports...'."\n"; |
|
| 1621 | + } |
|
| 1418 | 1622 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
| 1419 | - if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
|
| 1623 | + if ($globalDebug) { |
|
| 1624 | + echo 'Count all detected arrival airports...'."\n"; |
|
| 1625 | + } |
|
| 1420 | 1626 | $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
| 1421 | - if ($globalDebug) echo 'Order arrival airports...'."\n"; |
|
| 1627 | + if ($globalDebug) { |
|
| 1628 | + echo 'Order arrival airports...'."\n"; |
|
| 1629 | + } |
|
| 1422 | 1630 | $alldata = array(); |
| 1423 | 1631 | foreach ($pall as $value) { |
| 1424 | 1632 | $icao = $value['airport_arrival_icao']; |
@@ -1428,7 +1636,9 @@ discard block |
||
| 1428 | 1636 | $icao = $value['airport_arrival_icao']; |
| 1429 | 1637 | if (isset($alldata[$icao])) { |
| 1430 | 1638 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 1431 | - } else $alldata[$icao] = $value; |
|
| 1639 | + } else { |
|
| 1640 | + $alldata[$icao] = $value; |
|
| 1641 | + } |
|
| 1432 | 1642 | } |
| 1433 | 1643 | $count = array(); |
| 1434 | 1644 | foreach ($alldata as $key => $row) { |
@@ -1439,7 +1649,9 @@ discard block |
||
| 1439 | 1649 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset); |
| 1440 | 1650 | } |
| 1441 | 1651 | if ($Connection->tableExists('countries')) { |
| 1442 | - if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
|
| 1652 | + if ($globalDebug) { |
|
| 1653 | + echo 'Count all flights by countries...'."\n"; |
|
| 1654 | + } |
|
| 1443 | 1655 | $SpotterArchive = new SpotterArchive(); |
| 1444 | 1656 | $alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
| 1445 | 1657 | foreach ($alldata as $number) { |
@@ -1451,46 +1663,66 @@ discard block |
||
| 1451 | 1663 | // Add by month using getstat if month finish... |
| 1452 | 1664 | |
| 1453 | 1665 | //if (date('m',strtotime($last_update_day)) != date('m')) { |
| 1454 | - if ($globalDebug) echo 'Count all flights by months...'."\n"; |
|
| 1666 | + if ($globalDebug) { |
|
| 1667 | + echo 'Count all flights by months...'."\n"; |
|
| 1668 | + } |
|
| 1455 | 1669 | $Spotter = new Spotter($this->db); |
| 1456 | 1670 | $alldata = $Spotter->countAllMonths(); |
| 1457 | 1671 | $lastyear = false; |
| 1458 | 1672 | foreach ($alldata as $number) { |
| 1459 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 1673 | + if ($number['year_name'] != date('Y')) { |
|
| 1674 | + $lastyear = true; |
|
| 1675 | + } |
|
| 1460 | 1676 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 1461 | 1677 | } |
| 1462 | - if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
|
| 1678 | + if ($globalDebug) { |
|
| 1679 | + echo 'Count all military flights by months...'."\n"; |
|
| 1680 | + } |
|
| 1463 | 1681 | $alldata = $Spotter->countAllMilitaryMonths(); |
| 1464 | 1682 | foreach ($alldata as $number) { |
| 1465 | 1683 | $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 1466 | 1684 | } |
| 1467 | - if ($globalDebug) echo 'Count all owners by months...'."\n"; |
|
| 1685 | + if ($globalDebug) { |
|
| 1686 | + echo 'Count all owners by months...'."\n"; |
|
| 1687 | + } |
|
| 1468 | 1688 | $alldata = $Spotter->countAllMonthsOwners(); |
| 1469 | 1689 | foreach ($alldata as $number) { |
| 1470 | 1690 | $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 1471 | 1691 | } |
| 1472 | - if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
|
| 1692 | + if ($globalDebug) { |
|
| 1693 | + echo 'Count all pilots by months...'."\n"; |
|
| 1694 | + } |
|
| 1473 | 1695 | $alldata = $Spotter->countAllMonthsPilots(); |
| 1474 | 1696 | foreach ($alldata as $number) { |
| 1475 | 1697 | $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 1476 | 1698 | } |
| 1477 | - if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
|
| 1699 | + if ($globalDebug) { |
|
| 1700 | + echo 'Count all airlines by months...'."\n"; |
|
| 1701 | + } |
|
| 1478 | 1702 | $alldata = $Spotter->countAllMonthsAirlines(); |
| 1479 | 1703 | foreach ($alldata as $number) { |
| 1480 | 1704 | $this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 1481 | 1705 | } |
| 1482 | - if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
|
| 1706 | + if ($globalDebug) { |
|
| 1707 | + echo 'Count all aircrafts by months...'."\n"; |
|
| 1708 | + } |
|
| 1483 | 1709 | $alldata = $Spotter->countAllMonthsAircrafts(); |
| 1484 | 1710 | foreach ($alldata as $number) { |
| 1485 | 1711 | $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 1486 | 1712 | } |
| 1487 | - if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
|
| 1713 | + if ($globalDebug) { |
|
| 1714 | + echo 'Count all real arrivals by months...'."\n"; |
|
| 1715 | + } |
|
| 1488 | 1716 | $alldata = $Spotter->countAllMonthsRealArrivals(); |
| 1489 | 1717 | foreach ($alldata as $number) { |
| 1490 | 1718 | $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 1491 | 1719 | } |
| 1492 | - if ($globalDebug) echo 'Airports data...'."\n"; |
|
| 1493 | - if ($globalDebug) echo '...Departure'."\n"; |
|
| 1720 | + if ($globalDebug) { |
|
| 1721 | + echo 'Airports data...'."\n"; |
|
| 1722 | + } |
|
| 1723 | + if ($globalDebug) { |
|
| 1724 | + echo '...Departure'."\n"; |
|
| 1725 | + } |
|
| 1494 | 1726 | $this->deleteStatAirport('daily'); |
| 1495 | 1727 | // $pall = $Spotter->getLast7DaysAirportsDeparture(); |
| 1496 | 1728 | // $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
@@ -1610,37 +1842,53 @@ discard block |
||
| 1610 | 1842 | |
| 1611 | 1843 | // Count by airlines |
| 1612 | 1844 | echo '--- Stats by airlines ---'."\n"; |
| 1613 | - if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
|
| 1845 | + if ($globalDebug) { |
|
| 1846 | + echo 'Count all aircraft types by airlines...'."\n"; |
|
| 1847 | + } |
|
| 1614 | 1848 | $Spotter = new Spotter($this->db); |
| 1615 | 1849 | $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
| 1616 | 1850 | foreach ($alldata as $number) { |
| 1617 | 1851 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
| 1618 | 1852 | } |
| 1619 | - if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
|
| 1853 | + if ($globalDebug) { |
|
| 1854 | + echo 'Count all aircraft registrations by airlines...'."\n"; |
|
| 1855 | + } |
|
| 1620 | 1856 | $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
| 1621 | 1857 | foreach ($alldata as $number) { |
| 1622 | 1858 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
| 1623 | 1859 | } |
| 1624 | - if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
|
| 1860 | + if ($globalDebug) { |
|
| 1861 | + echo 'Count all callsigns by airlines...'."\n"; |
|
| 1862 | + } |
|
| 1625 | 1863 | $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
| 1626 | 1864 | foreach ($alldata as $number) { |
| 1627 | 1865 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
| 1628 | 1866 | } |
| 1629 | - if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
|
| 1867 | + if ($globalDebug) { |
|
| 1868 | + echo 'Count all owners by airlines...'."\n"; |
|
| 1869 | + } |
|
| 1630 | 1870 | $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
| 1631 | 1871 | foreach ($alldata as $number) { |
| 1632 | 1872 | $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
| 1633 | 1873 | } |
| 1634 | - if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
|
| 1874 | + if ($globalDebug) { |
|
| 1875 | + echo 'Count all pilots by airlines...'."\n"; |
|
| 1876 | + } |
|
| 1635 | 1877 | $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
| 1636 | 1878 | foreach ($alldata as $number) { |
| 1637 | 1879 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
| 1638 | 1880 | } |
| 1639 | - if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
|
| 1881 | + if ($globalDebug) { |
|
| 1882 | + echo 'Count all departure airports by airlines...'."\n"; |
|
| 1883 | + } |
|
| 1640 | 1884 | $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
| 1641 | - if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
|
| 1885 | + if ($globalDebug) { |
|
| 1886 | + echo 'Count all detected departure airports by airlines...'."\n"; |
|
| 1887 | + } |
|
| 1642 | 1888 | $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
| 1643 | - if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
|
| 1889 | + if ($globalDebug) { |
|
| 1890 | + echo 'Order detected departure airports by airlines...'."\n"; |
|
| 1891 | + } |
|
| 1644 | 1892 | //$alldata = array(); |
| 1645 | 1893 | foreach ($dall as $value) { |
| 1646 | 1894 | $icao = $value['airport_departure_icao']; |
@@ -1661,11 +1909,17 @@ discard block |
||
| 1661 | 1909 | foreach ($alldata as $number) { |
| 1662 | 1910 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset); |
| 1663 | 1911 | } |
| 1664 | - if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
|
| 1912 | + if ($globalDebug) { |
|
| 1913 | + echo 'Count all arrival airports by airlines...'."\n"; |
|
| 1914 | + } |
|
| 1665 | 1915 | $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
| 1666 | - if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
|
| 1916 | + if ($globalDebug) { |
|
| 1917 | + echo 'Count all detected arrival airports by airlines...'."\n"; |
|
| 1918 | + } |
|
| 1667 | 1919 | $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
| 1668 | - if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
|
| 1920 | + if ($globalDebug) { |
|
| 1921 | + echo 'Order arrival airports by airlines...'."\n"; |
|
| 1922 | + } |
|
| 1669 | 1923 | //$alldata = array(); |
| 1670 | 1924 | foreach ($dall as $value) { |
| 1671 | 1925 | $icao = $value['airport_arrival_icao']; |
@@ -1684,37 +1938,53 @@ discard block |
||
| 1684 | 1938 | } |
| 1685 | 1939 | $alldata = $pall; |
| 1686 | 1940 | foreach ($alldata as $number) { |
| 1687 | - if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
| 1941 | + if ($number['airline_icao'] != '') { |
|
| 1942 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
| 1943 | + } |
|
| 1944 | + } |
|
| 1945 | + if ($globalDebug) { |
|
| 1946 | + echo 'Count all flights by months by airlines...'."\n"; |
|
| 1688 | 1947 | } |
| 1689 | - if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
|
| 1690 | 1948 | $Spotter = new Spotter($this->db); |
| 1691 | 1949 | $alldata = $Spotter->countAllMonthsByAirlines(); |
| 1692 | 1950 | $lastyear = false; |
| 1693 | 1951 | foreach ($alldata as $number) { |
| 1694 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 1952 | + if ($number['year_name'] != date('Y')) { |
|
| 1953 | + $lastyear = true; |
|
| 1954 | + } |
|
| 1695 | 1955 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
| 1696 | 1956 | } |
| 1697 | - if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
|
| 1957 | + if ($globalDebug) { |
|
| 1958 | + echo 'Count all owners by months by airlines...'."\n"; |
|
| 1959 | + } |
|
| 1698 | 1960 | $alldata = $Spotter->countAllMonthsOwnersByAirlines(); |
| 1699 | 1961 | foreach ($alldata as $number) { |
| 1700 | 1962 | $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
| 1701 | 1963 | } |
| 1702 | - if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
|
| 1964 | + if ($globalDebug) { |
|
| 1965 | + echo 'Count all pilots by months by airlines...'."\n"; |
|
| 1966 | + } |
|
| 1703 | 1967 | $alldata = $Spotter->countAllMonthsPilotsByAirlines(); |
| 1704 | 1968 | foreach ($alldata as $number) { |
| 1705 | 1969 | $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
| 1706 | 1970 | } |
| 1707 | - if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
|
| 1971 | + if ($globalDebug) { |
|
| 1972 | + echo 'Count all aircrafts by months by airlines...'."\n"; |
|
| 1973 | + } |
|
| 1708 | 1974 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines(); |
| 1709 | 1975 | foreach ($alldata as $number) { |
| 1710 | 1976 | $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
| 1711 | 1977 | } |
| 1712 | - if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
|
| 1978 | + if ($globalDebug) { |
|
| 1979 | + echo 'Count all real arrivals by months by airlines...'."\n"; |
|
| 1980 | + } |
|
| 1713 | 1981 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines(); |
| 1714 | 1982 | foreach ($alldata as $number) { |
| 1715 | 1983 | $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
| 1716 | 1984 | } |
| 1717 | - if ($globalDebug) echo '...Departure'."\n"; |
|
| 1985 | + if ($globalDebug) { |
|
| 1986 | + echo '...Departure'."\n"; |
|
| 1987 | + } |
|
| 1718 | 1988 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
| 1719 | 1989 | $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
| 1720 | 1990 | foreach ($dall as $value) { |
@@ -1737,7 +2007,9 @@ discard block |
||
| 1737 | 2007 | foreach ($alldata as $number) { |
| 1738 | 2008 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']); |
| 1739 | 2009 | } |
| 1740 | - if ($globalDebug) echo '...Arrival'."\n"; |
|
| 2010 | + if ($globalDebug) { |
|
| 2011 | + echo '...Arrival'."\n"; |
|
| 2012 | + } |
|
| 1741 | 2013 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
| 1742 | 2014 | $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
| 1743 | 2015 | foreach ($dall as $value) { |
@@ -1761,13 +2033,19 @@ discard block |
||
| 1761 | 2033 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']); |
| 1762 | 2034 | } |
| 1763 | 2035 | |
| 1764 | - if ($globalDebug) echo 'Flights data...'."\n"; |
|
| 1765 | - if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
|
| 2036 | + if ($globalDebug) { |
|
| 2037 | + echo 'Flights data...'."\n"; |
|
| 2038 | + } |
|
| 2039 | + if ($globalDebug) { |
|
| 2040 | + echo '-> countAllDatesLastMonth...'."\n"; |
|
| 2041 | + } |
|
| 1766 | 2042 | $alldata = $Spotter->countAllDatesLastMonthByAirlines(); |
| 1767 | 2043 | foreach ($alldata as $number) { |
| 1768 | 2044 | $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
| 1769 | 2045 | } |
| 1770 | - if ($globalDebug) echo '-> countAllDates...'."\n"; |
|
| 2046 | + if ($globalDebug) { |
|
| 2047 | + echo '-> countAllDates...'."\n"; |
|
| 2048 | + } |
|
| 1771 | 2049 | //$previousdata = $this->countAllDatesByAirlines(); |
| 1772 | 2050 | $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines()); |
| 1773 | 2051 | $values = array(); |
@@ -1780,7 +2058,9 @@ discard block |
||
| 1780 | 2058 | $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
| 1781 | 2059 | } |
| 1782 | 2060 | |
| 1783 | - if ($globalDebug) echo '-> countAllHours...'."\n"; |
|
| 2061 | + if ($globalDebug) { |
|
| 2062 | + echo '-> countAllHours...'."\n"; |
|
| 2063 | + } |
|
| 1784 | 2064 | $alldata = $Spotter->countAllHoursByAirlines('hour'); |
| 1785 | 2065 | foreach ($alldata as $number) { |
| 1786 | 2066 | $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
@@ -1788,7 +2068,9 @@ discard block |
||
| 1788 | 2068 | |
| 1789 | 2069 | |
| 1790 | 2070 | // Stats by filters |
| 1791 | - if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array(); |
|
| 2071 | + if (!isset($globalStatsFilters) || $globalStatsFilters == '') { |
|
| 2072 | + $globalStatsFilters = array(); |
|
| 2073 | + } |
|
| 1792 | 2074 | foreach ($globalStatsFilters as $name => $filter) { |
| 1793 | 2075 | //$filter_name = $filter['name']; |
| 1794 | 2076 | $filter_name = $name; |
@@ -1796,11 +2078,15 @@ discard block |
||
| 1796 | 2078 | $last_update = $this->getLastStatsUpdate('last_update_stats_'.$filter_name); |
| 1797 | 2079 | if (isset($last_update[0]['value'])) { |
| 1798 | 2080 | $last_update_day = $last_update[0]['value']; |
| 1799 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
| 2081 | + } else { |
|
| 2082 | + $last_update_day = '2012-12-12 12:12:12'; |
|
| 2083 | + } |
|
| 1800 | 2084 | $reset = false; |
| 1801 | 2085 | |
| 1802 | 2086 | // Count by filter |
| 1803 | - if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
| 2087 | + if ($globalDebug) { |
|
| 2088 | + echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
| 2089 | + } |
|
| 1804 | 2090 | $Spotter = new Spotter($this->db); |
| 1805 | 2091 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
| 1806 | 2092 | foreach ($alldata as $number) { |
@@ -1837,7 +2123,9 @@ discard block |
||
| 1837 | 2123 | $icao = $value['airport_departure_icao']; |
| 1838 | 2124 | if (isset($alldata[$icao])) { |
| 1839 | 2125 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 1840 | - } else $alldata[$icao] = $value; |
|
| 2126 | + } else { |
|
| 2127 | + $alldata[$icao] = $value; |
|
| 2128 | + } |
|
| 1841 | 2129 | } |
| 1842 | 2130 | $count = array(); |
| 1843 | 2131 | foreach ($alldata as $key => $row) { |
@@ -1858,7 +2146,9 @@ discard block |
||
| 1858 | 2146 | $icao = $value['airport_arrival_icao']; |
| 1859 | 2147 | if (isset($alldata[$icao])) { |
| 1860 | 2148 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 1861 | - } else $alldata[$icao] = $value; |
|
| 2149 | + } else { |
|
| 2150 | + $alldata[$icao] = $value; |
|
| 2151 | + } |
|
| 1862 | 2152 | } |
| 1863 | 2153 | $count = array(); |
| 1864 | 2154 | foreach ($alldata as $key => $row) { |
@@ -1872,7 +2162,9 @@ discard block |
||
| 1872 | 2162 | $alldata = $Spotter->countAllMonths($filter); |
| 1873 | 2163 | $lastyear = false; |
| 1874 | 2164 | foreach ($alldata as $number) { |
| 1875 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 2165 | + if ($number['year_name'] != date('Y')) { |
|
| 2166 | + $lastyear = true; |
|
| 2167 | + } |
|
| 1876 | 2168 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
| 1877 | 2169 | } |
| 1878 | 2170 | $alldata = $Spotter->countAllMonthsOwners($filter); |
@@ -69,7 +69,9 @@ discard block |
||
| 69 | 69 | $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 72 | + if (is_array($globalFilter)) { |
|
| 73 | + $filter = array_merge($filter,$globalFilter); |
|
| 74 | + } |
|
| 73 | 75 | $filter_query_join = ''; |
| 74 | 76 | $filter_query_where = ''; |
| 75 | 77 | foreach($filters as $flt) { |
@@ -122,8 +124,11 @@ discard block |
||
| 122 | 124 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 123 | 125 | } |
| 124 | 126 | } |
| 125 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 126 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 127 | + if ($filter_query_where == '' && $where) { |
|
| 128 | + $filter_query_where = ' WHERE'; |
|
| 129 | + } elseif ($filter_query_where != '' && $and) { |
|
| 130 | + $filter_query_where .= ' AND'; |
|
| 131 | + } |
|
| 127 | 132 | $filter_query = $filter_query_join.$filter_query_where; |
| 128 | 133 | return $filter_query; |
| 129 | 134 | } |
@@ -143,10 +148,18 @@ discard block |
||
| 143 | 148 | $Image = new Image($this->db); |
| 144 | 149 | $Schedule = new Schedule($this->db); |
| 145 | 150 | $ACARS = new ACARS($this->db); |
| 146 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 147 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 148 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 149 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 151 | + if (!isset($globalIVAO)) { |
|
| 152 | + $globalIVAO = FALSE; |
|
| 153 | + } |
|
| 154 | + if (!isset($globalVATSIM)) { |
|
| 155 | + $globalVATSIM = FALSE; |
|
| 156 | + } |
|
| 157 | + if (!isset($globalphpVMS)) { |
|
| 158 | + $globalphpVMS = FALSE; |
|
| 159 | + } |
|
| 160 | + if (!isset($globalVAM)) { |
|
| 161 | + $globalVAM = FALSE; |
|
| 162 | + } |
|
| 150 | 163 | date_default_timezone_set('UTC'); |
| 151 | 164 | |
| 152 | 165 | if (!is_string($query)) |
@@ -193,21 +206,35 @@ discard block |
||
| 193 | 206 | } else { |
| 194 | 207 | $temp_array['spotter_id'] = ''; |
| 195 | 208 | } |
| 196 | - if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 197 | - if (isset($row['modes'])) $temp_array['modes'] = $row['modes']; |
|
| 209 | + if (isset($row['flightaware_id'])) { |
|
| 210 | + $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 211 | + } |
|
| 212 | + if (isset($row['modes'])) { |
|
| 213 | + $temp_array['modes'] = $row['modes']; |
|
| 214 | + } |
|
| 198 | 215 | $temp_array['ident'] = $row['ident']; |
| 199 | 216 | if (isset($row['registration']) && $row['registration'] != '') { |
| 200 | 217 | $temp_array['registration'] = $row['registration']; |
| 201 | 218 | } elseif (isset($temp_array['modes'])) { |
| 202 | 219 | $temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']); |
| 203 | - } else $temp_array['registration'] = ''; |
|
| 204 | - if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 220 | + } else { |
|
| 221 | + $temp_array['registration'] = ''; |
|
| 222 | + } |
|
| 223 | + if (isset($row['aircraft_icao'])) { |
|
| 224 | + $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 225 | + } |
|
| 205 | 226 | |
| 206 | 227 | $temp_array['departure_airport'] = $row['departure_airport_icao']; |
| 207 | 228 | $temp_array['arrival_airport'] = $row['arrival_airport_icao']; |
| 208 | - if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 209 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
| 210 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
| 229 | + if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) { |
|
| 230 | + $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 231 | + } |
|
| 232 | + if (isset($row['latitude'])) { |
|
| 233 | + $temp_array['latitude'] = $row['latitude']; |
|
| 234 | + } |
|
| 235 | + if (isset($row['longitude'])) { |
|
| 236 | + $temp_array['longitude'] = $row['longitude']; |
|
| 237 | + } |
|
| 211 | 238 | /* |
| 212 | 239 | if (Connection->tableExists('countries')) { |
| 213 | 240 | $country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']); |
@@ -217,8 +244,12 @@ discard block |
||
| 217 | 244 | } |
| 218 | 245 | } |
| 219 | 246 | */ |
| 220 | - if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints']; |
|
| 221 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
| 247 | + if (isset($row['waypoints'])) { |
|
| 248 | + $temp_array['waypoints'] = $row['waypoints']; |
|
| 249 | + } |
|
| 250 | + if (isset($row['format_source'])) { |
|
| 251 | + $temp_array['format_source'] = $row['format_source']; |
|
| 252 | + } |
|
| 222 | 253 | if (isset($row['route_stop'])) { |
| 223 | 254 | $temp_array['route_stop'] = $row['route_stop']; |
| 224 | 255 | if ($row['route_stop'] != '') { |
@@ -237,13 +268,19 @@ discard block |
||
| 237 | 268 | } |
| 238 | 269 | } |
| 239 | 270 | } |
| 240 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
| 271 | + if (isset($row['altitude'])) { |
|
| 272 | + $temp_array['altitude'] = $row['altitude']; |
|
| 273 | + } |
|
| 241 | 274 | if (isset($row['heading'])) { |
| 242 | 275 | $temp_array['heading'] = $row['heading']; |
| 243 | 276 | $heading_direction = $this->parseDirection($row['heading']); |
| 244 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 277 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
| 278 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 279 | + } |
|
| 280 | + } |
|
| 281 | + if (isset($row['ground_speed'])) { |
|
| 282 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 245 | 283 | } |
| 246 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 247 | 284 | $temp_array['image'] = ""; |
| 248 | 285 | $temp_array['image_thumbnail'] = ""; |
| 249 | 286 | $temp_array['image_source'] = ""; |
@@ -251,7 +288,9 @@ discard block |
||
| 251 | 288 | |
| 252 | 289 | if (isset($row['highlight'])) { |
| 253 | 290 | $temp_array['highlight'] = $row['highlight']; |
| 254 | - } else $temp_array['highlight'] = ''; |
|
| 291 | + } else { |
|
| 292 | + $temp_array['highlight'] = ''; |
|
| 293 | + } |
|
| 255 | 294 | |
| 256 | 295 | if (isset($row['date'])) { |
| 257 | 296 | $dateArray = $this->parseDateString($row['date']); |
@@ -299,7 +338,9 @@ discard block |
||
| 299 | 338 | |
| 300 | 339 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
| 301 | 340 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
| 302 | - } else $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 341 | + } else { |
|
| 342 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 343 | + } |
|
| 303 | 344 | } else { |
| 304 | 345 | $temp_array['aircraft_shadow'] = 'default.png'; |
| 305 | 346 | $temp_array['aircraft_name'] = 'N/A'; |
@@ -307,11 +348,17 @@ discard block |
||
| 307 | 348 | } |
| 308 | 349 | } |
| 309 | 350 | $fromsource = NULL; |
| 310 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 311 | - elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 312 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 313 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 314 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 351 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 352 | + $fromsource = $globalAirlinesSource; |
|
| 353 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 354 | + $fromsource = 'vatsim'; |
|
| 355 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 356 | + $fromsource = 'ivao'; |
|
| 357 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 358 | + $fromsource = 'vatsim'; |
|
| 359 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 360 | + $fromsource = 'ivao'; |
|
| 361 | + } |
|
| 315 | 362 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
| 316 | 363 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
| 317 | 364 | if (is_numeric(substr($row['ident'], 2, 1))) { |
@@ -334,12 +381,18 @@ discard block |
||
| 334 | 381 | } |
| 335 | 382 | } else { |
| 336 | 383 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 337 | - if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 338 | - else $temp_array['airline_iata'] = 'N/A'; |
|
| 384 | + if (isset($row['airline_iata'])) { |
|
| 385 | + $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 386 | + } else { |
|
| 387 | + $temp_array['airline_iata'] = 'N/A'; |
|
| 388 | + } |
|
| 339 | 389 | $temp_array['airline_name'] = $row['airline_name']; |
| 340 | 390 | $temp_array['airline_country'] = $row['airline_country']; |
| 341 | - if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 342 | - else $temp_array['airline_callsign'] = 'N/A'; |
|
| 391 | + if (isset($row['airline_callsign'])) { |
|
| 392 | + $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 393 | + } else { |
|
| 394 | + $temp_array['airline_callsign'] = 'N/A'; |
|
| 395 | + } |
|
| 343 | 396 | $temp_array['airline_type'] = $row['airline_type']; |
| 344 | 397 | if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') { |
| 345 | 398 | $airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']); |
@@ -366,7 +419,9 @@ discard block |
||
| 366 | 419 | } |
| 367 | 420 | if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) { |
| 368 | 421 | $owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']); |
| 369 | - if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 422 | + if ($owner_info['owner'] != '') { |
|
| 423 | + $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 424 | + } |
|
| 370 | 425 | $temp_array['aircraft_base'] = $owner_info['base']; |
| 371 | 426 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
| 372 | 427 | } |
@@ -374,9 +429,14 @@ discard block |
||
| 374 | 429 | if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
| 375 | 430 | { |
| 376 | 431 | if ($globalIVAO) { |
| 377 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 378 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 379 | - } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 432 | + if (isset($temp_array['airline_icao'])) { |
|
| 433 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 434 | + } else { |
|
| 435 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 436 | + } |
|
| 437 | + } else { |
|
| 438 | + $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 439 | + } |
|
| 380 | 440 | if (count($image_array) > 0) { |
| 381 | 441 | $temp_array['image'] = $image_array[0]['image']; |
| 382 | 442 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -428,7 +488,9 @@ discard block |
||
| 428 | 488 | //if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') { |
| 429 | 489 | if ($row['departure_airport_icao'] != '') { |
| 430 | 490 | $departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']); |
| 431 | - if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 491 | + if (!isset($departure_airport_array[0]['name'])) { |
|
| 492 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 493 | + } |
|
| 432 | 494 | /* |
| 433 | 495 | } elseif ($row['departure_airport_name'] != '') { |
| 434 | 496 | $temp_array['departure_airport_name'] = $row['departure_airport_name']; |
@@ -436,7 +498,9 @@ discard block |
||
| 436 | 498 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 437 | 499 | $temp_array['departure_airport_icao'] = $row['departure_airport_icao']; |
| 438 | 500 | */ |
| 439 | - } else $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 501 | + } else { |
|
| 502 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 503 | + } |
|
| 440 | 504 | if (isset($departure_airport_array[0]['name'])) { |
| 441 | 505 | $temp_array['departure_airport_name'] = $departure_airport_array[0]['name']; |
| 442 | 506 | $temp_array['departure_airport_city'] = $departure_airport_array[0]['city']; |
@@ -456,8 +520,12 @@ discard block |
||
| 456 | 520 | |
| 457 | 521 | if ($row['arrival_airport_icao'] != '') { |
| 458 | 522 | $arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']); |
| 459 | - if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 460 | - } else $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 523 | + if (count($arrival_airport_array) == 0) { |
|
| 524 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 525 | + } |
|
| 526 | + } else { |
|
| 527 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 528 | + } |
|
| 461 | 529 | if (isset($arrival_airport_array[0]['name'])) { |
| 462 | 530 | $temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name']; |
| 463 | 531 | $temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city']; |
@@ -473,27 +541,45 @@ discard block |
||
| 473 | 541 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
| 474 | 542 | } |
| 475 | 543 | */ |
| 476 | - if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 477 | - if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 478 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
| 479 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
| 480 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
| 544 | + if (isset($row['pilot_id']) && $row['pilot_id'] != '') { |
|
| 545 | + $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 546 | + } |
|
| 547 | + if (isset($row['pilot_name']) && $row['pilot_name'] != '') { |
|
| 548 | + $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 549 | + } |
|
| 550 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
| 551 | + $temp_array['source_name'] = $row['source_name']; |
|
| 552 | + } |
|
| 553 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
| 554 | + $temp_array['over_country'] = $row['over_country']; |
|
| 555 | + } |
|
| 556 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
| 557 | + $temp_array['distance'] = $row['distance']; |
|
| 558 | + } |
|
| 481 | 559 | if (isset($row['squawk'])) { |
| 482 | 560 | $temp_array['squawk'] = $row['squawk']; |
| 483 | 561 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
| 484 | 562 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
| 485 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 563 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 564 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 565 | + } |
|
| 486 | 566 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
| 487 | 567 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
| 488 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 489 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 568 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 569 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 570 | + } |
|
| 571 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) { |
|
| 572 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 573 | + } |
|
| 490 | 574 | } |
| 491 | 575 | |
| 492 | 576 | $temp_array['query_number_rows'] = $num_rows; |
| 493 | 577 | |
| 494 | 578 | $spotter_array[] = $temp_array; |
| 495 | 579 | } |
| 496 | - if ($num_rows == 0) return array(); |
|
| 580 | + if ($num_rows == 0) { |
|
| 581 | + return array(); |
|
| 582 | + } |
|
| 497 | 583 | $spotter_array[0]['query_number_rows'] = $num_rows; |
| 498 | 584 | return $spotter_array; |
| 499 | 585 | } |
@@ -526,7 +612,9 @@ discard block |
||
| 526 | 612 | foreach ($q_array as $q_item){ |
| 527 | 613 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
| 528 | 614 | $additional_query .= " AND ("; |
| 529 | - if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 615 | + if (is_int($q_item)) { |
|
| 616 | + $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 617 | + } |
|
| 530 | 618 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
| 531 | 619 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
| 532 | 620 | $additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
@@ -547,7 +635,9 @@ discard block |
||
| 547 | 635 | $additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR "; |
| 548 | 636 | $additional_query .= "(spotter_output.ident like '%".$q_item."%') OR "; |
| 549 | 637 | $translate = $Translation->ident2icao($q_item); |
| 550 | - if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 638 | + if ($translate != $q_item) { |
|
| 639 | + $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 640 | + } |
|
| 551 | 641 | $additional_query .= "(spotter_output.highlight like '%".$q_item."%')"; |
| 552 | 642 | $additional_query .= ")"; |
| 553 | 643 | } |
@@ -774,7 +864,9 @@ discard block |
||
| 774 | 864 | date_default_timezone_set($globalTimezone); |
| 775 | 865 | $datetime = new DateTime(); |
| 776 | 866 | $offset = $datetime->format('P'); |
| 777 | - } else $offset = '+00:00'; |
|
| 867 | + } else { |
|
| 868 | + $offset = '+00:00'; |
|
| 869 | + } |
|
| 778 | 870 | |
| 779 | 871 | if ($date_array[1] != "") |
| 780 | 872 | { |
@@ -806,8 +898,12 @@ discard block |
||
| 806 | 898 | { |
| 807 | 899 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 808 | 900 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 809 | - } else $limit_query = ""; |
|
| 810 | - } else $limit_query = ""; |
|
| 901 | + } else { |
|
| 902 | + $limit_query = ""; |
|
| 903 | + } |
|
| 904 | + } else { |
|
| 905 | + $limit_query = ""; |
|
| 906 | + } |
|
| 811 | 907 | |
| 812 | 908 | |
| 813 | 909 | if ($sort != "") |
@@ -875,8 +971,12 @@ discard block |
||
| 875 | 971 | { |
| 876 | 972 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 877 | 973 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 878 | - } else $limit_query = ""; |
|
| 879 | - } else $limit_query = ""; |
|
| 974 | + } else { |
|
| 975 | + $limit_query = ""; |
|
| 976 | + } |
|
| 977 | + } else { |
|
| 978 | + $limit_query = ""; |
|
| 979 | + } |
|
| 880 | 980 | |
| 881 | 981 | if ($sort != "") |
| 882 | 982 | { |
@@ -1200,7 +1300,9 @@ discard block |
||
| 1200 | 1300 | global $global_query; |
| 1201 | 1301 | |
| 1202 | 1302 | date_default_timezone_set('UTC'); |
| 1203 | - if ($id == '') return array(); |
|
| 1303 | + if ($id == '') { |
|
| 1304 | + return array(); |
|
| 1305 | + } |
|
| 1204 | 1306 | $additional_query = "spotter_output.spotter_id = :id"; |
| 1205 | 1307 | $query_values = array(':id' => $id); |
| 1206 | 1308 | |
@@ -1832,7 +1934,9 @@ discard block |
||
| 1832 | 1934 | { |
| 1833 | 1935 | $highlight = $row['highlight']; |
| 1834 | 1936 | } |
| 1835 | - if (isset($highlight)) return $highlight; |
|
| 1937 | + if (isset($highlight)) { |
|
| 1938 | + return $highlight; |
|
| 1939 | + } |
|
| 1836 | 1940 | } |
| 1837 | 1941 | |
| 1838 | 1942 | |
@@ -1860,7 +1964,9 @@ discard block |
||
| 1860 | 1964 | $sth->closeCursor(); |
| 1861 | 1965 | if (count($row) > 0) { |
| 1862 | 1966 | return $row['usage']; |
| 1863 | - } else return ''; |
|
| 1967 | + } else { |
|
| 1968 | + return ''; |
|
| 1969 | + } |
|
| 1864 | 1970 | } |
| 1865 | 1971 | |
| 1866 | 1972 | /** |
@@ -1885,7 +1991,9 @@ discard block |
||
| 1885 | 1991 | $sth->closeCursor(); |
| 1886 | 1992 | if (count($row) > 0) { |
| 1887 | 1993 | return $row['icao']; |
| 1888 | - } else return ''; |
|
| 1994 | + } else { |
|
| 1995 | + return ''; |
|
| 1996 | + } |
|
| 1889 | 1997 | } |
| 1890 | 1998 | |
| 1891 | 1999 | /** |
@@ -1913,7 +2021,9 @@ discard block |
||
| 1913 | 2021 | $airport_longitude = $row['longitude']; |
| 1914 | 2022 | $Common = new Common(); |
| 1915 | 2023 | return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
| 1916 | - } else return ''; |
|
| 2024 | + } else { |
|
| 2025 | + return ''; |
|
| 2026 | + } |
|
| 1917 | 2027 | } |
| 1918 | 2028 | |
| 1919 | 2029 | /** |
@@ -2025,7 +2135,9 @@ discard block |
||
| 2025 | 2135 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2026 | 2136 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2027 | 2137 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2028 | - } else return array(); |
|
| 2138 | + } else { |
|
| 2139 | + return array(); |
|
| 2140 | + } |
|
| 2029 | 2141 | if ($globalDBdriver == 'mysql') { |
| 2030 | 2142 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
| 2031 | 2143 | } else { |
@@ -2060,7 +2172,9 @@ discard block |
||
| 2060 | 2172 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2061 | 2173 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2062 | 2174 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2063 | - } else return array(); |
|
| 2175 | + } else { |
|
| 2176 | + return array(); |
|
| 2177 | + } |
|
| 2064 | 2178 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
| 2065 | 2179 | $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
| 2066 | 2180 | //$query = "SELECT waypoints.* FROM waypoints"; |
@@ -2095,7 +2209,9 @@ discard block |
||
| 2095 | 2209 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
| 2096 | 2210 | { |
| 2097 | 2211 | global $globalUseRealAirlines; |
| 2098 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2212 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2213 | + $fromsource = NULL; |
|
| 2214 | + } |
|
| 2099 | 2215 | $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
| 2100 | 2216 | if ($airline_icao == 'NA') { |
| 2101 | 2217 | $airline_array = array(); |
@@ -2145,7 +2261,9 @@ discard block |
||
| 2145 | 2261 | $sth->execute(array(':fromsource' => $fromsource)); |
| 2146 | 2262 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2147 | 2263 | $sth->closeCursor(); |
| 2148 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao); |
|
| 2264 | + if ($row['nb'] == 0) { |
|
| 2265 | + $result = $this->getAllAirlineInfo($airline_icao); |
|
| 2266 | + } |
|
| 2149 | 2267 | } |
| 2150 | 2268 | return $result; |
| 2151 | 2269 | } |
@@ -2161,7 +2279,9 @@ discard block |
||
| 2161 | 2279 | public function getAllAirlineInfoByName($airline_name, $fromsource = NULL) |
| 2162 | 2280 | { |
| 2163 | 2281 | global $globalUseRealAirlines; |
| 2164 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2282 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2283 | + $fromsource = NULL; |
|
| 2284 | + } |
|
| 2165 | 2285 | $airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING)); |
| 2166 | 2286 | $query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1"; |
| 2167 | 2287 | $sth = $this->db->prepare($query); |
@@ -2177,7 +2297,9 @@ discard block |
||
| 2177 | 2297 | $sth->execute(array(':fromsource' => $fromsource)); |
| 2178 | 2298 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2179 | 2299 | $sth->closeCursor(); |
| 2180 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name); |
|
| 2300 | + if ($row['nb'] == 0) { |
|
| 2301 | + $result = $this->getAllAirlineInfoByName($airline_name); |
|
| 2302 | + } |
|
| 2181 | 2303 | } |
| 2182 | 2304 | return $result; |
| 2183 | 2305 | } |
@@ -2240,15 +2362,20 @@ discard block |
||
| 2240 | 2362 | 'A320-211' => 'A320', |
| 2241 | 2363 | '747-8i' => 'B748', |
| 2242 | 2364 | 'A380' => 'A388'); |
| 2243 | - if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
|
| 2365 | + if (isset($all_aircraft[$aircraft_type])) { |
|
| 2366 | + return $all_aircraft[$aircraft_type]; |
|
| 2367 | + } |
|
| 2244 | 2368 | |
| 2245 | 2369 | $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
| 2246 | 2370 | $aircraft_type = strtoupper($aircraft_type); |
| 2247 | 2371 | $sth = $this->db->prepare($query); |
| 2248 | 2372 | $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
| 2249 | 2373 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2250 | - if (isset($result[0]['icao'])) return $result[0]['icao']; |
|
| 2251 | - else return ''; |
|
| 2374 | + if (isset($result[0]['icao'])) { |
|
| 2375 | + return $result[0]['icao']; |
|
| 2376 | + } else { |
|
| 2377 | + return ''; |
|
| 2378 | + } |
|
| 2252 | 2379 | } |
| 2253 | 2380 | |
| 2254 | 2381 | /** |
@@ -2271,9 +2398,13 @@ discard block |
||
| 2271 | 2398 | $sth->closeCursor(); |
| 2272 | 2399 | if (isset($row['icaotypecode'])) { |
| 2273 | 2400 | $icao = $row['icaotypecode']; |
| 2274 | - if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao]; |
|
| 2401 | + if (isset($this->aircraft_correct_icaotype[$icao])) { |
|
| 2402 | + $icao = $this->aircraft_correct_icaotype[$icao]; |
|
| 2403 | + } |
|
| 2275 | 2404 | return $icao; |
| 2276 | - } else return ''; |
|
| 2405 | + } else { |
|
| 2406 | + return ''; |
|
| 2407 | + } |
|
| 2277 | 2408 | } |
| 2278 | 2409 | |
| 2279 | 2410 | /** |
@@ -2296,7 +2427,9 @@ discard block |
||
| 2296 | 2427 | $sth->closeCursor(); |
| 2297 | 2428 | if (isset($row['icaotypecode'])) { |
| 2298 | 2429 | return $row['icaotypecode']; |
| 2299 | - } else return ''; |
|
| 2430 | + } else { |
|
| 2431 | + return ''; |
|
| 2432 | + } |
|
| 2300 | 2433 | } |
| 2301 | 2434 | |
| 2302 | 2435 | /** |
@@ -2342,7 +2475,9 @@ discard block |
||
| 2342 | 2475 | $sth->closeCursor(); |
| 2343 | 2476 | if (isset($row['operator_correct'])) { |
| 2344 | 2477 | return $row['operator_correct']; |
| 2345 | - } else return $operator; |
|
| 2478 | + } else { |
|
| 2479 | + return $operator; |
|
| 2480 | + } |
|
| 2346 | 2481 | } |
| 2347 | 2482 | |
| 2348 | 2483 | /** |
@@ -2355,7 +2490,9 @@ discard block |
||
| 2355 | 2490 | public function getRouteInfo($callsign) |
| 2356 | 2491 | { |
| 2357 | 2492 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
| 2358 | - if ($callsign == '') return array(); |
|
| 2493 | + if ($callsign == '') { |
|
| 2494 | + return array(); |
|
| 2495 | + } |
|
| 2359 | 2496 | $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
| 2360 | 2497 | |
| 2361 | 2498 | $sth = $this->db->prepare($query); |
@@ -2365,7 +2502,9 @@ discard block |
||
| 2365 | 2502 | $sth->closeCursor(); |
| 2366 | 2503 | if (count($row) > 0) { |
| 2367 | 2504 | return $row; |
| 2368 | - } else return array(); |
|
| 2505 | + } else { |
|
| 2506 | + return array(); |
|
| 2507 | + } |
|
| 2369 | 2508 | } |
| 2370 | 2509 | |
| 2371 | 2510 | /** |
@@ -2418,7 +2557,9 @@ discard block |
||
| 2418 | 2557 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 2419 | 2558 | $sth->closeCursor(); |
| 2420 | 2559 | return $result; |
| 2421 | - } else return array(); |
|
| 2560 | + } else { |
|
| 2561 | + return array(); |
|
| 2562 | + } |
|
| 2422 | 2563 | } |
| 2423 | 2564 | |
| 2424 | 2565 | |
@@ -2577,8 +2718,11 @@ discard block |
||
| 2577 | 2718 | $query .= " ORDER BY spotter_output.source_name ASC"; |
| 2578 | 2719 | |
| 2579 | 2720 | $sth = $this->db->prepare($query); |
| 2580 | - if (!empty($query_values)) $sth->execute($query_values); |
|
| 2581 | - else $sth->execute(); |
|
| 2721 | + if (!empty($query_values)) { |
|
| 2722 | + $sth->execute($query_values); |
|
| 2723 | + } else { |
|
| 2724 | + $sth->execute(); |
|
| 2725 | + } |
|
| 2582 | 2726 | |
| 2583 | 2727 | $source_array = array(); |
| 2584 | 2728 | $temp_array = array(); |
@@ -2611,9 +2755,13 @@ discard block |
||
| 2611 | 2755 | WHERE spotter_output.airline_icao <> '' |
| 2612 | 2756 | ORDER BY spotter_output.airline_name ASC"; |
| 2613 | 2757 | */ |
| 2614 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2615 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2616 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2758 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2759 | + $forsource = $globalAirlinesSource; |
|
| 2760 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2761 | + $forsource = 'vatsim'; |
|
| 2762 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2763 | + $forsource = 'ivao'; |
|
| 2764 | + } |
|
| 2617 | 2765 | if ($forsource === NULL) { |
| 2618 | 2766 | $query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC"; |
| 2619 | 2767 | $query_data = array(); |
@@ -2656,9 +2804,13 @@ discard block |
||
| 2656 | 2804 | { |
| 2657 | 2805 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
| 2658 | 2806 | $filter_query = $this->getFilter($filters,true,true); |
| 2659 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2660 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2661 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2807 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2808 | + $forsource = $globalAirlinesSource; |
|
| 2809 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2810 | + $forsource = 'vatsim'; |
|
| 2811 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2812 | + $forsource = 'ivao'; |
|
| 2813 | + } |
|
| 2662 | 2814 | if ($forsource === NULL) { |
| 2663 | 2815 | $query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC"; |
| 2664 | 2816 | $query_data = array(); |
@@ -2933,7 +3085,9 @@ discard block |
||
| 2933 | 3085 | date_default_timezone_set($globalTimezone); |
| 2934 | 3086 | $datetime = new DateTime(); |
| 2935 | 3087 | $offset = $datetime->format('P'); |
| 2936 | - } else $offset = '+00:00'; |
|
| 3088 | + } else { |
|
| 3089 | + $offset = '+00:00'; |
|
| 3090 | + } |
|
| 2937 | 3091 | if ($airport_icao == '') { |
| 2938 | 3092 | if ($globalDBdriver == 'mysql') { |
| 2939 | 3093 | $query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -2965,7 +3119,9 @@ discard block |
||
| 2965 | 3119 | date_default_timezone_set($globalTimezone); |
| 2966 | 3120 | $datetime = new DateTime(); |
| 2967 | 3121 | $offset = $datetime->format('P'); |
| 2968 | - } else $offset = '+00:00'; |
|
| 3122 | + } else { |
|
| 3123 | + $offset = '+00:00'; |
|
| 3124 | + } |
|
| 2969 | 3125 | if ($airport_icao == '') { |
| 2970 | 3126 | if ($globalDBdriver == 'mysql') { |
| 2971 | 3127 | $query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -2998,7 +3154,9 @@ discard block |
||
| 2998 | 3154 | date_default_timezone_set($globalTimezone); |
| 2999 | 3155 | $datetime = new DateTime(); |
| 3000 | 3156 | $offset = $datetime->format('P'); |
| 3001 | - } else $offset = '+00:00'; |
|
| 3157 | + } else { |
|
| 3158 | + $offset = '+00:00'; |
|
| 3159 | + } |
|
| 3002 | 3160 | if ($airport_icao == '') { |
| 3003 | 3161 | if ($globalDBdriver == 'mysql') { |
| 3004 | 3162 | $query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3037,7 +3195,9 @@ discard block |
||
| 3037 | 3195 | date_default_timezone_set($globalTimezone); |
| 3038 | 3196 | $datetime = new DateTime(); |
| 3039 | 3197 | $offset = $datetime->format('P'); |
| 3040 | - } else $offset = '+00:00'; |
|
| 3198 | + } else { |
|
| 3199 | + $offset = '+00:00'; |
|
| 3200 | + } |
|
| 3041 | 3201 | if ($airport_icao == '') { |
| 3042 | 3202 | if ($globalDBdriver == 'mysql') { |
| 3043 | 3203 | $query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3082,7 +3242,9 @@ discard block |
||
| 3082 | 3242 | date_default_timezone_set($globalTimezone); |
| 3083 | 3243 | $datetime = new DateTime(); |
| 3084 | 3244 | $offset = $datetime->format('P'); |
| 3085 | - } else $offset = '+00:00'; |
|
| 3245 | + } else { |
|
| 3246 | + $offset = '+00:00'; |
|
| 3247 | + } |
|
| 3086 | 3248 | if ($airport_icao == '') { |
| 3087 | 3249 | if ($globalDBdriver == 'mysql') { |
| 3088 | 3250 | $query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -3117,7 +3279,9 @@ discard block |
||
| 3117 | 3279 | date_default_timezone_set($globalTimezone); |
| 3118 | 3280 | $datetime = new DateTime(); |
| 3119 | 3281 | $offset = $datetime->format('P'); |
| 3120 | - } else $offset = '+00:00'; |
|
| 3282 | + } else { |
|
| 3283 | + $offset = '+00:00'; |
|
| 3284 | + } |
|
| 3121 | 3285 | if ($airport_icao == '') { |
| 3122 | 3286 | if ($globalDBdriver == 'mysql') { |
| 3123 | 3287 | $query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3159,7 +3323,9 @@ discard block |
||
| 3159 | 3323 | date_default_timezone_set($globalTimezone); |
| 3160 | 3324 | $datetime = new DateTime(); |
| 3161 | 3325 | $offset = $datetime->format('P'); |
| 3162 | - } else $offset = '+00:00'; |
|
| 3326 | + } else { |
|
| 3327 | + $offset = '+00:00'; |
|
| 3328 | + } |
|
| 3163 | 3329 | if ($airport_icao == '') { |
| 3164 | 3330 | if ($globalDBdriver == 'mysql') { |
| 3165 | 3331 | $query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -3193,7 +3359,9 @@ discard block |
||
| 3193 | 3359 | date_default_timezone_set($globalTimezone); |
| 3194 | 3360 | $datetime = new DateTime(); |
| 3195 | 3361 | $offset = $datetime->format('P'); |
| 3196 | - } else $offset = '+00:00'; |
|
| 3362 | + } else { |
|
| 3363 | + $offset = '+00:00'; |
|
| 3364 | + } |
|
| 3197 | 3365 | if ($airport_icao == '') { |
| 3198 | 3366 | if ($globalDBdriver == 'mysql') { |
| 3199 | 3367 | $query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3241,7 +3409,9 @@ discard block |
||
| 3241 | 3409 | date_default_timezone_set($globalTimezone); |
| 3242 | 3410 | $datetime = new DateTime(); |
| 3243 | 3411 | $offset = $datetime->format('P'); |
| 3244 | - } else $offset = '+00:00'; |
|
| 3412 | + } else { |
|
| 3413 | + $offset = '+00:00'; |
|
| 3414 | + } |
|
| 3245 | 3415 | |
| 3246 | 3416 | if ($globalDBdriver == 'mysql') { |
| 3247 | 3417 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
@@ -3361,7 +3531,9 @@ discard block |
||
| 3361 | 3531 | */ |
| 3362 | 3532 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
| 3363 | 3533 | { |
| 3364 | - if ($groundspeed == '') $groundspeed = NULL; |
|
| 3534 | + if ($groundspeed == '') { |
|
| 3535 | + $groundspeed = NULL; |
|
| 3536 | + } |
|
| 3365 | 3537 | $query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id'; |
| 3366 | 3538 | $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
| 3367 | 3539 | |
@@ -3411,10 +3583,18 @@ discard block |
||
| 3411 | 3583 | $Image = new Image($this->db); |
| 3412 | 3584 | $Common = new Common(); |
| 3413 | 3585 | |
| 3414 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 3415 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 3416 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 3417 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 3586 | + if (!isset($globalIVAO)) { |
|
| 3587 | + $globalIVAO = FALSE; |
|
| 3588 | + } |
|
| 3589 | + if (!isset($globalVATSIM)) { |
|
| 3590 | + $globalVATSIM = FALSE; |
|
| 3591 | + } |
|
| 3592 | + if (!isset($globalphpVMS)) { |
|
| 3593 | + $globalphpVMS = FALSE; |
|
| 3594 | + } |
|
| 3595 | + if (!isset($globalVAM)) { |
|
| 3596 | + $globalVAM = FALSE; |
|
| 3597 | + } |
|
| 3418 | 3598 | date_default_timezone_set('UTC'); |
| 3419 | 3599 | |
| 3420 | 3600 | //getting the registration |
@@ -3427,23 +3607,33 @@ discard block |
||
| 3427 | 3607 | if ($ModeS != '') { |
| 3428 | 3608 | $timeelapsed = microtime(true); |
| 3429 | 3609 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
| 3430 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3610 | + if ($globalDebugTimeElapsed) { |
|
| 3611 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3612 | + } |
|
| 3431 | 3613 | } else { |
| 3432 | 3614 | $myhex = explode('-',$flightaware_id); |
| 3433 | 3615 | if (count($myhex) > 0) { |
| 3434 | 3616 | $timeelapsed = microtime(true); |
| 3435 | 3617 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
| 3436 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3618 | + if ($globalDebugTimeElapsed) { |
|
| 3619 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3620 | + } |
|
| 3437 | 3621 | } |
| 3438 | 3622 | } |
| 3439 | 3623 | } |
| 3440 | 3624 | } |
| 3441 | 3625 | $fromsource = NULL; |
| 3442 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 3443 | - elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 3444 | - elseif ($format_source == 'whazzup') $fromsource = 'ivao'; |
|
| 3445 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 3446 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 3626 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 3627 | + $fromsource = $globalAirlinesSource; |
|
| 3628 | + } elseif ($format_source == 'vatsimtxt') { |
|
| 3629 | + $fromsource = 'vatsim'; |
|
| 3630 | + } elseif ($format_source == 'whazzup') { |
|
| 3631 | + $fromsource = 'ivao'; |
|
| 3632 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 3633 | + $fromsource = 'vatsim'; |
|
| 3634 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 3635 | + $fromsource = 'ivao'; |
|
| 3636 | + } |
|
| 3447 | 3637 | //getting the airline information |
| 3448 | 3638 | if ($ident != "") |
| 3449 | 3639 | { |
@@ -3467,15 +3657,21 @@ discard block |
||
| 3467 | 3657 | if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
| 3468 | 3658 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3469 | 3659 | } |
| 3470 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3660 | + if ($globalDebugTimeElapsed) { |
|
| 3661 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3662 | + } |
|
| 3471 | 3663 | |
| 3472 | 3664 | } else { |
| 3473 | 3665 | $timeelapsed = microtime(true); |
| 3474 | 3666 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3475 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3667 | + if ($globalDebugTimeElapsed) { |
|
| 3668 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3669 | + } |
|
| 3476 | 3670 | } |
| 3477 | 3671 | } |
| 3478 | - } else $airline_array = array(); |
|
| 3672 | + } else { |
|
| 3673 | + $airline_array = array(); |
|
| 3674 | + } |
|
| 3479 | 3675 | |
| 3480 | 3676 | //getting the aircraft information |
| 3481 | 3677 | $aircraft_array = array(); |
@@ -3489,27 +3685,37 @@ discard block |
||
| 3489 | 3685 | { |
| 3490 | 3686 | $timeelapsed = microtime(true); |
| 3491 | 3687 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3492 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3688 | + if ($globalDebugTimeElapsed) { |
|
| 3689 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3690 | + } |
|
| 3493 | 3691 | } else { |
| 3494 | 3692 | $timeelapsed = microtime(true); |
| 3495 | 3693 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3496 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3694 | + if ($globalDebugTimeElapsed) { |
|
| 3695 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3696 | + } |
|
| 3497 | 3697 | } |
| 3498 | 3698 | } |
| 3499 | 3699 | } else { |
| 3500 | 3700 | if ($ModeS != '') { |
| 3501 | 3701 | $timeelapsed = microtime(true); |
| 3502 | 3702 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
| 3503 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3703 | + if ($globalDebugTimeElapsed) { |
|
| 3704 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3705 | + } |
|
| 3504 | 3706 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
| 3505 | 3707 | { |
| 3506 | 3708 | $timeelapsed = microtime(true); |
| 3507 | 3709 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3508 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3710 | + if ($globalDebugTimeElapsed) { |
|
| 3711 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3712 | + } |
|
| 3509 | 3713 | } else { |
| 3510 | 3714 | $timeelapsed = microtime(true); |
| 3511 | 3715 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3512 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3716 | + if ($globalDebugTimeElapsed) { |
|
| 3717 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3718 | + } |
|
| 3513 | 3719 | } |
| 3514 | 3720 | } |
| 3515 | 3721 | } |
@@ -3525,7 +3731,9 @@ discard block |
||
| 3525 | 3731 | } else { |
| 3526 | 3732 | $timeelapsed = microtime(true); |
| 3527 | 3733 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
| 3528 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3734 | + if ($globalDebugTimeElapsed) { |
|
| 3735 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3736 | + } |
|
| 3529 | 3737 | } |
| 3530 | 3738 | } |
| 3531 | 3739 | |
@@ -3540,7 +3748,9 @@ discard block |
||
| 3540 | 3748 | } else { |
| 3541 | 3749 | $timeelapsed = microtime(true); |
| 3542 | 3750 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
| 3543 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3751 | + if ($globalDebugTimeElapsed) { |
|
| 3752 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3753 | + } |
|
| 3544 | 3754 | } |
| 3545 | 3755 | } |
| 3546 | 3756 | |
@@ -3574,7 +3784,9 @@ discard block |
||
| 3574 | 3784 | { |
| 3575 | 3785 | return false; |
| 3576 | 3786 | } |
| 3577 | - } else $altitude = 0; |
|
| 3787 | + } else { |
|
| 3788 | + $altitude = 0; |
|
| 3789 | + } |
|
| 3578 | 3790 | |
| 3579 | 3791 | if ($heading != "") |
| 3580 | 3792 | { |
@@ -3603,7 +3815,9 @@ discard block |
||
| 3603 | 3815 | { |
| 3604 | 3816 | $timeelapsed = microtime(true); |
| 3605 | 3817 | $image_array = $Image->getSpotterImage($registration); |
| 3606 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3818 | + if ($globalDebugTimeElapsed) { |
|
| 3819 | + echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3820 | + } |
|
| 3607 | 3821 | if (!isset($image_array[0]['registration'])) |
| 3608 | 3822 | { |
| 3609 | 3823 | //echo "Add image !!!! \n"; |
@@ -3611,14 +3825,21 @@ discard block |
||
| 3611 | 3825 | } |
| 3612 | 3826 | $timeelapsed = microtime(true); |
| 3613 | 3827 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
| 3614 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3615 | - if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 3828 | + if ($globalDebugTimeElapsed) { |
|
| 3829 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3830 | + } |
|
| 3831 | + if ($owner_info['owner'] != '') { |
|
| 3832 | + $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 3833 | + } |
|
| 3616 | 3834 | } |
| 3617 | 3835 | |
| 3618 | 3836 | if ($globalIVAO && $aircraft_icao != '') |
| 3619 | 3837 | { |
| 3620 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3621 | - else $airline_icao = ''; |
|
| 3838 | + if (isset($airline_array[0]['icao'])) { |
|
| 3839 | + $airline_icao = $airline_array[0]['icao']; |
|
| 3840 | + } else { |
|
| 3841 | + $airline_icao = ''; |
|
| 3842 | + } |
|
| 3622 | 3843 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
| 3623 | 3844 | if (!isset($image_array[0]['registration'])) |
| 3624 | 3845 | { |
@@ -3663,16 +3884,28 @@ discard block |
||
| 3663 | 3884 | { |
| 3664 | 3885 | $arrival_airport_array = $this->getAllAirportInfo('NA'); |
| 3665 | 3886 | } |
| 3666 | - if ($registration == '') $registration = 'NA'; |
|
| 3887 | + if ($registration == '') { |
|
| 3888 | + $registration = 'NA'; |
|
| 3889 | + } |
|
| 3667 | 3890 | if ($latitude == '' && $longitude == '') { |
| 3668 | 3891 | $latitude = 0; |
| 3669 | 3892 | $longitude = 0; |
| 3670 | 3893 | } |
| 3671 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3672 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3673 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3674 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3675 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 3894 | + if ($squawk == '' || $Common->isInteger($squawk) === false) { |
|
| 3895 | + $squawk = NULL; |
|
| 3896 | + } |
|
| 3897 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) { |
|
| 3898 | + $verticalrate = NULL; |
|
| 3899 | + } |
|
| 3900 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
| 3901 | + $heading = 0; |
|
| 3902 | + } |
|
| 3903 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
| 3904 | + $groundspeed = 0; |
|
| 3905 | + } |
|
| 3906 | + if (!isset($aircraft_owner)) { |
|
| 3907 | + $aircraft_owner = NULL; |
|
| 3908 | + } |
|
| 3676 | 3909 | $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
| 3677 | 3910 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)"; |
| 3678 | 3911 | |
@@ -3683,9 +3916,13 @@ discard block |
||
| 3683 | 3916 | if ($airline_type == '') { |
| 3684 | 3917 | $timeelapsed = microtime(true); |
| 3685 | 3918 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3686 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3919 | + if ($globalDebugTimeElapsed) { |
|
| 3920 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3921 | + } |
|
| 3922 | + } |
|
| 3923 | + if ($airline_type == null) { |
|
| 3924 | + $airline_type = ''; |
|
| 3687 | 3925 | } |
| 3688 | - if ($airline_type == null) $airline_type = ''; |
|
| 3689 | 3926 | $aircraft_type = $aircraft_array[0]['type']; |
| 3690 | 3927 | $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
| 3691 | 3928 | $departure_airport_name = $departure_airport_array[0]['name']; |
@@ -3849,7 +4086,9 @@ discard block |
||
| 3849 | 4086 | } |
| 3850 | 4087 | } |
| 3851 | 4088 | $query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC"; |
| 3852 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4089 | + if ($limit) { |
|
| 4090 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4091 | + } |
|
| 3853 | 4092 | |
| 3854 | 4093 | $sth = $this->db->prepare($query); |
| 3855 | 4094 | $sth->execute($query_values); |
@@ -3922,7 +4161,9 @@ discard block |
||
| 3922 | 4161 | } |
| 3923 | 4162 | |
| 3924 | 4163 | $query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 3925 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4164 | + if ($limit) { |
|
| 4165 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4166 | + } |
|
| 3926 | 4167 | |
| 3927 | 4168 | |
| 3928 | 4169 | $sth = $this->db->prepare($query); |
@@ -3966,7 +4207,9 @@ discard block |
||
| 3966 | 4207 | } |
| 3967 | 4208 | } |
| 3968 | 4209 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 3969 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4210 | + if ($limit) { |
|
| 4211 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4212 | + } |
|
| 3970 | 4213 | |
| 3971 | 4214 | |
| 3972 | 4215 | $sth = $this->db->prepare($query); |
@@ -4042,7 +4285,9 @@ discard block |
||
| 4042 | 4285 | } |
| 4043 | 4286 | } |
| 4044 | 4287 | $query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC"; |
| 4045 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4288 | + if ($limit) { |
|
| 4289 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4290 | + } |
|
| 4046 | 4291 | |
| 4047 | 4292 | $sth = $this->db->prepare($query); |
| 4048 | 4293 | $sth->execute($query_values); |
@@ -4084,7 +4329,9 @@ discard block |
||
| 4084 | 4329 | } |
| 4085 | 4330 | } |
| 4086 | 4331 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC"; |
| 4087 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4332 | + if ($limit) { |
|
| 4333 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4334 | + } |
|
| 4088 | 4335 | |
| 4089 | 4336 | |
| 4090 | 4337 | $sth = $this->db->prepare($query); |
@@ -4327,7 +4574,9 @@ discard block |
||
| 4327 | 4574 | date_default_timezone_set($globalTimezone); |
| 4328 | 4575 | $datetime = new DateTime($date); |
| 4329 | 4576 | $offset = $datetime->format('P'); |
| 4330 | - } else $offset = '+00:00'; |
|
| 4577 | + } else { |
|
| 4578 | + $offset = '+00:00'; |
|
| 4579 | + } |
|
| 4331 | 4580 | |
| 4332 | 4581 | if ($globalDBdriver == 'mysql') { |
| 4333 | 4582 | $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
@@ -4375,7 +4624,9 @@ discard block |
||
| 4375 | 4624 | date_default_timezone_set($globalTimezone); |
| 4376 | 4625 | $datetime = new DateTime($date); |
| 4377 | 4626 | $offset = $datetime->format('P'); |
| 4378 | - } else $offset = '+00:00'; |
|
| 4627 | + } else { |
|
| 4628 | + $offset = '+00:00'; |
|
| 4629 | + } |
|
| 4379 | 4630 | |
| 4380 | 4631 | if ($globalDBdriver == 'mysql') { |
| 4381 | 4632 | $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
@@ -4622,7 +4873,9 @@ discard block |
||
| 4622 | 4873 | } |
| 4623 | 4874 | $query .= " GROUP BY spotter_output.airline_country |
| 4624 | 4875 | ORDER BY airline_country_count DESC"; |
| 4625 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4876 | + if ($limit) { |
|
| 4877 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4878 | + } |
|
| 4626 | 4879 | |
| 4627 | 4880 | $sth = $this->db->prepare($query); |
| 4628 | 4881 | $sth->execute($query_values); |
@@ -4650,7 +4903,9 @@ discard block |
||
| 4650 | 4903 | global $globalDBdriver; |
| 4651 | 4904 | //$filter_query = $this->getFilter($filters,true,true); |
| 4652 | 4905 | $Connection= new Connection($this->db); |
| 4653 | - if (!$Connection->tableExists('countries')) return array(); |
|
| 4906 | + if (!$Connection->tableExists('countries')) { |
|
| 4907 | + return array(); |
|
| 4908 | + } |
|
| 4654 | 4909 | /* |
| 4655 | 4910 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
| 4656 | 4911 | FROM countries c, spotter_output s |
@@ -4682,7 +4937,9 @@ discard block |
||
| 4682 | 4937 | } |
| 4683 | 4938 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT flightaware_id,over_country FROM spotter_live".$filter_query.") l ON c.iso2 = l.over_country "; |
| 4684 | 4939 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
| 4685 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4940 | + if ($limit) { |
|
| 4941 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4942 | + } |
|
| 4686 | 4943 | |
| 4687 | 4944 | |
| 4688 | 4945 | $sth = $this->db->prepare($query); |
@@ -4759,7 +5016,9 @@ discard block |
||
| 4759 | 5016 | } |
| 4760 | 5017 | |
| 4761 | 5018 | $query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 4762 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5019 | + if ($limit) { |
|
| 5020 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5021 | + } |
|
| 4763 | 5022 | |
| 4764 | 5023 | $sth = $this->db->prepare($query); |
| 4765 | 5024 | $sth->execute($query_values); |
@@ -4833,7 +5092,9 @@ discard block |
||
| 4833 | 5092 | } |
| 4834 | 5093 | |
| 4835 | 5094 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 4836 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5095 | + if ($limit) { |
|
| 5096 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5097 | + } |
|
| 4837 | 5098 | |
| 4838 | 5099 | $sth = $this->db->prepare($query); |
| 4839 | 5100 | $sth->execute($query_values); |
@@ -4880,7 +5141,9 @@ discard block |
||
| 4880 | 5141 | } |
| 4881 | 5142 | |
| 4882 | 5143 | $query .= "GROUP BY EXTRACT(month from spotter_output.date), EXTRACT(year from spotter_output.date), spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 4883 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5144 | + if ($limit) { |
|
| 5145 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5146 | + } |
|
| 4884 | 5147 | |
| 4885 | 5148 | $sth = $this->db->prepare($query); |
| 4886 | 5149 | $sth->execute(); |
@@ -4933,7 +5196,9 @@ discard block |
||
| 4933 | 5196 | if($row['registration'] != "") |
| 4934 | 5197 | { |
| 4935 | 5198 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4936 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5199 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5200 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5201 | + } |
|
| 4937 | 5202 | } |
| 4938 | 5203 | $temp_array['registration_count'] = $row['registration_count']; |
| 4939 | 5204 | |
@@ -5008,7 +5273,9 @@ discard block |
||
| 5008 | 5273 | if($row['registration'] != "") |
| 5009 | 5274 | { |
| 5010 | 5275 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5011 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5276 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5277 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5278 | + } |
|
| 5012 | 5279 | } |
| 5013 | 5280 | $temp_array['registration_count'] = $row['registration_count']; |
| 5014 | 5281 | |
@@ -5115,7 +5382,9 @@ discard block |
||
| 5115 | 5382 | if($row['registration'] != "") |
| 5116 | 5383 | { |
| 5117 | 5384 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5118 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5385 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5386 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5387 | + } |
|
| 5119 | 5388 | } |
| 5120 | 5389 | $temp_array['registration_count'] = $row['registration_count']; |
| 5121 | 5390 | $aircraft_array[] = $temp_array; |
@@ -5240,7 +5509,9 @@ discard block |
||
| 5240 | 5509 | date_default_timezone_set($globalTimezone); |
| 5241 | 5510 | $datetime = new DateTime($date); |
| 5242 | 5511 | $offset = $datetime->format('P'); |
| 5243 | - } else $offset = '+00:00'; |
|
| 5512 | + } else { |
|
| 5513 | + $offset = '+00:00'; |
|
| 5514 | + } |
|
| 5244 | 5515 | |
| 5245 | 5516 | if ($globalDBdriver == 'mysql') { |
| 5246 | 5517 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
@@ -5287,7 +5558,9 @@ discard block |
||
| 5287 | 5558 | date_default_timezone_set($globalTimezone); |
| 5288 | 5559 | $datetime = new DateTime($date); |
| 5289 | 5560 | $offset = $datetime->format('P'); |
| 5290 | - } else $offset = '+00:00'; |
|
| 5561 | + } else { |
|
| 5562 | + $offset = '+00:00'; |
|
| 5563 | + } |
|
| 5291 | 5564 | |
| 5292 | 5565 | if ($globalDBdriver == 'mysql') { |
| 5293 | 5566 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
@@ -5316,7 +5589,9 @@ discard block |
||
| 5316 | 5589 | if($row['registration'] != "") |
| 5317 | 5590 | { |
| 5318 | 5591 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5319 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5592 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5593 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5594 | + } |
|
| 5320 | 5595 | } |
| 5321 | 5596 | $temp_array['registration_count'] = $row['registration_count']; |
| 5322 | 5597 | |
@@ -5341,7 +5616,9 @@ discard block |
||
| 5341 | 5616 | date_default_timezone_set($globalTimezone); |
| 5342 | 5617 | $datetime = new DateTime($date); |
| 5343 | 5618 | $offset = $datetime->format('P'); |
| 5344 | - } else $offset = '+00:00'; |
|
| 5619 | + } else { |
|
| 5620 | + $offset = '+00:00'; |
|
| 5621 | + } |
|
| 5345 | 5622 | |
| 5346 | 5623 | if ($globalDBdriver == 'mysql') { |
| 5347 | 5624 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
@@ -5439,8 +5716,11 @@ discard block |
||
| 5439 | 5716 | if($row['registration'] != "") |
| 5440 | 5717 | { |
| 5441 | 5718 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5442 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5443 | - else $temp_array['image_thumbnail'] = ''; |
|
| 5719 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5720 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5721 | + } else { |
|
| 5722 | + $temp_array['image_thumbnail'] = ''; |
|
| 5723 | + } |
|
| 5444 | 5724 | } |
| 5445 | 5725 | $temp_array['registration_count'] = $row['registration_count']; |
| 5446 | 5726 | $aircraft_array[] = $temp_array; |
@@ -5547,7 +5827,9 @@ discard block |
||
| 5547 | 5827 | if($row['registration'] != "") |
| 5548 | 5828 | { |
| 5549 | 5829 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5550 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5830 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5831 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5832 | + } |
|
| 5551 | 5833 | } |
| 5552 | 5834 | $temp_array['registration_count'] = $row['registration_count']; |
| 5553 | 5835 | |
@@ -5664,7 +5946,9 @@ discard block |
||
| 5664 | 5946 | if($row['registration'] != "") |
| 5665 | 5947 | { |
| 5666 | 5948 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5667 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5949 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5950 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5951 | + } |
|
| 5668 | 5952 | } |
| 5669 | 5953 | $temp_array['registration_count'] = $row['registration_count']; |
| 5670 | 5954 | |
@@ -5830,7 +6114,9 @@ discard block |
||
| 5830 | 6114 | } |
| 5831 | 6115 | } |
| 5832 | 6116 | $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
| 5833 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6117 | + if ($limit) { |
|
| 6118 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6119 | + } |
|
| 5834 | 6120 | |
| 5835 | 6121 | $sth = $this->db->prepare($query); |
| 5836 | 6122 | $sth->execute($query_values); |
@@ -5849,7 +6135,9 @@ discard block |
||
| 5849 | 6135 | if($row['registration'] != "") |
| 5850 | 6136 | { |
| 5851 | 6137 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5852 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6138 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6139 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6140 | + } |
|
| 5853 | 6141 | } |
| 5854 | 6142 | |
| 5855 | 6143 | $aircraft_array[] = $temp_array; |
@@ -5890,7 +6178,9 @@ discard block |
||
| 5890 | 6178 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5891 | 6179 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5892 | 6180 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
| 5893 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6181 | + if ($limit) { |
|
| 6182 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6183 | + } |
|
| 5894 | 6184 | |
| 5895 | 6185 | $sth = $this->db->prepare($query); |
| 5896 | 6186 | $sth->execute(); |
@@ -5910,7 +6200,9 @@ discard block |
||
| 5910 | 6200 | if($row['registration'] != "") |
| 5911 | 6201 | { |
| 5912 | 6202 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5913 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6203 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6204 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6205 | + } |
|
| 5914 | 6206 | } |
| 5915 | 6207 | |
| 5916 | 6208 | $aircraft_array[] = $temp_array; |
@@ -5976,7 +6268,9 @@ discard block |
||
| 5976 | 6268 | } |
| 5977 | 6269 | $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 5978 | 6270 | ORDER BY airport_departure_icao_count DESC"; |
| 5979 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6271 | + if ($limit) { |
|
| 6272 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6273 | + } |
|
| 5980 | 6274 | |
| 5981 | 6275 | $sth = $this->db->prepare($query); |
| 5982 | 6276 | $sth->execute($query_values); |
@@ -6027,7 +6321,9 @@ discard block |
||
| 6027 | 6321 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6028 | 6322 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6029 | 6323 | ORDER BY airport_departure_icao_count DESC"; |
| 6030 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6324 | + if ($limit) { |
|
| 6325 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6326 | + } |
|
| 6031 | 6327 | |
| 6032 | 6328 | $sth = $this->db->prepare($query); |
| 6033 | 6329 | $sth->execute(); |
@@ -6105,7 +6401,9 @@ discard block |
||
| 6105 | 6401 | } |
| 6106 | 6402 | $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
| 6107 | 6403 | ORDER BY airport_departure_icao_count DESC"; |
| 6108 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6404 | + if ($limit) { |
|
| 6405 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6406 | + } |
|
| 6109 | 6407 | //echo $query; |
| 6110 | 6408 | $sth = $this->db->prepare($query); |
| 6111 | 6409 | $sth->execute($query_values); |
@@ -6157,7 +6455,9 @@ discard block |
||
| 6157 | 6455 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6158 | 6456 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
| 6159 | 6457 | ORDER BY airport_departure_icao_count DESC"; |
| 6160 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6458 | + if ($limit) { |
|
| 6459 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6460 | + } |
|
| 6161 | 6461 | |
| 6162 | 6462 | $sth = $this->db->prepare($query); |
| 6163 | 6463 | $sth->execute(); |
@@ -6552,7 +6852,9 @@ discard block |
||
| 6552 | 6852 | date_default_timezone_set($globalTimezone); |
| 6553 | 6853 | $datetime = new DateTime($date); |
| 6554 | 6854 | $offset = $datetime->format('P'); |
| 6555 | - } else $offset = '+00:00'; |
|
| 6855 | + } else { |
|
| 6856 | + $offset = '+00:00'; |
|
| 6857 | + } |
|
| 6556 | 6858 | |
| 6557 | 6859 | if ($globalDBdriver == 'mysql') { |
| 6558 | 6860 | $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
@@ -6602,7 +6904,9 @@ discard block |
||
| 6602 | 6904 | date_default_timezone_set($globalTimezone); |
| 6603 | 6905 | $datetime = new DateTime($date); |
| 6604 | 6906 | $offset = $datetime->format('P'); |
| 6605 | - } else $offset = '+00:00'; |
|
| 6907 | + } else { |
|
| 6908 | + $offset = '+00:00'; |
|
| 6909 | + } |
|
| 6606 | 6910 | |
| 6607 | 6911 | if ($globalDBdriver == 'mysql') { |
| 6608 | 6912 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
@@ -6840,7 +7144,9 @@ discard block |
||
| 6840 | 7144 | } |
| 6841 | 7145 | $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6842 | 7146 | ORDER BY airport_arrival_icao_count DESC"; |
| 6843 | - if ($limit) $query .= " LIMIT 10"; |
|
| 7147 | + if ($limit) { |
|
| 7148 | + $query .= " LIMIT 10"; |
|
| 7149 | + } |
|
| 6844 | 7150 | |
| 6845 | 7151 | |
| 6846 | 7152 | $sth = $this->db->prepare($query); |
@@ -6860,7 +7166,9 @@ discard block |
||
| 6860 | 7166 | if ($icaoaskey) { |
| 6861 | 7167 | $icao = $row['arrival_airport_icao']; |
| 6862 | 7168 | $airport_array[$icao] = $temp_array; |
| 6863 | - } else $airport_array[] = $temp_array; |
|
| 7169 | + } else { |
|
| 7170 | + $airport_array[] = $temp_array; |
|
| 7171 | + } |
|
| 6864 | 7172 | } |
| 6865 | 7173 | |
| 6866 | 7174 | return $airport_array; |
@@ -6897,7 +7205,9 @@ discard block |
||
| 6897 | 7205 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6898 | 7206 | $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6899 | 7207 | ORDER BY airport_arrival_icao_count DESC"; |
| 6900 | - if ($limit) $query .= " LIMIT 10"; |
|
| 7208 | + if ($limit) { |
|
| 7209 | + $query .= " LIMIT 10"; |
|
| 7210 | + } |
|
| 6901 | 7211 | |
| 6902 | 7212 | |
| 6903 | 7213 | $sth = $this->db->prepare($query); |
@@ -6918,7 +7228,9 @@ discard block |
||
| 6918 | 7228 | if ($icaoaskey) { |
| 6919 | 7229 | $icao = $row['arrival_airport_icao']; |
| 6920 | 7230 | $airport_array[$icao] = $temp_array; |
| 6921 | - } else $airport_array[] = $temp_array; |
|
| 7231 | + } else { |
|
| 7232 | + $airport_array[] = $temp_array; |
|
| 7233 | + } |
|
| 6922 | 7234 | } |
| 6923 | 7235 | |
| 6924 | 7236 | return $airport_array; |
@@ -6981,7 +7293,9 @@ discard block |
||
| 6981 | 7293 | } |
| 6982 | 7294 | $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
| 6983 | 7295 | ORDER BY airport_arrival_icao_count DESC"; |
| 6984 | - if ($limit) $query .= " LIMIT 10"; |
|
| 7296 | + if ($limit) { |
|
| 7297 | + $query .= " LIMIT 10"; |
|
| 7298 | + } |
|
| 6985 | 7299 | |
| 6986 | 7300 | |
| 6987 | 7301 | $sth = $this->db->prepare($query); |
@@ -7000,7 +7314,9 @@ discard block |
||
| 7000 | 7314 | if ($icaoaskey) { |
| 7001 | 7315 | $icao = $row['arrival_airport_icao']; |
| 7002 | 7316 | $airport_array[$icao] = $temp_array; |
| 7003 | - } else $airport_array[] = $temp_array; |
|
| 7317 | + } else { |
|
| 7318 | + $airport_array[] = $temp_array; |
|
| 7319 | + } |
|
| 7004 | 7320 | } |
| 7005 | 7321 | |
| 7006 | 7322 | return $airport_array; |
@@ -7037,7 +7353,9 @@ discard block |
||
| 7037 | 7353 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 7038 | 7354 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
| 7039 | 7355 | ORDER BY airport_arrival_icao_count DESC"; |
| 7040 | - if ($limit) $query .= " LIMIT 10"; |
|
| 7356 | + if ($limit) { |
|
| 7357 | + $query .= " LIMIT 10"; |
|
| 7358 | + } |
|
| 7041 | 7359 | |
| 7042 | 7360 | |
| 7043 | 7361 | $sth = $this->db->prepare($query); |
@@ -7058,7 +7376,9 @@ discard block |
||
| 7058 | 7376 | if ($icaoaskey) { |
| 7059 | 7377 | $icao = $row['arrival_airport_icao']; |
| 7060 | 7378 | $airport_array[$icao] = $temp_array; |
| 7061 | - } else $airport_array[] = $temp_array; |
|
| 7379 | + } else { |
|
| 7380 | + $airport_array[] = $temp_array; |
|
| 7381 | + } |
|
| 7062 | 7382 | } |
| 7063 | 7383 | |
| 7064 | 7384 | return $airport_array; |
@@ -7439,7 +7759,9 @@ discard block |
||
| 7439 | 7759 | date_default_timezone_set($globalTimezone); |
| 7440 | 7760 | $datetime = new DateTime($date); |
| 7441 | 7761 | $offset = $datetime->format('P'); |
| 7442 | - } else $offset = '+00:00'; |
|
| 7762 | + } else { |
|
| 7763 | + $offset = '+00:00'; |
|
| 7764 | + } |
|
| 7443 | 7765 | |
| 7444 | 7766 | if ($globalDBdriver == 'mysql') { |
| 7445 | 7767 | $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
@@ -7489,7 +7811,9 @@ discard block |
||
| 7489 | 7811 | date_default_timezone_set($globalTimezone); |
| 7490 | 7812 | $datetime = new DateTime($date); |
| 7491 | 7813 | $offset = $datetime->format('P'); |
| 7492 | - } else $offset = '+00:00'; |
|
| 7814 | + } else { |
|
| 7815 | + $offset = '+00:00'; |
|
| 7816 | + } |
|
| 7493 | 7817 | |
| 7494 | 7818 | if ($globalDBdriver == 'mysql') { |
| 7495 | 7819 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
@@ -7771,7 +8095,9 @@ discard block |
||
| 7771 | 8095 | } |
| 7772 | 8096 | $query .= " GROUP BY spotter_output.arrival_airport_country |
| 7773 | 8097 | ORDER BY airport_arrival_country_count DESC"; |
| 7774 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 8098 | + if ($limit) { |
|
| 8099 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 8100 | + } |
|
| 7775 | 8101 | |
| 7776 | 8102 | |
| 7777 | 8103 | $sth = $this->db->prepare($query); |
@@ -8058,7 +8384,9 @@ discard block |
||
| 8058 | 8384 | date_default_timezone_set($globalTimezone); |
| 8059 | 8385 | $datetime = new DateTime($date); |
| 8060 | 8386 | $offset = $datetime->format('P'); |
| 8061 | - } else $offset = '+00:00'; |
|
| 8387 | + } else { |
|
| 8388 | + $offset = '+00:00'; |
|
| 8389 | + } |
|
| 8062 | 8390 | |
| 8063 | 8391 | if ($globalDBdriver == 'mysql') { |
| 8064 | 8392 | $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
@@ -8234,12 +8562,18 @@ discard block |
||
| 8234 | 8562 | $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
| 8235 | 8563 | FROM spotter_output".$filter_query." spotter_output.ident <> '' "; |
| 8236 | 8564 | if ($olderthanmonths > 0) { |
| 8237 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 8238 | - else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 8565 | + if ($globalDBdriver == 'mysql') { |
|
| 8566 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 8567 | + } else { |
|
| 8568 | + $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 8569 | + } |
|
| 8239 | 8570 | } |
| 8240 | 8571 | if ($sincedate != '') { |
| 8241 | - if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 8242 | - else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 8572 | + if ($globalDBdriver == 'mysql') { |
|
| 8573 | + $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 8574 | + } else { |
|
| 8575 | + $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 8576 | + } |
|
| 8243 | 8577 | } |
| 8244 | 8578 | $query_values = array(); |
| 8245 | 8579 | if ($year != '') { |
@@ -8270,7 +8604,9 @@ discard block |
||
| 8270 | 8604 | } |
| 8271 | 8605 | } |
| 8272 | 8606 | $query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 8273 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 8607 | + if ($limit) { |
|
| 8608 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 8609 | + } |
|
| 8274 | 8610 | |
| 8275 | 8611 | $sth = $this->db->prepare($query); |
| 8276 | 8612 | $sth->execute($query_values); |
@@ -8304,15 +8640,23 @@ discard block |
||
| 8304 | 8640 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
| 8305 | 8641 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
| 8306 | 8642 | if ($olderthanmonths > 0) { |
| 8307 | - if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 8308 | - else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 8643 | + if ($globalDBdriver == 'mysql') { |
|
| 8644 | + $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 8645 | + } else { |
|
| 8646 | + $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 8647 | + } |
|
| 8309 | 8648 | } |
| 8310 | 8649 | if ($sincedate != '') { |
| 8311 | - if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 8312 | - else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 8650 | + if ($globalDBdriver == 'mysql') { |
|
| 8651 | + $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 8652 | + } else { |
|
| 8653 | + $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 8654 | + } |
|
| 8313 | 8655 | } |
| 8314 | 8656 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 8315 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 8657 | + if ($limit) { |
|
| 8658 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 8659 | + } |
|
| 8316 | 8660 | |
| 8317 | 8661 | $sth = $this->db->prepare($query); |
| 8318 | 8662 | $sth->execute(); |
@@ -8349,7 +8693,9 @@ discard block |
||
| 8349 | 8693 | date_default_timezone_set($globalTimezone); |
| 8350 | 8694 | $datetime = new DateTime(); |
| 8351 | 8695 | $offset = $datetime->format('P'); |
| 8352 | - } else $offset = '+00:00'; |
|
| 8696 | + } else { |
|
| 8697 | + $offset = '+00:00'; |
|
| 8698 | + } |
|
| 8353 | 8699 | |
| 8354 | 8700 | if ($globalDBdriver == 'mysql') { |
| 8355 | 8701 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8398,7 +8744,9 @@ discard block |
||
| 8398 | 8744 | date_default_timezone_set($globalTimezone); |
| 8399 | 8745 | $datetime = new DateTime(); |
| 8400 | 8746 | $offset = $datetime->format('P'); |
| 8401 | - } else $offset = '+00:00'; |
|
| 8747 | + } else { |
|
| 8748 | + $offset = '+00:00'; |
|
| 8749 | + } |
|
| 8402 | 8750 | $filter_query = $this->getFilter($filters,true,true); |
| 8403 | 8751 | if ($globalDBdriver == 'mysql') { |
| 8404 | 8752 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8447,7 +8795,9 @@ discard block |
||
| 8447 | 8795 | date_default_timezone_set($globalTimezone); |
| 8448 | 8796 | $datetime = new DateTime(); |
| 8449 | 8797 | $offset = $datetime->format('P'); |
| 8450 | - } else $offset = '+00:00'; |
|
| 8798 | + } else { |
|
| 8799 | + $offset = '+00:00'; |
|
| 8800 | + } |
|
| 8451 | 8801 | $filter_query = $this->getFilter($filters,true,true); |
| 8452 | 8802 | if ($globalDBdriver == 'mysql') { |
| 8453 | 8803 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8493,7 +8843,9 @@ discard block |
||
| 8493 | 8843 | date_default_timezone_set($globalTimezone); |
| 8494 | 8844 | $datetime = new DateTime(); |
| 8495 | 8845 | $offset = $datetime->format('P'); |
| 8496 | - } else $offset = '+00:00'; |
|
| 8846 | + } else { |
|
| 8847 | + $offset = '+00:00'; |
|
| 8848 | + } |
|
| 8497 | 8849 | $filter_query = $this->getFilter($filters,true,true); |
| 8498 | 8850 | if ($globalDBdriver == 'mysql') { |
| 8499 | 8851 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8541,7 +8893,9 @@ discard block |
||
| 8541 | 8893 | date_default_timezone_set($globalTimezone); |
| 8542 | 8894 | $datetime = new DateTime(); |
| 8543 | 8895 | $offset = $datetime->format('P'); |
| 8544 | - } else $offset = '+00:00'; |
|
| 8896 | + } else { |
|
| 8897 | + $offset = '+00:00'; |
|
| 8898 | + } |
|
| 8545 | 8899 | |
| 8546 | 8900 | if ($globalDBdriver == 'mysql') { |
| 8547 | 8901 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8589,7 +8943,9 @@ discard block |
||
| 8589 | 8943 | date_default_timezone_set($globalTimezone); |
| 8590 | 8944 | $datetime = new DateTime(); |
| 8591 | 8945 | $offset = $datetime->format('P'); |
| 8592 | - } else $offset = '+00:00'; |
|
| 8946 | + } else { |
|
| 8947 | + $offset = '+00:00'; |
|
| 8948 | + } |
|
| 8593 | 8949 | |
| 8594 | 8950 | if ($globalDBdriver == 'mysql') { |
| 8595 | 8951 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -8636,7 +8992,9 @@ discard block |
||
| 8636 | 8992 | date_default_timezone_set($globalTimezone); |
| 8637 | 8993 | $datetime = new DateTime(); |
| 8638 | 8994 | $offset = $datetime->format('P'); |
| 8639 | - } else $offset = '+00:00'; |
|
| 8995 | + } else { |
|
| 8996 | + $offset = '+00:00'; |
|
| 8997 | + } |
|
| 8640 | 8998 | |
| 8641 | 8999 | if ($globalDBdriver == 'mysql') { |
| 8642 | 9000 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -8684,7 +9042,9 @@ discard block |
||
| 8684 | 9042 | date_default_timezone_set($globalTimezone); |
| 8685 | 9043 | $datetime = new DateTime(); |
| 8686 | 9044 | $offset = $datetime->format('P'); |
| 8687 | - } else $offset = '+00:00'; |
|
| 9045 | + } else { |
|
| 9046 | + $offset = '+00:00'; |
|
| 9047 | + } |
|
| 8688 | 9048 | $filter_query = $this->getFilter($filters,true,true); |
| 8689 | 9049 | if ($globalDBdriver == 'mysql') { |
| 8690 | 9050 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -8729,7 +9089,9 @@ discard block |
||
| 8729 | 9089 | date_default_timezone_set($globalTimezone); |
| 8730 | 9090 | $datetime = new DateTime(); |
| 8731 | 9091 | $offset = $datetime->format('P'); |
| 8732 | - } else $offset = '+00:00'; |
|
| 9092 | + } else { |
|
| 9093 | + $offset = '+00:00'; |
|
| 9094 | + } |
|
| 8733 | 9095 | $filter_query = $this->getFilter($filters,true,true); |
| 8734 | 9096 | |
| 8735 | 9097 | if ($globalDBdriver == 'mysql') { |
@@ -8776,7 +9138,9 @@ discard block |
||
| 8776 | 9138 | date_default_timezone_set($globalTimezone); |
| 8777 | 9139 | $datetime = new DateTime(); |
| 8778 | 9140 | $offset = $datetime->format('P'); |
| 8779 | - } else $offset = '+00:00'; |
|
| 9141 | + } else { |
|
| 9142 | + $offset = '+00:00'; |
|
| 9143 | + } |
|
| 8780 | 9144 | |
| 8781 | 9145 | if ($globalDBdriver == 'mysql') { |
| 8782 | 9146 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
@@ -8822,7 +9186,9 @@ discard block |
||
| 8822 | 9186 | date_default_timezone_set($globalTimezone); |
| 8823 | 9187 | $datetime = new DateTime(); |
| 8824 | 9188 | $offset = $datetime->format('P'); |
| 8825 | - } else $offset = '+00:00'; |
|
| 9189 | + } else { |
|
| 9190 | + $offset = '+00:00'; |
|
| 9191 | + } |
|
| 8826 | 9192 | $filter_query = $this->getFilter($filters,true,true); |
| 8827 | 9193 | |
| 8828 | 9194 | if ($globalDBdriver == 'mysql') { |
@@ -8869,7 +9235,9 @@ discard block |
||
| 8869 | 9235 | date_default_timezone_set($globalTimezone); |
| 8870 | 9236 | $datetime = new DateTime(); |
| 8871 | 9237 | $offset = $datetime->format('P'); |
| 8872 | - } else $offset = '+00:00'; |
|
| 9238 | + } else { |
|
| 9239 | + $offset = '+00:00'; |
|
| 9240 | + } |
|
| 8873 | 9241 | |
| 8874 | 9242 | if ($globalDBdriver == 'mysql') { |
| 8875 | 9243 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
@@ -8916,7 +9284,9 @@ discard block |
||
| 8916 | 9284 | date_default_timezone_set($globalTimezone); |
| 8917 | 9285 | $datetime = new DateTime(); |
| 8918 | 9286 | $offset = $datetime->format('P'); |
| 8919 | - } else $offset = '+00:00'; |
|
| 9287 | + } else { |
|
| 9288 | + $offset = '+00:00'; |
|
| 9289 | + } |
|
| 8920 | 9290 | |
| 8921 | 9291 | if ($globalDBdriver == 'mysql') { |
| 8922 | 9292 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
@@ -8961,7 +9331,9 @@ discard block |
||
| 8961 | 9331 | date_default_timezone_set($globalTimezone); |
| 8962 | 9332 | $datetime = new DateTime(); |
| 8963 | 9333 | $offset = $datetime->format('P'); |
| 8964 | - } else $offset = '+00:00'; |
|
| 9334 | + } else { |
|
| 9335 | + $offset = '+00:00'; |
|
| 9336 | + } |
|
| 8965 | 9337 | $filter_query = $this->getFilter($filters,true,true); |
| 8966 | 9338 | |
| 8967 | 9339 | if ($globalDBdriver == 'mysql') { |
@@ -9009,7 +9381,9 @@ discard block |
||
| 9009 | 9381 | date_default_timezone_set($globalTimezone); |
| 9010 | 9382 | $datetime = new DateTime(); |
| 9011 | 9383 | $offset = $datetime->format('P'); |
| 9012 | - } else $offset = '+00:00'; |
|
| 9384 | + } else { |
|
| 9385 | + $offset = '+00:00'; |
|
| 9386 | + } |
|
| 9013 | 9387 | |
| 9014 | 9388 | if ($globalDBdriver == 'mysql') { |
| 9015 | 9389 | $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
@@ -9055,7 +9429,9 @@ discard block |
||
| 9055 | 9429 | date_default_timezone_set($globalTimezone); |
| 9056 | 9430 | $datetime = new DateTime(); |
| 9057 | 9431 | $offset = $datetime->format('P'); |
| 9058 | - } else $offset = '+00:00'; |
|
| 9432 | + } else { |
|
| 9433 | + $offset = '+00:00'; |
|
| 9434 | + } |
|
| 9059 | 9435 | $filter_query = $this->getFilter($filters,true,true); |
| 9060 | 9436 | |
| 9061 | 9437 | if ($globalDBdriver == 'mysql') { |
@@ -9103,7 +9479,9 @@ discard block |
||
| 9103 | 9479 | date_default_timezone_set($globalTimezone); |
| 9104 | 9480 | $datetime = new DateTime(); |
| 9105 | 9481 | $offset = $datetime->format('P'); |
| 9106 | - } else $offset = '+00:00'; |
|
| 9482 | + } else { |
|
| 9483 | + $offset = '+00:00'; |
|
| 9484 | + } |
|
| 9107 | 9485 | |
| 9108 | 9486 | if ($globalDBdriver == 'mysql') { |
| 9109 | 9487 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
@@ -9150,7 +9528,9 @@ discard block |
||
| 9150 | 9528 | date_default_timezone_set($globalTimezone); |
| 9151 | 9529 | $datetime = new DateTime(); |
| 9152 | 9530 | $offset = $datetime->format('P'); |
| 9153 | - } else $offset = '+00:00'; |
|
| 9531 | + } else { |
|
| 9532 | + $offset = '+00:00'; |
|
| 9533 | + } |
|
| 9154 | 9534 | $filter_query = $this->getFilter($filters,true,true); |
| 9155 | 9535 | if ($globalDBdriver == 'mysql') { |
| 9156 | 9536 | $query = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
@@ -9199,7 +9579,9 @@ discard block |
||
| 9199 | 9579 | date_default_timezone_set($globalTimezone); |
| 9200 | 9580 | $datetime = new DateTime(); |
| 9201 | 9581 | $offset = $datetime->format('P'); |
| 9202 | - } else $offset = '+00:00'; |
|
| 9582 | + } else { |
|
| 9583 | + $offset = '+00:00'; |
|
| 9584 | + } |
|
| 9203 | 9585 | |
| 9204 | 9586 | $orderby_sql = ''; |
| 9205 | 9587 | if ($orderby == "hour") |
@@ -9265,7 +9647,9 @@ discard block |
||
| 9265 | 9647 | date_default_timezone_set($globalTimezone); |
| 9266 | 9648 | $datetime = new DateTime(); |
| 9267 | 9649 | $offset = $datetime->format('P'); |
| 9268 | - } else $offset = '+00:00'; |
|
| 9650 | + } else { |
|
| 9651 | + $offset = '+00:00'; |
|
| 9652 | + } |
|
| 9269 | 9653 | |
| 9270 | 9654 | $orderby_sql = ''; |
| 9271 | 9655 | if ($orderby == "hour") |
@@ -9332,7 +9716,9 @@ discard block |
||
| 9332 | 9716 | date_default_timezone_set($globalTimezone); |
| 9333 | 9717 | $datetime = new DateTime(); |
| 9334 | 9718 | $offset = $datetime->format('P'); |
| 9335 | - } else $offset = '+00:00'; |
|
| 9719 | + } else { |
|
| 9720 | + $offset = '+00:00'; |
|
| 9721 | + } |
|
| 9336 | 9722 | |
| 9337 | 9723 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
| 9338 | 9724 | |
@@ -9383,7 +9769,9 @@ discard block |
||
| 9383 | 9769 | date_default_timezone_set($globalTimezone); |
| 9384 | 9770 | $datetime = new DateTime(); |
| 9385 | 9771 | $offset = $datetime->format('P'); |
| 9386 | - } else $offset = '+00:00'; |
|
| 9772 | + } else { |
|
| 9773 | + $offset = '+00:00'; |
|
| 9774 | + } |
|
| 9387 | 9775 | |
| 9388 | 9776 | if ($globalDBdriver == 'mysql') { |
| 9389 | 9777 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9430,7 +9818,9 @@ discard block |
||
| 9430 | 9818 | date_default_timezone_set($globalTimezone); |
| 9431 | 9819 | $datetime = new DateTime(); |
| 9432 | 9820 | $offset = $datetime->format('P'); |
| 9433 | - } else $offset = '+00:00'; |
|
| 9821 | + } else { |
|
| 9822 | + $offset = '+00:00'; |
|
| 9823 | + } |
|
| 9434 | 9824 | |
| 9435 | 9825 | if ($globalDBdriver == 'mysql') { |
| 9436 | 9826 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9477,7 +9867,9 @@ discard block |
||
| 9477 | 9867 | date_default_timezone_set($globalTimezone); |
| 9478 | 9868 | $datetime = new DateTime(); |
| 9479 | 9869 | $offset = $datetime->format('P'); |
| 9480 | - } else $offset = '+00:00'; |
|
| 9870 | + } else { |
|
| 9871 | + $offset = '+00:00'; |
|
| 9872 | + } |
|
| 9481 | 9873 | |
| 9482 | 9874 | if ($globalDBdriver == 'mysql') { |
| 9483 | 9875 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9525,7 +9917,9 @@ discard block |
||
| 9525 | 9917 | date_default_timezone_set($globalTimezone); |
| 9526 | 9918 | $datetime = new DateTime(); |
| 9527 | 9919 | $offset = $datetime->format('P'); |
| 9528 | - } else $offset = '+00:00'; |
|
| 9920 | + } else { |
|
| 9921 | + $offset = '+00:00'; |
|
| 9922 | + } |
|
| 9529 | 9923 | |
| 9530 | 9924 | if ($globalDBdriver == 'mysql') { |
| 9531 | 9925 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9573,7 +9967,9 @@ discard block |
||
| 9573 | 9967 | date_default_timezone_set($globalTimezone); |
| 9574 | 9968 | $datetime = new DateTime($date); |
| 9575 | 9969 | $offset = $datetime->format('P'); |
| 9576 | - } else $offset = '+00:00'; |
|
| 9970 | + } else { |
|
| 9971 | + $offset = '+00:00'; |
|
| 9972 | + } |
|
| 9577 | 9973 | |
| 9578 | 9974 | if ($globalDBdriver == 'mysql') { |
| 9579 | 9975 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9621,7 +10017,9 @@ discard block |
||
| 9621 | 10017 | date_default_timezone_set($globalTimezone); |
| 9622 | 10018 | $datetime = new DateTime(); |
| 9623 | 10019 | $offset = $datetime->format('P'); |
| 9624 | - } else $offset = '+00:00'; |
|
| 10020 | + } else { |
|
| 10021 | + $offset = '+00:00'; |
|
| 10022 | + } |
|
| 9625 | 10023 | |
| 9626 | 10024 | if ($globalDBdriver == 'mysql') { |
| 9627 | 10025 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9671,7 +10069,9 @@ discard block |
||
| 9671 | 10069 | date_default_timezone_set($globalTimezone); |
| 9672 | 10070 | $datetime = new DateTime(); |
| 9673 | 10071 | $offset = $datetime->format('P'); |
| 9674 | - } else $offset = '+00:00'; |
|
| 10072 | + } else { |
|
| 10073 | + $offset = '+00:00'; |
|
| 10074 | + } |
|
| 9675 | 10075 | |
| 9676 | 10076 | if ($globalDBdriver == 'mysql') { |
| 9677 | 10077 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9718,7 +10118,9 @@ discard block |
||
| 9718 | 10118 | date_default_timezone_set($globalTimezone); |
| 9719 | 10119 | $datetime = new DateTime(); |
| 9720 | 10120 | $offset = $datetime->format('P'); |
| 9721 | - } else $offset = '+00:00'; |
|
| 10121 | + } else { |
|
| 10122 | + $offset = '+00:00'; |
|
| 10123 | + } |
|
| 9722 | 10124 | |
| 9723 | 10125 | if ($globalDBdriver == 'mysql') { |
| 9724 | 10126 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9928,8 +10330,11 @@ discard block |
||
| 9928 | 10330 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 9929 | 10331 | } |
| 9930 | 10332 | } |
| 9931 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
| 9932 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 10333 | + if (empty($query_values)) { |
|
| 10334 | + $queryi .= $this->getFilter($filters); |
|
| 10335 | + } else { |
|
| 10336 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 10337 | + } |
|
| 9933 | 10338 | |
| 9934 | 10339 | //echo $query; |
| 9935 | 10340 | $sth = $this->db->prepare($queryi); |
@@ -10008,8 +10413,11 @@ discard block |
||
| 10008 | 10413 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 10009 | 10414 | } |
| 10010 | 10415 | } |
| 10011 | - if ($query == '') $queryi .= $this->getFilter($filters); |
|
| 10012 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 10416 | + if ($query == '') { |
|
| 10417 | + $queryi .= $this->getFilter($filters); |
|
| 10418 | + } else { |
|
| 10419 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 10420 | + } |
|
| 10013 | 10421 | |
| 10014 | 10422 | |
| 10015 | 10423 | $sth = $this->db->prepare($queryi); |
@@ -10032,7 +10440,9 @@ discard block |
||
| 10032 | 10440 | date_default_timezone_set($globalTimezone); |
| 10033 | 10441 | $datetime = new DateTime(); |
| 10034 | 10442 | $offset = $datetime->format('P'); |
| 10035 | - } else $offset = '+00:00'; |
|
| 10443 | + } else { |
|
| 10444 | + $offset = '+00:00'; |
|
| 10445 | + } |
|
| 10036 | 10446 | |
| 10037 | 10447 | if ($globalDBdriver == 'mysql') { |
| 10038 | 10448 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10218,7 +10628,9 @@ discard block |
||
| 10218 | 10628 | */ |
| 10219 | 10629 | public function parseDirection($direction = 0) |
| 10220 | 10630 | { |
| 10221 | - if ($direction == '') $direction = 0; |
|
| 10631 | + if ($direction == '') { |
|
| 10632 | + $direction = 0; |
|
| 10633 | + } |
|
| 10222 | 10634 | $direction_array = array(); |
| 10223 | 10635 | $temp_array = array(); |
| 10224 | 10636 | |
@@ -10319,7 +10731,9 @@ discard block |
||
| 10319 | 10731 | if (isset($result->AirlineFlightInfoResult)) |
| 10320 | 10732 | { |
| 10321 | 10733 | $registration = $result->AirlineFlightInfoResult->tailnumber; |
| 10322 | - } else return ''; |
|
| 10734 | + } else { |
|
| 10735 | + return ''; |
|
| 10736 | + } |
|
| 10323 | 10737 | |
| 10324 | 10738 | $registration = $this->convertAircraftRegistration($registration); |
| 10325 | 10739 | |
@@ -10348,7 +10762,9 @@ discard block |
||
| 10348 | 10762 | if (count($row) > 0) { |
| 10349 | 10763 | //return $row['Registration']; |
| 10350 | 10764 | return $row['registration']; |
| 10351 | - } else return ''; |
|
| 10765 | + } else { |
|
| 10766 | + return ''; |
|
| 10767 | + } |
|
| 10352 | 10768 | |
| 10353 | 10769 | } |
| 10354 | 10770 | |
@@ -10371,9 +10787,14 @@ discard block |
||
| 10371 | 10787 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 10372 | 10788 | $sth->closeCursor(); |
| 10373 | 10789 | if (count($row) > 0) { |
| 10374 | - if ($row['type_flight'] == null) return ''; |
|
| 10375 | - else return $row['type_flight']; |
|
| 10376 | - } else return ''; |
|
| 10790 | + if ($row['type_flight'] == null) { |
|
| 10791 | + return ''; |
|
| 10792 | + } else { |
|
| 10793 | + return $row['type_flight']; |
|
| 10794 | + } |
|
| 10795 | + } else { |
|
| 10796 | + return ''; |
|
| 10797 | + } |
|
| 10377 | 10798 | |
| 10378 | 10799 | } |
| 10379 | 10800 | |
@@ -10391,7 +10812,9 @@ discard block |
||
| 10391 | 10812 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 10392 | 10813 | |
| 10393 | 10814 | $Connection = new Connection($this->db); |
| 10394 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 10815 | + if (!$Connection->tableExists('countries')) { |
|
| 10816 | + return ''; |
|
| 10817 | + } |
|
| 10395 | 10818 | |
| 10396 | 10819 | try { |
| 10397 | 10820 | /* |
@@ -10411,9 +10834,13 @@ discard block |
||
| 10411 | 10834 | $sth->closeCursor(); |
| 10412 | 10835 | if (count($row) > 0) { |
| 10413 | 10836 | return $row; |
| 10414 | - } else return ''; |
|
| 10837 | + } else { |
|
| 10838 | + return ''; |
|
| 10839 | + } |
|
| 10415 | 10840 | } catch (PDOException $e) { |
| 10416 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 10841 | + if (isset($globalDebug) && $globalDebug) { |
|
| 10842 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 10843 | + } |
|
| 10417 | 10844 | return ''; |
| 10418 | 10845 | } |
| 10419 | 10846 | |
@@ -10431,7 +10858,9 @@ discard block |
||
| 10431 | 10858 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
| 10432 | 10859 | |
| 10433 | 10860 | $Connection = new Connection($this->db); |
| 10434 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 10861 | + if (!$Connection->tableExists('countries')) { |
|
| 10862 | + return ''; |
|
| 10863 | + } |
|
| 10435 | 10864 | |
| 10436 | 10865 | try { |
| 10437 | 10866 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -10443,9 +10872,13 @@ discard block |
||
| 10443 | 10872 | $sth->closeCursor(); |
| 10444 | 10873 | if (count($row) > 0) { |
| 10445 | 10874 | return $row; |
| 10446 | - } else return ''; |
|
| 10875 | + } else { |
|
| 10876 | + return ''; |
|
| 10877 | + } |
|
| 10447 | 10878 | } catch (PDOException $e) { |
| 10448 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 10879 | + if (isset($globalDebug) && $globalDebug) { |
|
| 10880 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 10881 | + } |
|
| 10449 | 10882 | return ''; |
| 10450 | 10883 | } |
| 10451 | 10884 | |
@@ -10695,7 +11128,9 @@ discard block |
||
| 10695 | 11128 | { |
| 10696 | 11129 | global $globalBitlyAccessToken; |
| 10697 | 11130 | |
| 10698 | - if ($globalBitlyAccessToken == '') return $url; |
|
| 11131 | + if ($globalBitlyAccessToken == '') { |
|
| 11132 | + return $url; |
|
| 11133 | + } |
|
| 10699 | 11134 | |
| 10700 | 11135 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
| 10701 | 11136 | |
@@ -10844,7 +11279,9 @@ discard block |
||
| 10844 | 11279 | |
| 10845 | 11280 | |
| 10846 | 11281 | // routes |
| 10847 | - if ($globalDebug) print "Routes...\n"; |
|
| 11282 | + if ($globalDebug) { |
|
| 11283 | + print "Routes...\n"; |
|
| 11284 | + } |
|
| 10848 | 11285 | if ($globalDBdriver == 'mysql') { |
| 10849 | 11286 | $query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)"; |
| 10850 | 11287 | } else { |
@@ -10863,7 +11300,9 @@ discard block |
||
| 10863 | 11300 | } |
| 10864 | 11301 | } |
| 10865 | 11302 | |
| 10866 | - if ($globalDebug) print "Airlines...\n"; |
|
| 11303 | + if ($globalDebug) { |
|
| 11304 | + print "Airlines...\n"; |
|
| 11305 | + } |
|
| 10867 | 11306 | //airlines |
| 10868 | 11307 | if ($globalDBdriver == 'mysql') { |
| 10869 | 11308 | $query = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)"; |
@@ -10877,10 +11316,15 @@ discard block |
||
| 10877 | 11316 | if (is_numeric(substr($row['ident'], -1, 1))) |
| 10878 | 11317 | { |
| 10879 | 11318 | $fromsource = NULL; |
| 10880 | - if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 10881 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 10882 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 10883 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 11319 | + if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 11320 | + $fromsource = 'vatsim'; |
|
| 11321 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 11322 | + $fromsource = 'ivao'; |
|
| 11323 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 11324 | + $fromsource = 'vatsim'; |
|
| 11325 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 11326 | + $fromsource = 'ivao'; |
|
| 11327 | + } |
|
| 10884 | 11328 | $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
| 10885 | 11329 | if (isset($airline_array[0]['name'])) { |
| 10886 | 11330 | $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
@@ -10890,13 +11334,17 @@ discard block |
||
| 10890 | 11334 | } |
| 10891 | 11335 | } |
| 10892 | 11336 | |
| 10893 | - if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n"; |
|
| 11337 | + if ($globalDebug) { |
|
| 11338 | + print "Remove Duplicate in aircraft_modes...\n"; |
|
| 11339 | + } |
|
| 10894 | 11340 | //duplicate modes |
| 10895 | 11341 | $query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL"; |
| 10896 | 11342 | $sth = $this->db->prepare($query); |
| 10897 | 11343 | $sth->execute(); |
| 10898 | 11344 | |
| 10899 | - if ($globalDebug) print "Aircraft...\n"; |
|
| 11345 | + if ($globalDebug) { |
|
| 11346 | + print "Aircraft...\n"; |
|
| 11347 | + } |
|
| 10900 | 11348 | //aircraft |
| 10901 | 11349 | if ($globalDBdriver == 'mysql') { |
| 10902 | 11350 | $query = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -10939,26 +11387,38 @@ discard block |
||
| 10939 | 11387 | if (isset($closestAirports[0])) { |
| 10940 | 11388 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
| 10941 | 11389 | $airport_icao = $closestAirports[0]['icao']; |
| 10942 | - if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 11390 | + if ($globalDebug) { |
|
| 11391 | + echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 11392 | + } |
|
| 10943 | 11393 | } elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') { |
| 10944 | 11394 | foreach ($closestAirports as $airport) { |
| 10945 | 11395 | if ($row['arrival_airport_icao'] == $airport['icao']) { |
| 10946 | 11396 | $airport_icao = $airport['icao']; |
| 10947 | - if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 11397 | + if ($globalDebug) { |
|
| 11398 | + echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 11399 | + } |
|
| 10948 | 11400 | break; |
| 10949 | 11401 | } |
| 10950 | 11402 | } |
| 10951 | 11403 | } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
| 10952 | 11404 | $airport_icao = $closestAirports[0]['icao']; |
| 10953 | - if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 11405 | + if ($globalDebug) { |
|
| 11406 | + echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 11407 | + } |
|
| 10954 | 11408 | } else { |
| 10955 | - if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 11409 | + if ($globalDebug) { |
|
| 11410 | + echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 11411 | + } |
|
| 10956 | 11412 | } |
| 10957 | 11413 | } else { |
| 10958 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 11414 | + if ($globalDebug) { |
|
| 11415 | + echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 11416 | + } |
|
| 10959 | 11417 | } |
| 10960 | 11418 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
| 10961 | - if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
|
| 11419 | + if ($globalDebug) { |
|
| 11420 | + echo "Updating airport to ".$airport_icao."...\n"; |
|
| 11421 | + } |
|
| 10962 | 11422 | $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
| 10963 | 11423 | $sthu = $this->db->prepare($update_query); |
| 10964 | 11424 | $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
@@ -5,7 +5,9 @@ discard block |
||
| 5 | 5 | $Stats = new Stats(); |
| 6 | 6 | $title = _("Statistics").' - '._("Most common Departure Airport by Country"); |
| 7 | 7 | |
| 8 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 8 | +if (!isset($filter_name)) { |
|
| 9 | + $filter_name = ''; |
|
| 10 | +} |
|
| 9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 12 | if ($airline_icao == 'all') { |
| 11 | 13 | unset($_COOKIE['stats_airline_icao']); |
@@ -14,8 +16,10 @@ discard block |
||
| 14 | 16 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | 17 | $airline_icao = $_COOKIE['stats_airline_icao']; |
| 16 | 18 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 18 | -} |
|
| 19 | + if (isset($globalFilter['airline'])) { |
|
| 20 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 21 | + } |
|
| 22 | + } |
|
| 19 | 23 | setcookie('stats_airline_icao',$airline_icao); |
| 20 | 24 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 21 | 25 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -5,7 +5,9 @@ discard block |
||
| 5 | 5 | $Stats = new Stats(); |
| 6 | 6 | $title = _("Statistics").' - '._("Most common Callsign"); |
| 7 | 7 | |
| 8 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 8 | +if (!isset($filter_name)) { |
|
| 9 | + $filter_name = ''; |
|
| 10 | +} |
|
| 9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 12 | if ($airline_icao == 'all') { |
| 11 | 13 | unset($_COOKIE['stats_airline_icao']); |
@@ -14,8 +16,10 @@ discard block |
||
| 14 | 16 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | 17 | $airline_icao = $_COOKIE['stats_airline_icao']; |
| 16 | 18 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 18 | -} |
|
| 19 | + if (isset($globalFilter['airline'])) { |
|
| 20 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 21 | + } |
|
| 22 | + } |
|
| 19 | 23 | setcookie('stats_airline_icao',$airline_icao); |
| 20 | 24 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 21 | 25 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -5,7 +5,9 @@ discard block |
||
| 5 | 5 | $Stats = new Stats(); |
| 6 | 6 | $title = _("Statistics").' - '._("Most common Arrival Airport"); |
| 7 | 7 | |
| 8 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 8 | +if (!isset($filter_name)) { |
|
| 9 | + $filter_name = ''; |
|
| 10 | +} |
|
| 9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 12 | if ($airline_icao == 'all') { |
| 11 | 13 | unset($_COOKIE['stats_airline_icao']); |
@@ -14,8 +16,10 @@ discard block |
||
| 14 | 16 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | 17 | $airline_icao = $_COOKIE['stats_airline_icao']; |
| 16 | 18 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 18 | -} |
|
| 19 | + if (isset($globalFilter['airline'])) { |
|
| 20 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 21 | + } |
|
| 22 | + } |
|
| 19 | 23 | setcookie('stats_airline_icao',$airline_icao); |
| 20 | 24 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 21 | 25 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -5,7 +5,9 @@ discard block |
||
| 5 | 5 | $Stats = new Stats(); |
| 6 | 6 | $title = _("Statistics").' - '._("Most common Aircraft"); |
| 7 | 7 | |
| 8 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 8 | +if (!isset($filter_name)) { |
|
| 9 | + $filter_name = ''; |
|
| 10 | +} |
|
| 9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 12 | if ($airline_icao == 'all') { |
| 11 | 13 | unset($_COOKIE['stats_airline_icao']); |
@@ -14,8 +16,10 @@ discard block |
||
| 14 | 16 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 15 | 17 | $airline_icao = $_COOKIE['stats_airline_icao']; |
| 16 | 18 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 17 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 18 | -} |
|
| 19 | + if (isset($globalFilter['airline'])) { |
|
| 20 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 21 | + } |
|
| 22 | + } |
|
| 19 | 23 | setcookie('stats_airline_icao',$airline_icao); |
| 20 | 24 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 21 | 25 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |